@leitwerk-dev/ui 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ChronicleMarkdown-BLgtHeEE.js → ChronicleMarkdown-iH1VLv7x.js} +1 -1
- package/dist/assets/{FutureLaunchDetailPage-AdZHxRVW.js → FutureLaunchDetailPage-BJphZBFH.js} +1 -1
- package/dist/assets/{GenericLauncher-Cv38FByt.js → GenericLauncher-tr1to52a.js} +1 -1
- package/dist/assets/{HomePage-B4zqYhfn.js → HomePage-CSHVQefI.js} +1 -1
- package/dist/assets/{PageHeader-D6pP4hIh.js → PageHeader-C4j3zJKF.js} +1 -1
- package/dist/assets/{ProcessActionsMenu-l2mHq8L-.js → ProcessActionsMenu-gNiZGUCZ.js} +1 -1
- package/dist/assets/{ProcessDetailPage-CnjDQ1tp.js → ProcessDetailPage-CGyVxjeH.js} +1 -1
- package/dist/assets/{ProcessFlowDiagram-BAh_M_rb.js → ProcessFlowDiagram-BX_Zjm2n.js} +1 -1
- package/dist/assets/{ProcessesPage-98QqWYok.js → ProcessesPage-D3jjufse.js} +1 -1
- package/dist/assets/{ScheduleDateTimePicker-CQGvY-Rc.js → ScheduleDateTimePicker-D72J6EhE.js} +1 -1
- package/dist/assets/{SkillsPage-B8Qo6NCY.js → SkillsPage-CcYm4ATy.js} +1 -1
- package/dist/assets/WatchersPage-Bac86WLp.js +1 -0
- package/dist/assets/api-HGtUzekR.js +1 -0
- package/dist/assets/{dist-B7WNbObw.js → dist-DVNpSD5l.js} +1 -1
- package/dist/assets/{index-DtESEq4Z.js → index-ChVsVf6R.js} +3 -3
- package/dist/assets/{router.svelte-COr45o9R.js → router.svelte-C2wi6I7k.js} +1 -1
- package/dist/index.html +5 -5
- package/package.json +6 -6
- package/src/lib/api.ts +0 -3
- package/src/lib/format.ts +0 -2
- package/src/pages/WatchersPage.svelte +8 -44
- package/dist/assets/WatchersPage-DNyUsU1y.js +0 -1
- package/dist/assets/api-CqECFdii.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,t as r}from"./ChronicleMarkdown-
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./ChronicleMarkdown-iH1VLv7x.js";import{$ as i,B as a,E as o,F as s,G as c,H as l,I as u,J as d,K as f,L as p,M as m,N as h,O as g,P as _,Q as v,R as y,S as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,at as k,c as A,d as j,dt as M,et as N,f as P,ft as F,g as I,gt as L,h as R,ht as z,k as B,m as V,mt as H,n as U,ot as ee,p as W,pt as te,q as ne,r as G,rt as K,s as re,st as ie,t as ae,tt as q,u as J,v as Y,w as oe,y as se,yt as X,z as Z}from"./index-client-BqF3_t3P.js";import{D as ce,E as le,H as ue,I as de,J as fe,K as pe,N as me,O as Q,P as he,Q as ge,T as _e,U as ve,X as ye,Y as be,Z as xe,_t as Se,b as Ce,bt as we,f as Te,gt as Ee,ht as De,n as Oe,p as ke,tt as $,w as Ae,yt as je,z as Me}from"./api-HGtUzekR.js";import{d as Ne,m as Pe,n as Fe,r as Ie,u as Le}from"./router.svelte-C2wi6I7k.js";import{a as Re,o as ze,u as Be}from"./dist-DVNpSD5l.js";import{_ as Ve,a as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,m as Je,n as Ye,o as Xe,p as Ze,x as Qe}from"./index-ChVsVf6R.js";import{a as $e,i as et,n as tt,o as nt,r as rt,s as it,t as at}from"./ScheduleDateTimePicker-D72J6EhE.js";import{t as ot}from"./PageHeader-C4j3zJKF.js";import{n as st,r as ct,t as lt}from"./ProcessFlowDiagram-BX_Zjm2n.js";import{i as ut,n as dt,r as ft,t as pt}from"./ProcessActionsMenu-gNiZGUCZ.js";function mt(e){return e.replace(/\r\n?/g,`
|
|
2
2
|
`)}function ht(e){return mt(e).trim()}function gt(e,t={}){let n=t.trim?ht(e):mt(e);return n.length>0?n.split(`
|
|
3
3
|
`):[]}function _t(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function vt(e){return typeof e==`string`&&e.trim().length>=4}function yt(e,t,n){return t>=n?null:{kind:`context`,text:e,start:t,end:n}}function bt(e){let{fullPrompt:t,userInput:n}=e;if(!vt(n))return{segments:[{kind:`context`,text:t,start:0,end:t.length}],matchState:`skipped`};let r=[],i=0,a=t.indexOf(n,i);for(;a>=0;){let e=yt(t.slice(i,a),i,a);e&&r.push(e);let o=a+n.length;r.push({kind:`user_input`,text:t.slice(a,o),start:a,end:o}),i=o,a=t.indexOf(n,i)}if(r.length===0)return{segments:[{kind:`context`,text:t,start:0,end:t.length}],matchState:`not_found`};let o=yt(t.slice(i),i,t.length);return o&&r.push(o),{segments:r,matchState:`matched`}}var xt=s(`<span class="live-chip svelte-1hddaej"><span class="live-pulse svelte-1hddaej" aria-hidden="true"></span> </span>`);function St(e,t){let n=G(t,`size`,3,`md`);var r=xt(),i=w(d(r));L(r),c(()=>{j(r,`data-size`,n()),m(i,` ${t.label??``}`)}),h(e,r)}var Ct=s(`<span class="thinking-line svelte-15c5fg8"> </span>`),wt=s(`<p class="thinking-copy svelte-15c5fg8"></p>`);function Tt(e,t){F(t,!0);let n=G(t,`trim`,3,!1),r=G(t,`variant`,3,`default`),i=K(()=>gt(t.text,{trim:n()}));var a=wt();o(a,23,()=>S(i),(e,t)=>`thinking-line-${t}`,(e,t)=>{var n=Ct(),r=d(n,!0);L(n),c(()=>m(r,S(t).length>0?S(t):`\xA0`)),h(e,n)}),L(a),c(()=>j(a,`data-variant`,r())),h(e,a),M()}function Et(e,t){return t===`arguments`?e.arguments:e.result}function Dt(e,t){return e.kind===`json`?t===void 0?null:t:typeof t==`string`?t.trim()===``?null:t:null}function Ot(e){return Object.fromEntries(e.map(e=>[e.toolName,e]))}function kt(e,t){return e[t]??null}function At(e,t){if(!t)return[];let n=[];for(let r of t.fields){let t=Dt(r,Ke(Et(e,r.source),r.path));t!==null&&n.push({id:r.id,label:r.label,kind:r.kind,value:t})}return n}var jt=De(we(),$(e=>typeof e==`object`&&!!e&&!Array.isArray(e),`Expected object`),Ee(je(),we()));function Mt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function Nt(t){return typeof t==`string`?e(t,80):String(t)}function Pt(t,n=2){if(t==null)return null;if(Mt(t))return Nt(t);if(Array.isArray(t)){if(t.length===0)return`Empty list`;let e=t.filter(Mt).slice(0,n).map(Nt);return e.length>0?`${e.join(`, `)} · ${t.length} item${t.length===1?``:`s`}`:`List with ${t.length} item${t.length===1?``:`s`}`}let r=Se(jt,t);if(r.success){let e=Object.entries(r.output).filter(([,e])=>Mt(e)).slice(0,n).map(([e,t])=>`${e}: ${Nt(t)}`);if(e.length>0)return e.join(` · `);let t=Object.keys(r.output);return`${t.length} field${t.length===1?``:`s`} captured`}return e(String(t),80)}function Ft(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}var It=s(`<span class="tool-arguments svelte-1l8aofy"> </span>`),Lt=s(`<span class="tool-badge tool-badge-warning svelte-1l8aofy">truncated</span>`),Rt=s(`<div class="tool-summary-copy svelte-1l8aofy"><p class="tool-inline-copy svelte-1l8aofy"><span class="tool-name svelte-1l8aofy"> </span> <!></p></div> <div class="tool-summary-badges svelte-1l8aofy"><!> <span class="tool-status svelte-1l8aofy"><span aria-hidden="true"> </span></span></div>`,1),zt=s(`<div class="tool-warning svelte-1l8aofy" role="status" data-section="tool-truncation-warning"><p class="tool-warning-title svelte-1l8aofy">Tool result truncated</p> <p class="tool-warning-copy svelte-1l8aofy">The tool result was too large to show completely.</p></div>`),Bt=s(`<pre class="payload-block svelte-1l8aofy"> </pre>`),Vt=s(`<div class="renderer-field svelte-1l8aofy"><p class="payload-label svelte-1l8aofy"> </p> <!></div>`),Ht=s(`<div class="renderer-field-list svelte-1l8aofy" data-section="tool-renderer-fields"></div>`),Ut=s(`<p class="payload-summary empty-summary svelte-1l8aofy">No inputs were recorded.</p>`),Wt=s(`<div class="payload-summary-row svelte-1l8aofy"><p class="payload-label svelte-1l8aofy">Result</p> <pre> </pre></div>`),Gt=s(`<p class="payload-summary empty-summary svelte-1l8aofy">No result text was recorded.</p>`),Kt=s(`<div class="tool-details svelte-1l8aofy"><div class="tool-meta-line svelte-1l8aofy" data-section="tool-run-meta"><span class="tool-status-chip svelte-1l8aofy"><span aria-hidden="true"> </span> <span> </span></span> <span> </span></div> <!> <!> <div class="payload-summary-list svelte-1l8aofy" data-section="tool-session-details"><div class="payload-summary-row svelte-1l8aofy"><p class="payload-label svelte-1l8aofy">Inputs</p> <!></div> <!></div></div>`),qt=s(`<details class="tool-item tool-item-expandable svelte-1l8aofy" data-section="reasoning-tool-marker"><summary class="tool-summary svelte-1l8aofy"><!></summary> <!></details>`);function Jt(e,t){F(t,!0);let n=e=>{var t=Rt(),n=T(t),r=d(n),i=d(r),a=d(i,!0);L(i);var o=w(i,2),s=e=>{var t=It(),n=d(t,!0);L(t),c(()=>m(n,S(A))),h(e,t)};B(o,e=>{S(A)&&e(s)}),L(r),L(n);var l=w(n,2),u=d(l),f=e=>{h(e,Lt())};B(u,e=>{S(k)&&e(f)});var p=w(u,2),g=d(p),_=d(g,!0);L(g),L(p),L(l),c(()=>{m(a,S(D)),j(p,`data-tone`,S(R)),j(p,`aria-label`,S(P)),m(_,S(I))}),h(e,t)},s=new Set([`read`,`write`,`edit`,`bash`,`web_search`,`web_scrape`,`headroom_retrieve`,`headroom_stats`,`parallel`]),l=q(!1),u=q(null);f(()=>{S(u)!==t.toolCall.toolCallId&&(i(u,t.toolCall.toolCallId,!0),i(l,t.toolCall.status===`running`))});function p(e){i(l,e.currentTarget.open,!0)}function g(e){return kt(t.toolRendererIndex,e)}function _(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function v(e,t){let n=typeof e==`string`&&e.trim()!==``?e:`Unknown`,r=_(e),i=_(t);if(r===null||i===null||i<r)return`Started ${n} · Duration ${t?`Unknown`:`Running`}`;let a=Math.max(0,Math.round((i-r)/1e3));return`Started ${n} · Duration ${a<1?`<1s`:a<60?`${a}s`:`${Math.floor(a/60)}m ${a%60}s`}`}function y(e){let t=e.arguments;if(!t)return null;switch(e.toolName){case`read`:case`write`:case`edit`:return typeof t.path==`string`?t.path:Pt(t,1);case`bash`:return typeof t.command==`string`?t.command:Pt(t,1);case`web_search`:return typeof t.query==`string`?t.query:Pt(t,1);case`web_scrape`:return typeof t.url==`string`?t.url:Pt(t,1);case`headroom_retrieve`:return typeof t.hash==`string`?t.hash:Pt(t,1);default:return Pt(t,1)}}let b=K(()=>g(t.toolCall.toolName)),x=K(()=>At({arguments:t.toolCall.arguments,result:`result`in t.toolCall?t.toolCall.result:null},S(b))),C=K(()=>s.has(t.toolCall.toolName)),E=K(()=>S(C)?`internal`:`custom`),D=K(()=>S(b)?.title??(S(C)?t.toolCall.toolName:pe(t.toolCall.toolName))),O=K(()=>`resultText`in t.toolCall?t.toolCall.resultText:null),k=K(()=>`truncated`in t.toolCall&&t.toolCall.truncated),A=K(()=>y(t.toolCall)),N=K(()=>v(t.toolCall.startedAt,t.toolCall.completedAt)),P=K(()=>t.toolCall.isError?`Failed`:t.toolCall.status===`running`?`Running`:`Completed`),I=K(()=>t.toolCall.isError?`✕`:t.toolCall.status===`running`?`…`:`✓`),R=K(()=>t.toolCall.isError?`error`:t.toolCall.status===`running`?`running`:`success`);var z=qt(),V=d(z);n(d(V)),L(V);var H=w(V,2),U=e=>{var n=Kt(),i=d(n),a=d(i),s=d(a),l=d(s,!0);L(s);var u=w(s,2),f=d(u,!0);L(u),L(a);var p=w(a,2),g=d(p,!0);L(p),L(i);var _=w(i,2),v=e=>{h(e,zt())};B(_,e=>{S(k)&&e(v)});var y=w(_,2),b=e=>{var t=Ht();o(t,21,()=>S(x),e=>e.id,(e,t)=>{var n=Vt(),i=d(n),a=d(i,!0);L(i);var o=w(i,2),s=e=>{r(e,{get markdown(){return S(t).value},className:`tool-field-markdown`})},l=e=>{var n=Bt(),r=d(n,!0);L(n),c(e=>m(r,e),[()=>Ft(S(t).value)]),h(e,n)};B(o,e=>{S(t).kind===`markdown`&&typeof S(t).value==`string`?e(s):e(l,-1)}),L(n),c(()=>m(a,S(t).label)),h(e,n)}),L(t),h(e,t)};B(y,e=>{S(x).length>0&&e(b)});var C=w(y,2),T=d(C),E=w(d(T),2),D=e=>{var n=Bt(),r=d(n,!0);L(n),c(e=>m(r,e),[()=>Ft(t.toolCall.arguments)]),h(e,n)},A=e=>{h(e,Ut())};B(E,e=>{t.toolCall.arguments?e(D):e(A,-1)}),L(T);var M=w(T,2),F=e=>{var n=Wt(),r=w(d(n),2);let i;var a=d(r,!0);L(r),L(n),c(()=>{i=Y(r,1,`payload-block svelte-1l8aofy`,null,i,{"payload-summary-error":t.toolCall.isError}),m(a,S(O))}),h(e,n)},z=e=>{h(e,Gt())};B(M,e=>{S(O)?e(F):e(z,-1)}),L(C),L(n),c(()=>{j(a,`data-tone`,S(R)),m(l,S(I)),m(f,S(P)),m(g,S(N))}),h(e,n)};B(H,e=>{S(l)&&e(U)}),L(z),c(()=>{z.open=S(l),j(z,`data-tool-kind`,S(E)),j(z,`data-tool-name`,t.toolCall.toolName),j(z,`data-tool-status`,t.toolCall.isError?`failed`:t.toolCall.status),j(z,`data-tool-truncated`,S(k)?`true`:`false`)}),a(`toggle`,z,p),h(e,z),M()}var Yt=new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`,minimumFractionDigits:4,maximumFractionDigits:4});function Xt(e){return Yt.format(e)}function Zt(e){let t=[`Aggregate across model calls for this turn.`,`Input: ${e.input}`,`Output: ${e.output}`,...e.reasoning===void 0?[]:[`Reported reasoning: ${e.reasoning}`],`Cache Read: ${e.cacheRead}`,`Cache Write: ${e.cacheWrite}`,`Total tokens: ${e.totalTokens}`,...e.requestCount===void 0?[]:[`Requests: ${e.requestCount}`],...e.maxInputTokens===void 0?[]:[`Max single-request input: ${e.maxInputTokens}`],`Context source: Pi request context includes the active branch, including hidden prior branch entries and tool results that may not be rendered in the summary.`];return e.cost&&t.push([`Estimated total: ${Xt(e.cost.total)}`,`input ${Xt(e.cost.input)}`,`output ${Xt(e.cost.output)}`,`cache read ${Xt(e.cost.cacheRead)}`,`cache write ${Xt(e.cost.cacheWrite)}`].join(`, `)),t.join(`, `)}var Qt=s(`<span class="usage-item cost-estimate svelte-5e0b2l"> </span>`),$t=s(`<span class="usage-item reasoning svelte-5e0b2l"><span class="usage-figure svelte-5e0b2l"> </span> <span class="usage-label svelte-5e0b2l">reason</span></span>`),en=s(`<span class="usage-item cache-read svelte-5e0b2l"><span class="usage-figure svelte-5e0b2l"> </span> <span class="usage-label svelte-5e0b2l">cached</span></span>`),tn=s(`<span class="usage-item cache-write svelte-5e0b2l"><span class="usage-figure svelte-5e0b2l"> </span> <span class="usage-label svelte-5e0b2l">written</span></span>`),nn=s(`<span class="usage-item request-count svelte-5e0b2l"><span class="usage-figure svelte-5e0b2l"> </span> <span class="usage-label svelte-5e0b2l">req</span></span>`),rn=s(`<span class="usage-item max-input svelte-5e0b2l"><span class="usage-figure svelte-5e0b2l"> </span> <span class="usage-label svelte-5e0b2l">peak in</span></span>`),an=s(`<span class="usage-stats svelte-5e0b2l"><!> <span class="usage-item svelte-5e0b2l"><span class="usage-figure svelte-5e0b2l"> </span> <span class="usage-label svelte-5e0b2l">in</span></span> <span class="usage-item svelte-5e0b2l"><span class="usage-figure svelte-5e0b2l"> </span> <span class="usage-label svelte-5e0b2l">out</span></span> <!> <!> <!> <!> <!></span>`);function on(e,t){F(t,!0);let n=G(t,`size`,3,`sm`),r=G(t,`showCacheIcons`,3,!0),i=K(()=>Zt(t.usage));var a=an(),o=d(a),s=e=>{var n=Qt(),r=d(n);L(n),c(e=>m(r,`Est. ${e??``}`),[()=>Xt(t.usage.cost.total)]),h(e,n)};B(o,e=>{t.usage.cost&&e(s)});var l=w(o,2),u=d(l),f=d(u);L(u),z(2),L(l);var p=w(l,2),g=d(p),_=d(g);L(g),z(2),L(p);var v=w(p,2),y=e=>{var n=$t(),r=d(n),i=d(r,!0);L(r),z(2),L(n),c(e=>m(i,e),[()=>_t(t.usage.reasoning)]),h(e,n)};B(v,e=>{t.usage.reasoning!==void 0&&e(y)});var b=w(v,2),x=e=>{var n=en(),i=d(n),a=d(i);L(i),z(2),L(n),c(e=>m(a,`${r()?`⚡`:``}${e??``}`),[()=>_t(t.usage.cacheRead)]),h(e,n)};B(b,e=>{t.usage.cacheRead>0&&e(x)});var C=w(b,2),T=e=>{var n=tn(),i=d(n),a=d(i);L(i),z(2),L(n),c(e=>m(a,`${r()?`💾`:``}${e??``}`),[()=>_t(t.usage.cacheWrite)]),h(e,n)};B(C,e=>{t.usage.cacheWrite>0&&e(T)});var E=w(C,2),D=e=>{var n=nn(),r=d(n),i=d(r,!0);L(r),z(2),L(n),c(()=>m(i,t.usage.requestCount)),h(e,n)};B(E,e=>{t.usage.requestCount!==void 0&&e(D)});var O=w(E,2),k=e=>{var n=rn(),r=d(n),i=d(r);L(r),z(2),L(n),c(e=>m(i,`↑${e??``}`),[()=>_t(t.usage.maxInputTokens)]),h(e,n)};B(O,e=>{t.usage.maxInputTokens!==void 0&&e(k)}),L(a),c((e,t)=>{j(a,`data-size`,n()),j(a,`title`,S(i)),m(f,`↑${e??``}`),m(_,`↓${t??``}`)},[()=>_t(t.usage.input),()=>_t(t.usage.output)]),h(e,a),M()}var sn=s(`<span class="summary-muted svelte-1khcfjl">Usage unavailable</span>`),cn=s(`<button type="button" class="copy-button svelte-1khcfjl" data-action="copy-pi-input"> </button>`),ln=s(`<div class="prompt-part-header svelte-1khcfjl"><p class="prompt-part-label svelte-1khcfjl"> </p> <p class="prompt-part-meta svelte-1khcfjl"> </p></div>`),un=s(`<span class="prompt-segment svelte-1khcfjl"> </span>`),dn=s(`<article data-section="pi-input-message"><!> <pre class="prompt-copy svelte-1khcfjl"></pre></article>`),fn=s(`<p class="diagnostic-note svelte-1khcfjl" data-section="prompt-match-note">User input could not be matched inside the recorded Pi prompt.</p>`),pn=s(`<div class="prompt-part-list svelte-1khcfjl"></div> <!>`,1),mn=s(`<p class="empty-copy svelte-1khcfjl">No Pi input was recorded for this turn.</p>`),hn=s(`<div class="operational-event svelte-1khcfjl" data-section="reasoning-operational-event"><div class="operational-event-header svelte-1khcfjl"><span class="operational-event-severity svelte-1khcfjl"> </span> <span class="operational-event-title svelte-1khcfjl"> </span></div> <p class="svelte-1khcfjl"> </p></div>`),gn=s(`<p class="empty-copy svelte-1khcfjl">No reasoning details were recorded for this turn.</p>`),_n=s(`<div class="reasoning-details-overlay svelte-1khcfjl" data-section="reasoning-details-overlay" role="dialog" aria-modal="false"><header class="overlay-header svelte-1khcfjl"><div class="overlay-header-copy svelte-1khcfjl"><p class="overlay-eyebrow svelte-1khcfjl">Reasoning details</p> <div class="overlay-title-row svelte-1khcfjl"><h2 class="svelte-1khcfjl"> </h2> <!></div></div> <div class="overlay-header-actions svelte-1khcfjl"><div class="nav-group svelte-1khcfjl" aria-label="Reasoning turn navigation"><button type="button" class="nav-button svelte-1khcfjl" data-action="reasoning-overlay-prev" aria-label="Previous reasoning turn">←</button> <button type="button" class="nav-button svelte-1khcfjl" data-action="reasoning-overlay-next" aria-label="Next reasoning turn">→</button></div> <button type="button" class="close-button svelte-1khcfjl" data-action="close-reasoning-overlay" aria-label="Close reasoning details">×</button></div></header> <div class="overlay-body svelte-1khcfjl"><div class="run-summary-line svelte-1khcfjl" data-section="reasoning-run-summary"><span class="model-name svelte-1khcfjl"> </span> <!></div> <dl class="turn-facts svelte-1khcfjl" data-section="reasoning-turn-facts"><div class="fact-row svelte-1khcfjl"><dt class="svelte-1khcfjl">Duration</dt> <dd> </dd></div> <div class="fact-row svelte-1khcfjl"><dt class="svelte-1khcfjl">Triggered by</dt> <dd> </dd></div> <div class="fact-row svelte-1khcfjl"><dt class="svelte-1khcfjl">Run mode</dt> <dd> </dd></div> <div class="fact-row svelte-1khcfjl"><dt class="svelte-1khcfjl">Active tools</dt> <dd> </dd></div></dl> <section class="overlay-section prompt-section svelte-1khcfjl" data-section="reasoning-overlay-pi-input"><div class="section-header-row svelte-1khcfjl"><div class="section-heading svelte-1khcfjl"><p class="section-label svelte-1khcfjl">Pi input</p> <p class="section-caption svelte-1khcfjl">Actual input message entries recorded in Pi's session tree. User input is
|
|
4
4
|
highlighted when matched.</p></div> <!></div> <!></section> <section class="overlay-section reasoning-section svelte-1khcfjl" data-section="reasoning-overlay-trace"><div class="section-heading svelte-1khcfjl"><p class="section-label svelte-1khcfjl">Reasoning details</p> <p class="section-caption svelte-1khcfjl">Thinking, tool calls, retries, errors, and compactions in execution order.</p></div> <div class="reasoning-timeline svelte-1khcfjl"><!></div></section></div></div>`);function vn(e,t){F(t,!0);let n=q(null),r=q(null),s=q(!0),u=q(`idle`),p=null,g=q(null);function v(e,t=32){return e.scrollHeight-e.clientHeight-e.scrollTop<=t}function y(){!S(r)||!t.entry.isLive||i(s,v(S(r)),!0)}async function b(e){if(typeof navigator<`u`&&navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}if(typeof document>`u`)throw Error(`Clipboard unavailable`);let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t),t.select();let n=typeof document.execCommand==`function`&&document.execCommand(`copy`);if(document.body.removeChild(t),!n)throw Error(`Clipboard unavailable`)}function x(e){return e?e.parts.length===1?e.parts[0]?.text??``:e.fullPrompt:``}function C(e,t,n){let r=e.role===`system`?`Pi system message`:`Pi input message`;return n>1?`${r} ${t+1}`:r}async function E(){if(t.entry.piInput){try{await b(x(t.entry.piInput)),i(u,`copied`),i(g,t.entry.turnRecordId,!0)}catch{i(u,`failed`),i(g,t.entry.turnRecordId,!0)}p&&clearTimeout(p),p=setTimeout(()=>{i(u,`idle`),p=null,i(g,null)},1800)}}function D(e){if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`Escape`){e.preventDefault(),t.onClose();return}if(e.key===`ArrowLeft`&&t.hasPrevious){e.preventDefault(),t.onPrevious();return}e.key===`ArrowRight`&&t.hasNext&&(e.preventDefault(),t.onNext())}}function k(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function A(e,t){let n=k(e),r=k(t);if(n===null||r===null||r<n)return`Unknown`;let i=Math.max(0,Math.round((r-n)/1e3));if(i<1)return`<1s`;let a=Math.floor(i/3600),o=Math.floor(i%3600/60),s=i%60,c=[];return a>0&&c.push(`${a}h`),o>0&&c.push(`${o}m`),(s>0||c.length===0)&&c.push(`${s}s`),c.join(` `)}function N(e){switch(e){case`external_event`:return`External event`;case`user_action`:return`User action`;default:return`Unknown`}}function P(e){switch(e){case`scheduled`:return`Scheduled`;case`immediate`:return`Run immediately`;default:return`Unknown`}}function I(e){return e===`Unknown`||e===`None`}function R(e){switch(e){case`success`:return`Recovered`;case`warning`:return`Attention`;case`error`:return`Error`;default:return`Info`}}let z=K(()=>t.entry.piInput?.fullPrompt??``),V=K(()=>{let e=t.entry.piInput?.parts??[];return e.length>0?e:t.entry.piInput&&S(z).trim()!==``?[{entryId:`${t.entry.turnRecordId}:pi-input`,role:`unknown`,text:S(z),createdAt:t.entry.piInput.createdAt}]:[]}),H=K(()=>S(V).some(e=>e.text.trim()!==``)),ee=K(()=>bt({fullPrompt:S(z),userInput:t.entry.piInput?.userInput??null})),W=K(()=>S(V).map((e,n)=>({part:e,label:C(e,n,S(V).length),highlight:bt({fullPrompt:e.text,userInput:t.entry.piInput?.userInput??null})}))),te=K(()=>S(H)&&S(ee).matchState===`not_found`),ne=K(()=>ht(t.entry.reasoningSection.text)),G=K(()=>t.entry.isLive?t.entry.stateLabel??`Live`:null),re=K(()=>S(u)===`copied`&&S(g)===t.entry.turnRecordId?`Copied`:S(u)===`failed`&&S(g)===t.entry.turnRecordId?`Copy failed`:`Copy prompt`),ie=K(()=>t.entry.modelProfileId??`Unknown model`),J=K(()=>A(t.entry.facts.startedAt,t.entry.facts.endedAt)),oe=K(()=>N(t.entry.facts.triggerSource)),X=K(()=>P(t.entry.facts.runMode)),ce=K(()=>t.entry.facts.activeToolNames.length>0?t.entry.facts.activeToolNames.join(`, `):`None`);f(()=>{t.entry.isLive||i(s,!0)}),f(()=>{!t.entry.isLive||!S(r)||!S(s)||(t.entry.reasoningSection.items.length,S(ne),l().then(()=>{!S(r)||!S(s)||(S(r).scrollTop=S(r).scrollHeight)}))}),U(()=>{l().then(()=>S(n)?.focus()),window.addEventListener(`keydown`,D)}),ae(()=>{window.removeEventListener(`keydown`,D),p&&clearTimeout(p)});var le=_n(),ue=d(le),de=d(ue),fe=w(d(de),2),pe=d(fe),me=d(pe,!0);L(pe);var Q=w(pe,2),he=e=>{St(e,{get label(){return S(G)},size:`md`})};B(Q,e=>{S(G)&&e(he)}),L(fe),L(de);var ge=w(de,2),_e=d(ge),ve=d(_e),ye=w(ve,2);L(_e);var be=w(_e,2);O(be,e=>i(n,e),()=>S(n)),L(ge),L(ue);var xe=w(ue,2),Se=d(xe),Ce=d(Se),we=d(Ce,!0);L(Ce);var Te=w(Ce,2),Ee=e=>{on(e,{get usage(){return t.entry.usage},size:`md`})},De=e=>{h(e,sn())};B(Te,e=>{t.entry.usage?e(Ee):e(De,-1)}),L(Se);var Oe=w(Se,2),ke=d(Oe),$=w(d(ke),2),Ae=d($,!0);L($),L(ke);var je=w(ke,2),Me=w(d(je),2),Ne=d(Me,!0);L(Me),L(je);var Pe=w(je,2),Fe=w(d(Pe),2),Ie=d(Fe,!0);L(Fe),L(Pe);var Le=w(Pe,2),Re=w(d(Le),2),ze=d(Re,!0);L(Re),L(Le),L(Oe);var Be=w(Oe,2),Ve=d(Be),He=w(d(Ve),2),Ue=e=>{var t=cn(),n=d(t,!0);L(t),c(()=>m(n,S(re))),Z(`click`,t,E),h(e,t)};B(He,e=>{S(H)&&e(Ue)}),L(Ve);var We=w(Ve,2),Ge=e=>{var t=pn(),n=T(t);o(n,21,()=>S(W),e=>e.part.entryId,(e,t)=>{var n=dn(),r=d(n),i=e=>{var n=ln(),r=d(n),i=d(r,!0);L(r);var a=w(r,2),o=d(a,!0);L(a),L(n),c(()=>{m(i,S(t).label),m(o,S(t).part.createdAt)}),h(e,n)};B(r,e=>{S(W).length>1&&e(i)});var a=w(r,2);o(a,21,()=>S(t).highlight.segments,e=>`${S(t).part.entryId}-${e.start}-${e.end}-${e.kind}`,(e,t)=>{var n=un(),r=d(n,!0);L(n),c(()=>{j(n,`data-kind`,S(t).kind),j(n,`data-highlight`,S(t).kind===`user_input`?`user-input`:void 0),m(r,S(t).text)}),h(e,n)}),L(a),L(n),c(()=>{Y(n,1,se([`prompt-part`,S(W).length===1&&`is-single`]),`svelte-1khcfjl`),j(a,`data-match-state`,S(t).highlight.matchState)}),h(e,n)}),L(n);var r=w(n,2),i=e=>{h(e,fn())};B(r,e=>{S(te)&&e(i)}),c(()=>j(n,`data-prompt-part-count`,S(W).length)),h(e,t)},Ke=e=>{h(e,mn())};B(We,e=>{S(H)?e(Ge):e(Ke,-1)}),L(Be);var qe=w(Be,2),Je=w(d(qe),2),Ye=d(Je),Xe=e=>{var n=_();o(T(n),19,()=>t.entry.reasoningSection.items,(e,n)=>`reasoning-${t.entry.turnRecordId}-${n}`,(e,n)=>{var r=_(),i=T(r),a=e=>{Tt(e,{get text(){return S(n).text},trim:!0})},o=e=>{Jt(e,{get toolCall(){return S(n).toolCall},get toolRendererIndex(){return t.toolRendererIndex}})},s=e=>{var t=hn(),r=d(t),i=d(r),a=d(i,!0);L(i);var o=w(i,2),s=d(o,!0);L(o),L(r);var l=w(r,2),u=d(l,!0);L(l),L(t),c(e=>{j(t,`data-event-type`,S(n).event.eventType),j(t,`data-severity`,S(n).event.severity),m(a,e),m(s,S(n).event.title),m(u,S(n).event.message)},[()=>R(S(n).event.severity)]),h(e,t)};B(i,e=>{S(n).kind===`thinking_chunk`?e(a):S(n).kind===`tool_call`?e(o,1):e(s,-1)}),h(e,r)}),h(e,n)},Ze=e=>{Tt(e,{get text(){return S(ne)}})},Qe=e=>{h(e,gn())};B(Ye,e=>{t.entry.reasoningSection.items.length>0?e(Xe):S(ne)?e(Ze,1):e(Qe,-1)}),L(Je),L(qe),L(xe),L(le),O(le,e=>i(r,e),()=>S(r)),c((e,n,r,i)=>{j(le,`aria-labelledby`,`reasoning-details-title-${t.entry.turnRecordId}`),j(pe,`id`,`reasoning-details-title-${t.entry.turnRecordId}`),m(me,t.entry.title),ve.disabled=!t.hasPrevious,ye.disabled=!t.hasNext,m(we,S(ie)),Y($,1,e,`svelte-1khcfjl`),m(Ae,S(J)),Y(Me,1,n,`svelte-1khcfjl`),m(Ne,S(oe)),Y(Fe,1,r,`svelte-1khcfjl`),m(Ie,S(X)),Y(Re,1,i,`svelte-1khcfjl`),m(ze,S(ce)),j(Je,`data-live`,t.entry.isLive?`true`:`false`)},[()=>se([`fact-value`,I(S(J))&&`is-muted`]),()=>se([`fact-value`,I(S(oe))&&`is-muted`]),()=>se([`fact-value`,I(S(X))&&`is-muted`]),()=>se([`fact-value`,I(S(ce))&&`is-muted`])]),a(`scroll`,le,y),Z(`click`,ve,function(...e){t.onPrevious?.apply(this,e)}),Z(`click`,ye,function(...e){t.onNext?.apply(this,e)}),Z(`click`,be,()=>t.onClose()),h(e,le),M()}y([`click`]);function yn(e){return typeof e==`string`&&e.trim().length>0}function bn(e){return xe(e)}function xn(e){return e.presentation}function Sn(e){switch(xn(e)){case`operator_decision`:return`Operator decision`;case`external_trigger`:return`External trigger`;case`automatic_turn`:return`Automation`;default:return`LLM turn`}}function Cn(e){let t=xn(e);return t===`llm_turn`||t===`automatic_turn`?`primary`:`secondary`}function wn(e){let t=e.turnId;return e.outcome===`failed`?`square`:e.turnType===`human`||e.turnType===`external`||t===`plan_review`||t===`implementation_review`||t===`mr_polish_review`||t===`poem_review`||t===`poem_review_feedback`?`pill`:t===`run_llm_review`||t===`review_poem_draft`?`diamond`:`circle`}function Tn(n,r=220){let i=n.turnResultMarkdown||n.output||n.summary||bn(n.displayTurn);return e(n.turnResultMarkdown?t(i):i.trim(),r)}function En(e){return{turnRecordId:e.id,turnId:e.turnId,title:bn(e.displayTurn),turnLabel:e.turnId,status:e.status,createdAt:e.createdAt,shape:wn(e),presentation:xn(e),hierarchy:Cn(e),kindLabel:Sn(e)}}function Dn(e){return e.turnType===`llm`?ze(e.pathType):null}var On=320;function kn(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`)}function An(e){return`chronicle-turn-${kn(e)}`}function jn(e){return`chronicle-live-${kn(e)}`}function Mn(){return`chronicle-prompt`}function Nn(e){return`chronicle-leaf-outcome-${kn(e)}`}function Pn(e){return`chronicle-terminal-${kn(e)}`}function Fn(e){return e.replace(/\s+/g,` `).trim()}function In(e){let t=e?.traceItems??[],n=e?.toolCalls??[],r=new Map(n.map(e=>[e.toolCallId,e])),i=[],a=new Set;for(let e of t){if(e.kind===`thinking`){if(!yn(e.text))continue;i.push({kind:`thinking_chunk`,text:e.text});continue}if(e.kind===`operational_event`){i.push({kind:`operational_event`,event:e});continue}let t=r.get(e.toolCallId);t&&(a.add(t.toolCallId),i.push({kind:`tool_call`,toolCall:t}))}if(i.length===0){let t=e?.assistant.thinking??``;yn(t)&&i.push({kind:`thinking_chunk`,text:t});for(let e of n)i.push({kind:`tool_call`,toolCall:e}),a.add(e.toolCallId);return i}for(let e of n)a.has(e.toolCallId)||(i.push({kind:`tool_call`,toolCall:e}),a.add(e.toolCallId));return i}function Ln(e){return{kind:`thinking_preview`,text:``,preview:``,previewTruncated:e.preview?.thinkingPreviewTruncated??!1,items:[],toolCallCount:e.trace?.toolCalls.length??e.preview?.toolCallCount??0,traceItemCount:e.trace?.traceItems.length??e.preview?.traceItemCount??0}}function Rn(e){let t=e.trace?.assistant.thinking??e.preview?.thinkingPreview??``,n=In(e.trace),r=e.trace===void 0&&e.preview?.hasReasoningDetails===!0;if(!yn(t)&&n.length===0&&!r)return null;let i=e.trace?qe(t,3,On):{text:e.preview?.thinkingPreview??``,truncated:e.preview?.thinkingPreviewTruncated??!1};return{kind:`thinking_preview`,text:t,preview:i.text,previewTruncated:i.truncated,items:n,toolCallCount:e.trace?.toolCalls.length??e.preview?.toolCallCount??0,traceItemCount:e.trace?.traceItems.length??e.preview?.traceItemCount??0}}function zn(e){switch(e){case`app_steer`:return`Operator note`;case`external_comment`:return`External comment`;case`action_prompt`:return`Action prompt`;default:return`Input`}}function Bn(e){let t=new Set;for(let n of e){let e=n.trim();e!==``&&t.add(e)}return[...t]}function Vn(e,t){let n=e?.turns.find(e=>e.turnId===t);return Bn([...n?.activePiToolNames??[],...n?.outcomeActions.map(e=>e.name)??[]])}function Hn(e,t){if(t===`ui`)return`user_action`;if(t===`external`||t===`scheduled`)return`external_event`;if(!e)return`unknown`;switch(e.source){case`external_comment`:case`watcher_event`:return`external_event`;case`app_steer`:case`action_prompt`:case`initial_prompt`:return`user_action`;default:return`unknown`}}function Un(e,t){return t===`scheduled`?`scheduled`:t===`ui`||t===`external`||e?.source===`initial_prompt`||e?.source===`app_steer`||e?.source===`external_comment`||e?.source===`action_prompt`||e?.source===`watcher_event`?`immediate`:`unknown`}function Wn(e){let t=e.traceSource.trace?.piInput,n=e.traceSource.preview?.piInput,r=t?.fullPrompt??n?.userInputPreview??``;return r.trim()===``?null:{parts:t?[...t.parts]:[],fullPrompt:r,createdAt:t?.createdAt??n?.createdAt??``,userInput:Be(e.triggeringInput?.bodyMarkdown)??Be(e.initialUserInputText)??null}}function Gn(e){return{startedAt:e.durableTurnRecord?.startedAt??e.activeTurn?.startedAt??null,endedAt:e.durableTurnRecord?.endedAt??null,triggerSource:Hn(e.triggeringInput,e.actionSource),runMode:Un(e.triggeringInput,e.actionSource),activeToolNames:Vn(e.runDetails,e.turnId)}}function Kn(e){return yn(e.bodyMarkdown)}function qn(e){return Kn(e)?e.source===`app_steer`||e.source===`external_comment`||e.source===`action_prompt`:!1}function Jn(e){return Kn(e)?e.source===`app_steer`||e.source===`external_comment`:!1}function Yn(e,n,r=!1){if(!yn(e.turnResultMarkdown))return!1;let i=Fn(t(e.turnResultMarkdown)),a=Fn(n);return i.length===0?!1:r&&a.length>0?!i.startsWith(a):i!==a}function Xn(e,t){return t.some(t=>t.turnRecordId===e&&t.status===`ready`&&(typeof t.rendererId==`string`&&t.rendererId.trim()!==``||yn(t.fallbackMarkdown??``)))}function Zn(e,t){return e.turnType===`llm`&&(!!t.trace?.piInput||t.trace?.usage!=null||t.preview?.hasReasoningDetails===!0||e.modelProfileId!==null)}function Qn(e){let{turnRecord:t,turnTrace:n,turnTracePreview:r,triggeringInput:i}=e,a={trace:n,preview:r},o=[],s=xn(t),c=Rn(a)??(Zn(t,a)?Ln(a):null);c&&o.push(c);let l=n?.assistant.text?.trim()??r?.assistantTextPreview.trim()??``,u=!yn(t.turnResultMarkdown)&&yn(t.output)?t.output.trim():``;return l.length===0&&u.length>0&&o.push({kind:`operator_decision`,text:u}),!e.hasRenderableLeafOutcome&&Yn(t,l||u,n===void 0&&r?.assistantTextTruncated===!0)&&o.push({kind:`turn_result`,markdown:t.turnResultMarkdown}),{kind:`turn_cluster`,chronologyAt:t.createdAt,anchorId:An(t.id),turnRecordId:t.id,turnId:t.turnId,turnType:t.turnType,title:bn(t.displayTurn),turnLabel:t.turnId,pathLabel:Dn(t),createdAt:t.createdAt,preview:Tn(t,320),isOperatorDecision:s===`operator_decision`,turnPresentation:s,turnKindLabel:Sn(t),terminalStatus:e.terminalStatus,sections:o,modelProfileId:t.modelProfileId,usage:n?.usage??r?.usage??null,triggeringInput:i,piInput:Wn({traceSource:a,triggeringInput:i,initialUserInputText:e.initialUserInputText}),facts:e.facts}}function $n(e,t,n){return e.map(e=>({kind:`leaf_outcome`,chronologyAt:e.anchoredAt,anchorId:Nn(e.id),instanceId:e.instanceId,snapshotId:e.id,leafEntryId:e.leafEntryId,turnRecordId:e.turnRecordId,title:`Result`,ownerTurnTitle:e.turnRecordId?t.get(e.turnRecordId)??null:null,rendererId:e.rendererId,schemaVersion:e.schemaVersion,props:e.props,fallbackMarkdown:e.fallbackMarkdown,status:e.status,warningCode:e.warningCode,warningMessage:e.warningMessage,anchoredAt:e.anchoredAt,createdAt:e.createdAt,processLifecycleStatus:n.lifecycleStatus,processSelectedTurnId:n.selectedTurnId,processUpdatedAt:n.updatedAt}))}function er(t,n){let r=typeof t==`string`?t.trim():``;return{kind:`prompt`,anchorId:Mn(),createdAt:typeof n==`string`&&n.trim()!==``?n:null,text:r,preview:e(r||`No prompt recorded.`,120)}}function tr(e,t){return e.localeCompare(t)}function nr(e,t){let n=tr(e.consumedAt??e.receivedAt,t.consumedAt??t.receivedAt);return n===0?e.sequence-t.sequence:n}function rr(e,t){let n=tr(e.receivedAt,t.receivedAt);return n===0?e.sequence-t.sequence:n}function ir(e,t){let n=tr(e.startedAt,t.startedAt);return n===0?e.id.localeCompare(t.id):n}function ar(e){return qn(e)&&typeof e.consumedAt==`string`&&e.consumedAt!==``}function or(e){return qn(e)}function sr(e,t){let n=e.consumedAt??t??e.receivedAt;return n?{inputId:e.id,source:e.source,sourceLabel:zn(e.source),bodyMarkdown:e.bodyMarkdown,receivedAt:e.receivedAt,consumedAt:n}:null}function cr(e,t,n){let r=Be(e)??``;if(!yn(r))return null;let i=typeof t==`string`&&t.trim()!==``?t:n;return{inputId:`chronicle-initial-prompt`,source:`initial_prompt`,sourceLabel:`Initial prompt`,bodyMarkdown:r,receivedAt:i,consumedAt:i}}function lr(e){let t=e.inputs.filter(ar).sort(nr),n=e.inputs.filter(or).sort(rr),r=[...e.turnRecords].sort(ir);if(r.length===0)return new Map;let i=r[0]?.id??null,a=cr(e.initialUserInputText,e.promptCreatedAt,r[0]?.startedAt??``),o=new Map,s=new Set,c=0,l=null;for(let e of r){for(;c<t.length;){let n=t[c],r=n.consumedAt;if(!r){c+=1;continue}if(l&&tr(r,l)<=0){c+=1;continue}if(tr(r,e.startedAt)>0)break;let i=sr(n);i&&(o.set(e.id,i),s.add(n.id)),c+=1;break}if(e.id===i&&!o.has(e.id)&&a&&o.set(e.id,a),!o.has(e.id))for(let t=n.length-1;t>=0;--t){let r=n[t];if(s.has(r.id))continue;if(l&&tr(r.receivedAt,l)<=0)break;if(tr(r.receivedAt,e.startedAt)>0)continue;let i=sr(r,r.receivedAt);i&&(o.set(e.id,i),s.add(r.id));break}l=e.endedAt??e.startedAt}return o}function ur(e,t){let n=new Map((t??[]).map(e=>[e.toolCallId,e])),r=new Set,i=e.map(e=>{r.add(e.toolCallId);let t=n.get(e.toolCallId);return t?{...e,arguments:e.arguments??t.arguments,resultText:t.resultText,truncated:t.truncated}:e});for(let e of t??[])r.has(e.toolCallId)||i.push(e);return i}function dr(t){let{turnRecord:n,activeTurn:r,turnTrace:i,turnTracePreview:a,triggeringInput:o}=t;if(!n)return null;let s=r?ur(r.toolCalls,i?.toolCalls):[],c=r?[...s].reverse().find(e=>e.status===`running`)??null:null,l=r?.assistant.thinking??``,u=r?.assistant.text.trim()??``,d=l.trim().length>0,f=r?Rn({trace:{assistant:r.assistant,toolCalls:s,traceItems:r.traceItems,usage:r.usage,piInput:i?.piInput??null},preview:a}):null,p=c?`tool_running`:d?`thinking`:u.length>0?`streaming`:`waiting`,m=qe(l,3,On),h=p===`tool_running`?`Running ${pe(c?.toolName??`tool`)}…`:p===`thinking`?m.text:p===`streaming`?e(u,320):Tn(n,220)||`Waiting for more activity…`,g=p===`tool_running`?`Running action`:p===`thinking`?`Reasoning`:p===`streaming`?`Writing response`:`Waiting for activity`;return{kind:`live_tail`,anchorId:jn(n.id),turnRecordId:n.id,turnId:n.turnId,turnType:n.turnType,title:bn(n.displayTurn),turnLabel:n.turnId,pathLabel:Dn(r||n),state:p,stateLabel:g,copy:h,reasoningSection:f,toolCall:c,usage:r?.usage??null,eventWindowTruncated:r?.eventWindowTruncated??!1,modelProfileId:n.modelProfileId,triggeringInput:o,piInput:Wn({traceSource:{trace:i,preview:a},triggeringInput:o,initialUserInputText:t.initialUserInputText}),facts:t.facts??Gn({turnId:n.turnId,durableTurnRecord:void 0,activeTurn:r??null,triggeringInput:o,actionSource:null,runDetails:t.runDetails})}}function fr(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map,r=e=>{let r=n.get(e);if(r)return r;let i=e,a=new Set;for(;!a.has(i);){a.add(i);let e=t.get(i)?.parentTurnRecordId??null;if(!e)break;i=e}return n.set(e,i),i};for(let t of e)r(t.id);return n}function pr(e,t){let n=fr(e);return e.map(e=>({...En(e),anchorId:e.status===`in_progress`&&t?t.anchorId:An(e.id),retryLineageRootTurnRecordId:n.get(e.id)??e.id}))}function mr(e){return e?{terminalStatus:e,anchorId:Pn(e),title:ut(e)}:null}function hr(e){switch(e.kind){case`prompt`:return-1;case`operator_input`:return 0;case`turn_cluster`:return 1;case`leaf_outcome`:return 2;default:return 3}}function gr(e,t){if(!(`chronologyAt`in e)||!(`chronologyAt`in t))return 0;let n=e.chronologyAt.localeCompare(t.chronologyAt);return n===0?hr(e)-hr(t):n}function _r(e){for(let t of e)if(t.kind===`thinking_preview`)return t;return null}function vr(e){let t=[];for(let n of e.timelineItems){if(n.kind===`turn_cluster`){let e=_r(n.sections);if(!e)continue;t.push({entryId:n.turnRecordId,turnRecordId:n.turnRecordId,turnId:n.turnId,title:n.title,turnLabel:n.turnLabel,stateLabel:null,isLive:!1,modelProfileId:n.modelProfileId,usage:n.usage,triggeringInput:n.triggeringInput,piInput:n.piInput,facts:n.facts,reasoningSection:e});continue}n.kind!==`live_tail`||!n.reasoningSection||t.push({entryId:n.turnRecordId,turnRecordId:n.turnRecordId,turnId:n.turnId,title:n.title,turnLabel:n.turnLabel,stateLabel:n.stateLabel,isLive:!0,modelProfileId:n.modelProfileId,usage:n.usage,triggeringInput:n.triggeringInput,piInput:n.piInput,facts:n.facts,reasoningSection:n.reasoningSection})}return t}function yr(e){let t=e.lifecycleStatus===`completed`||e.lifecycleStatus===`aborted`?e.lifecycleStatus:null,n=Be(e.initialUserInputText)??Be(e.promptText),r=n?er(n,e.promptCreatedAt):null,i=lr(e),a=new Map(e.turnRecords.map(e=>[e.id,e])),o=e.turnRecords.filter(e=>e.status===`completed`),s=o.at(-1)?.id??null,c=o.map(n=>{let r=n.id===s,o=i.get(n.id)??null;return Qn({turnRecord:n,turnTrace:e.turnTraceIndex[n.id],turnTracePreview:e.turnTracePreviewIndex?.[n.id],terminalStatus:r?t:null,hasRenderableLeafOutcome:Xn(n.id,e.leafOutcomeSnapshots),triggeringInput:o,facts:Gn({turnId:n.turnId,durableTurnRecord:a.get(n.id),triggeringInput:o,actionSource:n.actionSource,runDetails:e.runDetails}),initialUserInputText:e.initialUserInputText})}),l=e.inputs.filter(Jn).map(e=>({kind:`operator_input`,chronologyAt:e.receivedAt,inputId:e.id,source:e.source,sourceLabel:zn(e.source),bodyMarkdown:e.bodyMarkdown,receivedAt:e.receivedAt})),u=new Map(e.turnRecords.map(e=>[e.id,bn(e.displayTurn)])),d=$n(e.leafOutcomeSnapshots,u,{lifecycleStatus:e.lifecycleStatus??null,selectedTurnId:e.selectedTurnId??null,updatedAt:e.processUpdatedAt??null}),f=e.turnRecords.find(e=>e.status===`in_progress`)??null,p=(f&&i.get(f.id))??null,m=dr({turnRecord:f,activeTurn:e.activeTurn,turnTrace:f?e.turnTraceIndex[f.id]:void 0,turnTracePreview:f?e.turnTracePreviewIndex?.[f.id]:void 0,triggeringInput:p,facts:f?Gn({turnId:f.turnId,durableTurnRecord:a.get(f.id),activeTurn:e.activeTurn??null,triggeringInput:p,actionSource:f.actionSource,runDetails:e.runDetails}):null,runDetails:e.runDetails,initialUserInputText:e.initialUserInputText}),h=mr(t),g=[...r?[r]:[],...c,...l,...d].sort(gr);m?g.push(m):e.definesLeafOutcome&&c.length>0&&d.length===0&&g.push({kind:`leaf_outcome_placeholder`,latestTurnTitle:c.at(-1)?.title??null});let _=[...g].reverse().find(e=>`anchorId`in e),v=[...g].reverse().find(e=>(e.kind===`turn_cluster`||e.kind===`live_tail`)&&typeof e.turnRecordId==`string`||e.kind===`leaf_outcome`);return{promptItem:r,turnRailItems:pr(e.turnRecords,m),terminalRailItem:h,timelineItems:g,initialAnchorId:h?.anchorId??_?.anchorId??null,initialFocusedTurnId:f?.id??(v&&`turnRecordId`in v?v.turnRecordId:e.turnRecords.at(-1)?.id??null),liveTail:m,latestCompletedTurnTitle:c.at(-1)?.title??null}}var br=`chronicle-action-section`,xr=`chronicle-process-error-section`;function Sr(e){return{kind:`prompt`,anchorId:e.anchorId,label:`Prompt`,title:`Initial prompt`,detail:null,hierarchy:`primary`,tone:`prompt`,markerText:`P`}}function Cr(e){return{kind:`terminal`,anchorId:e.anchorId,label:`Process state`,title:e.title,detail:null,hierarchy:`primary`,tone:`terminal`,markerText:ft(e.terminalStatus),terminalStatus:e.terminalStatus}}function wr(e){return e.retryLineageRootTurnRecordId??e.turnRecordId}function Tr(e,t){return e.turnId===t.turnId&&wr(e)===wr(t)}function Er(e){let t=[];e.projection.promptItem&&t.push(Sr(e.projection.promptItem));let n=new Map(e.projection.turnRailItems.map(e=>[e.turnRecordId,e])),r=0;for(let i=0;i<e.projection.timelineItems.length;i+=1){let a=e.projection.timelineItems[i];if(a.kind===`turn_cluster`||a.kind===`live_tail`){if(e.pendingRailItem?.replaceTurnRecordId&&a.turnRecordId===e.pendingRailItem.replaceTurnRecordId)continue;let o=n.get(a.turnRecordId);if(!o)continue;let s=e.projection.timelineItems.slice(i+1).find(e=>e.kind===`turn_cluster`||e.kind===`live_tail`),c=s?n.get(s.turnRecordId):void 0;if(c&&Tr(o,c))continue;o.presentation===`llm_turn`&&(r+=1),t.push({kind:`turn`,anchorId:o.anchorId,turnId:o.turnId,turnRecordId:o.turnRecordId,label:o.kindLabel,title:o.title,detail:null,hierarchy:o.hierarchy,tone:o.presentation,markerText:o.presentation===`llm_turn`?String(r):o.presentation===`automatic_turn`?`Auto`:o.presentation===`external_trigger`?`Ext`:`You`,status:o.status,shape:o.shape})}}return e.projection.terminalRailItem&&t.push(Cr(e.projection.terminalRailItem)),e.pendingRailItem&&t.push({kind:`action`,anchorId:e.pendingRailItem.anchorId??`chronicle-action-section`,label:e.pendingRailItem.label,title:e.pendingRailItem.title,detail:e.pendingRailItem.detail??null,hierarchy:`secondary`,tone:e.pendingRailItem.tone,markerText:e.pendingRailItem.markerText??(e.pendingRailItem.tone===`external_trigger`?`Ext`:e.pendingRailItem.tone===`error_recovery`?`!`:`You`),...e.pendingRailItem.relatedTurnRecordId?{turnRecordId:e.pendingRailItem.relatedTurnRecordId}:{}}),t}function Dr(e,t){return t?e.find(e=>e.anchorId===t)??null:null}function Or(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>e.anchorId===t),i=r>=0?r:e.length-1;return e[Math.max(0,Math.min(i+n,e.length-1))]?.anchorId??null}function kr(e,t,n){let r=Dr(t,n);if(r)return r.anchorId;if(!n)return null;let i=new Map(e.turnRailItems.map(e=>[e.turnRecordId,e])),a=e.timelineItems.find(e=>e.kind===`leaf_outcome`&&e.anchorId===n);if(a&&a.kind===`leaf_outcome`){let e=a.turnRecordId;if(e){let n=i.get(e),r=[...t].reverse().find(t=>{if(t.kind!==`turn`)return!1;if(t.turnRecordId===e)return!0;let r=i.get(t.turnRecordId);return!!(n&&r&&Tr(n,r))});if(r)return r.anchorId}}let o=e.turnRailItems.find(e=>e.anchorId===n);if(!o)return null;let s=t.find(e=>e.kind===`action`&&e.turnRecordId===o.turnRecordId);return s?s.anchorId:[...t].reverse().find(e=>{if(e.kind!==`turn`)return!1;let t=i.get(e.turnRecordId);return t?Tr(o,t):e.turnRecordId===o.turnRecordId})?.anchorId??null}function Ar(e,t){return e.turnRailItems.find(e=>e.turnRecordId===t)?.anchorId??null}function jr(e,t){let n=Dr(e,t);return n?n.kind===`turn`?n.turnRecordId:n.kind===`action`?n.turnRecordId??null:null:null}var Mr=196,Nr=68,Pr=72,Fr=60;function Ir(e,t,n){if(e.productLabels.length){let e={x:t.x+t.width/2,y:t.y},r=e.x+24,i={x:n.x,y:n.y-n.height/2},a=i.y-24;return[e,{x:r,y:e.y},{x:r,y:a},{x:i.x,y:a},i]}let r={x:n.x-n.width/2,y:n.y};if(t.lane!==n.lane&&n.x<=t.x){let e={x:t.x,y:t.y+t.height/2},i=e.y+Math.max(24,(n.y-e.y)*.45),a=r.x-40;return[e,{x:e.x,y:i},{x:a,y:i},{x:a,y:r.y},r]}let i={x:t.x+t.width/2,y:t.y};if(t.lane===n.lane)return[i,r];let a=Math.min(r.x-24,i.x+Math.max(24,(r.x-i.x)*.45));return[i,{x:a,y:i.y},{x:a,y:r.y},r]}function Lr(e,t,n=[]){if(!e.length)return null;let r=[...e].sort((e,t)=>e.timestamp.localeCompare(t.timestamp)||e.id.localeCompare(t.id)),i=new Map(r.map(e=>[e.id,e])),a=new Map;for(let e of r){if(!e.parentId||!i.has(e.parentId))continue;let t=a.get(e.parentId)??[];t.push(e),a.set(e.parentId,t)}let o=new Map,s=new Map,c=0;function l(e){let n=o.get(e.id);if(n)return n;let r=e.parentId?i.get(e.parentId):void 0,u=r?l(r):void 0,d=e.parentId?a.get(e.parentId)??[]:[],f=!u||e.pathType===`leaf_branch`||d[0]?.id!==e.id,p=f?c++:u.lane,m=u?(s.get(u.id)??0)+1:0;s.set(e.id,m);let h={...e,x:248+m*356,y:94+p*140,width:Mr,height:Nr,lane:p,startsLane:f,contextOrigin:f?u?`previous`:`fresh`:null,childCount:a.get(e.id)?.length??0,isCurrent:e.id===t};return o.set(e.id,h),h}let u=r.map(l),d=n.map(e=>{let t=o.get(e.sourceNodeId),n=e.targetNodeId?o.get(e.targetNodeId):null;return!t||e.targetNodeId&&!n?null:e.endState?{...e,points:[{x:t.x+t.width/2,y:t.y},{x:t.x+t.width/2+42,y:t.y},{x:t.x+t.width/2+82,y:t.y+38}]}:n?{...e,points:Ir(e,t,n)}:null}).filter(e=>!!e),f=Math.max(...s.values());return{width:174+(f+1)*Mr+f*160+(d.some(e=>e.endState)?100:0),height:Fr*2+c*Nr+Math.max(0,c-1)*Pr,laneCount:c,nodes:u,edges:d}}var Rr=0,zr=u(`<g class="lane-label svelte-14zvu68"><text class="lane-number svelte-14zvu68" y="0"> </text><text y="20"> </text></g>`),Br=u(`<text class="badge branch-badge svelte-14zvu68" y="-8">Branch</text>`),Vr=u(`<text class="badge current-badge svelte-14zvu68">Current</text>`),Hr=u(`<text class="badge failed-badge svelte-14zvu68">Failed</text>`),Ur=u(`<g data-tree-node="turn"><title> </title><rect rx="9" class="svelte-14zvu68"></rect><text class="node-title svelte-14zvu68" y="38" text-anchor="middle"> </text><!><!></g>`),Wr=u(`<g class="dead-end-marker svelte-14zvu68"><line x1="-5" y1="-5" x2="5" y2="5"></line><line x1="5" y1="-5" x2="-5" y2="5"></line></g>`),Gr=u(`<g class="completed-end-marker svelte-14zvu68"><path d="M -6 0 L -2 5 L 7 -6"></path></g>`),Kr=u(`<path></path><!>`,1),qr=s(`<span> </span>`),Jr=u(`<foreignObject height="60"><div class="edge-label-box svelte-14zvu68"><div class="edge-label svelte-14zvu68"></div></div></foreignObject>`),Yr=s(`<p class="summary-detail svelte-14zvu68"> </p> <div class="tree-viewport svelte-14zvu68" data-section="conversation-tree-diagram"><svg role="img" class="svelte-14zvu68"><title>Conversation input lineage</title><desc> </desc><defs><marker viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path class="context-arrowhead svelte-14zvu68" d="M 0 0 L 10 5 L 0 10 z"></path></marker><marker viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path class="product-arrowhead svelte-14zvu68" d="M 0 0 L 10 5 L 0 10 z"></path></marker></defs><!><!><!><!></svg></div>`,1);function Xr(e,t){F(t,!0);let n=K(()=>new Map(t.railItems.filter(e=>e.kind===`turn`).map(e=>[e.turnRecordId,e]))),r=`tree-arrow-${Rr++}`,i=K(()=>Lr(t.tree.nodes,t.tree.currentLeafId,t.tree.edges)),a=K(()=>S(i)?.nodes.filter(e=>e.startsLane)??[]),s=K(()=>S(i)?.nodes.filter(e=>e.childCount>1).length??0);function l(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}function u(e){let t=[S(n).get(e.id)?.title??e.label];return e.contextOrigin===`fresh`&&t.push(`fresh context`),e.contextOrigin===`previous`&&t.push(`branch with previous context`),e.childCount>1&&t.push(`branch point`),e.isCurrent&&t.push(`current input`),e.resultState===`failed`&&t.push(`failed`),t.join(`, `)}function f(e){return[e.actionLabel,...e.productLabels.map(e=>`${e} input`)].filter(e=>!!e)}function p(e){let t=S(i)?.nodes.find(t=>t.id===e.sourceNodeId),n=S(i)?.nodes.find(t=>t.id===e.targetNodeId);return!!(t&&n&&t.lane===n.lane&&!e.productLabels.length)}function g(e){let t=e.points.at(-1)??{x:0,y:0},n=e.points.at(-2)??t,r=S(i)?.nodes.find(t=>t.id===e.sourceNodeId),a=S(i)?.nodes.find(t=>t.id===e.targetNodeId);if(r&&a&&p(e))return{x:(r.x+a.x)/2,y:r.y-7};let o=S(i)?.edges.filter(t=>t.targetNodeId===e.targetNodeId&&!p(t)&&f(t).length)??[],s=Math.max(0,o.findIndex(t=>t.id===e.id));return{x:(n.x+t.x)/2,y:a?a.y-a.height/2-9-s*60:t.y-11}}let v=K(()=>S(i)?`Inputs: ${S(i).nodes.map(e=>u(e)).join(`; `)}. Connections: ${S(i).edges.map(e=>{let t=e.targetNodeId??e.endState??`no target`,n=f(e).join(` `)||(e.hasContext?`context`:`decision`);return`${e.sourceNodeId} to ${t}: ${n}`}).join(`; `)||`none`}.`:`No conversation input lineage.`);var y=_(),b=T(y),x=e=>{var t=Yr(),p=T(t),y=d(p);L(p);var b=w(p,2),x=d(b),C=d(x),E=w(C),D=d(E,!0);L(E);var O=w(E),k=d(O),A=w(k);L(O);var M=w(O);o(M,19,()=>S(a),e=>e.id,(e,t,n)=>{var r=zr(),i=d(r),a=d(i);L(i);var o=w(i);let s;var l=d(o,!0);L(o),L(r),c(()=>{j(r,`transform`,`translate(16 ${S(t).y-13})`),m(a,`Context ${S(n)+1}`),s=Y(o,0,`svelte-14zvu68`,null,s,{previous:S(t).contextOrigin===`previous`}),m(l,S(t).contextOrigin===`previous`?`Previous context`:`Fresh context`)}),h(e,r)});var N=w(M);o(N,17,()=>S(i).nodes,e=>e.id,(e,t)=>{let r=K(()=>S(n).get(S(t).id));var i=Ur();let a;var o=d(i),s=d(o,!0);L(o);var l=w(o),f=w(l),p=d(f,!0);L(f);var g=w(f),_=e=>{var n=Br();c(()=>j(n,`x`,S(t).width-58)),h(e,n)};B(g,e=>{S(t).childCount>1&&e(_)});var v=w(g),y=e=>{var n=Vr();c(()=>{j(n,`x`,S(t).width-62),j(n,`y`,S(t).height+17)}),h(e,n)},b=e=>{var n=Hr();c(()=>{j(n,`x`,S(t).width-52),j(n,`y`,S(t).height+17)}),h(e,n)};B(v,e=>{S(t).isCurrent?e(y):S(t).resultState===`failed`&&e(b,1)}),L(i),c(e=>{a=Y(i,0,`tree-node svelte-14zvu68`,null,a,{branch:S(t).childCount>1,current:S(t).isCurrent,failed:S(t).resultState===`failed`}),j(i,`transform`,`translate(${S(t).x-S(t).width/2} ${S(t).y-S(t).height/2})`),j(i,`data-context-origin`,S(t).contextOrigin),j(i,`data-rail-tone`,S(r)?.tone),m(s,e),j(l,`width`,S(t).width),j(l,`height`,S(t).height),j(f,`x`,S(t).width/2),m(p,S(r)?.title??S(t).label)},[()=>u(S(t))]),h(e,i)});var P=w(N);o(P,17,()=>S(i).edges,e=>e.id,(e,t)=>{var n=Kr(),i=T(n);let a;var o=w(i),s=e=>{let n=K(()=>S(t).points.at(-1)??{x:0,y:0});var r=_(),i=T(r),a=e=>{var t=Wr();c(()=>j(t,`transform`,`translate(${S(n).x} ${S(n).y})`)),h(e,t)},o=e=>{var t=Gr();c(()=>j(t,`transform`,`translate(${S(n).x} ${S(n).y})`)),h(e,t)};B(i,e=>{S(t).endState===`not_applied`?e(a):e(o,-1)}),h(e,r)};B(o,e=>{S(t).endState&&e(s)}),c(e=>{a=Y(i,0,`edge svelte-14zvu68`,null,a,{product:S(t).productLabels.length,decision:!S(t).hasContext&&!S(t).productLabels.length,"dead-end":S(t).endState===`not_applied`,"completed-end":S(t).endState===`completed`}),j(i,`d`,e),j(i,`marker-end`,S(t).endState?void 0:`url(#${r}-${S(t).productLabels.length?`product`:`context`})`)},[()=>l(S(t).points)]),h(e,n)}),o(w(P),17,()=>S(i).edges,e=>`label:${e.id}`,(e,t)=>{let n=K(()=>f(S(t)));var r=_(),i=T(r),a=e=>{let r=K(()=>g(S(t)));var i=Jr();let a;var s=d(i),l=d(s);o(l,21,()=>S(n),e=>`${S(t).id}:${e}`,(e,t)=>{var n=qr(),r=d(n,!0);L(n),c(()=>m(r,S(t))),h(e,n)}),L(l),L(s),L(i),c(()=>{a=Y(i,0,`edge-label-group svelte-14zvu68`,null,a,{product:S(t).productLabels.length}),j(i,`x`,S(r).x-160/2),j(i,`y`,S(r).y-60),j(i,`width`,160)}),h(e,i)};B(i,e=>{S(n).length&&e(a)}),h(e,r)}),L(x),L(b),c(()=>{m(y,`${S(i).nodes.length??``} model inputs · ${S(i).laneCount??``} contexts · ${S(s)??``} branch
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,E as t,F as n,G as r,I as i,J as a,M as o,N as s,P as c,R as l,V as u,X as d,Y as f,d as p,dt as m,ft as h,gt as g,k as _,r as v,rt as y,tt as b,v as x,y as S,z as C}from"./index-client-BqF3_t3P.js";import"./api-CqECFdii.js";var w=null;function T(e){w=e}function E(e){if(!w||w.instanceId!==e)return null;let t=w;return w=null,t}function D(e){(!e||w?.instanceId===e)&&(w=null)}var O=Object.defineProperty,k=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ee=(e,t)=>{for(var n in t)O(e,n,{get:t[n],enumerable:!0})},A=(e,t,n)=>k(e,typeof t==`symbol`?t:t+``,n),j={};ee(j,{Graph:()=>N,alg:()=>V,json:()=>R,version:()=>L});var te=Object.defineProperty,M=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},N=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e==`function`?this._defaultNodeLabelFn=e:this._defaultNodeLabelFn=()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return typeof e==`function`?this._defaultEdgeLabelFn=e:this._defaultEdgeLabelFn=()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=F(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=re(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,ne(this._preds[a],i),ne(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?I(this._isDirected,e):F(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r==`object`?r:{label:r}}hasEdge(e,t,n){return(arguments.length===1?I(this._isDirected,e):F(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?I(this._isDirected,e):F(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],P(this._preds[t],e),P(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function ne(e,t){e[t]?e[t]++:e[t]=1}function P(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function F(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function re(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function I(e,t){return F(e,t.v,t.w,t.name)}var L=`4.0.1`,R={};M(R,{read:()=>ae,write:()=>z});function z(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ie(e),edges:B(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function ie(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function B(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function ae(e){let t=new N(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var V={};M(V,{CycleException:()=>W,bellmanFord:()=>H,components:()=>ce,dijkstra:()=>U,dijkstraAll:()=>fe,findCycles:()=>me,floydWarshall:()=>ge,isAcyclic:()=>ye,postorder:()=>Ce,preorder:()=>we,prim:()=>Te,shortestPaths:()=>Ee,tarjan:()=>pe,topsort:()=>ve});var oe=()=>1;function H(e,t,n,r){return se(e,String(t),n||oe,r||function(t){return e.outEdges(t)})}function se(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function ce(e){let t={},n=[],r;function i(n){n in t||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var le=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},ue=()=>1;function U(e,t,n,r){return de(e,String(t),n||ue,r||function(t){return e.outEdges(t)})}function de(e,t,n,r){let i={},a=new le,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t],c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0&&(o=a.removeMin(),s=i[o],s.distance!==1/0);)r(o).forEach(c);return i}function fe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=U(e,i,t,n),r},{})}function pe(e){let t=0,n=[],r={},i=[];function a(o){let s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do t=n.pop(),r[t].onStack=!1,e.push(t);while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function me(e){return pe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var he=()=>1;function ge(e,t,n){return _e(e,t||he,n||function(t){return e.outEdges(t)})}function _e(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){let t=r[e];i.forEach(function(n){let a=r[n];i.forEach(function(n){let r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}var W=class extends Error{constructor(...e){super(...e)}};function ve(e){let t={},n={},r=[];function i(a){if(a in n)throw new W;a in t||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new W;return r}function ye(e){try{ve(e)}catch(e){if(e instanceof W)return!1;throw e}return!0}function be(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=xe(e,t,n===`post`,o,a,r,i)}),i}function xe(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=xe(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function Se(e,t,n){return be(e,t,n,function(e,t){return e.push(t),e},[])}function Ce(e,t){return Se(e,t,`post`)}function we(e,t){return Se(e,t,`pre`)}function Te(e,t){let n=new N,r={},i=new le,a;function o(e){let n=e.v===a?e.w:e.v,o=i.priority(n);if(o!==void 0){let s=t(e);s<o&&(r[n]=a,i.decrease(n,s))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){i.add(e,1/0),n.setNode(e)}),i.decrease(e.nodes()[0],0);let s=!1;for(;i.size()>0;){if(a=i.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw Error(`Input graph is not connected: `+e);s=!0}e.nodeEdges(a).forEach(o)}return n}function Ee(e,t,n,r){return De(e,t,n,r??(t=>e.outEdges(t)??[]))}function De(e,t,n,r){if(n===void 0)return U(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=r(a[o]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===a[o]?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return H(e,t,n,r)}return U(e,t,n,r)}function G(e,t,n,r){let i=r;for(;e.hasNode(i);)i=Ve(r);return n.dummy=t,e.setNode(i,n),i}function Oe(e){let t=new N().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function ke(e){let t=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Ae(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function K(e){let t=J(Ie(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function je(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=q(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function Me(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=q(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function Ne(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),G(e,`border`,i,t)}function Pe(e,t=Fe){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var Fe=65535;function q(e,t){return t.length>Fe?e(...Pe(t).map(t=>e(...t))):e(...t)}function Ie(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return q(Math.max,t)}function Le(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Re(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function ze(e,t){return t()}var Be=0;function Ve(e){return e+(``+ ++Be)}function J(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function Y(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function X(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function He(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var Z=`\0`,Ue=`3.0.0`,We=class{constructor(){A(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Ge(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Ge(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Ke)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Ge(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ke(e,t){if(e!==`_next`&&e!==`_prev`)return t}var qe=We,Je=()=>1;function Ye(e,t){if(e.nodeCount()<=1)return[];let n=Qe(e,t||Je);return Xe(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Xe(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Ze(e,t,n,o);for(;o=i.dequeue();)Ze(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(Ze(e,t,n,o,!0)||[]);break}}}return r}function Ze(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,$e(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,$e(t,n,o)}),e.removeNode(r.v),o}function Qe(e,t){let n=new N,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=et(i+r+3).map(()=>new qe),o=r+1;return n.nodes().forEach(e=>{$e(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function $e(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function et(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function tt(e){(e.graph().acyclicer===`greedy`?Ye(e,t(e)):nt(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Ve(`rev`))});function t(e){return t=>e.edge(t).weight}}function nt(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function rt(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function it(e){e.graph().dummyChains=[],e.edges().forEach(t=>at(e,t))}function at(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=G(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function ot(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function st(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=q(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function Q(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var ct=lt;function lt(e){let t=new N({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;ut(t,e)<i&&(a=dt(t,e),a);)o=t.hasNode(a.v)?Q(e,a):-Q(e,a),ft(t,e,o);return t}function ut(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Q(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function dt(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=Q(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function ft(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:pt,postorder:mt}=V,ht=$;$.initLowLimValues=yt,$.initCutValues=gt,$.calcCutValue=vt,$.leaveEdge=xt,$.enterEdge=St,$.exchangeEdges=Ct;function $(e){e=Oe(e),st(e);let t=ct(e);yt(t),gt(t,e);let n,r;for(;n=xt(t);)r=St(t,e,n),Ct(t,e,n,r)}function gt(e,t){let n=mt(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>_t(e,t,n))}function _t(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=vt(e,t,n)}function vt(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,Tt(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function yt(e,t){arguments.length<2&&(t=e.nodes()[0]),bt(e,{},1,t)}function bt(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=bt(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function xt(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function St(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===Et(e,e.node(t.v),s)&&c!==Et(e,e.node(t.w),s)).reduce((e,n)=>Q(t,n)<Q(t,e)?n:e)}function Ct(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),yt(e),gt(e,t),wt(e,t)}function wt(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=pt(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Tt(e,t,n){return e.hasEdge(t,n)}function Et(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Dt=Ot;function Ot(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:jt(e);break;case`tight-tree`:At(e);break;case`longest-path`:kt(e);break;case`none`:break;default:jt(e)}}var kt=st;function At(e){st(e),ct(e)}function jt(e){ht(e)}var Mt=Nt;function Nt(e){let t=Ft(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=Pt(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function Pt(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function Ft(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(Z).forEach(r),t}function It(e){let t=G(e,`root`,{},`_root`),n=Rt(e),r=Object.values(n),i=q(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=zt(e)+1;e.children(Z).forEach(r=>Lt(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function Lt(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=Ne(e,`_bt`),l=Ne(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{Lt(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function Rt(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(Z).forEach(e=>n(e,1)),t}function zt(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Bt(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var Vt=Ht;function Ht(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)Ut(e,`borderLeft`,`_bl`,n,i,t),Ut(e,`borderRight`,`_br`,n,i,t)}}e.children(Z).forEach(t)}function Ut(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=G(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Wt(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&Kt(e)}function Gt(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&Jt(e),(t===`lr`||t===`rl`)&&(Xt(e),Kt(e))}function Kt(e){e.nodes().forEach(t=>qt(e.node(t))),e.edges().forEach(t=>qt(e.edge(t)))}function qt(e){let t=e.width;e.width=e.height,e.height=t}function Jt(e){e.nodes().forEach(t=>Yt(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Yt),Object.hasOwn(r,`y`)&&Yt(r)})}function Yt(e){e.y=-e.y}function Xt(e){e.nodes().forEach(t=>Zt(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Zt),Object.hasOwn(r,`x`)&&Zt(r)})}function Zt(e){let t=e.x;e.x=e.y,e.y=t}function Qt(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=J(q(Math.max,r)+1).map(()=>[]);function a(n){if(t[n])return;t[n]=!0;let r=e.node(n);i[r.rank].push(n);let o=e.successors(n);o&&o.forEach(a)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(a),i}function $t(e,t){let n=0;for(let r=1;r<t.length;++r)n+=en(e,t[r-1],t[r]);return n}function en(e,t,n){let r=He(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function tn(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function nn(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),rn(Object.values(n).filter(e=>!e.indegree))}function rn(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&an(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>Y(e,[`vs`,`i`,`barycenter`,`weight`]))}function an(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function on(e,t){let n=Le(e,e=>Object.hasOwn(e,`barycenter`)),r=n.lhs,i=n.rhs.sort((e,t)=>t.i-e.i),a=[],o=0,s=0,c=0;r.sort(cn(!!t)),c=sn(a,i,c),r.forEach(e=>{c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=sn(a,i,c)});let l={vs:a.flat(1)};return s&&(l.barycenter=o/s,l.weight=s),l}function sn(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function cn(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function ln(e,t,n,r){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=i.filter(e=>e!==o&&e!==s));let l=tn(e,i);l.forEach(t=>{if(e.children(t.v).length){let i=ln(e,t.v,n,r);c[t.v]=i,Object.hasOwn(i,`barycenter`)&&dn(t,i)}});let u=nn(l,n);un(u,c);let d=on(u,r);if(o&&s){d.vs=[o,d.vs,s].flat(1);let t=e.predecessors(o);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(s),i=e.node(r[0]);Object.hasOwn(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+n.order+i.order)/(d.weight+2),d.weight+=2}}return d}function un(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function dn(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function fn(e,t,n,r){r||=e.nodes();let i=pn(e),a=new N({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function pn(e){let t;for(;e.hasNode(t=Ve(`_root`)););return t}function mn(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function hn(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,hn);return}let n=Ie(e),r=gn(e,J(1,n+1),`inEdges`),i=gn(e,J(n-1,-1,-1),`outEdges`),a=Qt(e);if(vn(e,a),t.disableOptimalOrderHeuristic)return;let o=1/0,s,c=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){_n(t%2?r:i,t%4>=2,c),a=K(e);let l=$t(e,a);l<o?(n=0,s=Object.assign({},a),o=l):l===o&&(s=structuredClone(a))}vn(e,s)}function gn(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return fn(e,t,n,r.get(t)||[])})}function _n(e,t,n){let r=new N;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=ln(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),mn(e,r,a.vs)})}function vn(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function yn(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=xn(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Sn(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function bn(e,t){let n={};function r(t,r,i,a,o){J(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Sn(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function xn(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Sn(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Cn(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function wn(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s&&s.length){let r=s.sort((e,t)=>{let n=o[e],r=o[t];return(n===void 0?0:n)-(r===void 0?0:r)}),c=(r.length-1)/2;for(let s=Math.floor(c),l=Math.ceil(c);s<=l;++s){let c=r[s];if(c===void 0)continue;let l=o[c];if(l!==void 0&&a[e]===e&&t<l&&!Cn(n,e,c)){let n=i[c];n!==void 0&&(a[c]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}}function Tn(e,t,n,r,i=!1){let a={},o=En(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function En(e,t,n,r){let i=new N,a=e.graph(),o=jn(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function Dn(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=Mn(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function On(e,t){let n=Object.values(t),r=q(Math.min,n),i=q(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-q(Math.min,c);a!==`l`&&(l=i-q(Math.max,c)),l&&(e[o]=X(s,e=>e+l))})})}function kn(e,t=void 0){let n=e.ul;return n?X(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function An(e){let t=K(e),n=Object.assign(yn(e,t),bn(e,t)),r={},i;return[`u`,`d`].forEach(a=>{i=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(i=i.map(e=>Object.values(e).reverse()));let o=wn(e,i,n,t=>(a===`u`?e.predecessors(t):e.successors(t))||[]),s=Tn(e,i,o.root,o.align,t===`r`);t===`r`&&(s=X(s,e=>-e)),r[a+t]=s})}),On(r,Dn(e,r)),kn(r,e.graph().align)}function jn(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),c}}function Mn(e,t){return e.node(t).width}function Nn(e){e=ke(e),Pn(e),Object.entries(An(e)).forEach(([t,n])=>e.node(t).x=n)}function Pn(e){let t=K(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);i===`top`?r.y=a+r.height/2:i===`bottom`?r.y=a+n-r.height/2:r.y=a+n/2}),a+=n+r})}function Fn(e,t={}){let n=t.debugTiming?Re:ze;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>Kn(e));return n(` runLayout`,()=>In(r,n,t)),n(` updateInputGraph`,()=>Ln(e,r)),r})}function In(e,t,n){t(` makeSpaceForEdgeLabels`,()=>qn(e)),t(` removeSelfEdges`,()=>nr(e)),t(` acyclic`,()=>tt(e)),t(` nestingGraph.run`,()=>It(e)),t(` rank`,()=>Dt(ke(e))),t(` injectEdgeLabelProxies`,()=>Jn(e)),t(` removeEmptyRanks`,()=>Me(e)),t(` nestingGraph.cleanup`,()=>Bt(e)),t(` normalizeRanks`,()=>je(e)),t(` assignRankMinMax`,()=>Yn(e)),t(` removeEdgeLabelProxies`,()=>Xn(e)),t(` normalize.run`,()=>it(e)),t(` parentDummyChains`,()=>Mt(e)),t(` addBorderSegments`,()=>Vt(e)),t(` order`,()=>hn(e,n)),t(` insertSelfEdges`,()=>rr(e)),t(` adjustCoordinateSystem`,()=>Wt(e)),t(` position`,()=>Nn(e)),t(` positionSelfEdges`,()=>ir(e)),t(` removeBorderNodes`,()=>tr(e)),t(` normalize.undo`,()=>ot(e)),t(` fixupEdgeLabelCoords`,()=>$n(e)),t(` undoCoordinateSystem`,()=>Gt(e)),t(` translateGraph`,()=>Zn(e)),t(` assignNodeIntersects`,()=>Qn(e)),t(` reversePoints`,()=>er(e)),t(` acyclic.undo`,()=>rt(e))}function Ln(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Rn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],zn={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},Bn=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],Vn=[`width`,`height`,`rank`],Hn={width:0,height:0},Un=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Wn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Gn=[`labelpos`];function Kn(e){let t=new N({multigraph:!0,compound:!0}),n=or(e.graph());return t.setGraph(Object.assign({},zn,ar(n,Rn),Y(n,Bn))),e.nodes().forEach(n=>{let r=ar(or(e.node(n)),Vn);Object.keys(Hn).forEach(e=>{r[e]===void 0&&(r[e]=Hn[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=or(e.edge(n));t.setEdge(n,Object.assign({},Wn,ar(r,Un),Y(r,Gn)))}),t}function qn(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Jn(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);G(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function Yn(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Xn(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Zn(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function Qn(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(Ae(r,a)),n.points.push(Ae(i,o))})}function $n(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function er(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function tr(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function nr(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function rr(e){K(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{G(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function ir(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`selfedge`){let r=n,i=e.node(r.e.v),a=i.x+i.width/2,o=i.y,s=n.x-a,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:a+2*s/3,y:o-c},{x:a+5*s/6,y:o-c},{x:a+s,y:o},{x:a+5*s/6,y:o+c},{x:a+2*s/3,y:o+c}],r.label.x=n.x,r.label.y=n.y}})}function ar(e,t){return X(Y(e,t),Number)}function or(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function sr(e){let t=K(e),n=new N({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var cr={graphlib:j,version:Ue,layout:Fn,debug:sr,util:{time:Re,notime:ze}},lr={charWidth:7.2,minNodeWidth:132,maxNodeWidth:280,nodeHeight:56,endNodeHeight:44,nodePaddingX:28,rankSep:56,nodeSep:36,edgeSep:18,edgeLabelCharWidth:6,edgeLabelHeight:18},ur=`__end__`;function dr(e){return`${ur}${e}`}function fr(e){return e===`completed`?`Completed`:`Aborted`}function pr(e){return e.length===0?``:e.length===1?e[0]:`${e.length} transitions`}function mr(e){switch(e){case`llm`:return`Agent turn`;case`human`:return`Operator decision`;case`external`:return`External wait`;case`automatic`:return`Automatic`;case`server_automatic`:return`Server step`}}function hr(e){switch(e){case`llm`:return`An AI agent does the work in this step, using its tools to plan, edit, or review.`;case`human`:return`You decide how the process continues by choosing one of the available actions.`;case`external`:return`The process pauses until an outside system or event reports back.`;case`automatic`:return`A deterministic step runs automatically in the workspace, with no AI or operator input.`;case`server_automatic`:return`The server runs this step automatically to prepare or finalize process state.`}}function gr(e,t,n=t.charWidth){let r=e.length*n+t.nodePaddingX*2;return Math.max(t.minNodeWidth,Math.min(t.maxNodeWidth,Math.round(r)))}function _r(e,t={}){let n={...lr,...t},r=new cr.graphlib.Graph({multigraph:!0});r.setGraph({rankdir:`TB`,ranksep:n.rankSep,nodesep:n.nodeSep,edgesep:n.edgeSep,marginx:12,marginy:12}),r.setDefaultEdgeLabel(()=>({}));let i=new Map;for(let t of e.nodes){i.set(t.turnId,t);let e=gr(t.description,n);r.setNode(t.turnId,{width:e,height:n.nodeHeight})}let a=new Set;for(let t of e.edges)t.lifecycleStatus!==null&&a.add(t.lifecycleStatus);for(let e of a){let t=fr(e);r.setNode(dr(e),{width:gr(t,n),height:n.endNodeHeight})}let o=new Map;for(let t of e.edges){let e=t.to??(t.lifecycleStatus?dr(t.lifecycleStatus):null);if(e===null||!r.hasNode(t.from)||!r.hasNode(e))continue;let n=`${t.from}|${e}|${t.kind}`,i=o.get(n);if(i){t.label&&!i.labels.includes(t.label)&&i.labels.push(t.label);continue}o.set(n,{from:t.from,target:e,kind:t.kind,labels:t.label?[t.label]:[]})}let s=new Map,c=0;for(let e of o.values()){let t=`e${c}`;c+=1;let i=pr(e.labels),a=i?{width:Math.round(i.length*n.edgeLabelCharWidth),height:n.edgeLabelHeight,labelpos:`c`}:{};r.setEdge(e.from,e.target,a,t),s.set(`${e.from}|${e.target}|${t}`,{kind:e.kind,labels:e.labels})}cr.layout(r);let l=r.graph(),u=[];for(let e of r.nodes()){let t=r.node(e);if(!t)continue;let n=i.get(e);if(n){u.push({id:e,kind:`turn`,x:t.x,y:t.y,width:t.width,height:t.height,title:n.description,subtitle:mr(n.turnType),role:n.role,turnType:n.turnType,lifecycleStatus:null,isEntry:n.isEntry});continue}let a=e.endsWith(`completed`)?`completed`:`aborted`;u.push({id:e,kind:`end`,x:t.x,y:t.y,width:t.width,height:t.height,title:fr(a),subtitle:`End state`,role:null,turnType:null,lifecycleStatus:a,isEntry:!1})}let d=[];for(let e of r.edges()){let t=r.edge(e);if(!t)continue;let n=s.get(`${e.v}|${e.w}|${e.name}`),i=(t.points??[]).map(e=>({x:e.x,y:e.y}));d.push({id:e.name??`${e.v}-${e.w}`,from:e.v,to:e.w,kind:n?.kind??`forward`,labels:n?.labels??[],points:i,labelX:typeof t.x==`number`?t.x:null,labelY:typeof t.y==`number`?t.y:null})}return{width:typeof l.width==`number`?l.width:0,height:typeof l.height==`number`?l.height:0,nodes:u,edges:d}}var vr=0,yr=n(`<span class="step-arrow svelte-1a1v0x8" aria-hidden="true">→</span>`),br=n(`<li class="flow-step svelte-1a1v0x8"><span class="step-chip svelte-1a1v0x8"> </span> <!></li>`),xr=n(`<li class="flow-step svelte-1a1v0x8" data-flow-end-state="completed"><span class="step-arrow svelte-1a1v0x8" aria-hidden="true">→</span> <span class="end-chip is-completed svelte-1a1v0x8">Completed</span></li>`),Sr=n(`<ol data-section="process-flow-diagram" data-flow-mode="happy" aria-label="Happy path"><!> <!></ol>`),Cr=i(`<marker viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" class="svelte-1a1v0x8"></path></marker>`),wr=i(`<title> </title>`),Tr=i(`<g><rect class="flow-edge-label-bg svelte-1a1v0x8" y="-9" height="18" rx="5"></rect><text class="flow-edge-label-text svelte-1a1v0x8" x="0" y="0" dominant-baseline="middle" text-anchor="middle"> </text><!></g>`),Er=i(`<path fill="none"></path><!>`,1),Dr=i(`<rect class="flow-entry-tab svelte-1a1v0x8" x="0" y="0" height="3" rx="1.5"></rect>`),Or=i(`<text class="flow-box-subtitle svelte-1a1v0x8" text-anchor="middle" dominant-baseline="middle"> </text>`),kr=i(`<g role="listitem"><!><rect class="flow-box-rect svelte-1a1v0x8"></rect><!><text class="flow-box-title svelte-1a1v0x8" text-anchor="middle" dominant-baseline="middle"> </text><!></g>`),Ar=n(`<span class="flow-legend-item svelte-1a1v0x8"><span class="flow-legend-swatch is-branch svelte-1a1v0x8" aria-hidden="true"></span> Branch step</span>`),jr=n(`<span class="flow-legend-item svelte-1a1v0x8"><span class="flow-legend-line is-loopback svelte-1a1v0x8" aria-hidden="true"></span> Loops back</span>`),Mr=n(`<span class="flow-legend-item svelte-1a1v0x8"><span aria-hidden="true"></span> </span>`),Nr=n(`<figure class="process-flow-chart svelte-1a1v0x8" data-section="process-flow-diagram" data-flow-mode="full"><p class="sr-only"> </p> <div class="flow-svg-viewport svelte-1a1v0x8"><svg preserveAspectRatio="xMidYMid meet" class="flow-svg svelte-1a1v0x8" role="group" aria-label="Process flow chart"><defs></defs><g class="flow-edges" aria-hidden="true"></g><g class="flow-nodes" role="list" aria-label="Process steps"></g></svg></div> <figcaption class="flow-legend svelte-1a1v0x8"><span class="flow-legend-item svelte-1a1v0x8"><span class="flow-legend-swatch is-spine svelte-1a1v0x8" aria-hidden="true"></span> Happy path</span> <!> <!> <!></figcaption></figure>`),Pr=n(`<div><!></div>`),Fr=n(`<div class="flow-disclosure svelte-1a1v0x8" data-section="process-flow-disclosure"><div class="flow-disclosure-body svelte-1a1v0x8"><!></div> <button type="button" class="flow-toggle svelte-1a1v0x8" data-pressable="true"><span class="flow-toggle-label svelte-1a1v0x8"> </span> <span aria-hidden="true">›</span></button></div>`);function Ir(n,i){h(i,!0);let l=e=>{var n=Sr(),i=a(n);t(i,19,()=>u(A),e=>e.turnId,(e,t,n)=>{var i=br(),c=a(i),l=a(c,!0);g(c);var f=d(c,2),m=e=>{s(e,yr())};_(f,e=>{u(n)<u(A).length-1&&e(m)}),g(i),r(()=>{p(i,`data-flow-turn-id`,u(t).turnId),p(c,`data-turn-type`,u(t).turnType),o(l,u(t).description)}),s(e,i)});var c=d(i,2),l=e=>{s(e,xr())};_(c,e=>{u(j)&&e(l)}),g(n),r(()=>x(n,1,S([`process-flow`,E()&&`is-compact`]),`svelte-1a1v0x8`)),s(e,n)},w=e=>{var n=c(),i=f(n),l=e=>{var n=Nr(),i=a(n),c=a(i,!0);g(i);var l=d(i,2),m=a(l),h=a(m);t(h,20,()=>I,e=>e,(e,t)=>{var n=Cr();r(e=>{p(n,`id`,e),x(n,0,`flow-marker is-${t}`,`svelte-1a1v0x8`)},[()=>re(t)]),s(e,n)}),g(h);var v=d(h);t(v,21,()=>u(M).edges,e=>e.id,(e,t)=>{let n=y(()=>pr(u(t).labels));var i=Er(),c=f(i),l=d(c),m=e=>{var i=Tr(),c=a(i),l=d(c),f=a(l,!0);g(l);var m=d(l),h=e=>{var n=wr(),i=a(n,!0);g(n),r(e=>o(i,e),[()=>u(t).labels.join(`
|
|
1
|
+
import{$ as e,E as t,F as n,G as r,I as i,J as a,M as o,N as s,P as c,R as l,V as u,X as d,Y as f,d as p,dt as m,ft as h,gt as g,k as _,r as v,rt as y,tt as b,v as x,y as S,z as C}from"./index-client-BqF3_t3P.js";import"./api-HGtUzekR.js";var w=null;function T(e){w=e}function E(e){if(!w||w.instanceId!==e)return null;let t=w;return w=null,t}function D(e){(!e||w?.instanceId===e)&&(w=null)}var O=Object.defineProperty,k=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ee=(e,t)=>{for(var n in t)O(e,n,{get:t[n],enumerable:!0})},A=(e,t,n)=>k(e,typeof t==`symbol`?t:t+``,n),j={};ee(j,{Graph:()=>N,alg:()=>V,json:()=>R,version:()=>L});var te=Object.defineProperty,M=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},N=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e==`function`?this._defaultNodeLabelFn=e:this._defaultNodeLabelFn=()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return typeof e==`function`?this._defaultEdgeLabelFn=e:this._defaultEdgeLabelFn=()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=F(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=re(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,ne(this._preds[a],i),ne(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?I(this._isDirected,e):F(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r==`object`?r:{label:r}}hasEdge(e,t,n){return(arguments.length===1?I(this._isDirected,e):F(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?I(this._isDirected,e):F(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],P(this._preds[t],e),P(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function ne(e,t){e[t]?e[t]++:e[t]=1}function P(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function F(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function re(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function I(e,t){return F(e,t.v,t.w,t.name)}var L=`4.0.1`,R={};M(R,{read:()=>ae,write:()=>z});function z(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ie(e),edges:B(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function ie(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function B(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function ae(e){let t=new N(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var V={};M(V,{CycleException:()=>W,bellmanFord:()=>H,components:()=>ce,dijkstra:()=>U,dijkstraAll:()=>fe,findCycles:()=>me,floydWarshall:()=>ge,isAcyclic:()=>ye,postorder:()=>Ce,preorder:()=>we,prim:()=>Te,shortestPaths:()=>Ee,tarjan:()=>pe,topsort:()=>ve});var oe=()=>1;function H(e,t,n,r){return se(e,String(t),n||oe,r||function(t){return e.outEdges(t)})}function se(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function ce(e){let t={},n=[],r;function i(n){n in t||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var le=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},ue=()=>1;function U(e,t,n,r){return de(e,String(t),n||ue,r||function(t){return e.outEdges(t)})}function de(e,t,n,r){let i={},a=new le,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t],c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0&&(o=a.removeMin(),s=i[o],s.distance!==1/0);)r(o).forEach(c);return i}function fe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=U(e,i,t,n),r},{})}function pe(e){let t=0,n=[],r={},i=[];function a(o){let s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do t=n.pop(),r[t].onStack=!1,e.push(t);while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function me(e){return pe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var he=()=>1;function ge(e,t,n){return _e(e,t||he,n||function(t){return e.outEdges(t)})}function _e(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){let t=r[e];i.forEach(function(n){let a=r[n];i.forEach(function(n){let r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}var W=class extends Error{constructor(...e){super(...e)}};function ve(e){let t={},n={},r=[];function i(a){if(a in n)throw new W;a in t||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new W;return r}function ye(e){try{ve(e)}catch(e){if(e instanceof W)return!1;throw e}return!0}function be(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=xe(e,t,n===`post`,o,a,r,i)}),i}function xe(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=xe(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function Se(e,t,n){return be(e,t,n,function(e,t){return e.push(t),e},[])}function Ce(e,t){return Se(e,t,`post`)}function we(e,t){return Se(e,t,`pre`)}function Te(e,t){let n=new N,r={},i=new le,a;function o(e){let n=e.v===a?e.w:e.v,o=i.priority(n);if(o!==void 0){let s=t(e);s<o&&(r[n]=a,i.decrease(n,s))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){i.add(e,1/0),n.setNode(e)}),i.decrease(e.nodes()[0],0);let s=!1;for(;i.size()>0;){if(a=i.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw Error(`Input graph is not connected: `+e);s=!0}e.nodeEdges(a).forEach(o)}return n}function Ee(e,t,n,r){return De(e,t,n,r??(t=>e.outEdges(t)??[]))}function De(e,t,n,r){if(n===void 0)return U(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=r(a[o]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===a[o]?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return H(e,t,n,r)}return U(e,t,n,r)}function G(e,t,n,r){let i=r;for(;e.hasNode(i);)i=Ve(r);return n.dummy=t,e.setNode(i,n),i}function Oe(e){let t=new N().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function ke(e){let t=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Ae(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function K(e){let t=J(Ie(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function je(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=q(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function Me(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=q(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function Ne(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),G(e,`border`,i,t)}function Pe(e,t=Fe){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var Fe=65535;function q(e,t){return t.length>Fe?e(...Pe(t).map(t=>e(...t))):e(...t)}function Ie(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return q(Math.max,t)}function Le(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Re(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function ze(e,t){return t()}var Be=0;function Ve(e){return e+(``+ ++Be)}function J(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function Y(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function X(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function He(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var Z=`\0`,Ue=`3.0.0`,We=class{constructor(){A(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Ge(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Ge(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Ke)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Ge(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ke(e,t){if(e!==`_next`&&e!==`_prev`)return t}var qe=We,Je=()=>1;function Ye(e,t){if(e.nodeCount()<=1)return[];let n=Qe(e,t||Je);return Xe(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Xe(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Ze(e,t,n,o);for(;o=i.dequeue();)Ze(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(Ze(e,t,n,o,!0)||[]);break}}}return r}function Ze(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,$e(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,$e(t,n,o)}),e.removeNode(r.v),o}function Qe(e,t){let n=new N,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=et(i+r+3).map(()=>new qe),o=r+1;return n.nodes().forEach(e=>{$e(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function $e(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function et(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function tt(e){(e.graph().acyclicer===`greedy`?Ye(e,t(e)):nt(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Ve(`rev`))});function t(e){return t=>e.edge(t).weight}}function nt(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function rt(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function it(e){e.graph().dummyChains=[],e.edges().forEach(t=>at(e,t))}function at(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=G(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function ot(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function st(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=q(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function Q(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var ct=lt;function lt(e){let t=new N({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;ut(t,e)<i&&(a=dt(t,e),a);)o=t.hasNode(a.v)?Q(e,a):-Q(e,a),ft(t,e,o);return t}function ut(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Q(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function dt(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=Q(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function ft(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:pt,postorder:mt}=V,ht=$;$.initLowLimValues=yt,$.initCutValues=gt,$.calcCutValue=vt,$.leaveEdge=xt,$.enterEdge=St,$.exchangeEdges=Ct;function $(e){e=Oe(e),st(e);let t=ct(e);yt(t),gt(t,e);let n,r;for(;n=xt(t);)r=St(t,e,n),Ct(t,e,n,r)}function gt(e,t){let n=mt(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>_t(e,t,n))}function _t(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=vt(e,t,n)}function vt(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,Tt(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function yt(e,t){arguments.length<2&&(t=e.nodes()[0]),bt(e,{},1,t)}function bt(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=bt(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function xt(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function St(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===Et(e,e.node(t.v),s)&&c!==Et(e,e.node(t.w),s)).reduce((e,n)=>Q(t,n)<Q(t,e)?n:e)}function Ct(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),yt(e),gt(e,t),wt(e,t)}function wt(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=pt(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Tt(e,t,n){return e.hasEdge(t,n)}function Et(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Dt=Ot;function Ot(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:jt(e);break;case`tight-tree`:At(e);break;case`longest-path`:kt(e);break;case`none`:break;default:jt(e)}}var kt=st;function At(e){st(e),ct(e)}function jt(e){ht(e)}var Mt=Nt;function Nt(e){let t=Ft(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=Pt(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function Pt(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function Ft(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(Z).forEach(r),t}function It(e){let t=G(e,`root`,{},`_root`),n=Rt(e),r=Object.values(n),i=q(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=zt(e)+1;e.children(Z).forEach(r=>Lt(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function Lt(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=Ne(e,`_bt`),l=Ne(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{Lt(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function Rt(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(Z).forEach(e=>n(e,1)),t}function zt(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Bt(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var Vt=Ht;function Ht(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)Ut(e,`borderLeft`,`_bl`,n,i,t),Ut(e,`borderRight`,`_br`,n,i,t)}}e.children(Z).forEach(t)}function Ut(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=G(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Wt(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&Kt(e)}function Gt(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&Jt(e),(t===`lr`||t===`rl`)&&(Xt(e),Kt(e))}function Kt(e){e.nodes().forEach(t=>qt(e.node(t))),e.edges().forEach(t=>qt(e.edge(t)))}function qt(e){let t=e.width;e.width=e.height,e.height=t}function Jt(e){e.nodes().forEach(t=>Yt(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Yt),Object.hasOwn(r,`y`)&&Yt(r)})}function Yt(e){e.y=-e.y}function Xt(e){e.nodes().forEach(t=>Zt(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Zt),Object.hasOwn(r,`x`)&&Zt(r)})}function Zt(e){let t=e.x;e.x=e.y,e.y=t}function Qt(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=J(q(Math.max,r)+1).map(()=>[]);function a(n){if(t[n])return;t[n]=!0;let r=e.node(n);i[r.rank].push(n);let o=e.successors(n);o&&o.forEach(a)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(a),i}function $t(e,t){let n=0;for(let r=1;r<t.length;++r)n+=en(e,t[r-1],t[r]);return n}function en(e,t,n){let r=He(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function tn(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function nn(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),rn(Object.values(n).filter(e=>!e.indegree))}function rn(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&an(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>Y(e,[`vs`,`i`,`barycenter`,`weight`]))}function an(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function on(e,t){let n=Le(e,e=>Object.hasOwn(e,`barycenter`)),r=n.lhs,i=n.rhs.sort((e,t)=>t.i-e.i),a=[],o=0,s=0,c=0;r.sort(cn(!!t)),c=sn(a,i,c),r.forEach(e=>{c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=sn(a,i,c)});let l={vs:a.flat(1)};return s&&(l.barycenter=o/s,l.weight=s),l}function sn(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function cn(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function ln(e,t,n,r){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=i.filter(e=>e!==o&&e!==s));let l=tn(e,i);l.forEach(t=>{if(e.children(t.v).length){let i=ln(e,t.v,n,r);c[t.v]=i,Object.hasOwn(i,`barycenter`)&&dn(t,i)}});let u=nn(l,n);un(u,c);let d=on(u,r);if(o&&s){d.vs=[o,d.vs,s].flat(1);let t=e.predecessors(o);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(s),i=e.node(r[0]);Object.hasOwn(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+n.order+i.order)/(d.weight+2),d.weight+=2}}return d}function un(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function dn(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function fn(e,t,n,r){r||=e.nodes();let i=pn(e),a=new N({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function pn(e){let t;for(;e.hasNode(t=Ve(`_root`)););return t}function mn(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function hn(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,hn);return}let n=Ie(e),r=gn(e,J(1,n+1),`inEdges`),i=gn(e,J(n-1,-1,-1),`outEdges`),a=Qt(e);if(vn(e,a),t.disableOptimalOrderHeuristic)return;let o=1/0,s,c=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){_n(t%2?r:i,t%4>=2,c),a=K(e);let l=$t(e,a);l<o?(n=0,s=Object.assign({},a),o=l):l===o&&(s=structuredClone(a))}vn(e,s)}function gn(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return fn(e,t,n,r.get(t)||[])})}function _n(e,t,n){let r=new N;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=ln(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),mn(e,r,a.vs)})}function vn(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function yn(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=xn(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Sn(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function bn(e,t){let n={};function r(t,r,i,a,o){J(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Sn(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function xn(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Sn(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Cn(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function wn(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s&&s.length){let r=s.sort((e,t)=>{let n=o[e],r=o[t];return(n===void 0?0:n)-(r===void 0?0:r)}),c=(r.length-1)/2;for(let s=Math.floor(c),l=Math.ceil(c);s<=l;++s){let c=r[s];if(c===void 0)continue;let l=o[c];if(l!==void 0&&a[e]===e&&t<l&&!Cn(n,e,c)){let n=i[c];n!==void 0&&(a[c]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}}function Tn(e,t,n,r,i=!1){let a={},o=En(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function En(e,t,n,r){let i=new N,a=e.graph(),o=jn(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function Dn(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=Mn(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function On(e,t){let n=Object.values(t),r=q(Math.min,n),i=q(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-q(Math.min,c);a!==`l`&&(l=i-q(Math.max,c)),l&&(e[o]=X(s,e=>e+l))})})}function kn(e,t=void 0){let n=e.ul;return n?X(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function An(e){let t=K(e),n=Object.assign(yn(e,t),bn(e,t)),r={},i;return[`u`,`d`].forEach(a=>{i=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(i=i.map(e=>Object.values(e).reverse()));let o=wn(e,i,n,t=>(a===`u`?e.predecessors(t):e.successors(t))||[]),s=Tn(e,i,o.root,o.align,t===`r`);t===`r`&&(s=X(s,e=>-e)),r[a+t]=s})}),On(r,Dn(e,r)),kn(r,e.graph().align)}function jn(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),c}}function Mn(e,t){return e.node(t).width}function Nn(e){e=ke(e),Pn(e),Object.entries(An(e)).forEach(([t,n])=>e.node(t).x=n)}function Pn(e){let t=K(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);i===`top`?r.y=a+r.height/2:i===`bottom`?r.y=a+n-r.height/2:r.y=a+n/2}),a+=n+r})}function Fn(e,t={}){let n=t.debugTiming?Re:ze;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>Kn(e));return n(` runLayout`,()=>In(r,n,t)),n(` updateInputGraph`,()=>Ln(e,r)),r})}function In(e,t,n){t(` makeSpaceForEdgeLabels`,()=>qn(e)),t(` removeSelfEdges`,()=>nr(e)),t(` acyclic`,()=>tt(e)),t(` nestingGraph.run`,()=>It(e)),t(` rank`,()=>Dt(ke(e))),t(` injectEdgeLabelProxies`,()=>Jn(e)),t(` removeEmptyRanks`,()=>Me(e)),t(` nestingGraph.cleanup`,()=>Bt(e)),t(` normalizeRanks`,()=>je(e)),t(` assignRankMinMax`,()=>Yn(e)),t(` removeEdgeLabelProxies`,()=>Xn(e)),t(` normalize.run`,()=>it(e)),t(` parentDummyChains`,()=>Mt(e)),t(` addBorderSegments`,()=>Vt(e)),t(` order`,()=>hn(e,n)),t(` insertSelfEdges`,()=>rr(e)),t(` adjustCoordinateSystem`,()=>Wt(e)),t(` position`,()=>Nn(e)),t(` positionSelfEdges`,()=>ir(e)),t(` removeBorderNodes`,()=>tr(e)),t(` normalize.undo`,()=>ot(e)),t(` fixupEdgeLabelCoords`,()=>$n(e)),t(` undoCoordinateSystem`,()=>Gt(e)),t(` translateGraph`,()=>Zn(e)),t(` assignNodeIntersects`,()=>Qn(e)),t(` reversePoints`,()=>er(e)),t(` acyclic.undo`,()=>rt(e))}function Ln(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Rn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],zn={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},Bn=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],Vn=[`width`,`height`,`rank`],Hn={width:0,height:0},Un=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Wn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Gn=[`labelpos`];function Kn(e){let t=new N({multigraph:!0,compound:!0}),n=or(e.graph());return t.setGraph(Object.assign({},zn,ar(n,Rn),Y(n,Bn))),e.nodes().forEach(n=>{let r=ar(or(e.node(n)),Vn);Object.keys(Hn).forEach(e=>{r[e]===void 0&&(r[e]=Hn[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=or(e.edge(n));t.setEdge(n,Object.assign({},Wn,ar(r,Un),Y(r,Gn)))}),t}function qn(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Jn(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);G(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function Yn(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Xn(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Zn(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function Qn(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(Ae(r,a)),n.points.push(Ae(i,o))})}function $n(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function er(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function tr(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function nr(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function rr(e){K(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{G(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function ir(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`selfedge`){let r=n,i=e.node(r.e.v),a=i.x+i.width/2,o=i.y,s=n.x-a,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:a+2*s/3,y:o-c},{x:a+5*s/6,y:o-c},{x:a+s,y:o},{x:a+5*s/6,y:o+c},{x:a+2*s/3,y:o+c}],r.label.x=n.x,r.label.y=n.y}})}function ar(e,t){return X(Y(e,t),Number)}function or(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function sr(e){let t=K(e),n=new N({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var cr={graphlib:j,version:Ue,layout:Fn,debug:sr,util:{time:Re,notime:ze}},lr={charWidth:7.2,minNodeWidth:132,maxNodeWidth:280,nodeHeight:56,endNodeHeight:44,nodePaddingX:28,rankSep:56,nodeSep:36,edgeSep:18,edgeLabelCharWidth:6,edgeLabelHeight:18},ur=`__end__`;function dr(e){return`${ur}${e}`}function fr(e){return e===`completed`?`Completed`:`Aborted`}function pr(e){return e.length===0?``:e.length===1?e[0]:`${e.length} transitions`}function mr(e){switch(e){case`llm`:return`Agent turn`;case`human`:return`Operator decision`;case`external`:return`External wait`;case`automatic`:return`Automatic`;case`server_automatic`:return`Server step`}}function hr(e){switch(e){case`llm`:return`An AI agent does the work in this step, using its tools to plan, edit, or review.`;case`human`:return`You decide how the process continues by choosing one of the available actions.`;case`external`:return`The process pauses until an outside system or event reports back.`;case`automatic`:return`A deterministic step runs automatically in the workspace, with no AI or operator input.`;case`server_automatic`:return`The server runs this step automatically to prepare or finalize process state.`}}function gr(e,t,n=t.charWidth){let r=e.length*n+t.nodePaddingX*2;return Math.max(t.minNodeWidth,Math.min(t.maxNodeWidth,Math.round(r)))}function _r(e,t={}){let n={...lr,...t},r=new cr.graphlib.Graph({multigraph:!0});r.setGraph({rankdir:`TB`,ranksep:n.rankSep,nodesep:n.nodeSep,edgesep:n.edgeSep,marginx:12,marginy:12}),r.setDefaultEdgeLabel(()=>({}));let i=new Map;for(let t of e.nodes){i.set(t.turnId,t);let e=gr(t.description,n);r.setNode(t.turnId,{width:e,height:n.nodeHeight})}let a=new Set;for(let t of e.edges)t.lifecycleStatus!==null&&a.add(t.lifecycleStatus);for(let e of a){let t=fr(e);r.setNode(dr(e),{width:gr(t,n),height:n.endNodeHeight})}let o=new Map;for(let t of e.edges){let e=t.to??(t.lifecycleStatus?dr(t.lifecycleStatus):null);if(e===null||!r.hasNode(t.from)||!r.hasNode(e))continue;let n=`${t.from}|${e}|${t.kind}`,i=o.get(n);if(i){t.label&&!i.labels.includes(t.label)&&i.labels.push(t.label);continue}o.set(n,{from:t.from,target:e,kind:t.kind,labels:t.label?[t.label]:[]})}let s=new Map,c=0;for(let e of o.values()){let t=`e${c}`;c+=1;let i=pr(e.labels),a=i?{width:Math.round(i.length*n.edgeLabelCharWidth),height:n.edgeLabelHeight,labelpos:`c`}:{};r.setEdge(e.from,e.target,a,t),s.set(`${e.from}|${e.target}|${t}`,{kind:e.kind,labels:e.labels})}cr.layout(r);let l=r.graph(),u=[];for(let e of r.nodes()){let t=r.node(e);if(!t)continue;let n=i.get(e);if(n){u.push({id:e,kind:`turn`,x:t.x,y:t.y,width:t.width,height:t.height,title:n.description,subtitle:mr(n.turnType),role:n.role,turnType:n.turnType,lifecycleStatus:null,isEntry:n.isEntry});continue}let a=e.endsWith(`completed`)?`completed`:`aborted`;u.push({id:e,kind:`end`,x:t.x,y:t.y,width:t.width,height:t.height,title:fr(a),subtitle:`End state`,role:null,turnType:null,lifecycleStatus:a,isEntry:!1})}let d=[];for(let e of r.edges()){let t=r.edge(e);if(!t)continue;let n=s.get(`${e.v}|${e.w}|${e.name}`),i=(t.points??[]).map(e=>({x:e.x,y:e.y}));d.push({id:e.name??`${e.v}-${e.w}`,from:e.v,to:e.w,kind:n?.kind??`forward`,labels:n?.labels??[],points:i,labelX:typeof t.x==`number`?t.x:null,labelY:typeof t.y==`number`?t.y:null})}return{width:typeof l.width==`number`?l.width:0,height:typeof l.height==`number`?l.height:0,nodes:u,edges:d}}var vr=0,yr=n(`<span class="step-arrow svelte-1a1v0x8" aria-hidden="true">→</span>`),br=n(`<li class="flow-step svelte-1a1v0x8"><span class="step-chip svelte-1a1v0x8"> </span> <!></li>`),xr=n(`<li class="flow-step svelte-1a1v0x8" data-flow-end-state="completed"><span class="step-arrow svelte-1a1v0x8" aria-hidden="true">→</span> <span class="end-chip is-completed svelte-1a1v0x8">Completed</span></li>`),Sr=n(`<ol data-section="process-flow-diagram" data-flow-mode="happy" aria-label="Happy path"><!> <!></ol>`),Cr=i(`<marker viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" class="svelte-1a1v0x8"></path></marker>`),wr=i(`<title> </title>`),Tr=i(`<g><rect class="flow-edge-label-bg svelte-1a1v0x8" y="-9" height="18" rx="5"></rect><text class="flow-edge-label-text svelte-1a1v0x8" x="0" y="0" dominant-baseline="middle" text-anchor="middle"> </text><!></g>`),Er=i(`<path fill="none"></path><!>`,1),Dr=i(`<rect class="flow-entry-tab svelte-1a1v0x8" x="0" y="0" height="3" rx="1.5"></rect>`),Or=i(`<text class="flow-box-subtitle svelte-1a1v0x8" text-anchor="middle" dominant-baseline="middle"> </text>`),kr=i(`<g role="listitem"><!><rect class="flow-box-rect svelte-1a1v0x8"></rect><!><text class="flow-box-title svelte-1a1v0x8" text-anchor="middle" dominant-baseline="middle"> </text><!></g>`),Ar=n(`<span class="flow-legend-item svelte-1a1v0x8"><span class="flow-legend-swatch is-branch svelte-1a1v0x8" aria-hidden="true"></span> Branch step</span>`),jr=n(`<span class="flow-legend-item svelte-1a1v0x8"><span class="flow-legend-line is-loopback svelte-1a1v0x8" aria-hidden="true"></span> Loops back</span>`),Mr=n(`<span class="flow-legend-item svelte-1a1v0x8"><span aria-hidden="true"></span> </span>`),Nr=n(`<figure class="process-flow-chart svelte-1a1v0x8" data-section="process-flow-diagram" data-flow-mode="full"><p class="sr-only"> </p> <div class="flow-svg-viewport svelte-1a1v0x8"><svg preserveAspectRatio="xMidYMid meet" class="flow-svg svelte-1a1v0x8" role="group" aria-label="Process flow chart"><defs></defs><g class="flow-edges" aria-hidden="true"></g><g class="flow-nodes" role="list" aria-label="Process steps"></g></svg></div> <figcaption class="flow-legend svelte-1a1v0x8"><span class="flow-legend-item svelte-1a1v0x8"><span class="flow-legend-swatch is-spine svelte-1a1v0x8" aria-hidden="true"></span> Happy path</span> <!> <!> <!></figcaption></figure>`),Pr=n(`<div><!></div>`),Fr=n(`<div class="flow-disclosure svelte-1a1v0x8" data-section="process-flow-disclosure"><div class="flow-disclosure-body svelte-1a1v0x8"><!></div> <button type="button" class="flow-toggle svelte-1a1v0x8" data-pressable="true"><span class="flow-toggle-label svelte-1a1v0x8"> </span> <span aria-hidden="true">›</span></button></div>`);function Ir(n,i){h(i,!0);let l=e=>{var n=Sr(),i=a(n);t(i,19,()=>u(A),e=>e.turnId,(e,t,n)=>{var i=br(),c=a(i),l=a(c,!0);g(c);var f=d(c,2),m=e=>{s(e,yr())};_(f,e=>{u(n)<u(A).length-1&&e(m)}),g(i),r(()=>{p(i,`data-flow-turn-id`,u(t).turnId),p(c,`data-turn-type`,u(t).turnType),o(l,u(t).description)}),s(e,i)});var c=d(i,2),l=e=>{s(e,xr())};_(c,e=>{u(j)&&e(l)}),g(n),r(()=>x(n,1,S([`process-flow`,E()&&`is-compact`]),`svelte-1a1v0x8`)),s(e,n)},w=e=>{var n=c(),i=f(n),l=e=>{var n=Nr(),i=a(n),c=a(i,!0);g(i);var l=d(i,2),m=a(l),h=a(m);t(h,20,()=>I,e=>e,(e,t)=>{var n=Cr();r(e=>{p(n,`id`,e),x(n,0,`flow-marker is-${t}`,`svelte-1a1v0x8`)},[()=>re(t)]),s(e,n)}),g(h);var v=d(h);t(v,21,()=>u(M).edges,e=>e.id,(e,t)=>{let n=y(()=>pr(u(t).labels));var i=Er(),c=f(i),l=d(c),m=e=>{var i=Tr(),c=a(i),l=d(c),f=a(l,!0);g(l);var m=d(l),h=e=>{var n=wr(),i=a(n,!0);g(n),r(e=>o(i,e),[()=>u(t).labels.join(`
|
|
2
2
|
`)]),s(e,n)};_(m,e=>{u(t).labels.length>1&&e(h)}),g(i),r(()=>{x(i,0,S([`flow-edge-label`,u(t).labels.length>1&&`is-multi`]),`svelte-1a1v0x8`),p(i,`transform`,`translate(${u(t).labelX}, ${u(t).labelY})`),p(i,`data-flow-edge-label-from`,u(t).from),p(i,`data-flow-edge-label-to`,u(t).to),p(i,`data-flow-edge-label-count`,u(t).labels.length),p(c,`x`,-(u(n).length*3.4+6)),p(c,`width`,u(n).length*6.8+12),o(f,u(n))}),s(e,i)};_(l,e=>{u(n)&&u(t).labelX!==null&&u(t).labelY!==null&&e(m)}),r((e,n)=>{x(c,0,`flow-edge is-${u(t).kind}`,`svelte-1a1v0x8`),p(c,`d`,e),p(c,`marker-end`,n),p(c,`data-flow-edge-kind`,u(t).kind),p(c,`data-flow-edge-from`,u(t).from),p(c,`data-flow-edge-to`,u(t).to)},[()=>N(u(t)),()=>`url(#${re(u(t).kind)})`]),s(e,i)}),g(v);var b=d(v);t(b,21,()=>u(M).nodes,e=>e.id,(e,t)=>{var n=kr(),i=a(n),c=e=>{var n=wr(),i=a(n,!0);g(n),r(e=>o(i,e),[()=>hr(u(t).turnType)]),s(e,n)};_(i,e=>{u(t).kind===`turn`&&u(t).turnType&&e(c)});var l=d(i),f=d(l),m=e=>{var n=Dr();r(()=>p(n,`width`,u(t).width)),s(e,n)};_(f,e=>{u(t).isEntry&&e(m)});var h=d(f),v=a(h,!0);g(h);var y=d(h),b=e=>{var n=Or(),i=a(n,!0);g(n),r(()=>{p(n,`x`,u(t).width/2),p(n,`y`,u(t).height/2+10),o(i,u(t).subtitle)}),s(e,n)};_(y,e=>{u(t).kind===`turn`&&e(b)}),g(n),r((e,r)=>{x(n,0,e,`svelte-1a1v0x8`),p(n,`transform`,`translate(${u(t).x-u(t).width/2}, ${u(t).y-u(t).height/2})`),p(n,`data-flow-turn-id`,u(t).kind===`turn`?u(t).id:void 0),p(n,`data-flow-end-state`,u(t).kind===`end`?u(t).lifecycleStatus:void 0),p(n,`data-flow-node-role`,u(t).role??void 0),p(n,`aria-label`,r),p(l,`width`,u(t).width),p(l,`height`,u(t).height),p(l,`rx`,u(t).kind===`end`?9:13),p(h,`x`,u(t).width/2),p(h,`y`,u(t).kind===`end`?u(t).height/2:u(t).height/2-7),o(v,u(t).title)},[()=>S(ne(u(t))),()=>ae(u(t))]),s(e,n)}),g(b),g(m),g(l);var C=d(l,2),w=d(a(C),2),T=e=>{s(e,Ar())};_(w,e=>{u(z).length>0&&e(T)});var E=d(w,2),D=e=>{s(e,jr())},O=y(()=>u(ie).has(`loopback`));_(E,e=>{u(O)&&e(D)}),t(d(E,2),17,()=>u(B),e=>e.lifecycleStatus,(e,t)=>{var n=Mr(),i=a(n),c=d(i);g(n),r(()=>{x(i,1,`flow-legend-swatch is-end is-${u(t).lifecycleStatus}`,`svelte-1a1v0x8`),o(c,` ${u(t).lifecycleStatus===`completed`?`Completed`:`Aborted`}`)}),s(e,n)}),g(C),g(n),r(()=>{p(i,`id`,`${P}-desc`),o(c,u(oe)),p(m,`viewBox`,`0 0 ${u(M).width} ${u(M).height}`),p(m,`aria-describedby`,`${P}-desc`),p(C,`id`,V)}),s(e,n)};_(i,e=>{u(M)&&u(M).nodes.length>0&&e(l)}),s(e,n)},T=v(i,`mode`,3,`happy`),E=v(i,`compact`,3,!1),D=v(i,`expandable`,3,!1),O=b(!1),k=y(()=>i.flow??i.launcher?.processFlow??null),ee=y(()=>new Map((u(k)?.nodes??[]).map(e=>[e.turnId,e]))),A=y(()=>(u(k)?.spine??[]).map(e=>u(ee).get(e)).filter(e=>e!==void 0)),j=y(()=>(u(k)?.endStates??[]).find(e=>e.lifecycleStatus===`completed`)??null),te=y(()=>T()===`full`||D()&&u(O)),M=y(()=>u(k)&&u(te)?_r(u(k)):null);function N(e){let t=e.points;if(t.length===0)return``;if(t.length===1)return`M ${t[0].x} ${t[0].y}`;let n=`M ${t[0].x} ${t[0].y}`;for(let e=1;e<t.length-1;e+=1){let r=t[e],i=t[e+1],a=(r.x+i.x)/2,o=(r.y+i.y)/2;n+=` Q ${r.x} ${r.y} ${a} ${o}`}let r=t[t.length-1];return n+=` L ${r.x} ${r.y}`,n}function ne(e){return e.kind===`end`?`flow-box is-end is-${e.lifecycleStatus}`:`flow-box is-turn ${e.role===`spine`?`is-spine`:`is-branch`}`}let P=`process-flow-${vr++}`,F=`${P}-chart`;function re(e){return`${P}-arrow-${e}`}let I=[`forward`,`loopback`,`branch`,`terminal`],L=y(()=>u(k)!==null&&u(A).length>0),R=y(()=>u(k)!==null&&(u(M)?.nodes.length??0)>0),z=y(()=>(u(k)?.nodes??[]).filter(e=>e.role===`branch`)),ie=y(()=>new Set((u(M)?.edges??[]).map(e=>e.kind))),B=y(()=>u(k)?.endStates??[]);function ae(e){return e.kind===`end`?`End state: ${e.title}`:e.turnType?`${e.title}. ${mr(e.turnType)}. ${hr(e.turnType)}`:e.title}let V=`${P}-legend`,oe=y(()=>{if(!u(k))return``;let e=[],t=u(A).map(e=>e.description).join(`, then `);if(t&&e.push(`Happy path: ${t}.`),u(z).length>0&&e.push(`Branch and recovery steps: ${u(z).map(e=>e.description).join(`, `)}.`),u(B).length>0){let t=u(B).map(e=>e.lifecycleStatus===`completed`?`Completed`:`Aborted`).join(` or `);e.push(`Ends in: ${t}.`)}return e.join(` `)});var H=c(),se=f(H),ce=t=>{var n=Fr(),i=a(n),c=a(i),f=e=>{var t=Pr(),n=a(t);w(n),g(t),r(()=>p(t,`id`,F)),s(e,t)},m=e=>{l(e)};_(c,e=>{u(O)&&u(R)?e(f):e(m,-1)}),g(i);var h=d(i,2),v=a(h),y=a(v,!0);g(v);var b=d(v,2);g(h),g(n),r(()=>{p(h,`aria-expanded`,u(O)),p(h,`aria-controls`,F),o(y,u(O)?`Hide flow`:`Show full flow`),x(b,1,S([`flow-toggle-caret`,u(O)&&`is-open`]),`svelte-1a1v0x8`)}),C(`click`,h,()=>e(O,!u(O))),s(t,n)},le=e=>{l(e)},ue=e=>{w(e)};_(se,e=>{D()&&u(L)?e(ce):T()===`happy`&&u(L)?e(le,1):T()===`full`&&u(R)&&e(ue,2)}),s(n,H),m()}l([`click`]);export{T as i,D as n,E as r,Ir as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,B as t,D as n,E as r,F as i,G as a,J as o,K as s,L as c,M as l,N as u,P as d,R as f,V as p,X as m,Y as h,Z as g,_t as ee,a as _,d as v,dt as te,ft as ne,g as re,gt as y,h as b,ht as ie,k as x,nt as S,ot as ae,p as oe,q as se,rt as C,st as ce,tt as w,u as le,v as T,vt as E,z as D}from"./index-client-BqF3_t3P.js";import{J as ue,K as de,X as O,Z as k,_t as fe,ct as A,dt as j,ht as pe,mt as M,yt as N}from"./api-CqECFdii.js";import{r as me,s as he,u as ge}from"./router.svelte-COr45o9R.js";import{b as _e,i as ve,r as ye,s as P,y as be}from"./index-DtESEq4Z.js";import{t as xe}from"./browser-storage-LbKCyf_w.js";import{t as Se}from"./PageHeader-D6pP4hIh.js";import{r as Ce,t as we}from"./ProcessActionsMenu-l2mHq8L-.js";var F=M([`all`,`running`,`scheduled`,`needs_attention`,`completed`,`aborted`]),I=j({key:M([`status`,`title`,`timeline`]),direction:M([`asc`,`desc`])}),L=j({status:F,processType:pe(N(),A(200)),sort:I}),R=`leitwerk.process-browser-view.v1`,z={status:`all`,processType:``,sort:{key:`timeline`,direction:`desc`}},Te={all:0,running:0,scheduled:0,needs_attention:0,completed:0,aborted:0};function Ee(e){try{let t=e?.getItem(R),n=t&&fe(L,JSON.parse(t));return n?.success?n.output:z}catch{return z}}function De(e,t){try{e?.setItem(R,JSON.stringify(t))}catch{}}function B(e){return e.lifecycleStatus===`completed`||e.lifecycleStatus===`aborted`?e.lifecycleStatus:e.lifecycleStatus===`error`||e.lifecycleStatus===`waiting`?`needs_attention`:`running`}function V(e){let t=O(e.lifecycleStatus);return e.selectedTurnId?`${t} · ${k(e.selectedTurnId)}`:t}function H(e){if(e.kind===`process`){let t=e.item;return{id:t.instanceId,kind:`process`,title:t.title,processId:t.processId,processDisplayName:t.processDisplayName?.trim()||de(t.processId),statusFilter:B(t),statusDetail:V(t),initialPrompt:t.initialPromptPreview,createdAt:t.createdAt,updatedAt:t.updatedAt,sortAt:t.statusCategory===`terminal`?t.closedAt??t.updatedAt??t.createdAt:t.updatedAt??t.createdAt,instanceId:t.instanceId,futureExecutionId:null,lifecycleStatus:t.lifecycleStatus}}let t=e.item;return{id:t.id,kind:`future`,title:t.title,processId:t.processId,processDisplayName:t.kind===`launch`&&t.launcherLabel||de(t.processId),statusFilter:`scheduled`,statusDetail:t.kind===`action`?`Scheduled action · ${t.actionLabel}`:t.scheduleKind===`cron`?`Recurring scheduled start`:`Scheduled start`,initialPrompt:t.initialPromptPreview,createdAt:null,updatedAt:t.nextRunAt,sortAt:t.nextRunAt,instanceId:t.instanceId,futureExecutionId:t.kind===`launch`?t.id:null,lifecycleStatus:null}}function Oe(e){return e.map(H)}function ke(e){return e.status!==`all`||e.query.trim()!==``||e.processType!==``}var Ae=i(`<button type="button" data-pressable="true"><span> </span> <span class="chip-count svelte-m0hp6c"> </span></button>`),je=i(`<button type="button"><span> </span> <span class="sort-arrow svelte-m0hp6c" aria-hidden="true"><!></span></button>`),Me=i(`<option> </option>`),Ne=i(`<button type="button" class="reset-view-button svelte-m0hp6c" data-pressable="true">Clear filters</button>`),Pe=i(`<div class="state-banner svelte-m0hp6c" role="status" data-state="process-list-error"><p class="svelte-m0hp6c">Process list couldn’t refresh. Existing results may be out of date.</p> <button type="button" data-pressable="true" class="svelte-m0hp6c">Try again</button></div>`),Fe=i(`<div class="skeleton-row svelte-m0hp6c"></div>`),Ie=i(`<div class="skeleton-list svelte-m0hp6c" data-state="processes-loading" role="status"></div>`),Le=i(`<div class="empty-state svelte-m0hp6c" data-state="processes-no-results"><h2 class="svelte-m0hp6c">No processes match these filters</h2> <p class="svelte-m0hp6c">Change the search or filters to see more process records.</p> <button type="button" class="clear-button svelte-m0hp6c" data-pressable="true">Clear search and filters</button></div>`),Re=i(`<div class="empty-state svelte-m0hp6c" data-state="processes-empty"><h2 class="svelte-m0hp6c">No process records yet</h2> <p class="svelte-m0hp6c">Started and scheduled processes will appear here.</p></div>`),ze=i(`<span class="muted svelte-m0hp6c">No initial prompt captured</span>`),Be=i(`<span class="future-action-note svelte-m0hp6c">Scheduled start</span>`),Ve=i(`<article class="process-browser-row svelte-m0hp6c" data-process-browser-row=""><a class="row-main svelte-m0hp6c" data-pressable="true"><span aria-hidden="true"> </span> <span class="row-process svelte-m0hp6c"><span class="row-title svelte-m0hp6c"> </span> <span class="row-meta svelte-m0hp6c"> </span></span> <span class="prompt-cell svelte-m0hp6c"><!></span> <span class="time-cell svelte-m0hp6c"> </span></a> <div class="row-actions svelte-m0hp6c"><!></div></article>`),He=i(`<div class="process-table svelte-m0hp6c" data-section="process-browser-results"></div>`),Ue=i(`<div class="pagination-row svelte-m0hp6c"><button type="button" class="show-more-button svelte-m0hp6c" data-pressable="true">Show more</button></div>`),We=i(`<section class="processes-page svelte-m0hp6c" data-section="all-processes-page"><!> <div class="browser-panel svelte-m0hp6c" data-section="process-browser"><div class="browser-toolbar svelte-m0hp6c" data-section="process-browse-controls"><label class="search-field svelte-m0hp6c"><span class="sr-only svelte-m0hp6c">Search</span> <input type="search" placeholder="Search processes by title or prompt" aria-label="Search processes by title or prompt" class="svelte-m0hp6c"/></label> <label class="type-filter svelte-m0hp6c"><span class="sr-only svelte-m0hp6c">Process type</span> <select data-filter="process-type" class="svelte-m0hp6c"><option>All process types</option><!><!></select></label> <p class="result-count svelte-m0hp6c" aria-live="polite"><span class="svelte-m0hp6c"> </span> </p> <!> <button type="button" class="refresh-button svelte-m0hp6c" data-action="refresh-processes" data-pressable="true"> </button></div> <div class="filter-row svelte-m0hp6c" role="group" aria-label="Process status filters"><span class="filter-row-label svelte-m0hp6c">Status</span> <div class="filter-group svelte-m0hp6c"><!></div> <div class="filter-group archive-group svelte-m0hp6c"><!></div></div> <!> <div class="process-table-shell svelte-m0hp6c"><div class="process-table-heading svelte-m0hp6c"><!> <!> <span class="prompt-heading svelte-m0hp6c">Initial prompt</span> <!> <span class="actions-heading svelte-m0hp6c">Actions</span></div> <!></div> <!></div></section>`);function Ge(i,f){ne(f,!0);let de=()=>ce(ye,`$browseItems`,k),O=()=>ce(ve,`$browseState`,k),[k,fe]=ae(),A=(e,t=E,n)=>{let i=S(()=>ee(n?.(),!1));var s=d();r(h(s),17,t,e=>e.value,(e,t)=>{var n=Ae();let r;var s=o(n),c=o(s,!0);y(s);var d=m(s,2),f=o(d,!0);y(d),y(n),a(()=>{r=T(n,1,`filter-chip svelte-m0hp6c`,null,r,{"archive-chip":p(i),"is-active":p(R)===p(t).value}),v(n,`data-filter-status`,p(t).value),v(n,`aria-pressed`,p(R)===p(t).value),l(c,p(t).label),l(f,p(Ke)[p(t).value])}),D(`click`,n,()=>$e(p(t).value)),u(e,n)}),u(e,s)},j=(e,t=E,n=E)=>{var r=je();let i;var s=o(r),d=o(s,!0);y(s);var f=m(s,2),h=o(f),g=e=>{var t=c();a(()=>l(t,p(B).direction===`asc`?`↑`:`↓`)),u(e,t)},ee=e=>{u(e,c(`↕`))};x(h,e=>{p(B).key===t()?e(g):e(ee,-1)}),y(f),y(r),a(e=>{i=T(r,1,`column-sort svelte-m0hp6c`,null,i,{"is-active":p(B).key===t()}),v(r,`data-sort-key`,t()),v(r,`aria-label`,e),l(d,n())},[()=>Xe(t(),n())]),D(`click`,r,()=>Ze(t())),u(e,r)},pe=[{value:`all`,label:`All`},{value:`running`,label:`Running`},{value:`scheduled`,label:`Scheduled`},{value:`needs_attention`,label:`Needs attention`}],M=[{value:`completed`,label:`Completed`},{value:`aborted`,label:`Aborted`}],N=xe(),F=Ee(N),I=w(null),L=w(``),R=w(g(F.status)),z=w(g(F.processType)),B=w(g(F.sort)),V=C(()=>Oe(de())),H=C(()=>O().facets?.processTypes??[]),Ge=C(()=>({status:p(R),query:p(L),processType:p(z)})),Ke=C(()=>O().facets?.statusCounts??Te),qe=C(()=>!!O().pagination?.hasMore),Je=C(()=>(O().pagination?.processTotal??0)+(O().pagination?.futureExecutionTotal??0)),Ye=C(()=>ke(p(Ge)));function U(e=100,t){return{limit:e,...t===void 0?{}:{offset:t},query:p(L),status:p(R),processType:p(z),sortKey:p(B).key,sortDirection:p(B).direction}}s(()=>{De(N,{status:p(R),processType:p(z),sort:p(B)})}),s(()=>{let e=setTimeout(()=>void P(U()),p(L).trim()?180:0);return()=>clearTimeout(e)});function Xe(e,t){if(p(B).key!==e)return`Sort by ${t}`;let n=p(B).direction===`asc`?`descending`:`ascending`;return`${t}, sorted ${p(B).direction===`asc`?`ascending`:`descending`}. Activate to sort ${n}.`}function Ze(t){p(B).key===t?e(B,{key:t,direction:p(B).direction===`asc`?`desc`:`asc`},!0):e(B,{key:t,direction:t===`title`?`asc`:`desc`},!0)}function Qe(t){e(L,t.currentTarget.value,!0)}function $e(t){e(R,t,!0)}function et(t){e(z,t.currentTarget.value,!0)}function tt(){e(L,``),e(R,`all`),e(z,``),p(I)?.focus()}function nt(){let e=O().pagination;e&&P(U(e.limit,p(V).length),{append:!0})}function W(){P(U())}function rt(e){return e.kind===`future`&&e.futureExecutionId?he(e.futureExecutionId):ge(e.instanceId??e.id)}function it(e,t){t.preventDefault(),me(rt(e))}function at(e){switch(e.statusFilter){case`running`:return`R`;case`scheduled`:return`S`;case`needs_attention`:return`W`;case`completed`:return Ce(`completed`);case`aborted`:return Ce(`aborted`);default:return`?`}}function ot(e){if(!e.sortAt)return`No timestamp`;let t=ue(e.sortAt);return e.statusFilter===`scheduled`?`Runs ${t}`:e.statusFilter===`completed`||e.statusFilter===`aborted`?`Closed ${t}`:`Updated ${t}`}function st(e){let t=e.initialPrompt?` Initial prompt: ${e.initialPrompt}`:``;return`${e.title}. ${e.statusDetail}. ${ot(e)}.${t}`}function ct(e){e.defaultPrevented||!be(e)||e.key!==`/`||_e(e.target)||(e.preventDefault(),p(I)?.focus(),p(I)?.select())}var G=We();t(`keydown`,se,ct);var lt=o(G);Se(lt,{title:`All processes`,subtitle:`Browse current, scheduled, and past process records. Search or filter to narrow the list.`});var ut=m(lt,2),K=o(ut),q=o(K),J=m(o(q),2);le(J),_(J,t=>e(I,t),()=>p(I)),y(q);var Y=m(q,2),X=m(o(Y),2),Z=o(X);Z.value=Z.__value=``;var dt=m(Z),ft=e=>{var t=Me(),n=o(t);y(t);var r={};a(()=>{l(n,`${p(z)??``} (unavailable)`),r!==(r=p(z))&&(t.value=(t.__value=p(z))??``)}),u(e,t)},pt=C(()=>O().facets&&p(z)&&!p(H).some(e=>e.value===p(z)));x(dt,e=>{p(pt)&&e(ft)}),r(m(dt),17,()=>p(H),e=>e.value,(e,t)=>{var n=Me(),r=o(n);y(n);var i={};a(()=>{l(r,`${p(t).label??``} (${p(t).count??``})`),i!==(i=p(t).value)&&(n.value=(n.__value=p(t).value)??``)}),u(e,n)}),y(X);var mt;b(X),y(Y);var Q=m(Y,2),ht=o(Q),gt=o(ht,!0);y(ht);var _t=m(ht);y(Q);var vt=m(Q,2),yt=e=>{var t=Ne();D(`click`,t,tt),u(e,t)};x(vt,e=>{p(Ye)&&e(yt)});var $=m(vt,2),bt=o($,!0);y($),y(K);var xt=m(K,2),St=m(o(xt),2);A(o(St),()=>pe),y(St);var Ct=m(St,2);A(o(Ct),()=>M,()=>!0),y(Ct),y(xt);var wt=m(xt,2),Tt=e=>{var t=Pe(),n=m(o(t),2);y(t),D(`click`,n,W),u(e,t)};x(wt,e=>{O().error&&e(Tt)});var Et=m(wt,2),Dt=o(Et),Ot=o(Dt);j(Ot,()=>`status`,()=>`Status`);var kt=m(Ot,2);j(kt,()=>`title`,()=>`Process`),j(m(kt,4),()=>`timeline`,()=>`Timeline`),ie(2),y(Dt);var At=m(Dt,2),jt=e=>{var t=Ie();r(t,20,()=>[,,,,,,],n,(e,t)=>{u(e,Fe())}),y(t),u(e,t)},Mt=e=>{var t=Le(),n=m(o(t),4);y(t),D(`click`,n,tt),u(e,t)},Nt=e=>{u(e,Re())},Pt=e=>{var t=He();r(t,21,()=>p(V),e=>e.id,(e,t)=>{var n=Ve(),r=o(n),i=o(r),s=o(i,!0);y(i);var d=m(i,2),f=o(d),h=o(f,!0);y(f);var g=m(f,2),ee=o(g);y(g),y(d);var _=m(d,2),te=o(_),ne=e=>{var n=c();a(()=>l(n,p(t).initialPrompt)),u(e,n)},re=e=>{u(e,ze())};x(te,e=>{p(t).initialPrompt?e(ne):e(re,-1)}),y(_);var b=m(_,2),ie=o(b,!0);y(b),y(r);var S=m(r,2),ae=o(S),oe=e=>{we(e,{get instanceId(){return p(t).instanceId},get lifecycleStatus(){return p(t).lifecycleStatus},get processLabel(){return p(t).title},onDeleted:W})},se=e=>{u(e,Be())};x(ae,e=>{p(t).kind===`process`&&p(t).instanceId?e(oe):e(se,-1)}),y(S),y(n),a((e,a,o,c)=>{v(n,`data-item-id`,p(t).id),v(n,`data-item-kind`,p(t).kind),v(n,`data-status-filter`,p(t).statusFilter),v(r,`href`,e),v(r,`aria-label`,a),T(i,1,`status-mark ${p(t).statusFilter}`,`svelte-m0hp6c`),l(s,o),l(h,p(t).title),l(ee,`${p(t).statusDetail??``} · ${p(t).processDisplayName??``}`),l(ie,c),v(S,`data-process-actions-for`,p(t).instanceId??p(t).id)},[()=>rt(p(t)),()=>st(p(t)),()=>at(p(t)),()=>ot(p(t))]),D(`click`,r,e=>it(p(t),e)),u(e,n)}),y(t),u(e,t)};x(At,e=>{O().loading&&p(V).length===0?e(jt):p(V).length===0&&p(Ye)?e(Mt,1):p(V).length===0?e(Nt,2):e(Pt,-1)}),y(Et);var Ft=m(Et,2),It=e=>{var t=Ue(),n=o(t);y(t),D(`click`,n,nt),u(e,t)};x(Ft,e=>{p(qe)&&e(It)}),y(ut),y(G),a(()=>{oe(J,p(L)),mt!==(mt=p(z))&&(X.value=(X.__value=p(z))??``,re(X,p(z))),l(gt,p(Je)),l(_t,` ${p(Je)===1?`record`:`records`}`),$.disabled=O().loading,l(bt,O().loading?`Refreshing…`:`Refresh`)}),D(`input`,J,Qe),D(`change`,X,et),D(`click`,$,W),u(i,G),te(),fe()}f([`click`,`input`,`change`]);export{Ge as default};
|
|
1
|
+
import{$ as e,B as t,D as n,E as r,F as i,G as a,J as o,K as s,L as c,M as l,N as u,P as d,R as f,V as p,X as m,Y as h,Z as g,_t as ee,a as _,d as v,dt as te,ft as ne,g as re,gt as y,h as b,ht as ie,k as x,nt as S,ot as ae,p as oe,q as se,rt as C,st as ce,tt as w,u as le,v as T,vt as E,z as D}from"./index-client-BqF3_t3P.js";import{J as ue,K as de,X as O,Z as k,_t as fe,ct as A,dt as j,ht as pe,mt as M,yt as N}from"./api-HGtUzekR.js";import{r as me,s as he,u as ge}from"./router.svelte-C2wi6I7k.js";import{b as _e,i as ve,r as ye,s as P,y as be}from"./index-ChVsVf6R.js";import{t as xe}from"./browser-storage-LbKCyf_w.js";import{t as Se}from"./PageHeader-C4j3zJKF.js";import{r as Ce,t as we}from"./ProcessActionsMenu-gNiZGUCZ.js";var F=M([`all`,`running`,`scheduled`,`needs_attention`,`completed`,`aborted`]),I=j({key:M([`status`,`title`,`timeline`]),direction:M([`asc`,`desc`])}),L=j({status:F,processType:pe(N(),A(200)),sort:I}),R=`leitwerk.process-browser-view.v1`,z={status:`all`,processType:``,sort:{key:`timeline`,direction:`desc`}},Te={all:0,running:0,scheduled:0,needs_attention:0,completed:0,aborted:0};function Ee(e){try{let t=e?.getItem(R),n=t&&fe(L,JSON.parse(t));return n?.success?n.output:z}catch{return z}}function De(e,t){try{e?.setItem(R,JSON.stringify(t))}catch{}}function B(e){return e.lifecycleStatus===`completed`||e.lifecycleStatus===`aborted`?e.lifecycleStatus:e.lifecycleStatus===`error`||e.lifecycleStatus===`waiting`?`needs_attention`:`running`}function V(e){let t=O(e.lifecycleStatus);return e.selectedTurnId?`${t} · ${k(e.selectedTurnId)}`:t}function H(e){if(e.kind===`process`){let t=e.item;return{id:t.instanceId,kind:`process`,title:t.title,processId:t.processId,processDisplayName:t.processDisplayName?.trim()||de(t.processId),statusFilter:B(t),statusDetail:V(t),initialPrompt:t.initialPromptPreview,createdAt:t.createdAt,updatedAt:t.updatedAt,sortAt:t.statusCategory===`terminal`?t.closedAt??t.updatedAt??t.createdAt:t.updatedAt??t.createdAt,instanceId:t.instanceId,futureExecutionId:null,lifecycleStatus:t.lifecycleStatus}}let t=e.item;return{id:t.id,kind:`future`,title:t.title,processId:t.processId,processDisplayName:t.kind===`launch`&&t.launcherLabel||de(t.processId),statusFilter:`scheduled`,statusDetail:t.kind===`action`?`Scheduled action · ${t.actionLabel}`:t.scheduleKind===`cron`?`Recurring scheduled start`:`Scheduled start`,initialPrompt:t.initialPromptPreview,createdAt:null,updatedAt:t.nextRunAt,sortAt:t.nextRunAt,instanceId:t.instanceId,futureExecutionId:t.kind===`launch`?t.id:null,lifecycleStatus:null}}function Oe(e){return e.map(H)}function ke(e){return e.status!==`all`||e.query.trim()!==``||e.processType!==``}var Ae=i(`<button type="button" data-pressable="true"><span> </span> <span class="chip-count svelte-m0hp6c"> </span></button>`),je=i(`<button type="button"><span> </span> <span class="sort-arrow svelte-m0hp6c" aria-hidden="true"><!></span></button>`),Me=i(`<option> </option>`),Ne=i(`<button type="button" class="reset-view-button svelte-m0hp6c" data-pressable="true">Clear filters</button>`),Pe=i(`<div class="state-banner svelte-m0hp6c" role="status" data-state="process-list-error"><p class="svelte-m0hp6c">Process list couldn’t refresh. Existing results may be out of date.</p> <button type="button" data-pressable="true" class="svelte-m0hp6c">Try again</button></div>`),Fe=i(`<div class="skeleton-row svelte-m0hp6c"></div>`),Ie=i(`<div class="skeleton-list svelte-m0hp6c" data-state="processes-loading" role="status"></div>`),Le=i(`<div class="empty-state svelte-m0hp6c" data-state="processes-no-results"><h2 class="svelte-m0hp6c">No processes match these filters</h2> <p class="svelte-m0hp6c">Change the search or filters to see more process records.</p> <button type="button" class="clear-button svelte-m0hp6c" data-pressable="true">Clear search and filters</button></div>`),Re=i(`<div class="empty-state svelte-m0hp6c" data-state="processes-empty"><h2 class="svelte-m0hp6c">No process records yet</h2> <p class="svelte-m0hp6c">Started and scheduled processes will appear here.</p></div>`),ze=i(`<span class="muted svelte-m0hp6c">No initial prompt captured</span>`),Be=i(`<span class="future-action-note svelte-m0hp6c">Scheduled start</span>`),Ve=i(`<article class="process-browser-row svelte-m0hp6c" data-process-browser-row=""><a class="row-main svelte-m0hp6c" data-pressable="true"><span aria-hidden="true"> </span> <span class="row-process svelte-m0hp6c"><span class="row-title svelte-m0hp6c"> </span> <span class="row-meta svelte-m0hp6c"> </span></span> <span class="prompt-cell svelte-m0hp6c"><!></span> <span class="time-cell svelte-m0hp6c"> </span></a> <div class="row-actions svelte-m0hp6c"><!></div></article>`),He=i(`<div class="process-table svelte-m0hp6c" data-section="process-browser-results"></div>`),Ue=i(`<div class="pagination-row svelte-m0hp6c"><button type="button" class="show-more-button svelte-m0hp6c" data-pressable="true">Show more</button></div>`),We=i(`<section class="processes-page svelte-m0hp6c" data-section="all-processes-page"><!> <div class="browser-panel svelte-m0hp6c" data-section="process-browser"><div class="browser-toolbar svelte-m0hp6c" data-section="process-browse-controls"><label class="search-field svelte-m0hp6c"><span class="sr-only svelte-m0hp6c">Search</span> <input type="search" placeholder="Search processes by title or prompt" aria-label="Search processes by title or prompt" class="svelte-m0hp6c"/></label> <label class="type-filter svelte-m0hp6c"><span class="sr-only svelte-m0hp6c">Process type</span> <select data-filter="process-type" class="svelte-m0hp6c"><option>All process types</option><!><!></select></label> <p class="result-count svelte-m0hp6c" aria-live="polite"><span class="svelte-m0hp6c"> </span> </p> <!> <button type="button" class="refresh-button svelte-m0hp6c" data-action="refresh-processes" data-pressable="true"> </button></div> <div class="filter-row svelte-m0hp6c" role="group" aria-label="Process status filters"><span class="filter-row-label svelte-m0hp6c">Status</span> <div class="filter-group svelte-m0hp6c"><!></div> <div class="filter-group archive-group svelte-m0hp6c"><!></div></div> <!> <div class="process-table-shell svelte-m0hp6c"><div class="process-table-heading svelte-m0hp6c"><!> <!> <span class="prompt-heading svelte-m0hp6c">Initial prompt</span> <!> <span class="actions-heading svelte-m0hp6c">Actions</span></div> <!></div> <!></div></section>`);function Ge(i,f){ne(f,!0);let de=()=>ce(ye,`$browseItems`,k),O=()=>ce(ve,`$browseState`,k),[k,fe]=ae(),A=(e,t=E,n)=>{let i=S(()=>ee(n?.(),!1));var s=d();r(h(s),17,t,e=>e.value,(e,t)=>{var n=Ae();let r;var s=o(n),c=o(s,!0);y(s);var d=m(s,2),f=o(d,!0);y(d),y(n),a(()=>{r=T(n,1,`filter-chip svelte-m0hp6c`,null,r,{"archive-chip":p(i),"is-active":p(R)===p(t).value}),v(n,`data-filter-status`,p(t).value),v(n,`aria-pressed`,p(R)===p(t).value),l(c,p(t).label),l(f,p(Ke)[p(t).value])}),D(`click`,n,()=>$e(p(t).value)),u(e,n)}),u(e,s)},j=(e,t=E,n=E)=>{var r=je();let i;var s=o(r),d=o(s,!0);y(s);var f=m(s,2),h=o(f),g=e=>{var t=c();a(()=>l(t,p(B).direction===`asc`?`↑`:`↓`)),u(e,t)},ee=e=>{u(e,c(`↕`))};x(h,e=>{p(B).key===t()?e(g):e(ee,-1)}),y(f),y(r),a(e=>{i=T(r,1,`column-sort svelte-m0hp6c`,null,i,{"is-active":p(B).key===t()}),v(r,`data-sort-key`,t()),v(r,`aria-label`,e),l(d,n())},[()=>Xe(t(),n())]),D(`click`,r,()=>Ze(t())),u(e,r)},pe=[{value:`all`,label:`All`},{value:`running`,label:`Running`},{value:`scheduled`,label:`Scheduled`},{value:`needs_attention`,label:`Needs attention`}],M=[{value:`completed`,label:`Completed`},{value:`aborted`,label:`Aborted`}],N=xe(),F=Ee(N),I=w(null),L=w(``),R=w(g(F.status)),z=w(g(F.processType)),B=w(g(F.sort)),V=C(()=>Oe(de())),H=C(()=>O().facets?.processTypes??[]),Ge=C(()=>({status:p(R),query:p(L),processType:p(z)})),Ke=C(()=>O().facets?.statusCounts??Te),qe=C(()=>!!O().pagination?.hasMore),Je=C(()=>(O().pagination?.processTotal??0)+(O().pagination?.futureExecutionTotal??0)),Ye=C(()=>ke(p(Ge)));function U(e=100,t){return{limit:e,...t===void 0?{}:{offset:t},query:p(L),status:p(R),processType:p(z),sortKey:p(B).key,sortDirection:p(B).direction}}s(()=>{De(N,{status:p(R),processType:p(z),sort:p(B)})}),s(()=>{let e=setTimeout(()=>void P(U()),p(L).trim()?180:0);return()=>clearTimeout(e)});function Xe(e,t){if(p(B).key!==e)return`Sort by ${t}`;let n=p(B).direction===`asc`?`descending`:`ascending`;return`${t}, sorted ${p(B).direction===`asc`?`ascending`:`descending`}. Activate to sort ${n}.`}function Ze(t){p(B).key===t?e(B,{key:t,direction:p(B).direction===`asc`?`desc`:`asc`},!0):e(B,{key:t,direction:t===`title`?`asc`:`desc`},!0)}function Qe(t){e(L,t.currentTarget.value,!0)}function $e(t){e(R,t,!0)}function et(t){e(z,t.currentTarget.value,!0)}function tt(){e(L,``),e(R,`all`),e(z,``),p(I)?.focus()}function nt(){let e=O().pagination;e&&P(U(e.limit,p(V).length),{append:!0})}function W(){P(U())}function rt(e){return e.kind===`future`&&e.futureExecutionId?he(e.futureExecutionId):ge(e.instanceId??e.id)}function it(e,t){t.preventDefault(),me(rt(e))}function at(e){switch(e.statusFilter){case`running`:return`R`;case`scheduled`:return`S`;case`needs_attention`:return`W`;case`completed`:return Ce(`completed`);case`aborted`:return Ce(`aborted`);default:return`?`}}function ot(e){if(!e.sortAt)return`No timestamp`;let t=ue(e.sortAt);return e.statusFilter===`scheduled`?`Runs ${t}`:e.statusFilter===`completed`||e.statusFilter===`aborted`?`Closed ${t}`:`Updated ${t}`}function st(e){let t=e.initialPrompt?` Initial prompt: ${e.initialPrompt}`:``;return`${e.title}. ${e.statusDetail}. ${ot(e)}.${t}`}function ct(e){e.defaultPrevented||!be(e)||e.key!==`/`||_e(e.target)||(e.preventDefault(),p(I)?.focus(),p(I)?.select())}var G=We();t(`keydown`,se,ct);var lt=o(G);Se(lt,{title:`All processes`,subtitle:`Browse current, scheduled, and past process records. Search or filter to narrow the list.`});var ut=m(lt,2),K=o(ut),q=o(K),J=m(o(q),2);le(J),_(J,t=>e(I,t),()=>p(I)),y(q);var Y=m(q,2),X=m(o(Y),2),Z=o(X);Z.value=Z.__value=``;var dt=m(Z),ft=e=>{var t=Me(),n=o(t);y(t);var r={};a(()=>{l(n,`${p(z)??``} (unavailable)`),r!==(r=p(z))&&(t.value=(t.__value=p(z))??``)}),u(e,t)},pt=C(()=>O().facets&&p(z)&&!p(H).some(e=>e.value===p(z)));x(dt,e=>{p(pt)&&e(ft)}),r(m(dt),17,()=>p(H),e=>e.value,(e,t)=>{var n=Me(),r=o(n);y(n);var i={};a(()=>{l(r,`${p(t).label??``} (${p(t).count??``})`),i!==(i=p(t).value)&&(n.value=(n.__value=p(t).value)??``)}),u(e,n)}),y(X);var mt;b(X),y(Y);var Q=m(Y,2),ht=o(Q),gt=o(ht,!0);y(ht);var _t=m(ht);y(Q);var vt=m(Q,2),yt=e=>{var t=Ne();D(`click`,t,tt),u(e,t)};x(vt,e=>{p(Ye)&&e(yt)});var $=m(vt,2),bt=o($,!0);y($),y(K);var xt=m(K,2),St=m(o(xt),2);A(o(St),()=>pe),y(St);var Ct=m(St,2);A(o(Ct),()=>M,()=>!0),y(Ct),y(xt);var wt=m(xt,2),Tt=e=>{var t=Pe(),n=m(o(t),2);y(t),D(`click`,n,W),u(e,t)};x(wt,e=>{O().error&&e(Tt)});var Et=m(wt,2),Dt=o(Et),Ot=o(Dt);j(Ot,()=>`status`,()=>`Status`);var kt=m(Ot,2);j(kt,()=>`title`,()=>`Process`),j(m(kt,4),()=>`timeline`,()=>`Timeline`),ie(2),y(Dt);var At=m(Dt,2),jt=e=>{var t=Ie();r(t,20,()=>[,,,,,,],n,(e,t)=>{u(e,Fe())}),y(t),u(e,t)},Mt=e=>{var t=Le(),n=m(o(t),4);y(t),D(`click`,n,tt),u(e,t)},Nt=e=>{u(e,Re())},Pt=e=>{var t=He();r(t,21,()=>p(V),e=>e.id,(e,t)=>{var n=Ve(),r=o(n),i=o(r),s=o(i,!0);y(i);var d=m(i,2),f=o(d),h=o(f,!0);y(f);var g=m(f,2),ee=o(g);y(g),y(d);var _=m(d,2),te=o(_),ne=e=>{var n=c();a(()=>l(n,p(t).initialPrompt)),u(e,n)},re=e=>{u(e,ze())};x(te,e=>{p(t).initialPrompt?e(ne):e(re,-1)}),y(_);var b=m(_,2),ie=o(b,!0);y(b),y(r);var S=m(r,2),ae=o(S),oe=e=>{we(e,{get instanceId(){return p(t).instanceId},get lifecycleStatus(){return p(t).lifecycleStatus},get processLabel(){return p(t).title},onDeleted:W})},se=e=>{u(e,Be())};x(ae,e=>{p(t).kind===`process`&&p(t).instanceId?e(oe):e(se,-1)}),y(S),y(n),a((e,a,o,c)=>{v(n,`data-item-id`,p(t).id),v(n,`data-item-kind`,p(t).kind),v(n,`data-status-filter`,p(t).statusFilter),v(r,`href`,e),v(r,`aria-label`,a),T(i,1,`status-mark ${p(t).statusFilter}`,`svelte-m0hp6c`),l(s,o),l(h,p(t).title),l(ee,`${p(t).statusDetail??``} · ${p(t).processDisplayName??``}`),l(ie,c),v(S,`data-process-actions-for`,p(t).instanceId??p(t).id)},[()=>rt(p(t)),()=>st(p(t)),()=>at(p(t)),()=>ot(p(t))]),D(`click`,r,e=>it(p(t),e)),u(e,n)}),y(t),u(e,t)};x(At,e=>{O().loading&&p(V).length===0?e(jt):p(V).length===0&&p(Ye)?e(Mt,1):p(V).length===0?e(Nt,2):e(Pt,-1)}),y(Et);var Ft=m(Et,2),It=e=>{var t=Ue(),n=o(t);y(t),D(`click`,n,nt),u(e,t)};x(Ft,e=>{p(qe)&&e(It)}),y(ut),y(G),a(()=>{oe(J,p(L)),mt!==(mt=p(z))&&(X.value=(X.__value=p(z))??``,re(X,p(z))),l(gt,p(Je)),l(_t,` ${p(Je)===1?`record`:`records`}`),$.disabled=O().loading,l(bt,O().loading?`Refreshing…`:`Refresh`)}),D(`input`,J,Qe),D(`change`,X,et),D(`click`,$,W),u(i,G),te(),fe()}f([`click`,`input`,`change`]);export{Ge as default};
|
package/dist/assets/{ScheduleDateTimePicker-CQGvY-Rc.js → ScheduleDateTimePicker-D72J6EhE.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e,F as t,G as n,J as r,M as i,N as a,R as o,V as s,X as c,Y as l,at as u,d,dt as f,ft as p,g as m,gt as h,h as g,k as _,l as v,r as y,rt as b,v as x,z as S}from"./index-client-BqF3_t3P.js";import"./api-
|
|
1
|
+
import{E as e,F as t,G as n,J as r,M as i,N as a,R as o,V as s,X as c,Y as l,at as u,d,dt as f,ft as p,g as m,gt as h,h as g,k as _,l as v,r as y,rt as b,v as x,z as S}from"./index-client-BqF3_t3P.js";import"./api-HGtUzekR.js";var C=t(`<span class="required-marker svelte-1uuuk71" title="This field is required" aria-hidden="true">*</span>`),w=t(`<div class="checkbox-row svelte-1uuuk71"><input/> <label class="checkbox-label svelte-1uuuk71"> <!></label></div>`),T=t(`<label class="field-label svelte-1uuuk71"> <!></label>`),E=t(`<p class="field-description svelte-1uuuk71"> </p>`),D=t(`<textarea></textarea>`),O=t(`<option> </option>`),k=t(`<p class="field-option-description svelte-1uuuk71"> </p>`),A=t(`<select><option>Choose an option</option><!></select> <!>`,1),j=t(`<button type="button" class="field-recent-chip svelte-1uuuk71"> </button>`),M=t(`<div class="field-recents svelte-1uuuk71"><p class="field-recents-label svelte-1uuuk71">Recent</p> <div class="field-recent-chip-list svelte-1uuuk71"></div></div>`),N=t(`<input/> <!>`,1),ee=t(`<li class="svelte-1uuuk71"> </li>`),P=t(`<ul class="field-error-list svelte-1uuuk71" role="alert"></ul>`),te=t(`<div><!> <!> <!> <!></div>`);function F(t,o){p(o,!0);let m=y(o,`errors`,19,()=>[]),g=y(o,`descriptionId`,3,void 0),F=y(o,`errorId`,3,void 0),I=y(o,`describedBy`,3,void 0),L=y(o,`marker`,3,`launcher`),R=y(o,`textareaRows`,3,4),z=y(o,`options`,19,()=>[]),B=y(o,`selectedOptionDescription`,3,null),V=y(o,`selectedOptionDescriptionId`,3,void 0),H=y(o,`recentValues`,19,()=>[]),U=y(o,`layout`,3,`stacked`),W=y(o,`onTextBlur`,3,void 0),G=y(o,`onRecentValue`,3,void 0),K=b(()=>L()===`action`?{"data-action-form-field":!0}:{"data-launcher-form-field":!0}),q=b(()=>m().length>0),J=b(()=>String(o.value??``)),ne=b(()=>o.value===!0);var Y=te();let X;var Z=r(Y),re=e=>{var t=w(),l=r(t),u=e=>o.onValueChange(o.field,e.currentTarget.checked);v(l,()=>({id:o.id,...s(K),type:`checkbox`,required:o.field.required?!0:void 0,checked:s(ne),"aria-describedby":I(),"aria-invalid":s(q),"aria-required":o.field.required?!0:void 0,onchange:u}),void 0,void 0,void 0,`svelte-1uuuk71`,!0);var f=c(l,2),p=r(f),m=c(p),g=e=>{a(e,C())};_(m,e=>{o.field.required&&e(g)}),h(f),h(t),n(()=>{d(f,`for`,o.id),i(p,`${o.field.label??``} `)}),a(e,t)},ie=e=>{var t=T(),s=r(t),l=c(s),u=e=>{a(e,C())};_(l,e=>{o.field.required&&e(u)}),h(t),n(()=>{d(t,`for`,o.id),i(s,`${o.field.label??``} `)}),a(e,t)};_(Z,e=>{o.field.kind===`boolean`?e(re):e(ie,-1)});var Q=c(Z,2),ae=e=>{var t=E(),s=r(t,!0);h(t),n(()=>{d(t,`id`,g()),i(s,o.field.description)}),a(e,t)};_(Q,e=>{o.field.description&&e(ae)});var $=c(Q,2),oe=e=>{var t=D();u(t);var n=e=>o.onValueChange(o.field,e.currentTarget.value);v(t,()=>({id:o.id,...s(K),rows:R(),required:o.field.required?!0:void 0,value:s(J),placeholder:o.field.placeholder??void 0,"aria-describedby":I(),"aria-invalid":s(q),"aria-required":o.field.required?!0:void 0,oninput:n,onblur:W()}),void 0,void 0,void 0,`svelte-1uuuk71`),a(e,t)},se=t=>{var u=A(),f=l(u),p=e=>o.onValueChange(o.field,e.currentTarget.value);v(f,()=>({id:o.id,...s(K),value:s(J),required:o.field.required?!0:void 0,"aria-describedby":I(),"aria-invalid":s(q),"aria-required":o.field.required?!0:void 0,onchange:p}),void 0,void 0,void 0,`svelte-1uuuk71`);var m=r(f);m.value=m.__value=``,e(c(m),19,z,(e,t)=>`${e.value}:${e.label}:${t}`,(e,t)=>{var o=O(),c=r(o,!0);h(o);var l={};n(()=>{i(c,s(t).label),l!==(l=s(t).value)&&(o.value=(o.__value=s(t).value)??``)}),a(e,o)}),h(f);var g=c(f,2),y=e=>{var t=k(),o=r(t,!0);h(t),n(()=>{d(t,`id`,V()),i(o,B())}),a(e,t)};_(g,e=>{B()&&e(y)}),a(t,u)},ce=e=>{},le=t=>{var u=N(),f=l(u),p=e=>o.onValueChange(o.field,e.currentTarget.value);v(f,()=>({id:o.id,...s(K),type:o.field.kind===`number`?`number`:`text`,required:o.field.required?!0:void 0,value:s(J),placeholder:o.field.placeholder??void 0,"aria-describedby":I(),"aria-invalid":s(q),"aria-required":o.field.required?!0:void 0,oninput:p,onblur:W()}),void 0,void 0,void 0,`svelte-1uuuk71`,!0);var m=c(f,2),g=t=>{var s=M(),l=c(r(s),2);e(l,20,H,e=>e,(e,t)=>{var s=j(),c=r(s,!0);h(s),n(()=>{d(s,`data-recent-value`,t),i(c,t)}),S(`click`,s,()=>(G()??o.onValueChange)(o.field,t)),a(e,s)}),h(l),h(s),n(()=>d(s,`data-field-recents`,o.field.id)),a(t,s)};_(m,e=>{o.field.kind===`text`&&H().length>0&&e(g)}),a(t,u)};_($,e=>{o.field.kind===`textarea`?e(oe):o.field.kind===`select`?e(se,1):o.field.kind===`boolean`?e(ce,2):e(le,-1)});var ue=c($,2),de=t=>{var o=P();e(o,20,m,e=>e,(e,t)=>{var o=ee(),s=r(o,!0);h(o),n(()=>i(s,t)),a(e,o)}),h(o),n(()=>d(o,`id`,F())),a(t,o)};_(ue,e=>{m().length>0&&e(de)}),h(Y),n(()=>X=x(Y,1,`form-field-group svelte-1uuuk71`,null,X,{"is-split":U()===`split`&&o.field.kind!==`boolean`})),a(t,Y),f()}o([`click`]);function I(e){return String(e).padStart(2,`0`)}function L(){return Array.from({length:24},(e,t)=>{let n=I(t);return{value:n,label:n}})}function R(e=1){if(!Number.isInteger(e)||e<1||e>60||60%e!=0)throw Error(`stepMinutes must evenly divide 60`);return Array.from({length:60/e},(t,n)=>{let r=I(n*e);return{value:r,label:r}})}function z(e){let t=/^(\d{2}):(\d{2})$/.exec(e.trim());return t?{hour:t[1],minute:t[2]}:{hour:``,minute:``}}function B(e){let t=typeof e.hour==`string`?e.hour.trim():``,n=typeof e.minute==`string`?e.minute.trim():``;return/^\d{2}$/.test(t)&&/^\d{2}$/.test(n)?`${t}:${n}`:``}function V(e){let t=e.getFullYear(),n=I(e.getMonth()+1),r=I(e.getDate()),i=I(e.getHours()),a=I(e.getMinutes());return{date:`${t}-${n}-${r}`,time:`${i}:${a}`}}function H(){return V(new Date)}function U(e){return V(new Date(e))}function W(e){let t=typeof e.date==`string`?e.date.trim():``,n=typeof e.time==`string`?e.time.trim():``;if(!t||!n)return null;let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t),i=/^(\d{2}):(\d{2})$/.exec(n);if(!r||!i)return null;let[,a,o,s]=r,[,c,l]=i,u=Number(a),d=Number(o),f=Number(s),p=Number(c),m=Number(l);if(!Number.isInteger(u)||!Number.isInteger(d)||!Number.isInteger(f)||!Number.isInteger(p)||!Number.isInteger(m)||d<1||d>12||f<1||f>31||p<0||p>23||m<0||m>59)return null;let h=new Date(u,d-1,f,p,m,0,0);return h.getFullYear()!==u||h.getMonth()!==d-1||h.getDate()!==f||h.getHours()!==p||h.getMinutes()!==m?null:h.toISOString()}var G=t(`<option> </option>`),K=t(`<div class="schedule-date-time-picker svelte-qeywfq" data-time-format="24-hour"><input/> <div class="schedule-time-picker svelte-qeywfq"><select aria-label="Hour (24-hour)" class="svelte-qeywfq"><option>HH</option><!></select> <span class="schedule-time-separator svelte-qeywfq" aria-hidden="true">:</span> <select aria-label="Minute" class="svelte-qeywfq"><option>MM</option><!></select></div></div>`);function q(t,o){p(o,!0);let l=y(o,`dataSection`,3,`schedule-date-time-picker`),u=y(o,`marker`,3,null),_=L(),x=R(),C=b(()=>u()===`action`?{"data-action-form-field":!0}:u()===`launcher`?{"data-launcher-form-field":!0}:{});var w=K(),T=r(w),E=e=>o.onDateChange(e.currentTarget.value);v(T,()=>({id:o.dateId,...s(C),type:`date`,value:o.dateValue,oninput:E}),void 0,void 0,void 0,`svelte-qeywfq`,!0);var D=c(T,2),O=r(D),k=r(O);k.value=k.__value=``,e(c(k),17,()=>_,e=>e.value,(e,t)=>{var o=G(),c=r(o,!0);h(o);var l={};n(()=>{i(c,s(t).label),l!==(l=s(t).value)&&(o.value=(o.__value=s(t).value)??``)}),a(e,o)}),h(O);var A;g(O);var j=c(O,4),M=r(j);M.value=M.__value=``,e(c(M),17,()=>x,e=>e.value,(e,t)=>{var o=G(),c=r(o,!0);h(o);var l={};n(()=>{i(c,s(t).label),l!==(l=s(t).value)&&(o.value=(o.__value=s(t).value)??``)}),a(e,o)}),h(j);var N;g(j),h(D),h(w),n(()=>{d(w,`data-section`,l()),d(O,`id`,o.hourId),A!==(A=o.hourValue)&&(O.value=(O.__value=o.hourValue)??``,m(O,o.hourValue)),d(j,`id`,o.minuteId),N!==(N=o.minuteValue)&&(j.value=(j.__value=o.minuteValue)??``,m(j,o.minuteValue))}),S(`change`,O,e=>o.onHourChange(e.currentTarget.value)),S(`change`,j,e=>o.onMinuteChange(e.currentTarget.value)),a(t,w),f()}o([`change`]);export{W as a,U as i,B as n,z as o,H as r,F as s,q as t};
|