@smartmemory/compose 0.2.34-beta → 0.2.36-beta
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/App-CpdZk3aa.js +681 -0
- package/dist/assets/{arc-pUkmrihQ.js → arc-DIXitrAQ.js} +1 -1
- package/dist/assets/{architectureDiagram-3BPJPVTR-HfQQjJmI.js → architectureDiagram-3BPJPVTR-Cj7dBJg7.js} +1 -1
- package/dist/assets/{blockDiagram-GPEHLZMM-BsKGohnn.js → blockDiagram-GPEHLZMM-Cl9S3jDb.js} +1 -1
- package/dist/assets/{c4Diagram-AAUBKEIU-BKxSEqgT.js → c4Diagram-AAUBKEIU-BhXknY2V.js} +1 -1
- package/dist/assets/channel-llllBK4h.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-CHHmGuZd.js → chunk-2J33WTMH-D9br4z7_.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-BElBpOhR.js → chunk-4BX2VUAB-BUm--OlR.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-DflFI1z8.js → chunk-55IACEB6-BPBvBDq8.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-D9nK-RWm.js → chunk-727SXJPM-D-k0AVv9.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-Dbn0WxRo.js → chunk-AQP2D5EJ-DbrnuPhd.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-BGcm6Vvv.js → chunk-FMBD7UC4-CArhG5bz.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-BB1l7iXM.js → chunk-ND2GUHAM-BMqJF8Yq.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-DBednlUY.js → chunk-QZHKN3VN-xEVO-BnU.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-BEiB5jyR.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-BEiB5jyR.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-DPu8eCS8.js → cose-bilkent-S5V4N54A-D8YuuIpy.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-CO-3fQv_.js → dagre-BM42HDAG-DAFO7F2u.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-ES8OaCtj.js → diagram-2AECGRRQ-BwnnQC9d.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-DAxAGwHz.js → diagram-5GNKFQAL-DBEb2BhO.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-Ch8FzysS.js → diagram-KO2AKTUF-BMIv-hqj.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-CKzGPl09.js → diagram-LMA3HP47-B_BQfoht.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-DO22Vj8Q.js → diagram-OG6HWLK6-CGX5WRJy.js} +1 -1
- package/dist/assets/{erDiagram-TEJ5UH35-BqW54tXR.js → erDiagram-TEJ5UH35-BA3HXlzl.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-B2b-dSfR.js → flowDiagram-I6XJVG4X-DqCc80Gc.js} +1 -1
- package/dist/assets/{ganttDiagram-6RSMTGT7-CmJFWbDF.js → ganttDiagram-6RSMTGT7-2JYlowTb.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-BT8o_4m6.js → gitGraphDiagram-PVQCEYII-DeFaU-B5.js} +1 -1
- package/dist/assets/{graph-Cs_vqCR0.js → graph-BqpC5g-G.js} +1 -1
- package/dist/assets/index-BUEdsF82.js +123 -0
- package/dist/assets/{infoDiagram-5YYISTIA-BqunByDN.js → infoDiagram-5YYISTIA-Denratb4.js} +1 -1
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-B7d9fw7d.js → ishikawaDiagram-YF4QCWOH-DmYnlEGM.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-gEGcRX8K.js → journeyDiagram-JHISSGLW-XCrNbncG.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-Ce6Ql7ld.js → kanban-definition-UN3LZRKU-tdCgL_BJ.js} +1 -1
- package/dist/assets/{linear-DmFVERwp.js → linear-CQCcdMrA.js} +1 -1
- package/dist/assets/{mindmap-definition-RKZ34NQL-B5XNiIMw.js → mindmap-definition-RKZ34NQL-DtZJzpjH.js} +1 -1
- package/dist/assets/mobile-DAxPPzok.js +17 -0
- package/dist/assets/{pieDiagram-4H26LBE5-DkZl7DXu.js → pieDiagram-4H26LBE5-BFeercFA.js} +1 -1
- package/dist/assets/{quadrantDiagram-W4KKPZXB-2lwVSBWb.js → quadrantDiagram-W4KKPZXB-BCX6XEvx.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-C0t5AupD.js → requirementDiagram-4Y6WPE33-Cbby1ELs.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP-CeXMM5uX.js → sankeyDiagram-5OEKKPKP-CoGrYNGu.js} +1 -1
- package/dist/assets/{sequenceDiagram-3UESZ5HK-B3NY1tZo.js → sequenceDiagram-3UESZ5HK-Ppn3RRuA.js} +1 -1
- package/dist/assets/{stateDiagram-AJRCARHV-DWmuapu-.js → stateDiagram-AJRCARHV-z3isZwb4.js} +1 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-CU-EnGpI.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-BcThQznB.js → timeline-definition-PNZ67QCA-MzpbvgHe.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-dfCrxHjF.js → vennDiagram-CIIHVFJN-Bsvlh8Xw.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-Cp-dRZDP.js → wardley-L42UT6IY-VWT3qdBy.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-BaxHdcre.js → wardleyDiagram-YWT4CUSO-DhsQvXBN.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-BmPqraoL.js → xychartDiagram-2RQKCTM6-DvmK5-UN.js} +1 -1
- package/dist/index.html +2 -2
- package/lib/feature-validator.js +23 -0
- package/lib/roadmap-gen.js +8 -11
- package/package.json +1 -1
- package/dist/assets/App-rQ0dy9X4.js +0 -770
- package/dist/assets/channel-Dle3XKII.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-C_u9Angz.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-C_u9Angz.js +0 -1
- package/dist/assets/index-D1hzx617.js +0 -34
- package/dist/assets/mobile-CG5tLa2S.js +0 -17
- package/dist/assets/stateDiagram-v2-BHNVJYJU-Dk4v8A5E.js +0 -1
|
@@ -1,770 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-BM42HDAG-CO-3fQv_.js","assets/graph-CAnANduQ.js","assets/layout-DGIYPm2g.js","assets/mobile-CG5tLa2S.js","assets/mobile-5PV1E6OC.css","assets/index-D1hzx617.js","assets/index-jqUffYBL.css","assets/graph-Cs_vqCR0.js","assets/cose-bilkent-S5V4N54A-DPu8eCS8.js","assets/c4Diagram-AAUBKEIU-BKxSEqgT.js","assets/chunk-ND2GUHAM-BB1l7iXM.js","assets/flowDiagram-I6XJVG4X-B2b-dSfR.js","assets/chunk-FMBD7UC4-BGcm6Vvv.js","assets/chunk-55IACEB6-DflFI1z8.js","assets/chunk-2J33WTMH-CHHmGuZd.js","assets/channel-Dle3XKII.js","assets/erDiagram-TEJ5UH35-BqW54tXR.js","assets/gitGraphDiagram-PVQCEYII-BT8o_4m6.js","assets/chunk-4BX2VUAB-BElBpOhR.js","assets/chunk-QZHKN3VN-DBednlUY.js","assets/wardley-L42UT6IY-Cp-dRZDP.js","assets/ganttDiagram-6RSMTGT7-CmJFWbDF.js","assets/linear-DmFVERwp.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-5YYISTIA-BqunByDN.js","assets/pieDiagram-4H26LBE5-DkZl7DXu.js","assets/arc-pUkmrihQ.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-W4KKPZXB-2lwVSBWb.js","assets/xychartDiagram-2RQKCTM6-BmPqraoL.js","assets/requirementDiagram-4Y6WPE33-C0t5AupD.js","assets/sequenceDiagram-3UESZ5HK-B3NY1tZo.js","assets/classDiagram-4FO5ZUOK-C_u9Angz.js","assets/chunk-727SXJPM-D9nK-RWm.js","assets/classDiagram-v2-Q7XG4LA2-C_u9Angz.js","assets/stateDiagram-AJRCARHV-DWmuapu-.js","assets/chunk-AQP2D5EJ-Dbn0WxRo.js","assets/stateDiagram-v2-BHNVJYJU-Dk4v8A5E.js","assets/journeyDiagram-JHISSGLW-gEGcRX8K.js","assets/timeline-definition-PNZ67QCA-BcThQznB.js","assets/mindmap-definition-RKZ34NQL-B5XNiIMw.js","assets/kanban-definition-UN3LZRKU-Ce6Ql7ld.js","assets/sankeyDiagram-5OEKKPKP-CeXMM5uX.js","assets/diagram-LMA3HP47-CKzGPl09.js","assets/diagram-2AECGRRQ-ES8OaCtj.js","assets/blockDiagram-GPEHLZMM-BsKGohnn.js","assets/diagram-5GNKFQAL-DAxAGwHz.js","assets/architectureDiagram-3BPJPVTR-HfQQjJmI.js","assets/diagram-KO2AKTUF-Ch8FzysS.js","assets/ishikawaDiagram-YF4QCWOH-B7d9fw7d.js","assets/vennDiagram-CIIHVFJN-dfCrxHjF.js","assets/diagram-OG6HWLK6-DO22Vj8Q.js","assets/wardleyDiagram-YWT4CUSO-BaxHdcre.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var f_=Object.defineProperty;var p_=(t,e,r)=>e in t?f_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ie=(t,e,r)=>p_(t,typeof e!="symbol"?e+"":e,r);import{a as C,j as h,R as Xt,b as m_,g as cf,w as Rt,d as g_,e as hf,f as ps}from"./mobile-CG5tLa2S.js";import{r as x_,_ as Jt,u as y_}from"./index-D1hzx617.js";import{c as ma,b as uy,f as b_}from"./graph-Cs_vqCR0.js";const br={feature:"#3b82f6",bug:"#ef4444",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},Xn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b",superseded:"#6b5b8a"},C_=["planned","ready","in_progress","review","complete","blocked","parked","killed","superseded"],dy=["vision","specification","planning","implementation","verification","release"],$l={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},uf=["Untested","Low","Moderate","High","Crystallized"],_e={explore_design:"Design",prd:"PRD",architecture:"Architecture",blueprint:"Blueprint",verification:"Verification",plan:"Plan",execute:"Execute",report:"Report",docs:"Docs",ship:"Ship",complete:"Complete",killed:"Killed"},fy={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},py=["claude","codex","gemini","human","unassigned"],rm={building:"bg-blue-500/10 text-blue-400",debugging:"bg-rose-500/10 text-rose-400",testing:"bg-amber-500/10 text-amber-400",exploring:"bg-purple-500/10 text-purple-400",thinking:"bg-cyan-500/10 text-cyan-400",reviewing:"bg-emerald-500/10 text-emerald-400"},Ch=[{id:"explore_design",name:"Explore Design",agent:"claude",phase:"design",hasGate:!1},{id:"design_review",name:"Design Review",agent:"codex",phase:"design",hasGate:!1},{id:"design_gate",name:"Design Gate",agent:"human",phase:"design",hasGate:!0},{id:"prd",name:"PRD",agent:"claude",phase:"design",hasGate:!1},{id:"prd_review",name:"PRD Review",agent:"codex",phase:"design",hasGate:!1},{id:"prd_gate",name:"PRD Gate",agent:"human",phase:"design",hasGate:!0},{id:"architecture",name:"Architecture",agent:"claude",phase:"design",hasGate:!1},{id:"architecture_review",name:"Arch Review",agent:"codex",phase:"design",hasGate:!1},{id:"architecture_gate",name:"Arch Gate",agent:"human",phase:"design",hasGate:!0},{id:"blueprint",name:"Blueprint",agent:"claude",phase:"blueprint",hasGate:!1},{id:"verification",name:"Verification",agent:"claude",phase:"blueprint",hasGate:!1},{id:"blueprint_review",name:"BP Review",agent:"codex",phase:"blueprint",hasGate:!1},{id:"plan",name:"Plan",agent:"claude",phase:"implementation",hasGate:!1},{id:"plan_review",name:"Plan Review",agent:"codex",phase:"implementation",hasGate:!1},{id:"plan_gate",name:"Plan Gate",agent:"human",phase:"implementation",hasGate:!0},{id:"execute",name:"Execute",agent:"claude",phase:"implementation",hasGate:!1},{id:"review",name:"Review Loop",agent:"codex",phase:"implementation",hasGate:!1},{id:"coverage",name:"Coverage Sweep",agent:"claude",phase:"implementation",hasGate:!1},{id:"report",name:"Report",agent:"claude",phase:"ship",hasGate:!1},{id:"report_review",name:"Report Review",agent:"codex",phase:"ship",hasGate:!1},{id:"report_gate",name:"Report Gate",agent:"human",phase:"ship",hasGate:!0},{id:"docs",name:"Docs",agent:"claude",phase:"ship",hasGate:!1},{id:"ship",name:"Ship",agent:"claude",phase:"ship",hasGate:!1},{id:"ship_gate",name:"Ship Gate",agent:"human",phase:"ship",hasGate:!0}],_n={design_gate:"Review Design",prd_gate:"Review PRD",architecture_gate:"Review Architecture",plan_gate:"Review Plan",report_gate:"Review Report",ship_gate:"Approve for Ship"};function Jo(t,e){const r=_n[t.stepId]??(t.fromPhase&&t.toPhase?`${_e[t.fromPhase]??t.fromPhase} → ${_e[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const nm={design:{label:"Phase 1: Design",color:"border-blue-500/30 bg-blue-500/5"},blueprint:{label:"Phase 2: Blueprint",color:"border-violet-500/30 bg-violet-500/5"},implementation:{label:"Phase 3: Implement",color:"border-amber-500/30 bg-amber-500/5"},ship:{label:"Phase 4: Ship",color:"border-emerald-500/30 bg-emerald-500/5"}},k_={reading:"hsl(210 70% 60%)",writing:"hsl(142 60% 50%)",executing:"hsl(38 90% 60%)",searching:"hsl(270 60% 65%)",fetching:"hsl(190 70% 55%)",delegating:"hsl(330 60% 65%)",thinking:"hsl(240 30% 70%)"},im={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},v_={development:"border-blue-500/30 bg-blue-500/5 text-blue-400",quality:"border-emerald-500/30 bg-emerald-500/5 text-emerald-400",maintenance:"border-amber-500/30 bg-amber-500/5 text-amber-400",documentation:"border-violet-500/30 bg-violet-500/5 text-violet-400",exploration:"border-cyan-500/30 bg-cyan-500/5 text-cyan-400"},w_={explore_design:{bg:"bg-blue-500/5",border:"border-blue-500/40",text:"text-blue-300"},prd:{bg:"bg-purple-500/5",border:"border-purple-500/40",text:"text-purple-300"},architecture:{bg:"bg-cyan-500/5",border:"border-cyan-500/40",text:"text-cyan-300"},blueprint:{bg:"bg-violet-500/5",border:"border-violet-500/40",text:"text-violet-300"},plan:{bg:"bg-amber-500/5",border:"border-amber-500/40",text:"text-amber-300"},report:{bg:"bg-emerald-500/5",border:"border-emerald-500/40",text:"text-emerald-300"},ship:{bg:"bg-green-500/5",border:"border-green-500/40",text:"text-green-300"}},S_={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},sm=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],T_={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},__={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},E_={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},om={reading:"var(--color-category-reading)",writing:"var(--color-category-writing)",executing:"var(--color-category-executing)",searching:"var(--color-category-searching)",fetching:"var(--color-category-fetching)",delegating:"var(--color-category-delegating)",thinking:"hsl(var(--muted-foreground))"},my={branch:{label:"Branch",icon:"⑂",color:"text-purple-400"},phase_transition:{label:"Phase",icon:"→",color:"text-blue-400"},iteration:{label:"Iteration",icon:"↻",color:"text-cyan-400"},gate:{label:"Gate",icon:"◈",color:"text-amber-400"},drift_threshold:{label:"Drift",icon:"⚠",color:"text-rose-400"}};function N_(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function j_(t){return`violations (${Array.isArray(t)?t.length:0})`}function L_(t){return t?"▾":"▸"}function B_({violations:t=[],expanded:e,onToggle:r}){const[n,i]=C.useState(!1),s=e!==void 0,o=s?e:n,a=N_(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const c=L_(o),u=j_(t);return h.jsxs("div",{style:{background:"hsl(38 90% 50% / 0.06)",borderLeft:"2px solid hsl(38 90% 50% / 0.3)",borderRadius:"3px",marginTop:"4px"},children:[h.jsxs("div",{onClick:l,style:{display:"flex",alignItems:"center",gap:"4px",padding:"3px 8px",cursor:"pointer",color:"hsl(38 90% 70%)",fontSize:"10px",fontFamily:"monospace",userSelect:"none"},children:[h.jsx("span",{style:{opacity:.7},children:c}),h.jsx("span",{children:u})]}),a==="expanded"&&h.jsx("ul",{style:{listStyle:"none",margin:0,padding:"0 8px 6px 16px"},children:t.map((d,p)=>h.jsx("li",{style:{color:"hsl(38 50% 60%)",fontSize:"10px",fontFamily:"monospace",lineHeight:"1.5"},children:d},p))})]})}function A_({msg:t,mode:e="stream"}){const[r,n]=C.useState(!1),i=t.retries??0,s=t.violations??[],o=s.length>0;return e==="strip"?i===0?null:h.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:i}):h.jsxs("div",{className:"text-[10px] py-0.5",children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsxs("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.7},children:["step complete -- ",t.stepId]}),i>0&&h.jsxs("span",{onClick:()=>n(a=>!a),style:{background:"hsl(38 90% 50% / 0.15)",color:"hsl(38 90% 60%)",padding:"1px 6px",borderRadius:"9999px",fontSize:"10px",cursor:"pointer"},children:[i," ",i===1?"retry":"retries"]}),o?h.jsxs("span",{onClick:()=>n(a=>!a),style:{color:"hsl(38 90% 60%)",fontSize:"10px",cursor:"pointer"},children:[s.length," ",s.length===1?"violation":"violations"]}):h.jsx("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.4,fontSize:"10px"},children:"✓ checks passed"})]}),r&&o&&h.jsx(B_,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const M_=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,am=20;function I_({summary:t,output:e}){const[r,n]=C.useState(!1),[i,s]=C.useState(!1),o=e?M_.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
|
|
3
|
-
`):[],c=l.length>am,u=r&&!i&&c?l.slice(0,am):l,d=o?"hsl(var(--destructive, 0 84% 60%))":"hsl(215 20% 20%)";return a?h.jsxs("div",{style:{marginLeft:8,borderLeft:`1px solid ${d}`,paddingLeft:8,marginTop:2},children:[h.jsxs("div",{onClick:()=>n(p=>!p),style:{opacity:.6,fontSize:"10px",cursor:"pointer",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace",userSelect:"none",display:"flex",alignItems:"center",gap:4},children:[h.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),t]}),r&&h.jsxs("pre",{style:{margin:"4px 0 0 0",padding:0,fontSize:"10px",fontFamily:"ui-monospace, monospace",color:o?"hsl(var(--destructive, 0 84% 60%))":"hsl(var(--muted-foreground))",opacity:o?.9:.7,whiteSpace:"pre-wrap",wordBreak:"break-word",lineHeight:1.5},children:[u.join(`
|
|
4
|
-
`),!i&&c&&h.jsxs(h.Fragment,{children:[`
|
|
5
|
-
`,h.jsxs("span",{onClick:p=>{p.stopPropagation(),s(!0)},style:{color:"hsl(var(--accent))",cursor:"pointer",textDecoration:"underline",fontSize:"10px"},children:["Show all (",l.length," lines)"]})]})]})]}):h.jsx("div",{style:{marginLeft:8,opacity:.6,fontSize:"10px",padding:"2px 0",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:t})}const F_={Read:"reading",Glob:"searching",Grep:"searching",Write:"writing",Edit:"writing",NotebookEdit:"writing",Bash:"executing",Task:"delegating",Skill:"delegating",WebFetch:"fetching",WebSearch:"searching",TodoRead:"reading",TodoWrite:"writing"};function P_(t){return k_[F_[t]||"thinking"]}function D_(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function O_(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function R_({input:t}){const[e,r]=C.useState(!1);if(!t||Object.keys(t).length===0)return null;const n=Object.keys(t)[0],i=String(t[n]??""),s=i.length>60?i.slice(0,57)+"…":i;return h.jsxs("div",{className:"mt-1",children:[h.jsxs("button",{onClick:()=>r(o=>!o),className:"text-[10px] font-mono flex items-center gap-1",style:{color:"hsl(var(--muted-foreground))",background:"none",border:"none",cursor:"pointer",padding:0},children:[h.jsx("span",{style:{opacity:.6},children:e?"▾":"▸"}),!e&&h.jsxs("span",{style:{opacity:.6},children:[n,": ",s]}),e&&h.jsx("span",{style:{opacity:.6},children:"collapse"})]}),e&&h.jsx("pre",{className:"mt-1 text-[10px] font-mono rounded p-2 overflow-x-auto",style:{background:"hsl(var(--muted) / 0.4)",color:"hsl(var(--muted-foreground))",maxHeight:"200px",overflowY:"auto"},children:JSON.stringify(t,null,2)})]})}function $_({block:t}){const e=P_(t.name);return h.jsxs("div",{className:"rounded px-2 py-1.5 my-1",style:{background:"hsl(var(--muted) / 0.3)",borderLeft:`2px solid ${e}`},children:[h.jsx("div",{className:"flex items-center gap-1.5",children:h.jsx("span",{className:"text-[11px] font-semibold font-mono",style:{color:e},children:t.name})}),h.jsx(R_,{input:t.input})]})}function z_({msg:t}){var r;const e=((r=t.message)==null?void 0:r.content)??[];return h.jsx("div",{className:"flex flex-col gap-1 py-1",children:e.map((n,i)=>{if(n.type==="text")return h.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",style:{color:"hsl(var(--foreground))"},children:n.text},i);if(n.type==="tool_use"){const s=!e.slice(i+1).some(o=>o.type==="tool_use");return h.jsxs(Xt.Fragment,{children:[h.jsx($_,{block:n}),s&&t._toolResult&&h.jsx(I_,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function W_({msg:t}){const e=t.subtype!=="success",r=e?"hsl(var(--destructive))":"hsl(var(--success, 142 60% 50%))";return h.jsxs("div",{className:"rounded px-3 py-2 text-xs font-mono flex items-center gap-3 flex-wrap",style:{background:"hsl(var(--muted) / 0.4)",borderLeft:`2px solid ${r}`,color:r},children:[h.jsx("span",{children:e?"✗ error":"✓ done"}),!e&&t.num_turns!=null&&h.jsxs("span",{style:{color:"hsl(var(--muted-foreground))"},children:[t.num_turns," turn",t.num_turns!==1?"s":""]}),t.duration_ms!=null&&h.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:D_(t.duration_ms)}),t.total_cost_usd!=null&&h.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:O_(t.total_cost_usd)}),e&&t.errors&&h.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function q_({msg:t}){var r,n,i,s;const e=typeof((r=t.message)==null?void 0:r.content)=="string"?t.message.content:((s=(i=(n=t.message)==null?void 0:n.content)==null?void 0:i[0])==null?void 0:s.text)??"";return!e||t.isSynthetic?null:h.jsx("div",{className:"flex justify-end py-1",children:h.jsx("div",{className:"rounded-lg px-3 py-2 text-sm max-w-[80%] whitespace-pre-wrap",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--accent) / 0.3)"},children:e})})}function H_({msg:t}){var e,r;if(t.type==="stream_event"||!t.verbose&&t.type==="tool_progress"||!t.verbose&&t.type==="tool_use_summary")return null;if(t.verbose){const n=t.type==="tool_progress"?`${t.tool||"tool"} · ${t.elapsed!=null?t.elapsed+"s":""}`:t.summary||"summary",i=t.type==="tool_progress"?"progress":"summary";return h.jsxs("div",{style:{opacity:.6,fontSize:"10px",padding:"2px 0",paddingLeft:4,borderLeft:"1px solid hsl(215 20% 20%)",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:[h.jsx("span",{style:{color:"hsl(210 40% 45%)",background:"hsl(210 40% 45% / 0.1)",padding:"0 4px",borderRadius:2,fontSize:"10px"},children:i})," ",n]})}if(t.type==="system"&&t.subtype==="init")return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-3 flex-wrap",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:[h.jsxs("span",{children:["session ",(e=t.session_id)==null?void 0:e.slice(0,8)]}),h.jsx("span",{children:t.model}),h.jsx("span",{children:t.permissionMode})]});if(t.type==="system"&&t.subtype==="connected")return h.jsxs("div",{className:"text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))",opacity:.5},children:["reconnected · session ",(r=t.sessionId)==null?void 0:r.slice(0,8)]});if(t.type==="system"&&(t.subtype==="build_start"||t.subtype==="build_resume")){const n=t.subtype==="build_resume"?"build resumed":"build started";return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:"hsl(var(--accent))",opacity:.8},children:[n," -- ",t.featureCode]})}if(t.type==="system"&&t.subtype==="build_step")return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-2",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsxs("span",{children:["step ",t.stepNum,"/",t.totalSteps]}),h.jsx("span",{className:"font-mono",children:t.stepId}),h.jsx("span",{style:{opacity:.5},children:t.agent})]});if(t.type==="system"&&t.subtype==="build_step_done")return h.jsx(A_,{msg:t,mode:"stream"});if(t.type==="system"&&t.subtype==="build_gate")return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:"hsl(38 90% 60%)"},children:["gate -- ",t.stepId]});if(t.type==="system"&&t.subtype==="build_gate_resolved"){const n=t.outcome==="approved"||t.outcome==="approve"?"hsl(var(--success, 142 60% 50%))":t.outcome==="revise"?"hsl(38 90% 60%)":"hsl(var(--destructive))";return h.jsxs("div",{className:"text-[10px] py-0.5",style:{color:n,opacity:.8},children:["gate ",t.outcome," -- ",t.stepId]})}if(t.type==="system"&&t.subtype==="build_end"){const n=t.status==="complete"?"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))";return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:n},children:["build ",t.status," -- ",t.featureCode]})}return t.type==="assistant"?h.jsx(z_,{msg:t}):t.type==="user"?h.jsx(q_,{msg:t}):t.type==="result"?h.jsx(W_,{msg:t}):t.type==="error"?h.jsx("div",{className:"text-xs rounded px-2 py-1.5 font-mono",style:{background:"hsl(var(--destructive) / 0.1)",color:"hsl(var(--destructive))",borderLeft:"2px solid hsl(var(--destructive))"},children:t.message}):null}function U_({onSend:t,disabled:e=!1,placeholder:r="Message Claude…"}){const n=C.useRef(null);C.useEffect(()=>{!e&&n.current&&n.current.focus()},[e]);function i(){const a=n.current;a&&(a.style.height="auto",a.style.height=`${Math.min(a.scrollHeight,160)}px`)}function s(a){a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())}function o(){const a=n.current;if(!a)return;const l=a.value.trim();l&&(t(l),a.value="",i())}return h.jsxs("div",{className:"flex items-end gap-2 px-3 py-2",style:{borderTop:"1px solid hsl(var(--border))"},children:[h.jsx("textarea",{ref:n,rows:1,disabled:e,placeholder:r,onKeyDown:s,onInput:i,className:"flex-1 resize-none bg-transparent text-sm outline-none font-mono leading-relaxed",style:{color:"hsl(var(--foreground))",caretColor:"hsl(var(--accent))",maxHeight:"160px",overflowY:"auto",opacity:e?.4:1,transition:"opacity 0.15s"}}),h.jsx("button",{onClick:o,disabled:e,title:"Send (Enter)",className:"shrink-0 rounded px-2 py-1 text-xs font-mono",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))",border:"1px solid hsl(var(--accent) / 0.3)",cursor:e?"not-allowed":"pointer",opacity:e?.4:1,transition:"opacity 0.15s"},children:"↵"})]})}const gy="compose:verboseStream",zl={verboseStream:!1};function xy(){return zl.verboseStream}function G_(t,e){zl.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(gy,String(zl.verboseStream))}catch{}}function Y_(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(gy);r!==null&&(zl.verboseStream=r==="true")}catch{}}function V_(t,e){return t.type==="stream_event"?{include:!1,msg:t}:t.type==="tool_progress"||t.type==="tool_use_summary"?e?{include:!0,msg:{...t,verbose:!0}}:{include:!1,msg:t}:{include:!0,msg:t}}function X_(t){var r,n;const e=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i+1],a=s.type==="assistant"&&((n=(r=s.message)==null?void 0:r.content)==null?void 0:n.some(c=>c.type==="tool_use")),l=o&&(o.type==="tool_use_summary"||o.type==="assistant"&&o.subtype==="tool_use_summary");a&&l?(e.push({...s,_toolResult:o}),i++):e.push(s)}return e}const yy=parseInt("4002",10),K_="compose-agent-session",lm=500,Z_=8,Q_=2e3,by=3e4,cm={Read:"reading",Glob:"searching",Grep:"searching",Write:"writing",Edit:"writing",NotebookEdit:"writing",Bash:"executing",Task:"delegating",Skill:"delegating",WebFetch:"fetching",WebSearch:"searching",TodoRead:"reading",TodoWrite:"writing"},J_={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};Y_();const Z={es:null,connected:!1,connecting:!1,reconnectTimer:null,reconnectAttempts:0,sessionId:null,messages:[],agentStatus:"idle",agentTool:null,agentCategory:null,currentActivity:null,activityLog:[],_idleTimer:null,sourceStatus:{build:null,interactive:null},parallelTasks:null,streamError:null,retryInfo:null,stalled:!1,onConnectedChange:null,onMessagesChange:null,onAgentStatusChange:null,onStreamErrorChange:null};function tE(t){var e,r;if(t._source==="build"){if(t.type==="system"){if(t.subtype==="build_step"||t.subtype==="build_step_done"||t.subtype==="build_gate_resolved")return{status:"working",tool:null,category:"thinking",_source:"build"};if(t.subtype==="build_gate")return{status:"working",tool:null,category:"waiting",_source:"build"};if(t.subtype==="build_end")return{status:"idle",tool:null,category:null,_source:"build"}}if(t.type==="error"&&t.source==="build")return{status:"working",tool:null,category:"thinking",_source:"build"};if(t.type==="assistant"){const n=((e=t.message)==null?void 0:e.content)??[];for(const i of n)if(i.type==="tool_use"){const s=cm[i.name]||"thinking";return{status:"working",tool:i.name,category:s,_source:"build"}}if(n.some(i=>i.type==="text"))return{status:"working",tool:null,category:"thinking",_source:"build"}}return null}if(t.type==="assistant"){const n=((r=t.message)==null?void 0:r.content)??[];for(const i of n)if(i.type==="tool_use"){const s=cm[i.name]||"thinking";return{status:"working",tool:i.name,category:s}}if(n.some(i=>i.type==="text"))return{status:"working",tool:null,category:"thinking"}}return t.type==="result"?{status:"idle",tool:null,category:null}:null}function kh(t,e,r){const n=Date.now(),i=Z.agentStatus,s=Z.agentTool;if(Z._idleTimer&&(clearTimeout(Z._idleTimer),Z._idleTimer=null),i==="working"&&(t==="idle"||e!==s)){const a=Z.currentActivity;a&&(a.endTime=n,a.duration=n-a.startTime,Z.activityLog.push(a),Z.activityLog.length>Z_&&Z.activityLog.shift())}t==="working"&&e!==s?Z.currentActivity={tool:e,category:r,startTime:n,endTime:null,duration:null}:t==="idle"&&(Z.currentActivity=null),Z.agentStatus=t,Z.agentTool=e,Z.agentCategory=r;const o={status:t,tool:e,category:r,activityLog:Z.activityLog,currentActivity:Z.currentActivity,parallelTasks:Z.parallelTasks};Z.onAgentStatusChange&&Z.onAgentStatusChange({...o}),window.dispatchEvent(new CustomEvent("compose:agent-status",{detail:o}))}function hm(){const t=Z.sourceStatus.build,e=Z.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?kh(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?kh(t.status,t.tool,t.category):Z._idleTimer=setTimeout(()=>{Z._idleTimer=null,kh("idle",null,null)},Q_)}function Du(t){var i,s,o,a,l,c;t._source==="build"&&t.type==="system"&&t.parallel&&(t.subtype==="build_step"&&((i=t.stepNum)!=null&&i.toString().startsWith("∥"))?(Z.parallelTasks||(Z.parallelTasks={total:0,completed:0,failed:0,active:0,tasks:{}}),Z.parallelTasks.total++,Z.parallelTasks.active++,Z.parallelTasks.tasks[t.stepId]="working"):t.subtype==="build_step_done"&&((o=(s=Z.parallelTasks)==null?void 0:s.tasks)!=null&&o[t.stepId])?(Z.parallelTasks.active=Math.max(0,Z.parallelTasks.active-1),Z.parallelTasks.completed++,Z.parallelTasks.tasks[t.stepId]="complete"):t.subtype==="build_step_done"&&Z.parallelTasks&&!((a=t.stepNum)!=null&&a.toString().startsWith("∥"))&&(Z.parallelTasks=null)),t._source==="build"&&t.type==="error"&&((c=(l=Z.parallelTasks)==null?void 0:l.tasks)!=null&&c[t.stepId])&&(Z.parallelTasks.active=Math.max(0,Z.parallelTasks.active-1),Z.parallelTasks.failed++,Z.parallelTasks.tasks[t.stepId]="failed");const e=tE(t);if(e){const u=e._source==="build"?"build":"interactive";Z.sourceStatus[u]=e,e.status==="idle"?(Z.parallelTasks=null,hm()):(Z._idleTimer&&(clearTimeout(Z._idleTimer),Z._idleTimer=null),hm())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(Z.sessionId=t.session_id,sessionStorage.setItem(K_,t.session_id));const{include:r,msg:n}=V_(t,xy());r&&(Z.messages=[...Z.messages,n],Z.messages.length>lm&&(Z.messages=Z.messages.slice(-lm)),Z.onMessagesChange&&Z.onMessagesChange(Z.messages))}function vh(){if(Z.es)return;const t=`${window.location.protocol}//${window.location.hostname}:${yy}/api/agent/stream`,e=m_({url:t,namedEvents:["hydrate"],onOpen:()=>{Z.connected=!0,Z.streamError=null,Z.retryInfo=null,Z.stalled=!1,Z.sourceStatus.build=null,Z.onConnectedChange&&Z.onConnectedChange(!0),Z.onStreamErrorChange&&Z.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})},onClose:()=>{Z.connected=!1,Z.onConnectedChange&&Z.onConnectedChange(!1)},onError:r=>{Z.streamError=(r==null?void 0:r.message)||"Connection error",Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:Z.retryInfo,stalled:Z.stalled})},onRetry:r=>{Z.retryInfo=r,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:r,stalled:Z.stalled})},onStall:()=>{Z.stalled=!0,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:Z.retryInfo,stalled:!0})},onExhausted:()=>{Z.es=null,Z.retryInfo=null,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:null,stalled:Z.stalled})},onEvent:(r,n)=>{if((Z.stalled||Z.streamError)&&(Z.stalled=!1,Z.streamError=null,Z.retryInfo=null,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})),n==="hydrate"){if(Array.isArray(r))for(const i of r)Du(i);return}Du(r)},maxBackoffMs:8e3,maxRetries:5,stallTimeoutMs:by});Z.es=e}async function wh(t,e){const r=await fetch(`${window.location.protocol}//${window.location.hostname}:${yy}${t}`,{method:"POST",headers:{"Content-Type":"application/json","x-compose-token":""},body:JSON.stringify(e)});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||r.statusText)}return r.json()}function um(t){if(!t)return"";if(t<1e3)return"<1s";const e=Math.floor(t/1e3);return e<60?`${e}s`:`${Math.floor(e/60)}m ${e%60}s`}function Cy(){var B;const[t,e]=C.useState(Z.connected),[r,n]=C.useState(Z.messages),[i,s]=C.useState({status:Z.agentStatus,tool:Z.agentTool,category:Z.agentCategory,activityLog:Z.activityLog,currentActivity:Z.currentActivity}),[o,a]=C.useState(!1),[l,c]=C.useState(null),[u,d]=C.useState({error:Z.streamError,retryInfo:Z.retryInfo,stalled:Z.stalled}),p=C.useRef(null),f=C.useRef(null),m=C.useRef(!1),x=r.length===0||r.every(I=>I.type==="system"&&(I.subtype==="init"||I.subtype==="connected"));C.useEffect(()=>(Z.onConnectedChange=e,Z.onMessagesChange=n,Z.onAgentStatusChange=s,Z.onStreamErrorChange=d,()=>{Z.onConnectedChange=null,Z.onMessagesChange=null,Z.onAgentStatusChange=null,Z.onStreamErrorChange=null}),[]),C.useEffect(()=>{vh()},[]);const g=C.useCallback(()=>{const I=f.current;if(!I)return;const E=I.scrollHeight-I.scrollTop-I.clientHeight<48;m.current=!E},[]);C.useEffect(()=>{var I;m.current||(I=p.current)==null||I.scrollIntoView({behavior:"smooth"})},[r.length]),C.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){c(null);return}const I=i.currentActivity.startTime,E=()=>c(Date.now()-I);E();const P=setInterval(E,1e3);return()=>clearInterval(P)},[i.status,(B=i.currentActivity)==null?void 0:B.startTime]);const y=C.useCallback(async I=>{a(!0);const E=I.match(/[A-Z]+-\d+/);E&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:E[0]}}));try{x||!Z.sessionId?await wh("/api/agent/session",{prompt:I}):await wh("/api/agent/message",{prompt:I})}catch(P){Du({type:"error",message:`Failed to send: ${P.message}`})}finally{a(!1)}},[x]),b=C.useCallback(async()=>{try{await wh("/api/agent/interrupt",{})}catch{}},[]),k=t&&(i.status==="working"||o),T=t?k?"#fbbf24":"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))",_=i.category?J_[i.category]:null,w=t?k?_||"working":"ready":"offline",N=i.activityLog||[];return h.jsxs("div",{className:"relative w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[h.jsxs("div",{className:"shrink-0 flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid hsl(var(--border) / 0.5)"},children:[h.jsx("div",{className:"flex items-center gap-0.5",children:t&&N.length>0&&N.slice(-5).map((I,E)=>h.jsx("div",{className:"h-1 rounded-full",title:`${I.tool||"thinking"} — ${um(I.duration)}`,style:{width:Math.max(6,Math.min(20,(I.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+E/5*.5}},E))}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[k&&h.jsx("button",{onClick:b,title:"Interrupt",className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))",border:"1px solid hsl(var(--destructive) / 0.3)",cursor:"pointer"},children:"stop"}),h.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:T,animation:k?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"text-[10px] uppercase tracking-wider",style:{color:k?"#fbbf24":"hsl(var(--muted-foreground))"},children:w}),k&&i.tool&&h.jsx("span",{className:"text-[10px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:i.tool}),k&&l!=null&&h.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:um(l)})]})]}),h.jsxs("div",{ref:f,onScroll:g,className:"flex-1 min-h-0 overflow-y-auto px-3 py-2",style:{scrollBehavior:"smooth"},children:[r.length===0&&h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 opacity-40",children:[h.jsx("span",{className:"text-2xl",children:"⬡"}),h.jsx("span",{className:"text-xs uppercase tracking-widest",style:{color:"hsl(var(--muted-foreground))"},children:t?"ready":"connecting…"})]}),X_(r).map((I,E)=>h.jsx(H_,{msg:I},I.uuid||E)),h.jsx("div",{ref:p})]}),!t&&h.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center pointer-events-none",style:{background:"hsl(var(--background) / 0.7)",backdropFilter:"blur(2px)"},children:h.jsxs("div",{className:"flex flex-col items-center gap-3",role:"status","aria-live":"polite",children:[h.jsx("div",{className:"w-5 h-5 rounded-full animate-spin",style:{border:"2px solid hsl(var(--accent) / 0.2)",borderTopColor:"hsl(var(--accent))"}}),h.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:u.retryInfo?`Retrying… ${u.retryInfo.attempt}/${u.retryInfo.maxRetries}`:"connecting to agent server…"}),u.error&&h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--destructive))"},children:u.error}),!Z.es&&u.error&&h.jsx("button",{onClick:()=>{Z.streamError=null,Z.retryInfo=null,Z.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),vh()},className:"pointer-events-auto px-3 py-1 rounded text-[11px] font-medium",style:{background:"hsl(var(--accent) / 0.15)",border:"1px solid hsl(var(--accent) / 0.3)",color:"hsl(var(--accent-foreground))",cursor:"pointer"},children:"Reconnect"})]})}),t&&(u.error||u.stalled)&&h.jsx("div",{role:"status","aria-live":"polite",className:"shrink-0 flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{background:u.stalled?"hsl(45 93% 47% / 0.1)":"hsl(var(--destructive) / 0.1)",borderBottom:`1px solid ${u.stalled?"hsl(45 93% 47% / 0.2)":"hsl(var(--destructive) / 0.2)"}`,color:u.stalled?"hsl(45 93% 47%)":"hsl(var(--destructive))"},children:u.stalled?h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:["No data received for ",by/1e3,"s — connection may be stalled."]}),h.jsx("button",{onClick:()=>{Z.es&&(Z.es.close(),Z.es=null),Z.connected=!1,Z.onConnectedChange&&Z.onConnectedChange(!1),Z.streamError=null,Z.retryInfo=null,Z.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),vh()},className:"ml-auto px-2 py-0.5 rounded text-[10px] font-medium",style:{background:"hsl(45 93% 47% / 0.15)",border:"1px solid hsl(45 93% 47% / 0.3)",cursor:"pointer"},children:"Reconnect"})]}):h.jsx("span",{children:u.error})}),h.jsx(U_,{onSend:y,disabled:k||!t,placeholder:k?"Working…":"Message Claude…"})]})}function eE(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const rE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iE={};function dm(t,e){return(iE.jsx?nE:rE).test(t)}const sE=/[ \t\n\f\r]/g;function oE(t){return typeof t=="object"?t.type==="text"?fm(t.value):!1:fm(t)}function fm(t){return t.replace(sE,"")===""}class ga{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}ga.prototype.normal={};ga.prototype.property={};ga.prototype.space=void 0;function ky(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new ga(r,n,e)}function Ou(t){return t.toLowerCase()}class Cr{constructor(e,r){this.attribute=r,this.property=e}}Cr.prototype.attribute="";Cr.prototype.booleanish=!1;Cr.prototype.boolean=!1;Cr.prototype.commaOrSpaceSeparated=!1;Cr.prototype.commaSeparated=!1;Cr.prototype.defined=!1;Cr.prototype.mustUseProperty=!1;Cr.prototype.number=!1;Cr.prototype.overloadedBoolean=!1;Cr.prototype.property="";Cr.prototype.spaceSeparated=!1;Cr.prototype.space=void 0;let aE=0;const $t=Fi(),je=Fi(),Ru=Fi(),at=Fi(),ce=Fi(),vi=Fi(),Sr=Fi();function Fi(){return 2**++aE}const $u=Object.freeze(Object.defineProperty({__proto__:null,boolean:$t,booleanish:je,commaOrSpaceSeparated:Sr,commaSeparated:vi,number:at,overloadedBoolean:Ru,spaceSeparated:ce},Symbol.toStringTag,{value:"Module"})),Sh=Object.keys($u);class df extends Cr{constructor(e,r,n,i){let s=-1;if(super(e,r),pm(this,"space",i),typeof n=="number")for(;++s<Sh.length;){const o=Sh[s];pm(this,Sh[s],(n&$u[o])===$u[o])}}}df.prototype.defined=!0;function pm(t,e,r){r&&(t[e]=r)}function Vs(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new df(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Ou(n)]=n,r[Ou(s.attribute)]=n}return new ga(e,r,t.space)}const vy=Vs({properties:{ariaActiveDescendant:null,ariaAtomic:je,ariaAutoComplete:null,ariaBusy:je,ariaChecked:je,ariaColCount:at,ariaColIndex:at,ariaColSpan:at,ariaControls:ce,ariaCurrent:null,ariaDescribedBy:ce,ariaDetails:null,ariaDisabled:je,ariaDropEffect:ce,ariaErrorMessage:null,ariaExpanded:je,ariaFlowTo:ce,ariaGrabbed:je,ariaHasPopup:null,ariaHidden:je,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ce,ariaLevel:at,ariaLive:null,ariaModal:je,ariaMultiLine:je,ariaMultiSelectable:je,ariaOrientation:null,ariaOwns:ce,ariaPlaceholder:null,ariaPosInSet:at,ariaPressed:je,ariaReadOnly:je,ariaRelevant:null,ariaRequired:je,ariaRoleDescription:ce,ariaRowCount:at,ariaRowIndex:at,ariaRowSpan:at,ariaSelected:je,ariaSetSize:at,ariaSort:null,ariaValueMax:at,ariaValueMin:at,ariaValueNow:at,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function wy(t,e){return e in t?t[e]:e}function Sy(t,e){return wy(t,e.toLowerCase())}const lE=Vs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:vi,acceptCharset:ce,accessKey:ce,action:null,allow:null,allowFullScreen:$t,allowPaymentRequest:$t,allowUserMedia:$t,alpha:$t,alt:null,as:null,async:$t,autoCapitalize:null,autoComplete:ce,autoFocus:$t,autoPlay:$t,blocking:ce,capture:null,charSet:null,checked:$t,cite:null,className:ce,closedBy:null,colorSpace:null,cols:at,colSpan:at,command:null,commandFor:null,content:null,contentEditable:je,controls:$t,controlsList:ce,coords:at|vi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$t,defer:$t,dir:null,dirName:null,disabled:$t,download:Ru,draggable:je,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$t,formTarget:null,headers:ce,height:at,hidden:Ru,high:at,href:null,hrefLang:null,htmlFor:ce,httpEquiv:ce,id:null,imageSizes:null,imageSrcSet:null,inert:$t,inputMode:null,integrity:null,is:null,isMap:$t,itemId:null,itemProp:ce,itemRef:ce,itemScope:$t,itemType:ce,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$t,low:at,manifest:null,max:null,maxLength:at,media:null,method:null,min:null,minLength:at,multiple:$t,muted:$t,name:null,nonce:null,noModule:$t,noValidate:$t,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:$t,optimum:at,pattern:null,ping:ce,placeholder:null,playsInline:$t,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$t,referrerPolicy:null,rel:ce,required:$t,reversed:$t,rows:at,rowSpan:at,sandbox:ce,scope:null,scoped:$t,seamless:$t,selected:$t,shadowRootClonable:$t,shadowRootCustomElementRegistry:$t,shadowRootDelegatesFocus:$t,shadowRootMode:null,shadowRootSerializable:$t,shape:null,size:at,sizes:null,slot:null,span:at,spellCheck:je,src:null,srcDoc:null,srcLang:null,srcSet:null,start:at,step:null,style:null,tabIndex:at,target:null,title:null,translate:null,type:null,typeMustMatch:$t,useMap:null,value:je,width:at,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ce,axis:null,background:null,bgColor:null,border:at,borderColor:null,bottomMargin:at,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$t,declare:$t,event:null,face:null,frame:null,frameBorder:null,hSpace:at,leftMargin:at,link:null,longDesc:null,lowSrc:null,marginHeight:at,marginWidth:at,noResize:$t,noHref:$t,noShade:$t,noWrap:$t,object:null,profile:null,prompt:null,rev:null,rightMargin:at,rules:null,scheme:null,scrolling:je,standby:null,summary:null,text:null,topMargin:at,valueType:null,version:null,vAlign:null,vLink:null,vSpace:at,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:$t,disablePictureInPicture:$t,disableRemotePlayback:$t,exportParts:vi,part:ce,prefix:null,property:null,results:at,security:null,unselectable:null},space:"html",transform:Sy}),cE=Vs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Sr,accentHeight:at,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:at,amplitude:at,arabicForm:null,ascent:at,attributeName:null,attributeType:null,azimuth:at,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:at,by:null,calcMode:null,capHeight:at,className:ce,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:at,diffuseConstant:at,direction:null,display:null,dur:null,divisor:at,dominantBaseline:null,download:$t,dx:null,dy:null,edgeMode:null,editable:null,elevation:at,enableBackground:null,end:null,event:null,exponent:at,externalResourcesRequired:null,fill:null,fillOpacity:at,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:vi,g2:vi,glyphName:vi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:at,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:at,horizOriginX:at,horizOriginY:at,id:null,ideographic:at,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:at,k:at,k1:at,k2:at,k3:at,k4:at,kernelMatrix:Sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:at,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:at,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:at,overlineThickness:at,paintOrder:null,panose1:null,path:null,pathLength:at,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ce,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:at,pointsAtY:at,pointsAtZ:at,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sr,rev:Sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sr,requiredFeatures:Sr,requiredFonts:Sr,requiredFormats:Sr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:at,specularExponent:at,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:at,strikethroughThickness:at,string:null,stroke:null,strokeDashArray:Sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:at,strokeOpacity:at,strokeWidth:null,style:null,surfaceScale:at,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Sr,tabIndex:at,tableValues:null,target:null,targetX:at,targetY:at,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:at,underlineThickness:at,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:at,values:null,vAlphabetic:at,vMathematical:at,vectorEffect:null,vHanging:at,vIdeographic:at,version:null,vertAdvY:at,vertOriginX:at,vertOriginY:at,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:at,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:wy}),Ty=Vs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),_y=Vs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sy}),Ey=Vs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),hE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uE=/[A-Z]/g,mm=/-[a-z]/g,dE=/^data[-\w.:]+$/i;function fE(t,e){const r=Ou(e);let n=e,i=Cr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&dE.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(mm,mE);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!mm.test(s)){let o=s.replace(uE,pE);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=df}return new i(n,e)}function pE(t){return"-"+t.toLowerCase()}function mE(t){return t.charAt(1).toUpperCase()}const gE=ky([vy,lE,Ty,_y,Ey],"html"),ff=ky([vy,cE,Ty,_y,Ey],"svg");function xE(t){return t.join(" ").trim()}var Ui={},Th,gm;function yE(){if(gm)return Th;gm=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
|
|
6
|
-
`,c="/",u="*",d="",p="comment",f="declaration";function m(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var b=1,k=1;function T(R){var F=R.match(e);F&&(b+=F.length);var M=R.lastIndexOf(l);k=~M?R.length-M:k+R.length}function _(){var R={line:b,column:k};return function(F){return F.position=new w(R),I(),F}}function w(R){this.start=R,this.end={line:b,column:k},this.source=y.source}w.prototype.content=g;function N(R){var F=new Error(y.source+":"+b+":"+k+": "+R);if(F.reason=R,F.filename=y.source,F.line=b,F.column=k,F.source=g,!y.silent)throw F}function B(R){var F=R.exec(g);if(F){var M=F[0];return T(M),g=g.slice(M.length),F}}function I(){B(r)}function E(R){var F;for(R=R||[];F=P();)F!==!1&&R.push(F);return R}function P(){var R=_();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var F=2;d!=g.charAt(F)&&(u!=g.charAt(F)||c!=g.charAt(F+1));)++F;if(F+=2,d===g.charAt(F-1))return N("End of comment missing");var M=g.slice(2,F-2);return k+=2,T(M),g=g.slice(F),k+=2,R({type:p,comment:M})}}function z(){var R=_(),F=B(n);if(F){if(P(),!B(i))return N("property missing ':'");var M=B(s),D=R({type:f,property:x(F[0].replace(t,d)),value:M?x(M[0].replace(t,d)):d});return B(o),D}}function q(){var R=[];E(R);for(var F;F=z();)F!==!1&&(R.push(F),E(R));return R}return I(),q()}function x(g){return g?g.replace(a,d):d}return Th=m,Th}var xm;function bE(){if(xm)return Ui;xm=1;var t=Ui&&Ui.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.default=r;const e=t(yE());function r(n,i){let s=null;if(!n||typeof n!="string")return s;const o=(0,e.default)(n),a=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?i(c,u,l):u&&(s=s||{},s[c]=u)}),s}return Ui}var ho={},ym;function CE(){if(ym)return ho;ym=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||r.test(c)||t.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),s(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,a):c=c.replace(n,a),c.replace(e,o))};return ho.camelCase=l,ho}var uo,bm;function kE(){if(bm)return uo;bm=1;var t=uo&&uo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(bE()),r=CE();function n(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,l){a&&l&&(o[(0,r.camelCase)(a,s)]=l)}),o}return n.default=n,uo=n,uo}var vE=kE();const wE=cf(vE),Ny=jy("end"),pf=jy("start");function jy(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function SE(t){const e=pf(t),r=Ny(t);if(e&&r)return{start:e,end:r}}function zo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Cm(t.position):"start"in t||"end"in t?Cm(t):"line"in t||"column"in t?zu(t):""}function zu(t){return km(t&&t.line)+":"+km(t&&t.column)}function Cm(t){return zu(t&&t.start)+"-"+zu(t&&t.end)}function km(t){return t&&typeof t=="number"?t:1}class Qe extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=zo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qe.prototype.file="";Qe.prototype.name="";Qe.prototype.reason="";Qe.prototype.message="";Qe.prototype.stack="";Qe.prototype.column=void 0;Qe.prototype.line=void 0;Qe.prototype.ancestors=void 0;Qe.prototype.cause=void 0;Qe.prototype.fatal=void 0;Qe.prototype.place=void 0;Qe.prototype.ruleId=void 0;Qe.prototype.source=void 0;const mf={}.hasOwnProperty,TE=new Map,_E=/[A-Z]/g,EE=new Set(["table","tbody","thead","tfoot","tr"]),NE=new Set(["td","th"]),Ly="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jE(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=DE(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=PE(r,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?ff:gE,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=By(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function By(t,e,r){if(e.type==="element")return LE(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return BE(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return ME(t,e,r);if(e.type==="mdxjsEsm")return AE(t,e);if(e.type==="root")return IE(t,e,r);if(e.type==="text")return FE(t,e)}function LE(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=ff,t.schema=i),t.ancestors.push(e);const s=My(t,e.tagName,!1),o=OE(t,e);let a=xf(t,e);return EE.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!oE(l):!0})),Ay(t,o,s,e),gf(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function BE(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}ta(t,e.position)}function AE(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ta(t,e.position)}function ME(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=ff,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:My(t,e.name,!0),o=RE(t,e),a=xf(t,e);return Ay(t,o,s,e),gf(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function IE(t,e,r){const n={};return gf(n,xf(t,e)),t.create(e,t.Fragment,n,r)}function FE(t,e){return e.value}function Ay(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function gf(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function PE(t,e,r){return n;function n(i,s,o,a){const c=Array.isArray(o.children)?r:e;return a?c(s,o,a):c(s,o)}}function DE(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=pf(n);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function OE(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&mf.call(e.properties,i)){const s=$E(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&NE.has(e.tagName)?n=a:r[o]=a}}if(n){const s=r.style||(r.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function RE(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(r,t.evaluater.evaluateExpression(a.argument))}else ta(t,e.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const a=n.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else ta(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function xf(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:TE;for(;++n<e.children.length;){const s=e.children[n];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=By(t,s,o);a!==void 0&&r.push(a)}return r}function $E(t,e,r){const n=fE(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?eE(r):xE(r)),n.property==="style"){let i=typeof r=="object"?r:zE(t,String(r));return t.stylePropertyNameCase==="css"&&(i=WE(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?hE[n.property]||n.property:n.attribute,r]}}function zE(t,e){try{return wE(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Qe("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=Ly+"#cannot-parse-style-attribute",i}}function My(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=dm(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}n=o}else n=dm(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return mf.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);ta(t)}function ta(t,e){const r=new Qe("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=Ly+"#cannot-handle-mdx-estrees-without-createevaluater",r}function WE(t){const e={};let r;for(r in t)mf.call(t,r)&&(e[qE(r)]=t[r]);return e}function qE(t){let e=t.replace(_E,HE);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function HE(t){return"-"+t.toLowerCase()}const _h={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},UE={};function yf(t,e){const r=UE,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Iy(t,n,i)}function Iy(t,e,r){if(GE(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return vm(t.children,e,r)}return Array.isArray(t)?vm(t,e,r):""}function vm(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=Iy(t[i],e,r);return n.join("")}function GE(t){return!!(t&&typeof t=="object")}const wm=document.createElement("i");function bf(t){const e="&"+t+";";wm.innerHTML=e;const r=wm.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function Tr(t,e,r,n){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Ar(t,e){return t.length>0?(Tr(t,t.length,0,e),t):e}const Sm={}.hasOwnProperty;function Fy(t){const e={};let r=-1;for(;++r<t.length;)YE(e,t[r]);return e}function YE(t,e){let r;for(r in e){const i=(Sm.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Sm.call(i,o)||(i[o]=[]);const a=s[o];VE(i[o],Array.isArray(a)?a:a?[a]:[])}}}function VE(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);Tr(t,0,0,n)}function Py(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ur(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ir=ri(/[A-Za-z]/),Ke=ri(/[\dA-Za-z]/),XE=ri(/[#-'*+\--9=?A-Z^-~]/);function Wl(t){return t!==null&&(t<32||t===127)}const Wu=ri(/\d/),KE=ri(/[\dA-Fa-f]/),ZE=ri(/[!-/:-@[-`{-~]/);function Bt(t){return t!==null&&t<-2}function ue(t){return t!==null&&(t<0||t===32)}function Zt(t){return t===-2||t===-1||t===32}const Pc=ri(new RegExp("\\p{P}|\\p{S}","u")),Ti=ri(/\s/);function ri(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Xs(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&Ke(t.charCodeAt(r+1))&&Ke(t.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(r+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function te(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Zt(l)?(t.enter(r),a(l)):e(l)}function a(l){return Zt(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const QE={tokenize:JE};function JE(t){const e=t.attempt(this.parser.constructs.contentInitial,n,i);let r;return e;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),te(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return Bt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const tN={tokenize:eN},Tm={tokenize:rN};function eN(t){const e=this,r=[];let n=0,i,s,o;return a;function a(k){if(n<r.length){const T=r[n];return e.containerState=T[1],t.attempt(T[0].continuation,l,c)(k)}return c(k)}function l(k){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();const T=e.events.length;let _=T,w;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){w=e.events[_][1].end;break}y(n);let N=T;for(;N<e.events.length;)e.events[N][1].end={...w},N++;return Tr(e.events,_+1,0,e.events.slice(T)),e.events.length=N,c(k)}return a(k)}function c(k){if(n===r.length){if(!i)return p(k);if(i.currentConstruct&&i.currentConstruct.concrete)return m(k);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Tm,u,d)(k)}function u(k){return i&&b(),y(n),p(k)}function d(k){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,m(k)}function p(k){return e.containerState={},t.attempt(Tm,f,m)(k)}function f(k){return n++,r.push([e.currentConstruct,e.containerState]),p(k)}function m(k){if(k===null){i&&b(),y(0),t.consume(k);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(k)}function x(k){if(k===null){g(t.exit("chunkFlow"),!0),y(0),t.consume(k);return}return Bt(k)?(t.consume(k),g(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(k),x)}function g(k,T){const _=e.sliceStream(k);if(T&&_.push(null),k.previous=s,s&&(s.next=k),s=k,i.defineSkip(k.start),i.write(_),e.parser.lazy[k.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<o&&(!i.events[w][1].end||i.events[w][1].end.offset>o))return;const N=e.events.length;let B=N,I,E;for(;B--;)if(e.events[B][0]==="exit"&&e.events[B][1].type==="chunkFlow"){if(I){E=e.events[B][1].end;break}I=!0}for(y(n),w=N;w<e.events.length;)e.events[w][1].end={...E},w++;Tr(e.events,B+1,0,e.events.slice(N)),e.events.length=w}}function y(k){let T=r.length;for(;T-- >k;){const _=r[T];e.containerState=_[1],_[0].exit.call(e,t)}r.length=k}function b(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function rN(t,e,r){return te(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fs(t){if(t===null||ue(t)||Ti(t))return 1;if(Pc(t))return 2}function Dc(t,e,r){const n=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!n.includes(s)&&(e=s(e,r),n.push(s))}return e}const qu={name:"attention",resolveAll:nN,tokenize:iN};function nN(t,e){let r=-1,n,i,s,o,a,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const d={...t[n][1].end},p={...t[r][1].start};_m(d,-l),_m(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[n][1].end={...o.start},t[r][1].start={...a.end},c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Ar(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Ar(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Ar(c,Dc(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=Ar(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=Ar(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,Tr(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function iN(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Fs(n);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),u=Fs(l),d=!u||u===2&&i||r.includes(l),p=!i||i===2&&u||r.includes(n);return c._open=!!(s===42?d:d&&(i||!p)),c._close=!!(s===42?p:p&&(u||!d)),e(l)}}function _m(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const sN={name:"autolink",tokenize:oN};function oN(t,e,r){let n=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return ir(f)?(t.consume(f),o):f===64?r(f):c(f)}function o(f){return f===43||f===45||f===46||Ke(f)?(n=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),n=0,l):(f===43||f===45||f===46||Ke(f))&&n++<32?(t.consume(f),a):(n=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Wl(f)?r(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):XE(f)?(t.consume(f),c):r(f)}function u(f){return Ke(f)?d(f):r(f)}function d(f){return f===46?(t.consume(f),n=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):p(f)}function p(f){if((f===45||Ke(f))&&n++<63){const m=f===45?p:d;return t.consume(f),m}return r(f)}}const xa={partial:!0,tokenize:aN};function aN(t,e,r){return n;function n(s){return Zt(s)?te(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Bt(s)?e(s):r(s)}}const Dy={continuation:{tokenize:cN},exit:hN,name:"blockQuote",tokenize:lN};function lN(t,e,r){const n=this;return i;function i(o){if(o===62){const a=n.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return r(o)}function s(o){return Zt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function cN(t,e,r){const n=this;return i;function i(o){return Zt(o)?te(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(Dy,e,r)(o)}}function hN(t){t.exit("blockQuote")}const Oy={name:"characterEscape",tokenize:uN};function uN(t,e,r){return n;function n(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return ZE(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const Ry={name:"characterReference",tokenize:dN};function dN(t,e,r){const n=this;let i=0,s,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=Ke,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=KE,u):(t.enter("characterReferenceValue"),s=7,o=Wu,u(d))}function u(d){if(d===59&&i){const p=t.exit("characterReferenceValue");return o===Ke&&!bf(n.sliceSerialize(p))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<s?(t.consume(d),u):r(d)}}const Em={partial:!0,tokenize:pN},Nm={concrete:!0,name:"codeFenced",tokenize:fN};function fN(t,e,r){const n=this,i={partial:!0,tokenize:_};let s=0,o=0,a;return l;function l(w){return c(w)}function c(w){const N=n.events[n.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=w,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===a?(o++,t.consume(w),u):o<3?r(w):(t.exit("codeFencedFenceSequence"),Zt(w)?te(t,d,"whitespace")(w):d(w))}function d(w){return w===null||Bt(w)?(t.exit("codeFencedFence"),n.interrupt?e(w):t.check(Em,x,T)(w)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||Bt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(w)):Zt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),te(t,f,"whitespace")(w)):w===96&&w===a?r(w):(t.consume(w),p)}function f(w){return w===null||Bt(w)?d(w):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||Bt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(w)):w===96&&w===a?r(w):(t.consume(w),m)}function x(w){return t.attempt(i,T,g)(w)}function g(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),y}function y(w){return s>0&&Zt(w)?te(t,b,"linePrefix",s+1)(w):b(w)}function b(w){return w===null||Bt(w)?t.check(Em,x,T)(w):(t.enter("codeFlowValue"),k(w))}function k(w){return w===null||Bt(w)?(t.exit("codeFlowValue"),b(w)):(t.consume(w),k)}function T(w){return t.exit("codeFenced"),e(w)}function _(w,N,B){let I=0;return E;function E(F){return w.enter("lineEnding"),w.consume(F),w.exit("lineEnding"),P}function P(F){return w.enter("codeFencedFence"),Zt(F)?te(w,z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):z(F)}function z(F){return F===a?(w.enter("codeFencedFenceSequence"),q(F)):B(F)}function q(F){return F===a?(I++,w.consume(F),q):I>=o?(w.exit("codeFencedFenceSequence"),Zt(F)?te(w,R,"whitespace")(F):R(F)):B(F)}function R(F){return F===null||Bt(F)?(w.exit("codeFencedFence"),N(F)):B(F)}}}function pN(t,e,r){const n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}const Eh={name:"codeIndented",tokenize:gN},mN={partial:!0,tokenize:xN};function gN(t,e,r){const n=this;return i;function i(c){return t.enter("codeIndented"),te(t,s,"linePrefix",5)(c)}function s(c){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?l(c):Bt(c)?t.attempt(mN,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Bt(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function xN(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Bt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):te(t,s,"linePrefix",5)(o)}function s(o){const a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Bt(o)?i(o):r(o)}}const yN={name:"codeText",previous:CN,resolve:bN,tokenize:kN};function bN(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function CN(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function kN(t,e,r){let n=0,i,s;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),n++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?r(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,u(d)):Bt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Bt(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),i++,u):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",c(d))}}class vN{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const i=r||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&fo(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),fo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),fo(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);fo(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);fo(this.left,r.reverse())}}}function fo(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function $y(t){const e={};let r=-1,n,i,s,o,a,l,c;const u=new vN(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,wN(u,r)),r=e[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...u.get(i)[1].start},a=u.slice(i,r),a.unshift(n),u.splice(i,r-i+1,a))}}return Tr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function wN(t,e){const r=t.get(e)[1],n=t.get(e)[2];let i=e-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,p=-1,f=r,m=0,x=0;const g=[x];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=n.sliceStream(f),f.next||u.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=r;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(x=p+1,g.push(x),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),p=g.length;p--;){const y=a.slice(g[p],g[p+1]),b=s.pop();l.push([b,b+y.length-1]),t.splice(b,2,y)}for(l.reverse(),p=-1;++p<l.length;)c[m+l[p][0]]=m+l[p][1],m+=l[p][1]-l[p][0]-1;return c}const SN={resolve:_N,tokenize:EN},TN={partial:!0,tokenize:NN};function _N(t){return $y(t),t}function EN(t,e){let r;return n;function n(a){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):Bt(a)?t.check(TN,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function NN(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),te(t,s,"linePrefix")}function s(o){if(o===null||Bt(o))return r(o);const a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function zy(t,e,r,n,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(y){return y===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(y),t.exit(s),p):y===null||y===32||y===41||Wl(y)?r(y):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(t.enter(s),t.consume(y),t.exit(s),t.exit(i),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(t.exit("chunkString"),t.exit(a),p(y)):y===null||y===60||Bt(y)?r(y):(t.consume(y),y===92?m:f)}function m(y){return y===60||y===62||y===92?(t.consume(y),f):f(y)}function x(y){return!u&&(y===null||y===41||ue(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(y)):u<c&&y===40?(t.consume(y),u++,x):y===41?(t.consume(y),u--,x):y===null||y===32||y===40||Wl(y)?r(y):(t.consume(y),y===92?g:x)}function g(y){return y===40||y===41||y===92?(t.consume(y),x):x(y)}}function Wy(t,e,r,n,i,s){const o=this;let a=0,l;return c;function c(f){return t.enter(n),t.enter(i),t.consume(f),t.exit(i),t.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):Bt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Bt(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!Zt(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function qy(t,e,r,n,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(t.enter(n),t.enter(i),t.consume(p),t.exit(i),o=p===40?41:p,l):r(p)}function l(p){return p===o?(t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):(t.enter(s),c(p))}function c(p){return p===o?(t.exit(s),l(o)):p===null?r(p):Bt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),te(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===o||p===null||Bt(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?d:u)}function d(p){return p===o||p===92?(t.consume(p),u):u(p)}}function Wo(t,e){let r;return n;function n(i){return Bt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Zt(i)?te(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const jN={name:"definition",tokenize:BN},LN={partial:!0,tokenize:AN};function BN(t,e,r){const n=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return Wy.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Ur(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):r(f)}function l(f){return ue(f)?Wo(t,c)(f):c(f)}function c(f){return zy(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(LN,d,d)(f)}function d(f){return Zt(f)?te(t,p,"whitespace")(f):p(f)}function p(f){return f===null||Bt(f)?(t.exit("definition"),n.parser.defined.push(i),e(f)):r(f)}}function AN(t,e,r){return n;function n(a){return ue(a)?Wo(t,i)(a):r(a)}function i(a){return qy(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Zt(a)?te(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Bt(a)?e(a):r(a)}}const MN={name:"hardBreakEscape",tokenize:IN};function IN(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Bt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const FN={name:"headingAtx",resolve:PN,tokenize:DN};function PN(t,e){let r=t.length-2,n=3,i,s;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},s={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},Tr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function DN(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(t.consume(u),o):u===null||ue(u)?(t.exit("atxHeadingSequence"),a(u)):r(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Bt(u)?(t.exit("atxHeading"),e(u)):Zt(u)?te(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||ue(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const ON=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],jm=["pre","script","style","textarea"],RN={concrete:!0,name:"htmlFlow",resolveTo:WN,tokenize:qN},$N={partial:!0,tokenize:UN},zN={partial:!0,tokenize:HN};function WN(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function qN(t,e,r){const n=this;let i,s,o,a,l;return c;function c(A){return u(A)}function u(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),d}function d(A){return A===33?(t.consume(A),p):A===47?(t.consume(A),s=!0,x):A===63?(t.consume(A),i=3,n.interrupt?e:S):ir(A)?(t.consume(A),o=String.fromCharCode(A),g):r(A)}function p(A){return A===45?(t.consume(A),i=2,f):A===91?(t.consume(A),i=5,a=0,m):ir(A)?(t.consume(A),i=4,n.interrupt?e:S):r(A)}function f(A){return A===45?(t.consume(A),n.interrupt?e:S):r(A)}function m(A){const ct="CDATA[";return A===ct.charCodeAt(a++)?(t.consume(A),a===ct.length?n.interrupt?e:z:m):r(A)}function x(A){return ir(A)?(t.consume(A),o=String.fromCharCode(A),g):r(A)}function g(A){if(A===null||A===47||A===62||ue(A)){const ct=A===47,ut=o.toLowerCase();return!ct&&!s&&jm.includes(ut)?(i=1,n.interrupt?e(A):z(A)):ON.includes(o.toLowerCase())?(i=6,ct?(t.consume(A),y):n.interrupt?e(A):z(A)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):s?b(A):k(A))}return A===45||Ke(A)?(t.consume(A),o+=String.fromCharCode(A),g):r(A)}function y(A){return A===62?(t.consume(A),n.interrupt?e:z):r(A)}function b(A){return Zt(A)?(t.consume(A),b):E(A)}function k(A){return A===47?(t.consume(A),E):A===58||A===95||ir(A)?(t.consume(A),T):Zt(A)?(t.consume(A),k):E(A)}function T(A){return A===45||A===46||A===58||A===95||Ke(A)?(t.consume(A),T):_(A)}function _(A){return A===61?(t.consume(A),w):Zt(A)?(t.consume(A),_):k(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(t.consume(A),l=A,N):Zt(A)?(t.consume(A),w):B(A)}function N(A){return A===l?(t.consume(A),l=null,I):A===null||Bt(A)?r(A):(t.consume(A),N)}function B(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||ue(A)?_(A):(t.consume(A),B)}function I(A){return A===47||A===62||Zt(A)?k(A):r(A)}function E(A){return A===62?(t.consume(A),P):r(A)}function P(A){return A===null||Bt(A)?z(A):Zt(A)?(t.consume(A),P):r(A)}function z(A){return A===45&&i===2?(t.consume(A),M):A===60&&i===1?(t.consume(A),D):A===62&&i===4?(t.consume(A),G):A===63&&i===3?(t.consume(A),S):A===93&&i===5?(t.consume(A),j):Bt(A)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check($N,Q,q)(A)):A===null||Bt(A)?(t.exit("htmlFlowData"),q(A)):(t.consume(A),z)}function q(A){return t.check(zN,R,Q)(A)}function R(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),F}function F(A){return A===null||Bt(A)?q(A):(t.enter("htmlFlowData"),z(A))}function M(A){return A===45?(t.consume(A),S):z(A)}function D(A){return A===47?(t.consume(A),o="",O):z(A)}function O(A){if(A===62){const ct=o.toLowerCase();return jm.includes(ct)?(t.consume(A),G):z(A)}return ir(A)&&o.length<8?(t.consume(A),o+=String.fromCharCode(A),O):z(A)}function j(A){return A===93?(t.consume(A),S):z(A)}function S(A){return A===62?(t.consume(A),G):A===45&&i===2?(t.consume(A),S):z(A)}function G(A){return A===null||Bt(A)?(t.exit("htmlFlowData"),Q(A)):(t.consume(A),G)}function Q(A){return t.exit("htmlFlow"),e(A)}}function HN(t,e,r){const n=this;return i;function i(o){return Bt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function UN(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(xa,e,r)}}const GN={name:"htmlText",tokenize:YN};function YN(t,e,r){const n=this;let i,s,o;return a;function a(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),c):S===47?(t.consume(S),_):S===63?(t.consume(S),k):ir(S)?(t.consume(S),B):r(S)}function c(S){return S===45?(t.consume(S),u):S===91?(t.consume(S),s=0,m):ir(S)?(t.consume(S),b):r(S)}function u(S){return S===45?(t.consume(S),f):r(S)}function d(S){return S===null?r(S):S===45?(t.consume(S),p):Bt(S)?(o=d,D(S)):(t.consume(S),d)}function p(S){return S===45?(t.consume(S),f):d(S)}function f(S){return S===62?M(S):S===45?p(S):d(S)}function m(S){const G="CDATA[";return S===G.charCodeAt(s++)?(t.consume(S),s===G.length?x:m):r(S)}function x(S){return S===null?r(S):S===93?(t.consume(S),g):Bt(S)?(o=x,D(S)):(t.consume(S),x)}function g(S){return S===93?(t.consume(S),y):x(S)}function y(S){return S===62?M(S):S===93?(t.consume(S),y):x(S)}function b(S){return S===null||S===62?M(S):Bt(S)?(o=b,D(S)):(t.consume(S),b)}function k(S){return S===null?r(S):S===63?(t.consume(S),T):Bt(S)?(o=k,D(S)):(t.consume(S),k)}function T(S){return S===62?M(S):k(S)}function _(S){return ir(S)?(t.consume(S),w):r(S)}function w(S){return S===45||Ke(S)?(t.consume(S),w):N(S)}function N(S){return Bt(S)?(o=N,D(S)):Zt(S)?(t.consume(S),N):M(S)}function B(S){return S===45||Ke(S)?(t.consume(S),B):S===47||S===62||ue(S)?I(S):r(S)}function I(S){return S===47?(t.consume(S),M):S===58||S===95||ir(S)?(t.consume(S),E):Bt(S)?(o=I,D(S)):Zt(S)?(t.consume(S),I):M(S)}function E(S){return S===45||S===46||S===58||S===95||Ke(S)?(t.consume(S),E):P(S)}function P(S){return S===61?(t.consume(S),z):Bt(S)?(o=P,D(S)):Zt(S)?(t.consume(S),P):I(S)}function z(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(t.consume(S),i=S,q):Bt(S)?(o=z,D(S)):Zt(S)?(t.consume(S),z):(t.consume(S),R)}function q(S){return S===i?(t.consume(S),i=void 0,F):S===null?r(S):Bt(S)?(o=q,D(S)):(t.consume(S),q)}function R(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||ue(S)?I(S):(t.consume(S),R)}function F(S){return S===47||S===62||ue(S)?I(S):r(S)}function M(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):r(S)}function D(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),O}function O(S){return Zt(S)?te(t,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):j(S)}function j(S){return t.enter("htmlTextData"),o(S)}}const Cf={name:"labelEnd",resolveAll:ZN,resolveTo:QN,tokenize:JN},VN={tokenize:tj},XN={tokenize:ej},KN={tokenize:rj};function ZN(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",e+=i}}return t.length!==r.length&&Tr(t,0,t.length,r),t}function QN(t,e){let r=t.length,n=0,i,s,o,a;for(;r--;)if(i=t[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+n+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=Ar(a,t.slice(s+1,s+n+3)),a=Ar(a,[["enter",u,e]]),a=Ar(a,Dc(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Ar(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=Ar(a,t.slice(o+1)),a=Ar(a,[["exit",l,e]]),Tr(t,s,t.length,a),t}function JN(t,e,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return a;function a(p){return s?s._inactive?d(p):(o=n.parser.defined.includes(Ur(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),l):r(p)}function l(p){return p===40?t.attempt(VN,u,o?u:d)(p):p===91?t.attempt(XN,u,o?c:d)(p):o?u(p):d(p)}function c(p){return t.attempt(KN,u,d)(p)}function u(p){return e(p)}function d(p){return s._balanced=!0,r(p)}}function tj(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return ue(d)?Wo(t,s)(d):s(d)}function s(d){return d===41?u(d):zy(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ue(d)?Wo(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?qy(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ue(d)?Wo(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function ej(t,e,r){const n=this;return i;function i(a){return Wy.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(Ur(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function rj(t,e,r){return n;function n(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):r(s)}}const nj={name:"labelStartImage",resolveAll:Cf.resolveAll,tokenize:ij};function ij(t,e,r){const n=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):r(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):e(a)}}const sj={name:"labelStartLink",resolveAll:Cf.resolveAll,tokenize:oj};function oj(t,e,r){const n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const Nh={name:"lineEnding",tokenize:aj};function aj(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),te(t,e,"linePrefix")}}const vl={name:"thematicBreak",tokenize:lj};function lj(t,e,r){let n=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||Bt(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),Zt(c)?te(t,a,"whitespace")(c):a(c))}}const pr={continuation:{tokenize:dj},exit:pj,name:"list",tokenize:uj},cj={partial:!0,tokenize:mj},hj={partial:!0,tokenize:fj};function uj(t,e,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const m=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:Wu(f)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(vl,r,c)(f):c(f);if(!n.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return r(f)}function l(f){return Wu(f)&&++o<10?(t.consume(f),l):(!n.interrupt||o<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):r(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,t.check(xa,n.interrupt?r:u,t.attempt(cj,p,d))}function u(f){return n.containerState.initialBlankLine=!0,s++,p(f)}function d(f){return Zt(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),p):r(f)}function p(f){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function dj(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(xa,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,te(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Zt(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(hj,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,te(t,t.attempt(pr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function fj(t,e,r){const n=this;return te(t,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(s):r(s)}}function pj(t){t.exit(this.containerState.type)}function mj(t,e,r){const n=this;return te(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!Zt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const Lm={name:"setextUnderline",resolveTo:gj,tokenize:xj};function gj(t,e){let r=t.length,n,i,s;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!s&&t[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[n][1],e]),t[n][1].end={...t[s][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function xj(t,e,r){const n=this;let i;return s;function s(c){let u=n.events.length,d;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){d=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Zt(c)?te(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Bt(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}const yj={tokenize:bj};function bj(t){const e=this,r=t.attempt(xa,n,t.attempt(this.parser.constructs.flowInitial,i,te(t,t.attempt(this.parser.constructs.flow,i,t.attempt(SN,i)),"linePrefix")));return r;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const Cj={resolveAll:Uy()},kj=Hy("string"),vj=Hy("text");function Hy(t){return{resolveAll:Uy(t==="text"?wj:void 0),tokenize:e};function e(r){const n=this,i=this.parser.constructs[t],s=r.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),s(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function Uy(t){return e;function e(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(r,n):r}}function wj(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],i=e.sliceStream(n);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const c={type:r===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-a,offset:n.end.offset-a},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}const Sj={42:pr,43:pr,45:pr,48:pr,49:pr,50:pr,51:pr,52:pr,53:pr,54:pr,55:pr,56:pr,57:pr,62:Dy},Tj={91:jN},_j={[-2]:Eh,[-1]:Eh,32:Eh},Ej={35:FN,42:vl,45:[Lm,vl],60:RN,61:Lm,95:vl,96:Nm,126:Nm},Nj={38:Ry,92:Oy},jj={[-5]:Nh,[-4]:Nh,[-3]:Nh,33:nj,38:Ry,42:qu,60:[sN,GN],91:sj,92:[MN,Oy],93:Cf,95:qu,96:yN},Lj={null:[qu,Cj]},Bj={null:[42,95]},Aj={null:[]},Mj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Bj,contentInitial:Tj,disable:Aj,document:Sj,flow:Ej,flowInitial:_j,insideSpan:Lj,string:Nj,text:jj},Symbol.toStringTag,{value:"Module"}));function Ij(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:N(_),check:N(w),consume:b,enter:k,exit:T,interrupt:N(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:t,previous:null,sliceSerialize:p,sliceStream:f,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function d(P){return o=Ar(o,P),g(),o[o.length-1]!==null?[]:(B(e,0),c.events=Dc(s,c.events,c),c.events)}function p(P,z){return Pj(f(P),z)}function f(P){return Fj(o,P)}function m(){const{_bufferIndex:P,_index:z,line:q,column:R,offset:F}=n;return{_bufferIndex:P,_index:z,line:q,column:R,offset:F}}function x(P){i[P.line]=P.column,E()}function g(){let P;for(;n._index<o.length;){const z=o[n._index];if(typeof z=="string")for(P=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===P&&n._bufferIndex<z.length;)y(z.charCodeAt(n._bufferIndex));else y(z)}}function y(P){u=u(P)}function b(P){Bt(P)?(n.line++,n.column=1,n.offset+=P===-3?2:1,E()):P!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=P}function k(P,z){const q=z||{};return q.type=P,q.start=m(),c.events.push(["enter",q,c]),a.push(q),q}function T(P){const z=a.pop();return z.end=m(),c.events.push(["exit",z,c]),z}function _(P,z){B(P,z.from)}function w(P,z){z.restore()}function N(P,z){return q;function q(R,F,M){let D,O,j,S;return Array.isArray(R)?Q(R):"tokenize"in R?Q([R]):G(R);function G(st){return It;function It(ht){const ot=ht!==null&&st[ht],Y=ht!==null&&st.null,lt=[...Array.isArray(ot)?ot:ot?[ot]:[],...Array.isArray(Y)?Y:Y?[Y]:[]];return Q(lt)(ht)}}function Q(st){return D=st,O=0,st.length===0?M:A(st[O])}function A(st){return It;function It(ht){return S=I(),j=st,st.partial||(c.currentConstruct=st),st.name&&c.parser.constructs.disable.null.includes(st.name)?ut():st.tokenize.call(z?Object.assign(Object.create(c),z):c,l,ct,ut)(ht)}}function ct(st){return P(j,S),F}function ut(st){return S.restore(),++O<D.length?A(D[O]):M}}}function B(P,z){P.resolveAll&&!s.includes(P)&&s.push(P),P.resolve&&Tr(c.events,z,c.events.length-z,P.resolve(c.events.slice(z),c)),P.resolveTo&&(c.events=P.resolveTo(c.events,c))}function I(){const P=m(),z=c.previous,q=c.currentConstruct,R=c.events.length,F=Array.from(a);return{from:R,restore:M};function M(){n=P,c.previous=z,c.currentConstruct=q,c.events.length=R,a=F,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function Fj(t,e){const r=e.start._index,n=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(r===i)o=[t[r].slice(n,s)];else{if(o=t.slice(r,i),n>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(n):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function Pj(t,e){let r=-1;const n=[];let i;for(;++r<t.length;){const s=t[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
7
|
-
`;break}case-3:{o=`\r
|
|
8
|
-
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function Dj(t){const n={constructs:Fy([Mj,...(t||{}).extensions||[]]),content:i(QE),defined:[],document:i(tN),flow:i(yj),lazy:{},string:i(kj),text:i(vj)};return n;function i(s){return o;function o(a){return Ij(n,s,a)}}}function Oj(t){for(;!$y(t););return t}const Bm=/[\0\t\n\r]/g;function Rj(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let c,u,d,p,f;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,e="",r&&(s.charCodeAt(0)===65279&&d++,r=void 0);d<s.length;){if(Bm.lastIndex=d,c=Bm.exec(s),p=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(p),!c){e=s.slice(d);break}if(f===10&&d===p&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<p&&(l.push(s.slice(d,p)),t+=p-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=p+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const $j=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zj(t){return t.replace($j,Wj)}function Wj(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return Py(r.slice(s?2:1),s?16:10)}return bf(r)||t}const Gy={}.hasOwnProperty;function qj(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),Hj(r)(Oj(Dj(r).document().write(Rj()(t,e,!0))))}function Hj(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(we),autolinkProtocol:I,autolinkEmail:I,atxHeading:s(le),blockQuote:s(Y),characterEscape:I,characterReference:I,codeFenced:s(lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(lt,o),codeText:s(xt,o),codeTextData:I,data:I,codeFlowValue:I,definition:s(Nt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Dt),hardBreakEscape:s(be),hardBreakTrailing:s(be),htmlFlow:s(tr,o),htmlFlowData:I,htmlText:s(tr,o),htmlTextData:I,image:s(Kt),label:o,link:s(we),listItem:s(it),listItemValue:p,listOrdered:s(V,d),listUnordered:s(V),paragraph:s(ft),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(le),strong:s(_t),thematicBreak:s(bt)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:ot,autolinkProtocol:ht,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ut,characterReferenceMarkerNumeric:ut,characterReferenceValue:st,characterReference:It,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:l(y),codeText:l(F),codeTextData:E,data:E,definition:l(),definitionDestinationString:T,definitionLabelString:b,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(q),htmlFlowData:E,htmlText:l(R),htmlTextData:E,image:l(D),label:j,labelText:O,lineEnding:P,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ct,resourceDestinationString:S,resourceTitleString:G,resource:Q,setextHeading:l(B),setextHeadingLineSequence:N,setextHeadingText:w,strong:l(),thematicBreak:l()}};Yy(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(U){let nt={type:"root",children:[]};const jt={stack:[nt],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:r},Wt=[];let Ut=-1;for(;++Ut<U.length;)if(U[Ut][1].type==="listOrdered"||U[Ut][1].type==="listUnordered")if(U[Ut][0]==="enter")Wt.push(Ut);else{const fe=Wt.pop();Ut=i(U,fe,Ut)}for(Ut=-1;++Ut<U.length;){const fe=e[U[Ut][0]];Gy.call(fe,U[Ut][1].type)&&fe[U[Ut][1].type].call(Object.assign({sliceSerialize:U[Ut][2].sliceSerialize},jt),U[Ut][1])}if(jt.tokenStack.length>0){const fe=jt.tokenStack[jt.tokenStack.length-1];(fe[1]||Am).call(jt,void 0,fe[0])}for(nt.position={start:Pn(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Pn(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},Ut=-1;++Ut<e.transforms.length;)nt=e.transforms[Ut](nt)||nt;return nt}function i(U,nt,jt){let Wt=nt-1,Ut=-1,fe=!1,Ce,de,Dr,Re;for(;++Wt<=jt;){const Se=U[Wt];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?Ut++:Ut--,Re=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(Ce&&!Re&&!Ut&&!Dr&&(Dr=Wt),Re=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Re=void 0}if(!Ut&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||Ut===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(Ce){let jr=Wt;for(de=void 0;jr--;){const He=U[jr];if(He[1].type==="lineEnding"||He[1].type==="lineEndingBlank"){if(He[0]==="exit")continue;de&&(U[de][1].type="lineEndingBlank",fe=!0),He[1].type="lineEnding",de=jr}else if(!(He[1].type==="linePrefix"||He[1].type==="blockQuotePrefix"||He[1].type==="blockQuotePrefixWhitespace"||He[1].type==="blockQuoteMarker"||He[1].type==="listItemIndent"))break}Dr&&(!de||Dr<de)&&(Ce._spread=!0),Ce.end=Object.assign({},de?U[de][1].start:Se[1].end),U.splice(de||Wt,0,["exit",Ce,Se[2]]),Wt++,jt++}if(Se[1].type==="listItemPrefix"){const jr={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};Ce=jr,U.splice(Wt,0,["enter",jr,Se[2]]),Wt++,jt++,Dr=void 0,Re=!0}}}return U[nt][1]._spread=fe,jt}function s(U,nt){return jt;function jt(Wt){a.call(this,U(Wt),Wt),nt&&nt.call(this,Wt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(U,nt,jt){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([nt,jt||void 0]),U.position={start:Pn(nt.start),end:void 0}}function l(U){return nt;function nt(jt){U&&U.call(this,jt),c.call(this,jt)}}function c(U,nt){const jt=this.stack.pop(),Wt=this.tokenStack.pop();if(Wt)Wt[0].type!==U.type&&(nt?nt.call(this,U,Wt[0]):(Wt[1]||Am).call(this,U,Wt[0]));else throw new Error("Cannot close `"+U.type+"` ("+zo({start:U.start,end:U.end})+"): it’s not open");jt.position.end=Pn(U.end)}function u(){return yf(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(U){if(this.data.expectingFirstListItemValue){const nt=this.stack[this.stack.length-2];nt.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function f(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.lang=U}function m(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.meta=U}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U.replace(/(\r?\n|\r)$/g,"")}function b(U){const nt=this.resume(),jt=this.stack[this.stack.length-1];jt.label=nt,jt.identifier=Ur(this.sliceSerialize(U)).toLowerCase()}function k(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.title=U}function T(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.url=U}function _(U){const nt=this.stack[this.stack.length-1];if(!nt.depth){const jt=this.sliceSerialize(U).length;nt.depth=jt}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function N(U){const nt=this.stack[this.stack.length-1];nt.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function I(U){const jt=this.stack[this.stack.length-1].children;let Wt=jt[jt.length-1];(!Wt||Wt.type!=="text")&&(Wt=et(),Wt.position={start:Pn(U.start),end:void 0},jt.push(Wt)),this.stack.push(Wt)}function E(U){const nt=this.stack.pop();nt.value+=this.sliceSerialize(U),nt.position.end=Pn(U.end)}function P(U){const nt=this.stack[this.stack.length-1];if(this.data.atHardBreak){const jt=nt.children[nt.children.length-1];jt.position.end=Pn(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(nt.type)&&(I.call(this,U),E.call(this,U))}function z(){this.data.atHardBreak=!0}function q(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U}function R(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U}function F(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U}function M(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const nt=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=nt,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function D(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const nt=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=nt,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function O(U){const nt=this.sliceSerialize(U),jt=this.stack[this.stack.length-2];jt.label=zj(nt),jt.identifier=Ur(nt).toLowerCase()}function j(){const U=this.stack[this.stack.length-1],nt=this.resume(),jt=this.stack[this.stack.length-1];if(this.data.inReference=!0,jt.type==="link"){const Wt=U.children;jt.children=Wt}else jt.alt=nt}function S(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.url=U}function G(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.title=U}function Q(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ct(U){const nt=this.resume(),jt=this.stack[this.stack.length-1];jt.label=nt,jt.identifier=Ur(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function ut(U){this.data.characterReferenceType=U.type}function st(U){const nt=this.sliceSerialize(U),jt=this.data.characterReferenceType;let Wt;jt?(Wt=Py(nt,jt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Wt=bf(nt);const Ut=this.stack[this.stack.length-1];Ut.value+=Wt}function It(U){const nt=this.stack.pop();nt.position.end=Pn(U.end)}function ht(U){E.call(this,U);const nt=this.stack[this.stack.length-1];nt.url=this.sliceSerialize(U)}function ot(U){E.call(this,U);const nt=this.stack[this.stack.length-1];nt.url="mailto:"+this.sliceSerialize(U)}function Y(){return{type:"blockquote",children:[]}}function lt(){return{type:"code",lang:null,meta:null,value:""}}function xt(){return{type:"inlineCode",value:""}}function Nt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Dt(){return{type:"emphasis",children:[]}}function le(){return{type:"heading",depth:0,children:[]}}function be(){return{type:"break"}}function tr(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function we(){return{type:"link",title:null,url:"",children:[]}}function V(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function it(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function ft(){return{type:"paragraph",children:[]}}function _t(){return{type:"strong",children:[]}}function et(){return{type:"text",value:""}}function bt(){return{type:"thematicBreak"}}}function Pn(t){return{line:t.line,column:t.column,offset:t.offset}}function Yy(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?Yy(t,n):Uj(t,n)}}function Uj(t,e){let r;for(r in e)if(Gy.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function Am(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+zo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+zo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+zo({start:e.start,end:e.end})+") is still open")}function Gj(t){const e=this;e.parser=r;function r(n){return qj(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Yj(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function Vj(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
9
|
-
`}]}function Xj(t,e){const r=e.value?e.value+`
|
|
10
|
-
`:"",n={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Kj(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Zj(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Qj(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Xs(n.toLowerCase()),s=t.footnoteOrder.indexOf(n);let o,a=t.footnoteCounts.get(n);a===void 0?(a=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(n,a);const l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function Jj(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function t5(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function Vy(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function e5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Vy(t,e);const i={src:Xs(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function r5(t,e){const r={src:Xs(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function n5(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function i5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Vy(t,e);const i={href:Xs(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function s5(t,e){const r={href:Xs(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function o5(t,e,r){const n=t.all(e),i=r?a5(r):Xy(e),s={},o=[];if(typeof e.checked=="boolean"){const u=n[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<n.length;){const u=n[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
11
|
-
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
12
|
-
`});const c={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,c),t.applyData(e,c)}function a5(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=Xy(r[n])}return e}function Xy(t){const e=t.spread;return e??t.children.length>1}function l5(t,e){const r={},n=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,s),t.applyData(e,s)}function c5(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function h5(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function u5(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function d5(t,e){const r=t.all(e),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},a=pf(e.children[1]),l=Ny(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function f5(t,e,r){const n=r?r.children:void 0,s=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const d=e.children[l],p={},f=o?o[l]:void 0;f&&(p.align=f);let m={type:"element",tagName:s,properties:p,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function p5(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Mm=9,Im=32;function m5(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Fm(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Fm(e.slice(i),i>0,!1)),s.join("")}function Fm(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===Mm||s===Im;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===Mm||s===Im;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function g5(t,e){const r={type:"text",value:m5(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function x5(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const y5={blockquote:Yj,break:Vj,code:Xj,delete:Kj,emphasis:Zj,footnoteReference:Qj,heading:Jj,html:t5,imageReference:e5,image:r5,inlineCode:n5,linkReference:i5,link:s5,listItem:o5,list:l5,paragraph:c5,root:h5,strong:u5,table:d5,tableCell:p5,tableRow:f5,text:g5,thematicBreak:x5,toml:za,yaml:za,definition:za,footnoteDefinition:za};function za(){}const Ky=-1,Oc=0,qo=1,ql=2,kf=3,vf=4,wf=5,Sf=6,Zy=7,Qy=8,b5=typeof self=="object"?self:globalThis,Pm=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new b5[t](e)},C5=(t,e)=>{const r=(i,s)=>(t.set(s,i),i),n=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Oc:case Ky:return r(o,i);case qo:{const a=r([],i);for(const l of o)a.push(n(l));return a}case ql:{const a=r({},i);for(const[l,c]of o)a[n(l)]=n(c);return a}case kf:return r(new Date(o),i);case vf:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case wf:{const a=r(new Map,i);for(const[l,c]of o)a.set(n(l),n(c));return a}case Sf:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case Zy:{const{name:a,message:l}=o;return r(Pm(a,l),i)}case Qy:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return r(new DataView(a),o)}}return r(Pm(s,o),i)};return n},Dm=t=>C5(new Map,t)(0),Gi="",{toString:k5}={},{keys:v5}=Object,po=t=>{const e=typeof t;if(e!=="object"||!t)return[Oc,e];const r=k5.call(t).slice(8,-1);switch(r){case"Array":return[qo,Gi];case"Object":return[ql,Gi];case"Date":return[kf,Gi];case"RegExp":return[vf,Gi];case"Map":return[wf,Gi];case"Set":return[Sf,Gi];case"DataView":return[qo,r]}return r.includes("Array")?[qo,r]:r.includes("Error")?[Zy,r]:[ql,r]},Wa=([t,e])=>t===Oc&&(e==="function"||e==="symbol"),w5=(t,e,r,n)=>{const i=(o,a)=>{const l=n.push(o)-1;return r.set(a,l),l},s=o=>{if(r.has(o))return r.get(o);let[a,l]=po(o);switch(a){case Oc:{let u=o;switch(l){case"bigint":a=Qy,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([Ky],o)}return i([a,u],o)}case qo:{if(l){let p=o;return l==="DataView"?p=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(o)),i([l,[...p]],o)}const u=[],d=i([a,u],o);for(const p of o)u.push(s(p));return d}case ql:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const u=[],d=i([a,u],o);for(const p of v5(o))(t||!Wa(po(o[p])))&&u.push([s(p),s(o[p])]);return d}case kf:return i([a,o.toISOString()],o);case vf:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case wf:{const u=[],d=i([a,u],o);for(const[p,f]of o)(t||!(Wa(po(p))||Wa(po(f))))&&u.push([s(p),s(f)]);return d}case Sf:{const u=[],d=i([a,u],o);for(const p of o)(t||!Wa(po(p)))&&u.push(s(p));return d}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},Om=(t,{json:e,lossy:r}={})=>{const n=[];return w5(!(e||r),!!e,new Map,n)(t),n},Hl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Dm(Om(t,e)):structuredClone(t):(t,e)=>Dm(Om(t,e));function S5(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function T5(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function _5(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||S5,n=t.options.footnoteBackLabel||T5,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const u=t.all(c),d=String(c.identifier).toUpperCase(),p=Xs(d.toLowerCase());let f=0;const m=[],x=t.footnoteCounts.get(d);for(;x!==void 0&&++f<=x;){m.length>0&&m.push({type:"text",value:" "});let b=typeof r=="string"?r:r(l,f);typeof b=="string"&&(b={type:"text",value:b}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const b=g.children[g.children.length-1];b&&b.type==="text"?b.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...m)}else u.push(...m);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(u,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Hl(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
13
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
|
|
14
|
-
`}]}}const Rc=(function(t){if(t==null)return L5;if(typeof t=="function")return $c(t);if(typeof t=="object")return Array.isArray(t)?E5(t):N5(t);if(typeof t=="string")return j5(t);throw new Error("Expected function, string, or object as test")});function E5(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=Rc(t[r]);return $c(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function N5(t){const e=t;return $c(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function j5(t){return $c(e);function e(r){return r&&r.type===t}}function $c(t){return e;function e(r,n,i){return!!(B5(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function L5(){return!0}function B5(t){return t!==null&&typeof t=="object"&&"type"in t}const Jy=[],A5=!0,Hu=!1,M5="skip";function tb(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=Rc(i),o=n?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Jy,m,x,g;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=I5(r(l,u)),f[0]===Hu))return f;if("children"in l&&l.children){const y=l;if(y.children&&f[0]!==M5)for(x=(n?y.children.length:-1)+o,g=u.concat(y);x>-1&&x<y.children.length;){const b=y.children[x];if(m=a(b,x,g)(),m[0]===Hu)return m;x=typeof m[1]=="number"?m[1]:x+o}}return f}}}function I5(t){return Array.isArray(t)?t:typeof t=="number"?[A5,t]:t==null?Jy:[t]}function Tf(t,e,r,n){let i,s,o;typeof e=="function"&&typeof r!="function"?(s=void 0,o=e,i=r):(s=e,o=r,i=n),tb(t,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const Uu={}.hasOwnProperty,F5={};function P5(t,e){const r=e||F5,n=new Map,i=new Map,s=new Map,o={...y5,...r.handlers},a={all:c,applyData:O5,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:D5,wrap:$5};return Tf(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?n:i,p=String(u.identifier).toUpperCase();d.has(p)||d.set(p,u)}}),a;function l(u,d){const p=u.type,f=a.handlers[p];if(Uu.call(a.handlers,p)&&f)return f(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in u){const{children:x,...g}=u,y=Hl(g);return y.children=a.all(u),y}return Hl(u)}return(a.options.unknownHandler||R5)(a,u,d)}function c(u){const d=[];if("children"in u){const p=u.children;let f=-1;for(;++f<p.length;){const m=a.one(p[f],u);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Rm(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=Rm(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function D5(t,e){t.position&&(e.position=SE(t))}function O5(t,e){let r=e;if(t&&t.data){const n=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,Hl(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function R5(t,e){const r=e.data||{},n="value"in e&&!(Uu.call(r,"hProperties")||Uu.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $5(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
|
|
15
|
-
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
16
|
-
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
17
|
-
`}),r}function Rm(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function $m(t,e){const r=P5(t,e),n=r.one(t,void 0),i=_5(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
18
|
-
`},i),s}function z5(t,e){return t&&"run"in t?async function(r,n){const i=$m(r,{file:n,...e});await t.run(i,n)}:function(r,n){return $m(r,{file:n,...t||e})}}function zm(t){if(t)throw t}var jh,Wm;function W5(){if(Wm)return jh;Wm=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var p;for(p in c);return typeof p>"u"||t.call(c,p)},o=function(c,u){r&&u.name==="__proto__"?r(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(n)return n(c,u).value}else return;return c[u]};return jh=function l(){var c,u,d,p,f,m,x=arguments[0],g=1,y=arguments.length,b=!1;for(typeof x=="boolean"&&(b=x,x=arguments[1]||{},g=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});g<y;++g)if(c=arguments[g],c!=null)for(u in c)d=a(x,u),p=a(c,u),x!==p&&(b&&p&&(s(p)||(f=i(p)))?(f?(f=!1,m=d&&i(d)?d:[]):m=d&&s(d)?d:{},o(x,{name:u,newValue:l(b,m,p)})):typeof p<"u"&&o(x,{name:u,newValue:p}));return x},jh}var q5=W5();const Lh=cf(q5);function Gu(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function H5(){const t=[],e={run:r,use:n};return e;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const u=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?U5(u,a)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function U5(t,e){let r;return n;function n(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&r)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){r||(r=!0,e(o,...a))}function s(o){i(null,o)}}const sn={basename:G5,dirname:Y5,extname:V5,join:X5,sep:"/"};function G5(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ya(t);let r=0,n=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function Y5(t){if(ya(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function V5(t){ya(t);let e=t.length,r=-1,n=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function X5(...t){let e=-1,r;for(;++e<t.length;)ya(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":K5(r)}function K5(t){ya(t);const e=t.codePointAt(0)===47;let r=Z5(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function Z5(t,e){let r="",n=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return r}function ya(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Q5={cwd:J5};function J5(){return"/"}function Yu(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function tL(t){if(typeof t=="string")t=new URL(t);else if(!Yu(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return eL(t)}function eL(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const Bh=["history","path","basename","stem","extname","dirname"];class eb{constructor(e){let r;e?Yu(e)?r={path:e}:typeof e=="string"||rL(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":Q5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Bh.length;){const s=Bh[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)Bh.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?sn.basename(this.path):void 0}set basename(e){Mh(e,"basename"),Ah(e,"basename"),this.path=sn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?sn.dirname(this.path):void 0}set dirname(e){qm(this.basename,"dirname"),this.path=sn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?sn.extname(this.path):void 0}set extname(e){if(Ah(e,"extname"),qm(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=sn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Yu(e)&&(e=tL(e)),Mh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?sn.basename(this.path,this.extname):void 0}set stem(e){Mh(e,"stem"),Ah(e,"stem"),this.path=sn.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){const i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){const i=new Qe(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Ah(t,e){if(t&&t.includes(sn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+sn.sep+"`")}function Mh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function qm(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function rL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const nL=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),iL={}.hasOwnProperty;class _f extends nL{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=H5()}copy(){const e=new _f;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Lh(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Ph("data",this.frozen),this.namespace[e]=r,this):iL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ph("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=qa(e),n=this.parser||this.Parser;return Ih("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Ih("process",this.parser||this.Parser),Fh("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=qa(e),l=n.parse(a);n.run(l,a,function(u,d,p){if(u||!d||!p)return c(u);const f=d,m=n.stringify(f,p);aL(m)?p.value=m:p.result=m,c(u,p)});function c(u,d){u||!d?o(u):s?s(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),Ih("processSync",this.parser||this.Parser),Fh("processSync",this.compiler||this.Compiler),this.process(e,i),Um("processSync","process",r),n;function i(s,o){r=!0,zm(s),n=o}}run(e,r,n){Hm(e),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,a){const l=qa(r);i.run(e,l,c);function c(u,d,p){const f=d||e;u?a(u):o?o(f):n(void 0,f,p)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),Um("runSync","run",n),i;function s(o,a){zm(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=qa(r),i=this.compiler||this.Compiler;return Fh("stringify",i),Hm(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(Ph("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=Lh(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===c){p=d;break}if(p===-1)n.push([c,...u]);else if(u.length>0){let[f,...m]=u;const x=n[p][1];Gu(x)&&Gu(f)&&(f=Lh(!0,x,f)),n[p]=[c,f,...m]}}}}const sL=new _f().freeze();function Ih(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Fh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ph(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Hm(t){if(!Gu(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Um(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function qa(t){return oL(t)?t:new eb(t)}function oL(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function aL(t){return typeof t=="string"||lL(t)}function lL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const cL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Gm=[],Ym={allowDangerousHtml:!0},hL=/^(https?|ircs?|mailto|xmpp)$/i,uL=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ef(t){const e=dL(t),r=fL(t);return pL(e.runSync(e.parse(r),r),t)}function dL(t){const e=t.rehypePlugins||Gm,r=t.remarkPlugins||Gm,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Ym}:Ym;return sL().use(Gj).use(r).use(z5,n).use(e)}function fL(t){const e=t.children||"",r=new eb;return typeof e=="string"&&(r.value=e),r}function pL(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||mL;for(const u of uL)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+cL+u.id,void 0);return Tf(t,c),jE(t,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,p){if(u.type==="raw"&&p&&typeof d=="number")return o?p.children.splice(d,1):p.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let f;for(f in _h)if(Object.hasOwn(_h,f)&&Object.hasOwn(u.properties,f)){const m=u.properties[f],x=_h[f];(x===null||x.includes(u.tagName))&&(u.properties[f]=l(String(m||""),f,u))}}if(u.type==="element"){let f=r?!r.includes(u.tagName):s?s.includes(u.tagName):!1;if(!f&&n&&typeof d=="number"&&(f=!n(u,d,p)),f&&p&&typeof d=="number")return a&&u.children?p.children.splice(d,1,...u.children):p.children.splice(d,1),d}}}function mL(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||r!==-1&&e>r||n!==-1&&e>n||hL.test(t.slice(0,e))?t:""}function Vm(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function gL(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xL(t,e,r){const i=Rc((r||{}).ignore||[]),s=yL(e);let o=-1;for(;++o<s.length;)tb(t,"text",a);function a(c,u){let d=-1,p;for(;++d<u.length;){const f=u[d],m=p?p.children:void 0;if(i(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return l(c,u)}function l(c,u){const d=u[u.length-1],p=s[o][0],f=s[o][1];let m=0;const g=d.children.indexOf(c);let y=!1,b=[];p.lastIndex=0;let k=p.exec(c.value);for(;k;){const T=k.index,_={index:k.index,input:k.input,stack:[...u,c]};let w=f(...k,_);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=T+1:(m!==T&&b.push({type:"text",value:c.value.slice(m,T)}),Array.isArray(w)?b.push(...w):w&&b.push(w),m=T+k[0].length,y=!0),!p.global)break;k=p.exec(c.value)}return y?(m<c.value.length&&b.push({type:"text",value:c.value.slice(m)}),d.children.splice(g,1,...b)):b=[c],g+b.length}}function yL(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let n=-1;for(;++n<r.length;){const i=r[n];e.push([bL(i[0]),CL(i[1])])}return e}function bL(t){return typeof t=="string"?new RegExp(gL(t),"g"):t}function CL(t){return typeof t=="function"?t:function(){return t}}const Dh="phrasing",Oh=["autolink","link","image","label"];function kL(){return{transforms:[NL],enter:{literalAutolink:wL,literalAutolinkEmail:Rh,literalAutolinkHttp:Rh,literalAutolinkWww:Rh},exit:{literalAutolink:EL,literalAutolinkEmail:_L,literalAutolinkHttp:SL,literalAutolinkWww:TL}}}function vL(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dh,notInConstruct:Oh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dh,notInConstruct:Oh},{character:":",before:"[ps]",after:"\\/",inConstruct:Dh,notInConstruct:Oh}]}}function wL(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Rh(t){this.config.enter.autolinkProtocol.call(this,t)}function SL(t){this.config.exit.autolinkProtocol.call(this,t)}function TL(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function _L(t){this.config.exit.autolinkEmail.call(this,t)}function EL(t){this.exit(t)}function NL(t){xL(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jL],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),LL]],{ignore:["link","linkReference"]})}function jL(t,e,r,n,i){let s="";if(!rb(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!BL(r)))return!1;const o=AL(r+n);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function LL(t,e,r,n){return!rb(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function BL(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function AL(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],n=r.indexOf(")");const i=Vm(t,"(");let s=Vm(t,")");for(;n!==-1&&i>s;)t+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[t,r]}function rb(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Ti(r)||Pc(r))&&(!e||r!==47)}nb.peek=zL;function ML(){this.buffer()}function IL(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function FL(){this.buffer()}function PL(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function DL(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ur(this.sliceSerialize(t)).toLowerCase(),r.label=e}function OL(t){this.exit(t)}function RL(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ur(this.sliceSerialize(t)).toLowerCase(),r.label=e}function $L(t){this.exit(t)}function zL(){return"["}function nb(t,e,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),a=r.enter("reference");return s+=i.move(r.safe(r.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function WL(){return{enter:{gfmFootnoteCallString:ML,gfmFootnoteCall:IL,gfmFootnoteDefinitionLabelString:FL,gfmFootnoteDefinition:PL},exit:{gfmFootnoteCallString:DL,gfmFootnoteCall:OL,gfmFootnoteDefinitionLabelString:RL,gfmFootnoteDefinition:$L}}}function qL(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:nb},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return l+=a.move(s.safe(s.associationId(n),{before:l,after:"]"})),u(),l+=a.move("]:"),n.children&&n.children.length>0&&(a.shift(4),l+=a.move((e?`
|
|
19
|
-
`:" ")+s.indentLines(s.containerFlow(n,a.current()),e?ib:HL))),c(),l}}function HL(t,e,r){return e===0?t:ib(t,e,r)}function ib(t,e,r){return(r?"":" ")+t}const UL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];sb.peek=KL;function GL(){return{canContainEols:["delete"],enter:{strikethrough:VL},exit:{strikethrough:XL}}}function YL(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:UL}],handlers:{delete:sb}}}function VL(t){this.enter({type:"delete",children:[]},t)}function XL(t){this.exit(t)}function sb(t,e,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function KL(){return"~"}function ZL(t){return t.length}function QL(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||ZL,s=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const x=[],g=[];let y=-1;for(t[u].length>c&&(c=t[u].length);++y<t[u].length;){const b=JL(t[u][y]);if(r.alignDelimiters!==!1){const k=i(b);g[y]=k,(l[y]===void 0||k>l[y])&&(l[y]=k)}x.push(b)}o[u]=x,a[u]=g}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<c;)s[d]=Xm(n[d]);else{const x=Xm(n);for(;++d<c;)s[d]=x}d=-1;const p=[],f=[];for(;++d<c;){const x=s[d];let g="",y="";x===99?(g=":",y=":"):x===108?g=":":x===114&&(y=":");let b=r.alignDelimiters===!1?1:Math.max(1,l[d]-g.length-y.length);const k=g+"-".repeat(b)+y;r.alignDelimiters!==!1&&(b=g.length+b+y.length,b>l[d]&&(l[d]=b),f[d]=b),p[d]=k}o.splice(1,0,p),a.splice(1,0,f),u=-1;const m=[];for(;++u<o.length;){const x=o[u],g=a[u];d=-1;const y=[];for(;++d<c;){const b=x[d]||"";let k="",T="";if(r.alignDelimiters!==!1){const _=l[d]-(g[d]||0),w=s[d];w===114?k=" ".repeat(_):w===99?_%2?(k=" ".repeat(_/2+.5),T=" ".repeat(_/2-.5)):(k=" ".repeat(_/2),T=k):T=" ".repeat(_)}r.delimiterStart!==!1&&!d&&y.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&b==="")&&(r.delimiterStart!==!1||d)&&y.push(" "),r.alignDelimiters!==!1&&y.push(k),y.push(b),r.alignDelimiters!==!1&&y.push(T),r.padding!==!1&&y.push(" "),(r.delimiterEnd!==!1||d!==c-1)&&y.push("|")}m.push(r.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
|
|
20
|
-
`)}function JL(t){return t==null?"":String(t)}function Xm(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function tB(t,e,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(t,s.current()),eB);return i(),o}function eB(t,e,r){return">"+(r?"":" ")+t}function rB(t,e){return Km(t,e.inConstruct,!0)&&!Km(t,e.notInConstruct,!1)}function Km(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let n=-1;for(;++n<e.length;)if(t.includes(e[n]))return!0;return!1}function Zm(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
21
|
-
`&&rB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
22
|
-
`}function nB(t,e){const r=String(t);let n=r.indexOf(e),i=n,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+e.length,n=r.indexOf(e,i);return o}function iB(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function sB(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function oB(t,e,r,n){const i=sB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(iB(t,r)){const d=r.enter("codeIndented"),p=r.indentLines(s,aB);return d(),p}const a=r.createTracker(n),l=i.repeat(Math.max(nB(s,i)+1,3)),c=r.enter("codeFenced");let u=a.move(l);if(t.lang){const d=r.enter(`codeFencedLang${o}`);u+=a.move(r.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=r.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(r.safe(t.meta,{before:u,after:`
|
|
23
|
-
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
|
|
24
|
-
`),s&&(u+=a.move(s+`
|
|
25
|
-
`)),u+=a.move(l),c(),u}function aB(t,e,r){return(r?"":" ")+t}function Nf(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function lB(t,e,r,n){const i=Nf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("[");return c+=l.move(r.safe(r.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":`
|
|
26
|
-
`,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}function cB(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function ea(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ul(t,e,r){const n=Fs(t),i=Fs(e);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ob.peek=hB;function ob(t,e,r,n){const i=cB(r),s=r.enter("emphasis"),o=r.createTracker(n),a=o.move(i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=Ul(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=ea(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Ul(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+ea(d));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function hB(t,e,r){return r.options.emphasis||"*"}function uB(t,e){let r=!1;return Tf(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Hu}),!!((!t.depth||t.depth<3)&&yf(t)&&(e.options.setext||r))}function dB(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(uB(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),p=r.containerPhrasing(t,{...s.current(),before:`
|
|
27
|
-
`,after:`
|
|
28
|
-
`});return d(),u(),p+`
|
|
29
|
-
`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
30
|
-
`))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let c=r.containerPhrasing(t,{before:"# ",after:`
|
|
31
|
-
`,...s.current()});return/^[\t ]/.test(c)&&(c=ea(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),l(),a(),c}ab.peek=fB;function ab(t){return t.value||""}function fB(){return"<"}lb.peek=pB;function lb(t,e,r,n){const i=Nf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("![");return c+=l.move(r.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function pB(){return"!"}cb.peek=mB;function cb(t,e,r,n){const i=t.referenceType,s=r.enter("imageReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("![");const c=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function mB(){return"!"}hb.peek=gB;function hb(t,e,r){let n=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],a=r.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(n);){let c=l.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(l.index+1)}}return i+n+i}function gB(){return"`"}function ub(t,e){const r=yf(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}db.peek=xB;function db(t,e,r,n){const i=Nf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(ub(t,r)){const u=r.stack;r.stack=[],a=r.enter("autolink");let d=o.move("<");return d+=o.move(r.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),r.stack=u,d}a=r.enter("link"),l=r.enter("label");let c=o.move("[");return c+=o.move(r.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=r.enter("destinationRaw"),c+=o.move(r.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(t.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function xB(t,e,r){return ub(t,r)?"<":"["}fb.peek=yB;function fb(t,e,r,n){const i=t.referenceType,s=r.enter("linkReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("[");const c=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function yB(){return"["}function jf(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function bB(t){const e=jf(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}function CB(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function pb(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function kB(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?CB(r):jf(r);const a=t.ordered?o==="."?")":".":bB(r);let l=e&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),pb(r)===o&&u){let d=-1;for(;++d<t.children.length;){const p=t.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),r.bulletCurrent=o;const c=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),c}function vB(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function wB(t,e,r,n){const i=vB(r);let s=r.bulletCurrent||jf(r);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=r.createTracker(n);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=r.enter("listItem"),c=r.indentLines(r.containerFlow(t,a.current()),u);return l(),c;function u(d,p,f){return p?(f?"":" ".repeat(o))+d:(f?s:s+" ".repeat(o-s.length))+d}}function SB(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const TB=Rc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _B(t,e,r,n){return(t.children.some(function(o){return TB(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function EB(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}mb.peek=NB;function mb(t,e,r,n){const i=EB(r),s=r.enter("strong"),o=r.createTracker(n),a=o.move(i+i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=Ul(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=ea(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Ul(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+ea(d));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function NB(t,e,r){return r.options.strong||"*"}function jB(t,e,r,n){return r.safe(t.value,n)}function LB(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function BB(t,e,r){const n=(pb(r)+(r.options.ruleSpaces?" ":"")).repeat(LB(r));return r.options.ruleSpaces?n.slice(0,-1):n}const gb={blockquote:tB,break:Zm,code:oB,definition:lB,emphasis:ob,hardBreak:Zm,heading:dB,html:ab,image:lb,imageReference:cb,inlineCode:hb,link:db,linkReference:fb,list:kB,listItem:wB,paragraph:SB,root:_B,strong:mb,text:jB,thematicBreak:BB};function AB(){return{enter:{table:MB,tableData:Qm,tableHeader:Qm,tableRow:FB},exit:{codeText:PB,table:IB,tableData:$h,tableHeader:$h,tableRow:$h}}}function MB(t){const e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function IB(t){this.exit(t),this.data.inTable=void 0}function FB(t){this.enter({type:"tableRow",children:[]},t)}function $h(t){this.exit(t)}function Qm(t){this.enter({type:"tableCell",children:[]},t)}function PB(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,DB));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function DB(t,e){return e==="|"?e:t}function OB(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
32
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:l,tableRow:a}};function o(f,m,x,g){return c(u(f,x,g),f.align)}function a(f,m,x,g){const y=d(f,x,g),b=c([y]);return b.slice(0,b.indexOf(`
|
|
33
|
-
`))}function l(f,m,x,g){const y=x.enter("tableCell"),b=x.enter("phrasing"),k=x.containerPhrasing(f,{...g,before:s,after:s});return b(),y(),k}function c(f,m){return QL(f,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function u(f,m,x){const g=f.children;let y=-1;const b=[],k=m.enter("table");for(;++y<g.length;)b[y]=d(g[y],m,x);return k(),b}function d(f,m,x){const g=f.children;let y=-1;const b=[],k=m.enter("tableRow");for(;++y<g.length;)b[y]=l(g[y],f,m,x);return k(),b}function p(f,m,x){let g=gb.inlineCode(f,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function RB(){return{exit:{taskListCheckValueChecked:Jm,taskListCheckValueUnchecked:Jm,paragraph:zB}}}function $B(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:WB}}}function Jm(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function zB(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(t)}function WB(t,e,r,n){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=r.createTracker(n);s&&a.move(o);let l=gb.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function qB(){return[kL(),WL(),GL(),AB(),RB()]}function HB(t){return{extensions:[vL(),qL(t),YL(),OB(t),$B()]}}const UB={tokenize:ZB,partial:!0},xb={tokenize:QB,partial:!0},yb={tokenize:JB,partial:!0},bb={tokenize:tA,partial:!0},GB={tokenize:eA,partial:!0},Cb={name:"wwwAutolink",tokenize:XB,previous:vb},kb={name:"protocolAutolink",tokenize:KB,previous:wb},jn={name:"emailAutolink",tokenize:VB,previous:Sb},un={};function YB(){return{text:un}}let hi=48;for(;hi<123;)un[hi]=jn,hi++,hi===58?hi=65:hi===91&&(hi=97);un[43]=jn;un[45]=jn;un[46]=jn;un[95]=jn;un[72]=[jn,kb];un[104]=[jn,kb];un[87]=[jn,Cb];un[119]=[jn,Cb];function VB(t,e,r){const n=this;let i,s;return o;function o(d){return!Vu(d)||!Sb.call(n,n.previous)||Lf(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return Vu(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(GB,u,c)(d):d===45||d===95||Ke(d)?(s=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return s&&i&&ir(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function XB(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!vb.call(n,n.previous)||Lf(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(UB,t.attempt(xb,t.attempt(yb,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function KB(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&wb.call(n,n.previous)&&!Lf(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(ir(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),s?c:(s=!0,l)):r(d)}function c(d){return d===null||Wl(d)||ue(d)||Ti(d)||Pc(d)?r(d):t.attempt(xb,t.attempt(yb,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function ZB(t,e,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,t.consume(o),i):o===46&&n===3?(t.consume(o),s):r(o)}function s(o){return o===null?r(o):e(o)}}function QB(t,e,r){let n,i,s;return o;function o(c){return c===46||c===95?t.check(bb,l,a)(c):c===null||ue(c)||Ti(c)||c!==45&&Pc(c)?l(c):(s=!0,t.consume(c),o)}function a(c){return c===95?n=!0:(i=n,n=void 0),t.consume(c),o}function l(c){return i||n||!s?r(c):e(c)}}function JB(t,e){let r=0,n=0;return i;function i(o){return o===40?(r++,t.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(bb,e,s)(o):o===null||ue(o)||Ti(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function tA(t,e,r){return n;function n(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),n):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||ue(a)||Ti(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||ue(a)||Ti(a)?e(a):n(a)}function s(a){return ir(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):ir(a)?(t.consume(a),o):r(a)}}function eA(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ke(s)?r(s):e(s)}}function vb(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ue(t)}function wb(t){return!ir(t)}function Sb(t){return!(t===47||Vu(t))}function Vu(t){return t===43||t===45||t===46||t===95||Ke(t)}function Lf(t){let e=t.length,r=!1;for(;e--;){const n=t[e][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const rA={tokenize:hA,partial:!0};function nA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aA,continuation:{tokenize:lA},exit:cA}},text:{91:{name:"gfmFootnoteCall",tokenize:oA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iA,resolveTo:sA}}}}function iA(t,e,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const l=n.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return r(l);const c=Ur(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function sA(t,e){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...a),t}function oA(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||ue(d))return r(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(Ur(n.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return ue(d)||(o=!0),s++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,c):c(d)}}function aA(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||ue(m))return r(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return s=Ur(n.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return ue(m)||(a=!0),o++,t.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(s)||i.push(s),te(t,f,"gfmFootnoteDefinitionWhitespace")):r(m)}function f(m){return e(m)}}function lA(t,e,r){return t.check(xa,e,t.attempt(rA,e,r))}function cA(t){t.exit("gfmFootnoteDefinition")}function hA(t,e,r){const n=this;return te(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):r(s)}}function uA(t){let r=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},p=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&Tr(p,p.length,0,Dc(f,o.slice(c+1,l),a)),Tr(p,p.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Tr(o,c-1,l-c+3,p),l=c+p.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let d=0;return p;function p(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const x=Fs(c);if(m===126)return d>1?l(m):(o.consume(m),d++,f);if(d<2&&!r)return l(m);const g=o.exit("strikethroughSequenceTemporary"),y=Fs(m);return g._open=!y||y===2&&!!x,g._close=!x||x===2&&!!y,a(m)}}}class dA{constructor(){this.map=[]}add(e,r,n){fA(this,e,r,n)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];n.push(e.slice()),e.length=0;let i=n.pop();for(;i;){for(const s of i)e.push(s);i=n.pop()}this.map.length=0}}function fA(t,e,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=r,t.map[i][2].push(...n);return}i+=1}t.map.push([e,r,n])}}function pA(t,e){let r=!1;const n=[];for(;e<t.length;){const i=t[e];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return n}function mA(){return{flow:{null:{name:"table",tokenize:gA,resolveAll:xA}}}}function gA(t,e,r){const n=this;let i=0,s=0,o;return a;function a(E){let P=n.events.length-1;for(;P>-1;){const R=n.events[P][1].type;if(R==="lineEnding"||R==="linePrefix")P--;else break}const z=P>-1?n.events[P][1].type:null,q=z==="tableHead"||z==="tableRow"?w:l;return q===w&&n.parser.lazy[n.now().line]?r(E):q(E)}function l(E){return t.enter("tableHead"),t.enter("tableRow"),c(E)}function c(E){return E===124||(o=!0,s+=1),u(E)}function u(E){return E===null?r(E):Bt(E)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),f):r(E):Zt(E)?te(t,u,"whitespace")(E):(s+=1,o&&(o=!1,i+=1),E===124?(t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(E)))}function d(E){return E===null||E===124||ue(E)?(t.exit("data"),u(E)):(t.consume(E),E===92?p:d)}function p(E){return E===92||E===124?(t.consume(E),d):d(E)}function f(E){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(E):(t.enter("tableDelimiterRow"),o=!1,Zt(E)?te(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):m(E))}function m(E){return E===45||E===58?g(E):E===124?(o=!0,t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),x):_(E)}function x(E){return Zt(E)?te(t,g,"whitespace")(E):g(E)}function g(E){return E===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(E),t.exit("tableDelimiterMarker"),y):E===45?(s+=1,y(E)):E===null||Bt(E)?T(E):_(E)}function y(E){return E===45?(t.enter("tableDelimiterFiller"),b(E)):_(E)}function b(E){return E===45?(t.consume(E),b):E===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(E),t.exit("tableDelimiterMarker"),k):(t.exit("tableDelimiterFiller"),k(E))}function k(E){return Zt(E)?te(t,T,"whitespace")(E):T(E)}function T(E){return E===124?m(E):E===null||Bt(E)?!o||i!==s?_(E):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(E)):_(E)}function _(E){return r(E)}function w(E){return t.enter("tableRow"),N(E)}function N(E){return E===124?(t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),N):E===null||Bt(E)?(t.exit("tableRow"),e(E)):Zt(E)?te(t,N,"whitespace")(E):(t.enter("data"),B(E))}function B(E){return E===null||E===124||ue(E)?(t.exit("data"),N(E)):(t.consume(E),E===92?I:B)}function I(E){return E===92||E===124?(t.consume(E),B):B(E)}}function xA(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const p=new dA;for(;++r<t.length;){const f=t[r],m=f[1];f[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(tg(p,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(r,0,[["enter",c,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,d=void 0,s=[0,0,0,0],o=[0,r+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(r,0,[["enter",u,e]])),i=m.type==="tableDelimiterRow"?2:u?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=Ha(p,e,s,i,void 0,d),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],d=Ha(p,e,s,i,void 0,d)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(a=!0,l=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=r,s[1]!==0?(o[0]=o[1],d=Ha(p,e,s,i,r,d)):o[1]!==0&&(d=Ha(p,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&tg(p,e,l,c,u),p.consume(e.events),r=-1;++r<e.events.length;){const f=e.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=pA(e.events,r))}return t}function Ha(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},os(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=os(e.events,r[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",s,e]]),r[2]!==0){const c=os(e.events,r[2]),u=os(e.events,r[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){const p=e.events[r[2]],f=e.events[r[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,x=r[3]-r[2]-1;t.add(m,x,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},os(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function tg(t,e,r,n,i){const s=[],o=os(e.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),n.end=Object.assign({},o),s.push(["exit",n,e]),t.add(r+1,0,s)}function os(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const yA={name:"tasklistCheck",tokenize:CA};function bA(){return{text:{91:yA}}}function CA(t,e,r){const n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return ue(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):r(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):r(l)}function a(l){return Bt(l)?e(l):Zt(l)?t.check({tokenize:kA},e,r)(l):r(l)}}function kA(t,e,r){return te(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function vA(t){return Fy([YB(),nA(),uA(t),mA(),bA()])}const wA={};function Bf(t){const e=this,r=t||wA,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(vA(r)),s.push(qB()),o.push(HB(r))}/**
|
|
34
|
-
* @license lucide-react v0.563.0 - ISC
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the ISC license.
|
|
37
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/const Tb=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
|
|
39
|
-
* @license lucide-react v0.563.0 - ISC
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the ISC license.
|
|
42
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/const SA=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
44
|
-
* @license lucide-react v0.563.0 - ISC
|
|
45
|
-
*
|
|
46
|
-
* This source code is licensed under the ISC license.
|
|
47
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/const TA=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());/**
|
|
49
|
-
* @license lucide-react v0.563.0 - ISC
|
|
50
|
-
*
|
|
51
|
-
* This source code is licensed under the ISC license.
|
|
52
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
53
|
-
*/const eg=t=>{const e=TA(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
|
|
54
|
-
* @license lucide-react v0.563.0 - ISC
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the ISC license.
|
|
57
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
58
|
-
*/var _A={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
59
|
-
* @license lucide-react v0.563.0 - ISC
|
|
60
|
-
*
|
|
61
|
-
* This source code is licensed under the ISC license.
|
|
62
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
-
*/const EA=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
|
|
64
|
-
* @license lucide-react v0.563.0 - ISC
|
|
65
|
-
*
|
|
66
|
-
* This source code is licensed under the ISC license.
|
|
67
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
68
|
-
*/const NA=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},l)=>C.createElement("svg",{ref:l,..._A,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Tb("lucide",i),...!s&&!EA(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,u])=>C.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
|
|
69
|
-
* @license lucide-react v0.563.0 - ISC
|
|
70
|
-
*
|
|
71
|
-
* This source code is licensed under the ISC license.
|
|
72
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/const Lt=(t,e)=>{const r=C.forwardRef(({className:n,...i},s)=>C.createElement(NA,{ref:s,iconNode:e,className:Tb(`lucide-${SA(eg(t))}`,`lucide-${t}`,n),...i}));return r.displayName=eg(t),r};/**
|
|
74
|
-
* @license lucide-react v0.563.0 - ISC
|
|
75
|
-
*
|
|
76
|
-
* This source code is licensed under the ISC license.
|
|
77
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
-
*/const jA=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Af=Lt("activity",jA);/**
|
|
79
|
-
* @license lucide-react v0.563.0 - ISC
|
|
80
|
-
*
|
|
81
|
-
* This source code is licensed under the ISC license.
|
|
82
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/const LA=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],BA=Lt("arrow-down-to-line",LA);/**
|
|
84
|
-
* @license lucide-react v0.563.0 - ISC
|
|
85
|
-
*
|
|
86
|
-
* This source code is licensed under the ISC license.
|
|
87
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
-
*/const AA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],MA=Lt("arrow-left",AA);/**
|
|
89
|
-
* @license lucide-react v0.563.0 - ISC
|
|
90
|
-
*
|
|
91
|
-
* This source code is licensed under the ISC license.
|
|
92
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
-
*/const IA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],_b=Lt("arrow-right",IA);/**
|
|
94
|
-
* @license lucide-react v0.563.0 - ISC
|
|
95
|
-
*
|
|
96
|
-
* This source code is licensed under the ISC license.
|
|
97
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/const FA=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],PA=Lt("bell",FA);/**
|
|
99
|
-
* @license lucide-react v0.563.0 - ISC
|
|
100
|
-
*
|
|
101
|
-
* This source code is licensed under the ISC license.
|
|
102
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
-
*/const DA=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ms=Lt("bot",DA);/**
|
|
104
|
-
* @license lucide-react v0.563.0 - ISC
|
|
105
|
-
*
|
|
106
|
-
* This source code is licensed under the ISC license.
|
|
107
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
-
*/const OA=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],RA=Lt("chart-no-axes-column",OA);/**
|
|
109
|
-
* @license lucide-react v0.563.0 - ISC
|
|
110
|
-
*
|
|
111
|
-
* This source code is licensed under the ISC license.
|
|
112
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
-
*/const $A=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ba=Lt("check",$A);/**
|
|
114
|
-
* @license lucide-react v0.563.0 - ISC
|
|
115
|
-
*
|
|
116
|
-
* This source code is licensed under the ISC license.
|
|
117
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
-
*/const zA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ca=Lt("chevron-down",zA);/**
|
|
119
|
-
* @license lucide-react v0.563.0 - ISC
|
|
120
|
-
*
|
|
121
|
-
* This source code is licensed under the ISC license.
|
|
122
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
-
*/const WA=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Eb=Lt("chevron-left",WA);/**
|
|
124
|
-
* @license lucide-react v0.563.0 - ISC
|
|
125
|
-
*
|
|
126
|
-
* This source code is licensed under the ISC license.
|
|
127
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
-
*/const qA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ps=Lt("chevron-right",qA);/**
|
|
129
|
-
* @license lucide-react v0.563.0 - ISC
|
|
130
|
-
*
|
|
131
|
-
* This source code is licensed under the ISC license.
|
|
132
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
-
*/const HA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Nb=Lt("chevron-up",HA);/**
|
|
134
|
-
* @license lucide-react v0.563.0 - ISC
|
|
135
|
-
*
|
|
136
|
-
* This source code is licensed under the ISC license.
|
|
137
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
-
*/const UA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],GA=Lt("circle-check-big",UA);/**
|
|
139
|
-
* @license lucide-react v0.563.0 - ISC
|
|
140
|
-
*
|
|
141
|
-
* This source code is licensed under the ISC license.
|
|
142
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
-
*/const YA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],jb=Lt("circle-check",YA);/**
|
|
144
|
-
* @license lucide-react v0.563.0 - ISC
|
|
145
|
-
*
|
|
146
|
-
* This source code is licensed under the ISC license.
|
|
147
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
-
*/const VA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],XA=Lt("circle-x",VA);/**
|
|
149
|
-
* @license lucide-react v0.563.0 - ISC
|
|
150
|
-
*
|
|
151
|
-
* This source code is licensed under the ISC license.
|
|
152
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
-
*/const KA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ZA=Lt("circle",KA);/**
|
|
154
|
-
* @license lucide-react v0.563.0 - ISC
|
|
155
|
-
*
|
|
156
|
-
* This source code is licensed under the ISC license.
|
|
157
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
-
*/const QA=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Lb=Lt("clock",QA);/**
|
|
159
|
-
* @license lucide-react v0.563.0 - ISC
|
|
160
|
-
*
|
|
161
|
-
* This source code is licensed under the ISC license.
|
|
162
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
-
*/const JA=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Mf=Lt("cpu",JA);/**
|
|
164
|
-
* @license lucide-react v0.563.0 - ISC
|
|
165
|
-
*
|
|
166
|
-
* This source code is licensed under the ISC license.
|
|
167
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
-
*/const tM=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Bb=Lt("eye",tM);/**
|
|
169
|
-
* @license lucide-react v0.563.0 - ISC
|
|
170
|
-
*
|
|
171
|
-
* This source code is licensed under the ISC license.
|
|
172
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
-
*/const eM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Pi=Lt("file-text",eM);/**
|
|
174
|
-
* @license lucide-react v0.563.0 - ISC
|
|
175
|
-
*
|
|
176
|
-
* This source code is licensed under the ISC license.
|
|
177
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
-
*/const rM=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],nM=Lt("folder-open",rM);/**
|
|
179
|
-
* @license lucide-react v0.563.0 - ISC
|
|
180
|
-
*
|
|
181
|
-
* This source code is licensed under the ISC license.
|
|
182
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
-
*/const iM=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],If=Lt("folder",iM);/**
|
|
184
|
-
* @license lucide-react v0.563.0 - ISC
|
|
185
|
-
*
|
|
186
|
-
* This source code is licensed under the ISC license.
|
|
187
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
-
*/const sM=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],oM=Lt("funnel",sM);/**
|
|
189
|
-
* @license lucide-react v0.563.0 - ISC
|
|
190
|
-
*
|
|
191
|
-
* This source code is licensed under the ISC license.
|
|
192
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
-
*/const aM=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Ab=Lt("git-branch",aM);/**
|
|
194
|
-
* @license lucide-react v0.563.0 - ISC
|
|
195
|
-
*
|
|
196
|
-
* This source code is licensed under the ISC license.
|
|
197
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
-
*/const lM=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],cM=Lt("inbox",lM);/**
|
|
199
|
-
* @license lucide-react v0.563.0 - ISC
|
|
200
|
-
*
|
|
201
|
-
* This source code is licensed under the ISC license.
|
|
202
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
203
|
-
*/const hM=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],uM=Lt("layers",hM);/**
|
|
204
|
-
* @license lucide-react v0.563.0 - ISC
|
|
205
|
-
*
|
|
206
|
-
* This source code is licensed under the ISC license.
|
|
207
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
-
*/const dM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],fM=Lt("layout-dashboard",dM);/**
|
|
209
|
-
* @license lucide-react v0.563.0 - ISC
|
|
210
|
-
*
|
|
211
|
-
* This source code is licensed under the ISC license.
|
|
212
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
-
*/const pM=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],_i=Lt("lightbulb",pM);/**
|
|
214
|
-
* @license lucide-react v0.563.0 - ISC
|
|
215
|
-
*
|
|
216
|
-
* This source code is licensed under the ISC license.
|
|
217
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
-
*/const mM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],gM=Lt("link-2",mM);/**
|
|
219
|
-
* @license lucide-react v0.563.0 - ISC
|
|
220
|
-
*
|
|
221
|
-
* This source code is licensed under the ISC license.
|
|
222
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
223
|
-
*/const xM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],yM=Lt("list",xM);/**
|
|
224
|
-
* @license lucide-react v0.563.0 - ISC
|
|
225
|
-
*
|
|
226
|
-
* This source code is licensed under the ISC license.
|
|
227
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
228
|
-
*/const bM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Mb=Lt("loader-circle",bM);/**
|
|
229
|
-
* @license lucide-react v0.563.0 - ISC
|
|
230
|
-
*
|
|
231
|
-
* This source code is licensed under the ISC license.
|
|
232
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
233
|
-
*/const CM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],zc=Lt("message-square",CM);/**
|
|
234
|
-
* @license lucide-react v0.563.0 - ISC
|
|
235
|
-
*
|
|
236
|
-
* This source code is licensed under the ISC license.
|
|
237
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
238
|
-
*/const kM=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],vM=Lt("moon",kM);/**
|
|
239
|
-
* @license lucide-react v0.563.0 - ISC
|
|
240
|
-
*
|
|
241
|
-
* This source code is licensed under the ISC license.
|
|
242
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
243
|
-
*/const wM=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],SM=Lt("network",wM);/**
|
|
244
|
-
* @license lucide-react v0.563.0 - ISC
|
|
245
|
-
*
|
|
246
|
-
* This source code is licensed under the ISC license.
|
|
247
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
248
|
-
*/const TM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ib=Lt("pencil",TM);/**
|
|
249
|
-
* @license lucide-react v0.563.0 - ISC
|
|
250
|
-
*
|
|
251
|
-
* This source code is licensed under the ISC license.
|
|
252
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
253
|
-
*/const _M=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],EM=Lt("play",_M);/**
|
|
254
|
-
* @license lucide-react v0.563.0 - ISC
|
|
255
|
-
*
|
|
256
|
-
* This source code is licensed under the ISC license.
|
|
257
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
258
|
-
*/const NM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Fb=Lt("plus",NM);/**
|
|
259
|
-
* @license lucide-react v0.563.0 - ISC
|
|
260
|
-
*
|
|
261
|
-
* This source code is licensed under the ISC license.
|
|
262
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
263
|
-
*/const jM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Gl=Lt("refresh-cw",jM);/**
|
|
264
|
-
* @license lucide-react v0.563.0 - ISC
|
|
265
|
-
*
|
|
266
|
-
* This source code is licensed under the ISC license.
|
|
267
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
268
|
-
*/const LM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],BM=Lt("save",LM);/**
|
|
269
|
-
* @license lucide-react v0.563.0 - ISC
|
|
270
|
-
*
|
|
271
|
-
* This source code is licensed under the ISC license.
|
|
272
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
273
|
-
*/const AM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ni=Lt("search",AM);/**
|
|
274
|
-
* @license lucide-react v0.563.0 - ISC
|
|
275
|
-
*
|
|
276
|
-
* This source code is licensed under the ISC license.
|
|
277
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
-
*/const MM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Ff=Lt("send",MM);/**
|
|
279
|
-
* @license lucide-react v0.563.0 - ISC
|
|
280
|
-
*
|
|
281
|
-
* This source code is licensed under the ISC license.
|
|
282
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
283
|
-
*/const IM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ks=Lt("shield-check",IM);/**
|
|
284
|
-
* @license lucide-react v0.563.0 - ISC
|
|
285
|
-
*
|
|
286
|
-
* This source code is licensed under the ISC license.
|
|
287
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
288
|
-
*/const FM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],PM=Lt("shield",FM);/**
|
|
289
|
-
* @license lucide-react v0.563.0 - ISC
|
|
290
|
-
*
|
|
291
|
-
* This source code is licensed under the ISC license.
|
|
292
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
293
|
-
*/const DM=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Pb=Lt("skip-forward",DM);/**
|
|
294
|
-
* @license lucide-react v0.563.0 - ISC
|
|
295
|
-
*
|
|
296
|
-
* This source code is licensed under the ISC license.
|
|
297
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
298
|
-
*/const OM=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],rg=Lt("sparkles",OM);/**
|
|
299
|
-
* @license lucide-react v0.563.0 - ISC
|
|
300
|
-
*
|
|
301
|
-
* This source code is licensed under the ISC license.
|
|
302
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
303
|
-
*/const RM=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],$M=Lt("star",RM);/**
|
|
304
|
-
* @license lucide-react v0.563.0 - ISC
|
|
305
|
-
*
|
|
306
|
-
* This source code is licensed under the ISC license.
|
|
307
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
308
|
-
*/const zM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],WM=Lt("sun",zM);/**
|
|
309
|
-
* @license lucide-react v0.563.0 - ISC
|
|
310
|
-
*
|
|
311
|
-
* This source code is licensed under the ISC license.
|
|
312
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
313
|
-
*/const qM=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],HM=Lt("terminal",qM);/**
|
|
314
|
-
* @license lucide-react v0.563.0 - ISC
|
|
315
|
-
*
|
|
316
|
-
* This source code is licensed under the ISC license.
|
|
317
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
318
|
-
*/const UM=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ng=Lt("trash-2",UM);/**
|
|
319
|
-
* @license lucide-react v0.563.0 - ISC
|
|
320
|
-
*
|
|
321
|
-
* This source code is licensed under the ISC license.
|
|
322
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
323
|
-
*/const GM=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Wc=Lt("triangle-alert",GM);/**
|
|
324
|
-
* @license lucide-react v0.563.0 - ISC
|
|
325
|
-
*
|
|
326
|
-
* This source code is licensed under the ISC license.
|
|
327
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
328
|
-
*/const YM=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Pf=Lt("user",YM);/**
|
|
329
|
-
* @license lucide-react v0.563.0 - ISC
|
|
330
|
-
*
|
|
331
|
-
* This source code is licensed under the ISC license.
|
|
332
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
333
|
-
*/const VM=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],XM=Lt("workflow",VM);/**
|
|
334
|
-
* @license lucide-react v0.563.0 - ISC
|
|
335
|
-
*
|
|
336
|
-
* This source code is licensed under the ISC license.
|
|
337
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
338
|
-
*/const KM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=Lt("x",KM);/**
|
|
339
|
-
* @license lucide-react v0.563.0 - ISC
|
|
340
|
-
*
|
|
341
|
-
* This source code is licensed under the ISC license.
|
|
342
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
343
|
-
*/const ZM=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Yl=Lt("zap",ZM),qc=C.createContext({newIds:new Set,changedIds:new Set}),ig=t=>{let e;const r=new Set,n=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const p=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(f=>f(e,p))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c))},l=e=t(n,i,a);return a},QM=(t=>t?ig(t):ig),JM=t=>t;function tI(t,e=JM){const r=Xt.useSyncExternalStore(t.subscribe,Xt.useCallback(()=>e(t.getState()),[t,e]),Xt.useCallback(()=>e(t.getInitialState()),[t,e]));return Xt.useDebugValue(r),r}const sg=t=>{const e=QM(t),r=n=>tI(e,n);return Object.assign(r,e),r},Df=(t=>t?sg(t):sg),mo=new Map;function eI(t,e,r){var D,O;const{prevItemMapRef:n,snapshotProviderRef:i,gatesRef:s,pendingResolveIdsRef:o,changeTimerRef:a,sessionEndTimerRef:l,wsRef:c}=e,{setItems:u,setConnections:d,setGates:p,setGateEvent:f,setRecentChanges:m,setUICommand:x,setAgentActivity:g,setAgentErrors:y,setSessionState:b,setSpawnedAgents:k,setAgentRelays:T,setSettings:_,setPipelineDraft:w,setActiveBuild:N,setSessions:B,setIterationStates:I,setFeatureTimeline:E,EMPTY_CHANGES:P,appendDecisionEvent:z,setDecisionEventsSnapshot:q,setStatusSnapshot:R,clearStatusSnapshots:F}=r,M=E?j=>{E(S=>S.some(G=>G.id===j.id)?S:[...S,j])}:null;if(t.type==="visionState"||t.type==="hydrate"){const j=t.items||[];if(n.current){const S=n.current,G=new Set,Q=new Set;for(const A of j){const ct=S.get(A.id);ct?(ct.status!==A.status||ct.confidence!==A.confidence||ct.title!==A.title)&&Q.add(A.id):G.add(A.id)}(G.size>0||Q.size>0)&&(m({newIds:G,changedIds:Q}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(P),800))}n.current=new Map(j.map(S=>[S.id,S])),u(j),d(t.connections||[]),p(t.gates||[]),B&&B(t.sessions||[]),q&&Array.isArray(t.decisionEventsSnapshot)&&q(t.decisionEventsSnapshot),F&&F()}else if(t.type==="decisionEvent")z&&t.event&&z(t.event);else if(t.type==="decisionEventsSnapshot")q&&Array.isArray(t.events)&&q(t.events);else if(t.type==="statusSnapshot")R&&t.featureCode&&t.snapshot&&R(t.featureCode,t.snapshot);else if(t.type==="visionUI")x(t);else if(t.type==="agentActivity")g(j=>{const S=[...j,{tool:t.tool,category:t.category||null,detail:t.detail,items:t.items||[],error:t.error||null,timestamp:t.timestamp}];return S.length>20?S.slice(-20):S}),b(j=>j!=null&&j.active?{...j,toolCount:(j.toolCount||0)+1}:j);else if(t.type==="agentSpawned")k(j=>[...j,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")k(j=>j.map(S=>S.agentId===t.agentId?{...S,silent:!0,silentSinceMs:t.silentSinceMs}:S));else if(t.type==="agentKilled")k(j=>j.map(S=>S.agentId===t.agentId?{...S,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:S));else if(t.type==="agentGC")((D=t.removed)==null?void 0:D.length)>0&&g(j=>{const S=[...j,{tool:"gc",category:"executing",detail:`Cleaned ${t.removed.length} orphan worktree(s)`,items:[],timestamp:t.timestamp}];return S.length>20?S.slice(-20):S});else if(t.type==="agentComplete")k(j=>j.map(S=>S.agentId===t.agentId?S.status==="killed"?S:{...S,status:t.status,completedAt:new Date().toISOString()}:S));else if(t.type==="agentRelay")T(j=>[...j,t].slice(-50));else if(t.type==="sessionStart")l.current&&(clearTimeout(l.current),l.current=null),k(()=>[]),T(()=>[]),b(j=>j&&j.id===t.sessionId?{...j,active:!0}:{id:t.sessionId,active:!0,startedAt:t.timestamp,source:t.source,toolCount:0,errorCount:0,summaries:[],featureCode:null,featureItemId:null,phaseAtBind:null,boundAt:null}),M&&M({id:`session-start-${t.sessionId}`,timestamp:t.timestamp,category:"session",title:"Session started",detail:t.source?`Source: ${t.source}`:null,severity:"info",sessionId:t.sessionId,meta:{source:t.source}});else if(t.type==="sessionEnd")l.current&&(clearTimeout(l.current),l.current=null),b(j=>j?{...j,active:!1,endedAt:t.timestamp,toolCount:t.toolCount,duration:t.duration,journalSpawned:t.journalSpawned,featureCode:t.featureCode||(j==null?void 0:j.featureCode)||null,phaseAtEnd:t.phaseAtEnd||null}:null),l.current=setTimeout(()=>{b(null),l.current=null},3e3),M&&M({id:`session-end-${t.sessionId||Date.now()}`,timestamp:t.timestamp,category:"session",title:`Session ended (${t.toolCount??0} tools)`,detail:null,severity:"info",sessionId:t.sessionId||null,meta:{toolCount:t.toolCount,duration:t.duration}});else if(t.type==="sessionSummary")b(j=>j&&{...j,summaries:[...j.summaries||[],{summary:t.summary,intent:t.intent,component:t.component,timestamp:t.timestamp}].slice(-5)});else if(t.type==="sessionBound")b(j=>j&&{...j,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(j=>{const S=[...j,{errorType:t.errorType,severity:t.severity,message:t.message,tool:t.tool,detail:t.detail,items:t.items||[],timestamp:t.timestamp||new Date().toISOString()}];return S.length>10?S.slice(-10):S}),b(j=>j!=null&&j.active?{...j,errorCount:(j.errorCount||0)+1}:j),M&&M({id:`error-${t.timestamp}-${Math.random().toString(36).slice(2,6)}`,timestamp:t.timestamp||new Date().toISOString(),category:"error",title:t.message||`${t.errorType} error`,detail:t.tool?`Tool: ${t.tool}`:null,severity:t.severity==="error"?"error":"warning",sessionId:null,meta:{type:t.errorType,tool:t.tool}});else if(t.type==="gateCreated"||t.type==="gatePending")f({type:"pending",gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}),M&&M({id:`gate-created-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:t.fromPhase&&t.toPhase?`Gate: ${t.fromPhase} → ${t.toPhase}`:"Gate created",detail:null,severity:"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}});else if(t.type==="gateResolved"){if(p(G=>G.map(Q=>Q.id===t.gateId?{...Q,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:Q)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const G=t.itemId??((O=s.current.find(Q=>Q.id===t.gateId))==null?void 0:O.itemId)??t.gateId;f({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:G})}const j=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,S={approve:"success",revise:"warning",kill:"error"};M&&M({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${j}`,detail:null,severity:S[t.outcome]||"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,outcome:t.outcome}})}else if(t.type==="iterationStarted"||t.type==="iterationUpdate"||t.type==="iterationComplete"){if(g(j=>{let S;t.type==="iterationStarted"?S=`${t.loopType} loop started (0/${t.maxIterations})`:t.type==="iterationComplete"?S=`${t.loopType??"loop"} loop complete (${t.outcome} after ${t.finalCount} iterations)`:S=`${t.loopType??"loop"} iteration ${t.count}/${t.maxIterations}`;const G=[...j,{tool:"iteration",category:t.loopType||"iteration",detail:S,items:[],timestamp:t.timestamp}];return G.length>20?G.slice(-20):G}),t.type==="iterationStarted")mo.has(t.loopId)&&(clearTimeout(mo.get(t.loopId)),mo.delete(t.loopId)),I(j=>{const S=new Map(j);return S.set(t.loopId,{loopId:t.loopId,itemId:t.itemId,loopType:t.loopType,count:0,maxIterations:t.maxIterations,status:"running",outcome:null,startedAt:t.startedAt??t.timestamp,wallClockTimeout:t.wallClockTimeout??null,maxActions:t.maxActions??null}),S});else if(t.type==="iterationUpdate")I(j=>{const S=j.get(t.loopId);if(!S)return j;const G=new Map(j);return G.set(t.loopId,{...S,count:t.count,maxIterations:t.maxIterations}),G});else if(t.type==="iterationComplete"){I(S=>{const G=S.get(t.loopId);if(!G)return S;const Q=new Map(S);return Q.set(t.loopId,{...G,status:"complete",outcome:t.outcome,count:t.finalCount??G.count}),Q});const j=setTimeout(()=>{I(S=>{const G=new Map(S);return G.delete(t.loopId),G}),mo.delete(t.loopId)},5e3);mo.set(t.loopId,j)}if(t.type==="iterationComplete"&&(t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit")){const j={max_reached:`${t.loopType??"Loop"} hit max iterations (${t.finalCount}) — problem may be in the spec`,timeout:`${t.loopType??"Loop"} timed out after ${t.elapsedMinutes??"?"} minutes (${t.finalCount} iterations)`,action_limit:`${t.loopType??"Loop"} hit action count ceiling (${t.finalCount} iterations)`};y(S=>{const G=[...S,{errorType:"iteration_limit",severity:"warning",message:j[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return G.length>10?G.slice(-10):G}),b(S=>S!=null&&S.active?{...S,errorCount:(S.errorCount||0)+1}:S)}if(M&&(t.type==="iterationStarted"||t.type==="iterationComplete")){const j=t.type==="iterationStarted"?`${t.loopType} loop started (0/${t.maxIterations})`:`${t.loopType??"loop"} loop ${t.outcome} (${t.finalCount} iterations)`;M({id:`iteration-${t.loopId}-${t.type}`,timestamp:t.timestamp,category:"iteration",title:j,detail:null,severity:t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit"?"warning":t.type==="iterationComplete"?"success":"info",sessionId:null,meta:{loopId:t.loopId,loopType:t.loopType}})}}else if(t.type==="lifecycleStarted")M&&M({id:`lifecycle-started-${t.itemId}`,timestamp:t.timestamp,category:"phase",title:`Lifecycle started: ${t.phase}`,detail:t.featureCode?`Feature: ${t.featureCode}`:null,severity:"success",sessionId:null,meta:{itemId:t.itemId,phase:t.phase,featureCode:t.featureCode}});else if(t.type==="lifecycleTransition"){const j=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",S=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";M&&M({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${j}`,detail:null,severity:S,sessionId:null,meta:{itemId:t.itemId,from:t.from,to:t.to,outcome:t.outcome}})}else if(t.type==="openLoopsUpdate")u&&t.itemId&&Array.isArray(t.loops)&&u(j=>j.map(S=>{if(S.id!==t.itemId)return S;const G=S.lifecycle?{...S.lifecycle}:{};return G.lifecycle_ext={...G.lifecycle_ext||{},open_loops:t.loops},{...S,lifecycle:G}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(j=>j.map(S=>{if(S.id!==t.itemId)return S;const G=S.lifecycle?{...S.lifecycle}:{};return G.lifecycle_ext={...G.lifecycle_ext||{},drift_axes:t.drift_axes},{...S,lifecycle:G}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:j,itemId:S,...G}=t;u(Q=>Q.map(A=>{if(A.id!==S)return A;const ct=A.lifecycle?{...A.lifecycle}:{};return ct.lifecycle_ext={...ct.lifecycle_ext||{},branch_lineage:G},{...A,lifecycle:ct}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")_&&_(t.settings||null);else if(t.type==="buildState")N&&N(j=>{const S=(j==null?void 0:j.flowId)&&t.flowId&&j.flowId===t.flowId;return{...t,tierEvents:S?j.tierEvents??[]:[],capabilityEvents:S?j.capabilityEvents??[]:[],...S&&(j==null?void 0:j.health_score)!=null?{health_score:j.health_score,health_breakdown:j.health_breakdown,health_missing:j.health_missing}:{}}});else if(t.type==="pipelineDraft")w&&w(t);else if(t.type==="pipelineDraftResolved")w&&w(null);else if(t.type==="system"&&t.subtype==="health_score")N&&N(j=>j&&{...j,health_score:t.score,health_breakdown:t.breakdown,health_missing:t.missing});else if(t.type==="system"&&(t.subtype==="gate_tier_result"||t.subtype==="gate_tier_failed"||t.subtype==="gate_tier_summary"))N&&N(j=>j&&{...j,tierEvents:[...j.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")N&&N(j=>j&&{...j,capabilityEvents:[...j.capabilityEvents||[],t].slice(-200)});else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:j}=e,S=i.current?i.current():{},G=j?j():{},Q=c.current;Q&&Q.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...S,dom:G,timestamp:new Date().toISOString()}}))}}function rI(){const t=new Set(["SCRIPT","STYLE","LINK","META","NOSCRIPT"]),e=12,r=120;function n(s,o){if(!s||o>e)return null;if(s.nodeType===Node.TEXT_NODE){const p=s.textContent.trim();return p?p.slice(0,r):null}if(s.nodeType!==Node.ELEMENT_NODE||t.has(s.tagName))return null;const a=window.getComputedStyle(s);if(a.display==="none"||a.visibility==="hidden")return null;const l={},c=s.getAttribute("role")||s.getAttribute("aria-label"),u=s.tagName.toLowerCase();if(c?l.role=c:l.tag=u,s.className&&typeof s.className=="string"){const p=s.className.trim();p.length<80&&(l.class=p)}const d=[];for(const p of s.childNodes){const f=n(p,o+1);f&&d.push(f)}return d.length===1&&typeof d[0]=="string"?l.text=d[0]:d.length>0&&(l.children=d),!c&&(u==="div"||u==="span")&&!l.text&&d.length===1&&typeof d[0]=="object"?d[0]:l}const i=document.querySelector("[data-snapshot-root]")||document.body;return n(i,0)}const xe={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},og={newIds:new Set,changedIds:new Set},yr=Df((t,e)=>{async function r(o,a){const l=await Rt(o,a),c=await l.json();return l.ok?c:(console.error(`[vision] API error ${l.status}:`,c.error||c),{error:c.error||`HTTP ${l.status}`})}function n(){t({connected:!0}),Rt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),Rt("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),Rt("/api/agents/tree").then(o=>o.json()).then(o=>{e().spawnedAgents.length===0&&t({spawnedAgents:(o.agents||[]).map(l=>({agentId:l.agentId,parentSessionId:l.parentSessionId,agentType:l.agentType,status:l.status||"running",startedAt:l.startedAt,prompt:l.prompt}))})}).catch(()=>{})}function i(o){try{const a=JSON.parse(o.data);eI(a,{prevItemMapRef:{get current(){return xe.prevItemMap},set current(l){xe.prevItemMap=l}},snapshotProviderRef:{get current(){return xe.snapshotProvider},set current(l){xe.snapshotProvider=l}},gatesRef:{get current(){return xe.gates},set current(l){xe.gates=l}},pendingResolveIdsRef:{get current(){return xe.pendingResolveIds},set current(l){xe.pendingResolveIds=l}},changeTimerRef:{get current(){return xe.changeTimer},set current(l){xe.changeTimer=l}},sessionEndTimerRef:{get current(){return xe.sessionEndTimer},set current(l){xe.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=xe.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:rI},{setItems:l=>t(c=>({items:typeof l=="function"?l(c.items):l})),setConnections:l=>t(c=>({connections:typeof l=="function"?l(c.connections):l})),setGates:l=>{t(c=>{const u=typeof l=="function"?l(c.gates):l;return xe.gates=u,{gates:u}})},setGateEvent:l=>t({gateEvent:l}),setRecentChanges:l=>t(c=>({recentChanges:typeof l=="function"?l(c.recentChanges):l})),setUICommand:l=>t({uiCommand:l}),setAgentActivity:l=>t(c=>({agentActivity:typeof l=="function"?l(c.agentActivity):l})),setAgentErrors:l=>{t(c=>{const u=typeof l=="function"?l(c.agentErrors):l,d=Date.now()-6e4,p=u.filter(f=>new Date(f.timestamp).getTime()>d).slice(-5);return{agentErrors:u,recentErrors:p}})},setSessionState:l=>t(c=>({sessionState:typeof l=="function"?l(c.sessionState):l})),setSpawnedAgents:l=>t(c=>({spawnedAgents:typeof l=="function"?l(c.spawnedAgents):l})),setAgentRelays:l=>t(c=>({agentRelays:typeof l=="function"?l(c.agentRelays):l})),setSettings:l=>t({settings:l}),setPipelineDraft:l=>t({pipelineDraft:l}),setActiveBuild:l=>t(c=>({activeBuild:typeof l=="function"?l(c.activeBuild):l})),setSessions:l=>t(c=>({sessions:typeof l=="function"?l(c.sessions):l})),setFeatureTimeline:l=>t(c=>({featureTimeline:typeof l=="function"?l(c.featureTimeline):l})),setIterationStates:l=>t(c=>({iterationStates:typeof l=="function"?l(c.iterationStates):l})),appendDecisionEvent:l=>t(c=>!(l!=null&&l.id)||c.decisionEvents.some(u=>u.id===l.id)?c:{decisionEvents:[...c.decisionEvents,l]}),setDecisionEventsSnapshot:l=>t({decisionEvents:Array.isArray(l)?l:[]}),setStatusSnapshot:(l,c)=>t(u=>({statusSnapshots:{...u.statusSnapshots,[l]:c}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),EMPTY_CHANGES:og})}catch{}}function s(){if(xe.disposed||xe.ws)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/vision`;xe.ws=g_({url:a,onOpen:n,onMessage:i,onClose:()=>t({connected:!1})})}return Rt("/api/session/current").then(o=>o.json()).then(o=>{o.session&&t(a=>a.sessionState?{}:{sessionState:{id:o.session.id,active:!0,startedAt:o.session.startedAt,source:o.session.source||"hydrated",toolCount:o.session.toolCount||0,errorCount:o.session.errorCount||0,summaries:o.session.summaries||[],featureCode:o.session.featureCode||null,featureItemId:o.session.featureItemId||null,phaseAtBind:o.session.phaseAtBind||null,boundAt:o.session.boundAt||null}})}).catch(()=>console.warn("[vision] Failed to hydrate session state")),xe.buildPollInterval=setInterval(()=>{Rt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),xe.recentErrorsInterval=setInterval(()=>{const{agentErrors:o}=e(),a=Date.now()-6e4,l=o.filter(c=>new Date(c.timestamp).getTime()>a).slice(-5);t({recentErrors:l})},1e4),s(),{items:[],connections:[],connected:!1,uiCommand:null,recentChanges:og,agentActivity:[],agentErrors:[],recentErrors:[],spawnedAgents:[],agentRelays:[],sessionState:null,gates:[],gateEvent:null,settings:null,pipelineDraft:null,activeBuild:null,iterationStates:new Map,sessions:[],featureTimeline:[],selectedPhase:(()=>{try{return localStorage.getItem("compose:selectedPhase")||null}catch{return null}})(),selectedBranches:{},decisionEvents:[],statusSnapshots:{},clearUICommand:()=>t({uiCommand:null}),setSelectedBranches:(o,a)=>t(l=>({selectedBranches:{...l.selectedBranches,[o]:a}})),setStatusSnapshot:(o,a)=>t(l=>({statusSnapshots:{...l.statusSnapshots,[o]:a}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),setDecisionEventsSnapshot:o=>t({decisionEvents:Array.isArray(o)?o:[]}),appendDecisionEvent:o=>t(a=>!(o!=null&&o.id)||a.decisionEvents.some(l=>l.id===o.id)?a:{decisionEvents:[...a.decisionEvents,o]}),registerSnapshotProvider:o=>{xe.snapshotProvider=o},setActiveBuild:o=>t({activeBuild:o}),setPipelineDraft:o=>t({pipelineDraft:o}),setFeatureTimeline:o=>t(a=>({featureTimeline:typeof o=="function"?o(a.featureTimeline):o})),setSelectedPhase:o=>{t({selectedPhase:o});try{o?localStorage.setItem("compose:selectedPhase",o):localStorage.removeItem("compose:selectedPhase")}catch{}},updateItemPosition:(o,a)=>{t(l=>({items:l.items.map(c=>c.id===o?{...c,position:a}:c)}))},createItem:o=>r("/api/vision/items",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),updateItem:(o,a)=>r(`/api/vision/items/${o}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),deleteItem:o=>r(`/api/vision/items/${o}`,{method:"DELETE"}),createConnection:o=>r("/api/vision/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),deleteConnection:o=>r(`/api/vision/connections/${o}`,{method:"DELETE"}),resolveGate:async(o,a,l)=>{xe.pendingResolveIds.add(o);try{const c=await r(`/api/vision/gates/${o}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({outcome:a,comment:l})});return c.error&&xe.pendingResolveIds.delete(o),c}catch{return xe.pendingResolveIds.delete(o),{error:"Network error"}}},updateSettings:o=>r("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),resetSettings:o=>r("/api/settings/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o?{section:o}:{})})}});function Db(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=Db(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Ob(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=Db(t))&&(n&&(n+=" "),n+=e);return n}const ag=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,lg=Ob,Rb=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return lg(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const u=r==null?void 0:r[c],d=s==null?void 0:s[c];if(u===null)return null;const p=ag(u)||ag(d);return i[c][p]}),a=r&&Object.entries(r).reduce((c,u)=>{let[d,p]=u;return p===void 0||(c[d]=p),c},{}),l=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:d,className:p,...f}=u;return Object.entries(f).every(m=>{let[x,g]=m;return Array.isArray(g)?g.includes({...s,...a}[x]):{...s,...a}[x]===g})?[...c,d,p]:c},[]);return lg(t,o,l,r==null?void 0:r.class,r==null?void 0:r.className)},nI=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},iI=(t,e)=>({classGroupId:t,validator:e}),$b=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),Vl="-",cg=[],sI="arbitrary..",oI=t=>{const e=lI(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return aI(o);const a=o.split(Vl),l=a[0]===""&&a.length>1?1:0;return zb(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=r[o];return l?c?nI(c,l):l:c||cg}return r[o]||cg}}},zb=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],s=r.nextPart.get(i);if(s){const c=zb(t,e+1,s);if(c)return c}const o=r.validators;if(o===null)return;const a=e===0?t.join(Vl):t.slice(e).join(Vl),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},aI=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?sI+n:void 0})(),lI=t=>{const{theme:e,classGroups:r}=t;return cI(r,e)},cI=(t,e)=>{const r=$b();for(const n in t){const i=t[n];Of(i,r,n,e)}return r},Of=(t,e,r,n)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];hI(o,e,r,n)}},hI=(t,e,r,n)=>{if(typeof t=="string"){uI(t,e,r);return}if(typeof t=="function"){dI(t,e,r,n);return}fI(t,e,r,n)},uI=(t,e,r)=>{const n=t===""?e:Wb(e,t);n.classGroupId=r},dI=(t,e,r,n)=>{if(pI(t)){Of(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(iI(r,t))},fI=(t,e,r,n)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];Of(l,Wb(e,a),r,n)}},Wb=(t,e)=>{let r=t;const n=e.split(Vl),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=r.nextPart.get(o);a||(a=$b(),r.nextPart.set(o,a)),r=a}return r},pI=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,mI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},Xu="!",hg=":",gI=[],ug=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),xI=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let x=0;x<u;x++){const g=i[x];if(o===0&&a===0){if(g===hg){s.push(i.slice(l,x)),l=x+1;continue}if(g==="/"){c=x;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.slice(l);let p=d,f=!1;d.endsWith(Xu)?(p=d.slice(0,-1),f=!0):d.startsWith(Xu)&&(p=d.slice(1),f=!0);const m=c&&c>l?c-l:void 0;return ug(s,f,p,m)};if(e){const i=e+hg,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):ug(gI,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},yI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},bI=t=>({cache:mI(t.cacheSize),parseClassName:xI(t),sortModifiers:yI(t),postfixLookupClassGroupIds:CI(t),...oI(t)}),CI=t=>{const e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)e[r[n]]=!0;return e},kI=/\s+/,vI=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s,postfixLookupClassGroupIds:o}=e,a=[],l=t.trim().split(kI);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let y=!!g,b;if(y){const N=x.substring(0,g);b=n(N);const B=b&&o[b]?n(x):void 0;B&&B!==b&&(b=B,y=!1)}else b=n(x);if(!b){if(!y){c=d+(c.length>0?" "+c:c);continue}if(b=n(x),!b){c=d+(c.length>0?" "+c:c);continue}y=!1}const k=f.length===0?"":f.length===1?f[0]:s(f).join(":"),T=m?k+Xu:k,_=T+b;if(a.indexOf(_)>-1)continue;a.push(_);const w=i(b,y);for(let N=0;N<w.length;++N){const B=w[N];a.push(T+B)}c=d+(c.length>0?" "+c:c)}return c},wI=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=qb(r))&&(i&&(i+=" "),i+=n);return i},qb=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=qb(t[n]))&&(r&&(r+=" "),r+=e);return r},SI=(t,...e)=>{let r,n,i,s;const o=l=>{const c=e.reduce((u,d)=>d(u),t());return r=bI(c),n=r.cache.get,i=r.cache.set,s=a,a(l)},a=l=>{const c=n(l);if(c)return c;const u=vI(l,r);return i(l,u),u};return s=o,(...l)=>s(wI(...l))},TI=[],Ae=t=>{const e=r=>r[t]||TI;return e.isThemeGetter=!0,e},Hb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ub=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_I=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,EI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,LI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,BI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dn=t=>_I.test(t),Vt=t=>!!t&&!Number.isNaN(Number(t)),Qr=t=>!!t&&Number.isInteger(Number(t)),zh=t=>t.endsWith("%")&&Vt(t.slice(0,-1)),bn=t=>EI.test(t),Gb=()=>!0,AI=t=>NI.test(t)&&!jI.test(t),Rf=()=>!1,MI=t=>LI.test(t),II=t=>BI.test(t),FI=t=>!mt(t)&&!gt(t),PI=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),DI=t=>ii(t,Xb,Rf),mt=t=>Hb.test(t),ui=t=>ii(t,Kb,AI),dg=t=>ii(t,UI,Vt),OI=t=>ii(t,Qb,Gb),RI=t=>ii(t,Zb,Rf),fg=t=>ii(t,Yb,Rf),$I=t=>ii(t,Vb,II),Ua=t=>ii(t,Jb,MI),gt=t=>Ub.test(t),go=t=>Di(t,Kb),zI=t=>Di(t,Zb),pg=t=>Di(t,Yb),WI=t=>Di(t,Xb),qI=t=>Di(t,Vb),Ga=t=>Di(t,Jb,!0),HI=t=>Di(t,Qb,!0),ii=(t,e,r)=>{const n=Hb.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},Di=(t,e,r=!1)=>{const n=Ub.exec(t);return n?n[1]?e(n[1]):r:!1},Yb=t=>t==="position"||t==="percentage",Vb=t=>t==="image"||t==="url",Xb=t=>t==="length"||t==="size"||t==="bg-size",Kb=t=>t==="length",UI=t=>t==="number",Zb=t=>t==="family-name",Qb=t=>t==="number"||t==="weight",Jb=t=>t==="shadow",GI=()=>{const t=Ae("color"),e=Ae("font"),r=Ae("text"),n=Ae("font-weight"),i=Ae("tracking"),s=Ae("leading"),o=Ae("breakpoint"),a=Ae("container"),l=Ae("spacing"),c=Ae("radius"),u=Ae("shadow"),d=Ae("inset-shadow"),p=Ae("text-shadow"),f=Ae("drop-shadow"),m=Ae("blur"),x=Ae("perspective"),g=Ae("aspect"),y=Ae("ease"),b=Ae("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...T(),gt,mt],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],B=()=>[gt,mt,l],I=()=>[Dn,"full","auto",...B()],E=()=>[Qr,"none","subgrid",gt,mt],P=()=>["auto",{span:["full",Qr,gt,mt]},Qr,gt,mt],z=()=>[Qr,"auto",gt,mt],q=()=>["auto","min","max","fr",gt,mt],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...B()],D=()=>[Dn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],O=()=>[Dn,"screen","full","dvw","lvw","svw","min","max","fit",...B()],j=()=>[Dn,"screen","full","lh","dvh","lvh","svh","min","max","fit",...B()],S=()=>[t,gt,mt],G=()=>[...T(),pg,fg,{position:[gt,mt]}],Q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",WI,DI,{size:[gt,mt]}],ct=()=>[zh,go,ui],ut=()=>["","none","full",c,gt,mt],st=()=>["",Vt,go,ui],It=()=>["solid","dashed","dotted","double"],ht=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ot=()=>[Vt,zh,pg,fg],Y=()=>["","none",m,gt,mt],lt=()=>["none",Vt,gt,mt],xt=()=>["none",Vt,gt,mt],Nt=()=>[Vt,gt,mt],Dt=()=>[Dn,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bn],breakpoint:[bn],color:[Gb],container:[bn],"drop-shadow":[bn],ease:["in","out","in-out"],font:[FI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bn],shadow:[bn],spacing:["px",Vt],text:[bn],"text-shadow":[bn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Dn,mt,gt,g]}],container:["container"],"container-type":[{"@container":["","normal","size",gt,mt]}],"container-named":[PI],columns:[{columns:[Vt,mt,gt,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Qr,"auto",gt,mt]}],basis:[{basis:[Dn,"full","auto",a,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Vt,Dn,"auto","initial","none",mt]}],grow:[{grow:["",Vt,gt,mt]}],shrink:[{shrink:["",Vt,gt,mt]}],order:[{order:[Qr,"first","last","none",gt,mt]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pbs:[{pbs:B()}],pbe:[{pbe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...j()]}],"min-block-size":[{"min-block":["auto",...j()]}],"max-block-size":[{"max-block":["none",...j()]}],w:[{w:[a,"screen",...D()]}],"min-w":[{"min-w":[a,"screen","none",...D()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",r,go,ui]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,HI,OI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zh,mt]}],"font-family":[{font:[zI,RI,e]}],"font-features":[{"font-features":[mt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,gt,mt]}],"line-clamp":[{"line-clamp":[Vt,"none",gt,dg]}],leading:[{leading:[s,...B()]}],"list-image":[{"list-image":["none",gt,mt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",gt,mt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...It(),"wavy"]}],"text-decoration-thickness":[{decoration:[Vt,"from-font","auto",gt,ui]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Vt,"auto",gt,mt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"tab-size":[{tab:[Qr,gt,mt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt,mt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gt,mt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:Q()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qr,gt,mt],radial:["",gt,mt],conic:[Qr,gt,mt]},qI,$I]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:ct()}],"gradient-via-pos":[{via:ct()}],"gradient-to-pos":[{to:ct()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:ut()}],"rounded-s":[{"rounded-s":ut()}],"rounded-e":[{"rounded-e":ut()}],"rounded-t":[{"rounded-t":ut()}],"rounded-r":[{"rounded-r":ut()}],"rounded-b":[{"rounded-b":ut()}],"rounded-l":[{"rounded-l":ut()}],"rounded-ss":[{"rounded-ss":ut()}],"rounded-se":[{"rounded-se":ut()}],"rounded-ee":[{"rounded-ee":ut()}],"rounded-es":[{"rounded-es":ut()}],"rounded-tl":[{"rounded-tl":ut()}],"rounded-tr":[{"rounded-tr":ut()}],"rounded-br":[{"rounded-br":ut()}],"rounded-bl":[{"rounded-bl":ut()}],"border-w":[{border:st()}],"border-w-x":[{"border-x":st()}],"border-w-y":[{"border-y":st()}],"border-w-s":[{"border-s":st()}],"border-w-e":[{"border-e":st()}],"border-w-bs":[{"border-bs":st()}],"border-w-be":[{"border-be":st()}],"border-w-t":[{"border-t":st()}],"border-w-r":[{"border-r":st()}],"border-w-b":[{"border-b":st()}],"border-w-l":[{"border-l":st()}],"divide-x":[{"divide-x":st()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":st()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...It(),"hidden","none"]}],"divide-style":[{divide:[...It(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-bs":[{"border-bs":S()}],"border-color-be":[{"border-be":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...It(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Vt,gt,mt]}],"outline-w":[{outline:["",Vt,go,ui]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",u,Ga,Ua]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",d,Ga,Ua]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:st()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Vt,ui]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":st()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",p,Ga,Ua]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Vt,gt,mt]}],"mix-blend":[{"mix-blend":[...ht(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ht()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Vt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ot()}],"mask-image-linear-to-pos":[{"mask-linear-to":ot()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":ot()}],"mask-image-t-to-pos":[{"mask-t-to":ot()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":ot()}],"mask-image-r-to-pos":[{"mask-r-to":ot()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":ot()}],"mask-image-b-to-pos":[{"mask-b-to":ot()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":ot()}],"mask-image-l-to-pos":[{"mask-l-to":ot()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":ot()}],"mask-image-x-to-pos":[{"mask-x-to":ot()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":ot()}],"mask-image-y-to-pos":[{"mask-y-to":ot()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[gt,mt]}],"mask-image-radial-from-pos":[{"mask-radial-from":ot()}],"mask-image-radial-to-pos":[{"mask-radial-to":ot()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Vt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ot()}],"mask-image-conic-to-pos":[{"mask-conic-to":ot()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:Q()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",gt,mt]}],filter:[{filter:["","none",gt,mt]}],blur:[{blur:Y()}],brightness:[{brightness:[Vt,gt,mt]}],contrast:[{contrast:[Vt,gt,mt]}],"drop-shadow":[{"drop-shadow":["","none",f,Ga,Ua]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Vt,gt,mt]}],"hue-rotate":[{"hue-rotate":[Vt,gt,mt]}],invert:[{invert:["",Vt,gt,mt]}],saturate:[{saturate:[Vt,gt,mt]}],sepia:[{sepia:["",Vt,gt,mt]}],"backdrop-filter":[{"backdrop-filter":["","none",gt,mt]}],"backdrop-blur":[{"backdrop-blur":Y()}],"backdrop-brightness":[{"backdrop-brightness":[Vt,gt,mt]}],"backdrop-contrast":[{"backdrop-contrast":[Vt,gt,mt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Vt,gt,mt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vt,gt,mt]}],"backdrop-invert":[{"backdrop-invert":["",Vt,gt,mt]}],"backdrop-opacity":[{"backdrop-opacity":[Vt,gt,mt]}],"backdrop-saturate":[{"backdrop-saturate":[Vt,gt,mt]}],"backdrop-sepia":[{"backdrop-sepia":["",Vt,gt,mt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",gt,mt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Vt,"initial",gt,mt]}],ease:[{ease:["linear","initial",y,gt,mt]}],delay:[{delay:[Vt,gt,mt]}],animate:[{animate:["none",b,gt,mt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,gt,mt]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:lt()}],"rotate-x":[{"rotate-x":lt()}],"rotate-y":[{"rotate-y":lt()}],"rotate-z":[{"rotate-z":lt()}],scale:[{scale:xt()}],"scale-x":[{"scale-x":xt()}],"scale-y":[{"scale-y":xt()}],"scale-z":[{"scale-z":xt()}],"scale-3d":["scale-3d"],skew:[{skew:Nt()}],"skew-x":[{"skew-x":Nt()}],"skew-y":[{"skew-y":Nt()}],transform:[{transform:[gt,mt,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Dt()}],"translate-x":[{"translate-x":Dt()}],"translate-y":[{"translate-y":Dt()}],"translate-z":[{"translate-z":Dt()}],"translate-none":["translate-none"],zoom:[{zoom:[Qr,gt,mt]}],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gt,mt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":S()}],"scrollbar-track-color":[{"scrollbar-track":S()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mbs":[{"scroll-mbs":B()}],"scroll-mbe":[{"scroll-mbe":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pbs":[{"scroll-pbs":B()}],"scroll-pbe":[{"scroll-pbe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gt,mt]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Vt,go,ui,dg]}],stroke:[{stroke:["none",...S()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},YI=SI(GI);function rt(...t){return YI(Ob(t))}const VI=Rb("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ar({className:t,variant:e,...r}){return h.jsx("div",{className:rt(VI({variant:e}),t),...r})}const Hc=C.forwardRef(({className:t,type:e,...r},n)=>h.jsx("input",{type:e,className:rt("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));Hc.displayName="Input";var $f=x_();function mg(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function XI(...t){return e=>{let r=!1;const n=t.map(i=>{const s=mg(i,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let i=0;i<n.length;i++){const s=n[i];typeof s=="function"?s():mg(t[i],null)}}}}function Nr(...t){return C.useCallback(XI(...t),t)}function zf(t){const e=C.forwardRef((r,n)=>{let{children:i,...s}=r,o=null,a=!1;const l=[];gg(i)&&typeof Ya=="function"&&(i=Ya(i._payload)),C.Children.forEach(i,p=>{var f;if(e3(p)){a=!0;const m=p;let x="child"in m.props?m.props.child:m.props.children;gg(x)&&typeof Ya=="function"&&(x=Ya(x._payload)),o=QI(m,x),l.push((f=o==null?void 0:o.props)==null?void 0:f.children)}else l.push(p)}),o?o=C.cloneElement(o,void 0,l):!a&&C.Children.count(i)===1&&C.isValidElement(i)&&(o=i);const c=o?t3(o):void 0,u=Nr(n,c);if(!o){if(i||i===0)throw new Error(a?s3(t):i3(t));return i}const d=JI(s,o.props??{});return o.type!==C.Fragment&&(d.ref=n?u:c),C.cloneElement(o,d)});return e.displayName=`${t}.Slot`,e}var KI=zf("Slot"),ZI=Symbol.for("radix.slottable"),QI=(t,e)=>{if("child"in t.props){const r=t.props.child;return C.isValidElement(r)?C.cloneElement(r,void 0,t.props.children(r.props.children)):null}return C.isValidElement(e)?e:null};function JI(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function t3(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function e3(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===ZI}var r3=Symbol.for("react.lazy");function gg(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===r3&&"_payload"in t&&n3(t._payload)}function n3(t){return typeof t=="object"&&t!==null&&"then"in t}var i3=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,s3=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Ya=hf[" use ".trim().toString()],o3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ur=o3.reduce((t,e)=>{const r=zf(`Primitive.${e}`),n=C.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function a3(t,e){t&&$f.flushSync(()=>t.dispatchEvent(e))}var Ds=globalThis!=null&&globalThis.document?C.useLayoutEffect:()=>{};function l3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var si=t=>{const{present:e,children:r}=t,n=c3(e),i=typeof r=="function"?r({present:n.isPresent}):C.Children.only(r),s=h3(n.ref,u3(i));return typeof r=="function"||n.isPresent?C.cloneElement(i,{ref:s}):null};si.displayName="Presence";function c3(t){const[e,r]=C.useState(),n=C.useRef(null),i=C.useRef(t),s=C.useRef("none"),o=t?"mounted":"unmounted",[a,l]=l3(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{const c=Va(n.current);s.current=a==="mounted"?c:"none"},[a]),Ds(()=>{const c=n.current,u=i.current;if(u!==t){const p=s.current,f=Va(c);t?l("MOUNT"):f==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Ds(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const x=Va(n.current).includes(CSS.escape(f.animationName));if(f.target===e&&x&&(l("ANIMATION_END"),!i.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},p=f=>{f.target===e&&(s.current=Va(n.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:C.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function xg(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function h3(...t){const e=C.useRef(t);return e.current=t,C.useCallback(r=>{const n=e.current;let i=!1;const s=n.map(o=>{const a=xg(o,r);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():xg(n[o],null)}}},[])}function Va(t){return(t==null?void 0:t.animationName)||"none"}function u3(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function d3(t,e){const r=C.createContext(e);r.displayName=t+"Context";const n=s=>{const{children:o,...a}=s,l=C.useMemo(()=>a,Object.values(a));return h.jsx(r.Provider,{value:l,children:o})};n.displayName=t+"Provider";function i(s){const o=C.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[n,i]}function t1(t,e=[]){let r=[];function n(s,o){const a=C.createContext(o);a.displayName=s+"Context";const l=r.length;r=[...r,o];const c=d=>{var y;const{scope:p,children:f,...m}=d,x=((y=p==null?void 0:p[t])==null?void 0:y[l])||a,g=C.useMemo(()=>m,Object.values(m));return h.jsx(x.Provider,{value:g,children:f})};c.displayName=s+"Provider";function u(d,p){var x;const f=((x=p==null?void 0:p[t])==null?void 0:x[l])||a,m=C.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=r.map(o=>C.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return C.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[n,f3(i,...e)]}function f3(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Mr(t){const e=C.useRef(t);return C.useEffect(()=>{e.current=t}),C.useMemo(()=>((...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)}),[])}var p3=C.createContext(void 0);function m3(t){const e=C.useContext(p3);return t||e||"ltr"}function g3(t,[e,r]){return Math.min(r,Math.max(e,t))}function lr(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function x3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var Wf="ScrollArea",[e1]=t1(Wf),[y3,Pr]=e1(Wf),r1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=C.useState(null),[c,u]=C.useState(null),[d,p]=C.useState(null),[f,m]=C.useState(null),[x,g]=C.useState(null),[y,b]=C.useState(0),[k,T]=C.useState(0),[_,w]=C.useState(!1),[N,B]=C.useState(!1),I=Nr(e,P=>l(P)),E=m3(i);return h.jsx(y3,{scope:r,type:n,dir:E,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:p,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:w,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:B,onCornerWidthChange:b,onCornerHeightChange:T,children:h.jsx(ur.div,{dir:E,...o,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...t.style}})})});r1.displayName=Wf;var n1="ScrollAreaViewport",i1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Pr(n1,r),a=C.useRef(null),l=Nr(e,a,o.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),h.jsx(ur.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:h.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});i1.displayName=n1;var fn="ScrollAreaScrollbar",qf=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Pr(fn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return C.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?h.jsx(b3,{...n,ref:e,forceMount:r}):i.type==="scroll"?h.jsx(C3,{...n,ref:e,forceMount:r}):i.type==="auto"?h.jsx(s1,{...n,ref:e,forceMount:r}):i.type==="always"?h.jsx(Hf,{...n,ref:e,"data-state":"visible"}):null});qf.displayName=fn;var b3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Pr(fn,t.__scopeScrollArea),[s,o]=C.useState(!1);return C.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),h.jsx(si,{present:r||s,children:h.jsx(s1,{"data-state":s?"visible":"hidden",...n,ref:e})})}),C3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Pr(fn,t.__scopeScrollArea),s=t.orientation==="horizontal",o=Gc(()=>l("SCROLL_END"),100),[a,l]=x3("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),C.useEffect(()=>{const c=i.viewport,u=s?"scrollLeft":"scrollTop";if(c){let d=c[u];const p=()=>{const f=c[u];d!==f&&(l("SCROLL"),o()),d=f};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[i.viewport,s,l,o]),h.jsx(si,{present:r||a!=="hidden",children:h.jsx(Hf,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:lr(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:lr(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),s1=C.forwardRef((t,e)=>{const r=Pr(fn,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=C.useState(!1),a=t.orientation==="horizontal",l=Gc(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?c:u)}},10);return Os(r.viewport,l),Os(r.content,l),h.jsx(si,{present:n||s,children:h.jsx(Hf,{"data-state":s?"visible":"hidden",...i,ref:e})})}),Hf=C.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Pr(fn,t.__scopeScrollArea),s=C.useRef(null),o=C.useRef(0),[a,l]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=h1(a.viewport,a.content),u={...n,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function d(p,f){return _3(p,o.current,a,f)}return r==="horizontal"?h.jsx(k3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,f=yg(p,a,i.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=d(p,i.dir))}}):r==="vertical"?h.jsx(v3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,f=yg(p,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=d(p))}}):null}),k3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Pr(fn,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=Nr(e,l,s.onScrollbarXChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(a1,{"data-orientation":"horizontal",...i,ref:c,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Uc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(p),d1(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Kl(o.paddingLeft),paddingEnd:Kl(o.paddingRight)}})}})}),v3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Pr(fn,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=Nr(e,l,s.onScrollbarYChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(a1,{"data-orientation":"vertical",...i,ref:c,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Uc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(p),d1(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Kl(o.paddingTop),paddingEnd:Kl(o.paddingBottom)}})}})}),[w3,o1]=e1(fn),a1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...p}=t,f=Pr(fn,r),[m,x]=C.useState(null),g=Nr(e,I=>x(I)),y=C.useRef(null),b=C.useRef(""),k=f.viewport,T=n.content-n.viewport,_=Mr(u),w=Mr(l),N=Gc(d,10);function B(I){if(y.current){const E=I.clientX-y.current.left,P=I.clientY-y.current.top;c({x:E,y:P})}}return C.useEffect(()=>{const I=E=>{const P=E.target;(m==null?void 0:m.contains(P))&&_(E,T)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[k,m,T,_]),C.useEffect(w,[n,w]),Os(m,N),Os(f.content,N),h.jsx(w3,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:Mr(s),onThumbPointerUp:Mr(o),onThumbPositionChange:w,onThumbPointerDown:Mr(a),children:h.jsx(ur.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:lr(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),y.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),B(I))}),onPointerMove:lr(t.onPointerMove,B),onPointerUp:lr(t.onPointerUp,I=>{const E=I.target;E.hasPointerCapture(I.pointerId)&&E.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),Xl="ScrollAreaThumb",l1=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=o1(Xl,t.__scopeScrollArea);return h.jsx(si,{present:r||i.hasThumb,children:h.jsx(S3,{ref:e,...n})})}),S3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Pr(Xl,r),o=o1(Xl,r),{onThumbPositionChange:a}=o,l=Nr(e,d=>o.onThumbChange(d)),c=C.useRef(void 0),u=Gc(()=>{c.current&&(c.current(),c.current=void 0)},100);return C.useEffect(()=>{const d=s.viewport;if(d){const p=()=>{if(u(),!c.current){const f=E3(d,a);c.current=f,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[s.viewport,u,a]),h.jsx(ur.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:lr(t.onPointerDownCapture,d=>{const f=d.target.getBoundingClientRect(),m=d.clientX-f.left,x=d.clientY-f.top;o.onThumbPointerDown({x:m,y:x})}),onPointerUp:lr(t.onPointerUp,o.onThumbPointerUp)})});l1.displayName=Xl;var Uf="ScrollAreaCorner",c1=C.forwardRef((t,e)=>{const r=Pr(Uf,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?h.jsx(T3,{...t,ref:e}):null});c1.displayName=Uf;var T3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Pr(Uf,r),[s,o]=C.useState(0),[a,l]=C.useState(0),c=!!(s&&a);return Os(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),l(u)}),Os(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),c?h.jsx(ur.div,{...n,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Kl(t){return t?parseInt(t,10):0}function h1(t,e){const r=t/e;return isNaN(r)?0:r}function Uc(t){const e=h1(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function _3(t,e,r,n="ltr"){const i=Uc(r),s=i/2,o=e||s,a=i-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-a,u=r.content-r.viewport,d=n==="ltr"?[0,u]:[u*-1,0];return u1([l,c],d)(t)}function yg(t,e,r="ltr"){const n=Uc(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-n,l=r==="ltr"?[0,o]:[o*-1,0],c=g3(t,l);return u1([0,o],[0,a])(c)}function u1(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function d1(t,e){return t>0&&t<e}var E3=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&e(),r=s,n=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(n)};function Gc(t,e){const r=Mr(t),n=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(n.current),[]),C.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Os(t,e){const r=Mr(e);Ds(()=>{let n=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(n),i.unobserve(t)}}},[t,r])}var f1=r1,N3=i1,j3=c1;const Kn=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(f1,{ref:n,className:rt("relative overflow-hidden",t),...r,children:[h.jsx(N3,{className:"h-full w-full rounded-[inherit]",children:e}),h.jsx(p1,{}),h.jsx(j3,{})]}));Kn.displayName=f1.displayName;const p1=C.forwardRef(({className:t,orientation:e="vertical",...r},n)=>h.jsx(qf,{ref:n,orientation:e,className:rt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:h.jsx(l1,{className:"relative flex-1 rounded-full bg-border"})}));p1.displayName=qf.displayName;var L3="Separator",bg="horizontal",B3=["horizontal","vertical"],m1=C.forwardRef((t,e)=>{const{decorative:r,orientation:n=bg,...i}=t,s=A3(n)?n:bg,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return h.jsx(ur.div,{"data-orientation":s,...a,...i,ref:e})});m1.displayName=L3;function A3(t){return B3.includes(t)}var g1=m1;const Zl=C.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>h.jsx(g1,{ref:i,decorative:r,orientation:e,className:rt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Zl.displayName=g1.displayName;function M3({agentId:t,status:e}){const[r,n]=C.useState(""),[i,s]=C.useState(""),o=C.useRef(null),a=C.useRef(!1),l=C.useCallback(()=>{const d=o.current;d&&(a.current=d.scrollTop+d.clientHeight<d.scrollHeight-20)},[]);C.useEffect(()=>{const d=o.current;d&&!a.current&&(d.scrollTop=d.scrollHeight)},[r,i]),C.useEffect(()=>{if(!t)return;const d=async()=>{try{const p=await Rt(`/api/agent/${t}`);if(!p.ok)return;const f=await p.json();f.output!=null&&n(f.output),f.stderr!=null&&s(f.stderr)}catch{}};if(d(),e==="running"){const p=setInterval(d,2e3);return()=>clearInterval(p)}},[t,e]);const c=!r&&!i,u=e==="running";return h.jsx("div",{children:h.jsx("div",{ref:o,onScroll:l,className:"overflow-auto max-h-[300px] rounded bg-muted/30 p-2",children:c?h.jsx("p",{className:"text-[10px] font-mono text-muted-foreground italic",children:u?"Waiting for output...":"No output"}):h.jsxs(h.Fragment,{children:[r&&h.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground whitespace-pre-wrap break-all m-0",children:r}),i&&h.jsxs("div",{className:"mt-2",children:[h.jsx("span",{className:"text-[10px] font-mono font-medium text-destructive",children:"stderr"}),h.jsx("pre",{className:"text-[10px] font-mono text-destructive whitespace-pre-wrap break-all m-0 mt-0.5",children:i})]})]})})})}const I3=Xt.memo(M3);function F3(t){if(!t)return"";const e=Math.floor((Date.now()-new Date(t).getTime())/1e3);return e<5?"now":e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:`${Math.floor(e/3600)}h ago`}function P3({agentId:t,relays:e}){const r=C.useMemo(()=>!e||!t?[]:e.filter(n=>n.fromAgentId===t||n.toAgentId===t),[e,t]);return r.length===0?null:h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Relays"}),h.jsx("div",{className:"space-y-0.5",children:r.map((n,i)=>{const s=n.direction==="result";return h.jsxs("div",{className:"flex items-start gap-1 text-[10px] font-mono",children:[h.jsx("span",{className:s?"text-foreground shrink-0":"text-muted-foreground shrink-0",children:s?"→":"←"}),h.jsx("span",{className:s?"text-foreground truncate":"text-muted-foreground truncate",title:n.messagePreview,children:n.messagePreview}),h.jsx("span",{className:"text-muted-foreground opacity-50 ml-auto shrink-0 tabular-nums",children:F3(n.timestamp)})]},n.id||i)})})]})}const D3=Xt.memo(P3),O3={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},Cg={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function Wh(t){if(!t||t<1e3)return"<1s";const e=Math.floor(t/1e3);return e<60?`${e}s`:`${Math.floor(e/60)}m ${e%60}s`}const R3=Xt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Xt.useState(0);Xt.useEffect(()=>{if(!r)return;const l=setInterval(()=>i(c=>c+1),1e3);return()=>clearInterval(l)},[r]);const s=r?Math.floor((Date.now()-new Date(e).getTime())/1e3):n||0,o=Math.floor(s/60),a=s%60;return h.jsxs("span",{className:"tabular-nums",children:[o,"m ",String(a).padStart(2,"0"),"s"]})});function $3({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,b;const[a,l]=Xt.useState(null),[c,u]=Xt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Xt.useState(0),[p,f]=Xt.useState([]),m=Xt.useRef(null);return Xt.useEffect(()=>{const k=T=>u(T.detail);return window.addEventListener("compose:agent-status",k),()=>window.removeEventListener("compose:agent-status",k)},[]),Xt.useEffect(()=>{if(c.status!=="working")return;const k=setInterval(()=>d(T=>T+1),1e3);return()=>clearInterval(k)},[c.status]),Xt.useEffect(()=>{if(!t||t.length===0)return;const k=t[t.length-1];Array.isArray(k.items)&&k.items.length>0&&(f(k.items),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>f([]),3e4))},[t]),Xt.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),h.jsxs(h.Fragment,{children:[i&&i.length>0&&h.jsxs("div",{className:"flex items-center gap-0.5 mb-1.5 overflow-x-auto px-3",children:[h.jsx("button",{onClick:()=>l(null),className:rt("text-[10px] px-2 py-0.5 rounded cursor-pointer transition-colors border shrink-0",a?"bg-transparent text-muted-foreground border-border hover:text-foreground":"bg-primary text-primary-foreground border-primary"),children:"Session"}),i.map(k=>h.jsxs("span",{className:"flex items-center gap-0 shrink-0",children:[h.jsxs("button",{onClick:()=>l(k.agentId),className:rt("text-[10px] px-2 py-0.5 rounded-l cursor-pointer transition-colors border flex items-center gap-1 shrink-0",a===k.agentId?"bg-primary text-primary-foreground border-primary":"bg-transparent text-muted-foreground border-border hover:text-foreground"),children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:k.status==="killed"?"hsl(var(--destructive))":k.silent?"hsl(45 93% 47%)":k.status==="running"?"hsl(var(--success))":k.status==="complete"?"hsl(142 71% 45%)":"hsl(var(--destructive))",animation:k.status==="running"&&!k.silent?"phase-active-pulse 2s ease-in-out infinite":"none"}}),k.agentType,k.silent&&h.jsx("span",{className:"text-[8px] text-yellow-500 ml-0.5",title:"Agent silent",children:"!"})]}),k.status==="running"&&o&&h.jsx("button",{onClick:T=>{T.stopPropagation(),o(k.agentId)},className:"text-[10px] px-1 py-0.5 rounded-r border border-l-0 border-border hover:bg-destructive/20 hover:text-destructive cursor-pointer transition-colors",title:"Stop agent",children:"x"})]},k.agentId))]}),a?h.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[h.jsx(I3,{agentId:a,status:(x=i.find(k=>k.agentId===a))==null?void 0:x.status}),h.jsx(D3,{agentId:a,relays:s})]}):h.jsxs(h.Fragment,{children:[(r==null?void 0:r.featureCode)&&h.jsxs("div",{className:"px-3 py-1.5 mb-1 rounded bg-muted/50",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:"Working on"}),h.jsx("button",{className:"font-medium text-foreground hover:underline",onClick:()=>r.featureItemId&&(n==null?void 0:n(r.featureItemId)),children:r.featureCode})]}),r.phaseAtBind&&h.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Phase: ",r.phaseAtBind.replace(/_/g," ")]})]}),r&&h.jsxs("div",{className:"px-3 pb-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:r.active?"hsl(var(--primary))":"hsl(var(--success))"}}),h.jsx(R3,{startedAt:r.startedAt,active:r.active,duration:r.duration}),h.jsxs("span",{className:"tabular-nums",children:[r.toolCount||0," tools"]}),r.errorCount>0&&h.jsxs("span",{style:{color:"hsl(var(--destructive))"},children:[r.errorCount," err"]}),!r.active&&r.journalSpawned&&h.jsx("span",{style:{color:"hsl(var(--primary))"},children:"journal"})]}),((g=r.summaries)==null?void 0:g.length)>0&&h.jsx("p",{className:"text-[10px] mt-0.5 truncate",style:{color:"hsl(var(--muted-foreground))",opacity:.7},title:(y=r.summaries[r.summaries.length-1])==null?void 0:y.summary,children:(b=r.summaries[r.summaries.length-1])==null?void 0:b.summary})]}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("div",{className:"rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:c.status==="working"?"var(--color-category-writing)":"hsl(var(--success))",animation:c.status==="working"?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider",style:{color:c.status==="working"?"var(--color-category-writing)":"hsl(var(--muted-foreground))"},children:c.status==="working"?O3[c.category]||"Working":"Idle"}),c.status==="working"&&c.tool&&h.jsx("span",{className:"text-[10px] tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:c.tool}),c.status==="working"&&c.currentActivity&&h.jsx("span",{className:"text-[10px] tabular-nums ml-auto",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:Wh(Date.now()-c.currentActivity.startTime)})]}),c.activityLog&&c.activityLog.length>0&&h.jsx("div",{className:"flex items-center gap-0.5 mt-1",children:c.activityLog.slice(-6).map((k,T,_)=>h.jsx("div",{className:"h-1 rounded-full",title:`${k.tool||"thinking"} — ${Wh(k.duration)}`,style:{width:Math.max(4,Math.min(16,(k.duration||0)/1e3*2)),background:om[k.category]||(c.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+T/_.length*.6}},T))}),t&&t.length>0&&h.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((k,T)=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px]",style:{color:k.error?"hsl(var(--destructive))":"hsl(var(--muted-foreground))"},children:[k.error&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"font-medium shrink-0",children:k.tool}),k.category&&!k.error&&h.jsx("span",{className:"shrink-0 opacity-50",style:{color:om[k.category]},children:k.category}),k.error?h.jsx("span",{className:"truncate",title:k.error.type,children:Cg[k.error.type]||k.error.type}):k.detail?h.jsx("span",{className:"truncate opacity-60",title:k.detail,children:k.detail.split("/").pop()}):null]},T))}),p.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Working on"}),p.slice(0,3).map(k=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{children:k.status==="in_progress"?"◆":"◇"}),h.jsx("span",{className:"truncate",children:k.title})]},k.id))]}),e&&e.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--destructive))"},children:"Errors"}),e.slice(-3).map((k,T)=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--destructive))"},children:[h.jsx("span",{className:"font-medium shrink-0",children:Cg[k.errorType]||k.errorType}),h.jsx("span",{className:"truncate opacity-70",title:k.message,children:k.message})]},T))]}),i&&i.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Subagents"}),i.map(k=>h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:k.status==="running"?"var(--color-category-executing)":k.status==="complete"?"hsl(var(--success))":"hsl(var(--destructive))",animation:k.status==="running"?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"font-medium shrink-0",children:k.agentType}),h.jsx("span",{className:"truncate opacity-60",children:k.status}),h.jsx("span",{className:"tabular-nums ml-auto opacity-50",children:Wh(Date.now()-new Date(k.startedAt).getTime())})]},k.agentId))]})]})})]})]})}const z3=Xt.memo($3),Ho={DECISION:1,PENDING_GATE:2,BLOCKED:3};function x1(t,e){const r=new Set((e||[]).filter(s=>s.status==="pending").map(s=>s.itemId)),n=new Map,i=(s,o,a)=>{const l=n.get(s.id);(!l||o>l.priority)&&n.set(s.id,{item:s,priority:o,reason:a})};for(const s of t||[])s.status==="blocked"&&i(s,Ho.BLOCKED,"Blocked"),r.has(s.id)&&i(s,Ho.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,Ho.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function W3(t){if(!t)return{isRunning:!1,pct:0,stepLabel:"",featureCode:"",stepNum:0,totalSteps:0,status:""};const{currentStepId:e,stepNum:r,totalSteps:n,status:i,featureCode:s}=t,o=i==="running",a=n>0?r/n*100:0,l=Math.min(100,Math.max(0,Math.round(a))),c=e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," "):"";return{isRunning:o,pct:l,stepLabel:c,featureCode:s||"",stepNum:r??0,totalSteps:n??0,status:i||""}}function y1(t,e){const r=t||[],n=e||[];let i=0,s=0,o=0;for(const l of r)l.status==="in_progress"&&i++,l.status==="blocked"&&s++;const a=n.filter(l=>l.status==="pending"||l.status==="awaiting").length;return o=x1(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function q3(t,e){return t&&t===e?null:e}const H3={planned:{bg:"bg-slate-500/15",text:"text-slate-400",dot:"bg-slate-400"},ready:{bg:"bg-sky-500/15",text:"text-sky-400",dot:"bg-sky-400"},in_progress:{bg:"bg-blue-500/15",text:"text-blue-400",dot:"bg-blue-400"},review:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"},complete:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},blocked:{bg:"bg-rose-500/15",text:"text-rose-400",dot:"bg-rose-400"},parked:{bg:"bg-slate-500/15",text:"text-slate-500",dot:"bg-slate-500"},killed:{bg:"bg-slate-500/15",text:"text-slate-600",dot:"bg-slate-600"},pending:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"},resolved:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},active:{bg:"bg-blue-500/15",text:"text-blue-400",dot:"bg-blue-400"},completed:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},failed:{bg:"bg-rose-500/15",text:"text-rose-400",dot:"bg-rose-400"},paused:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"}},U3={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function Gf({status:t,className:e}){const r=H3[t]||U3,n=t?t.replace(/_/g," "):"—";return h.jsxs("span",{className:rt("inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",r.bg,r.text,e),children:[h.jsx("span",{className:rt("w-1 h-1 rounded-full shrink-0",r.dot)}),n]})}const G3={vision:"text-violet-400 bg-violet-500/10 border-violet-500/20",specification:"text-purple-400 bg-purple-500/10 border-purple-500/20",planning:"text-cyan-400 bg-cyan-500/10 border-cyan-500/20",implementation:"text-amber-400 bg-amber-500/10 border-amber-500/20",verification:"text-emerald-400 bg-emerald-500/10 border-emerald-500/20",release:"text-green-400 bg-green-500/10 border-green-500/20"},Y3="text-slate-400 bg-slate-500/10 border-slate-500/20";function V3({phase:t,className:e}){const r=G3[t]||Y3;return h.jsx("span",{className:rt("inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-mono",r,e),children:t||"—"})}async function On(t,e={}){const r=await Rt(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let qh=null;function b1(t){if(qh)return;const e=window.location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${e}//${window.location.host}/ws/vision`);qh=r,r.onmessage=n=>{try{const i=JSON.parse(n.data);i.type==="ideaboxUpdated"&&t(i)}catch{}},r.onclose=()=>{qh=null,setTimeout(()=>{b1(t)},3e3)},r.onerror=()=>{}}const Rs=Df((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{b1(()=>{e().hydrate()})},500),{ideas:[],killed:[],loading:!1,error:null,selectedIdeaId:null,filters:{tag:"",status:"",priority:"",search:""},hydrate:async()=>{t({loading:!0,error:null});try{const r=await On("/api/ideabox");t({ideas:r.ideas||[],killed:r.killed||[],loading:!1})}catch(r){t({error:r.message,loading:!1})}},addIdea:async r=>{const n=await On("/api/ideabox/ideas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return await e().hydrate(),n},promoteIdea:async(r,n="")=>{const i=await On(`/api/ideabox/ideas/${r}/promote`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({featureCode:n})});return await e().hydrate(),i},killIdea:async(r,n="")=>{const i=await On(`/api/ideabox/ideas/${r}/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})});return await e().hydrate(),i},setPriority:async(r,n)=>{const i=await On(`/api/ideabox/ideas/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:n})});return t(s=>({ideas:s.ideas.map(o=>o.id===r?{...o,priority:n}:o)})),i},resurrectIdea:async r=>{const n=await On(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await On(`/api/ideabox/ideas/${encodeURIComponent(r)}/discuss`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:n,text:i})});return await e().hydrate(),s},updateIdea:async(r,n)=>{const i=await On(`/api/ideabox/ideas/${encodeURIComponent(r)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e().hydrate(),i},setSelectedIdea:r=>t({selectedIdeaId:r}),updateFilters:r=>t(n=>({filters:{...n.filters,...r}})),clearFilters:()=>t({filters:{tag:"",status:"",priority:"",search:""}})}));function X3({activeBuild:t}){const e=W3(t);if(!t)return null;const r=e.isRunning?"hsl(var(--primary))":e.status==="complete"?"hsl(var(--success))":e.status==="failed"||e.status==="killed"?"hsl(var(--destructive))":"hsl(var(--muted-foreground))";return h.jsxs("div",{className:"mx-3 mb-2 rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Yl,{className:"h-3 w-3 shrink-0",style:{color:r}}),h.jsx("span",{className:"text-[10px] font-medium truncate max-w-[100px]",style:{color:"hsl(var(--foreground))"},children:e.featureCode||"Build"})]}),h.jsxs("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))"},children:[e.stepNum,"/",e.totalSteps]})]}),h.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${e.pct}%`,background:r}})}),h.jsxs("div",{className:"flex items-center justify-between mt-1",children:[h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:e.stepLabel}),e.isRunning&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--primary))",animation:"pulse 1.5s ease-in-out infinite"}})]})]})}function K3({items:t,gates:e,onSelectItem:r,onViewChange:n}){const i=Xt.useMemo(()=>x1(t,e),[t,e]);if(i.length===0)return null;const s=i.slice(0,5),o=i.length-s.length,a=l=>l===Ho.BLOCKED?h.jsx(Wc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):l===Ho.PENDING_GATE?h.jsx(PM,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):h.jsx(PA,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--muted-foreground))"}});return h.jsxs("div",{className:"px-2 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Needs Attention"}),s.map(({item:l,priority:c,reason:u})=>h.jsxs("button",{onClick:()=>r==null?void 0:r(l.id),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:u,children:[a(c),h.jsx("span",{className:"truncate flex-1 text-left",children:l.title}),l.phase&&h.jsx(V3,{phase:l.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),h.jsx(Gf,{status:l.status,className:"shrink-0"})]},l.id)),o>0&&h.jsxs("button",{onClick:()=>n==null?void 0:n("attention"),className:"flex w-full items-center px-2 py-0.5 text-[10px] rounded-md hover:bg-sidebar-accent/50 transition-colors",style:{color:"hsl(var(--muted-foreground))"},children:["+",o," more"]})]})}function Z3({items:t,gates:e}){const r=Xt.useMemo(()=>y1(t,e),[t,e]);return r.total===0?null:h.jsxs("div",{className:"flex items-center gap-2 flex-wrap px-3 pb-1",children:[h.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.total," items"]}),r.inProgress>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--primary))"},children:[r.inProgress," active"]}),r.blocked>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--destructive))"},children:[r.blocked," blocked"]}),r.pendingGates>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--warning))"},children:[r.pendingGates," ",r.pendingGates===1?"gate":"gates"]})]})}const Q3=new Set(["planned","ready","in_progress","review","blocked","parked"]);function J3({items:t,hiddenGroups:e,onToggleGroup:r}){const n=Xt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!Q3.has(o.status))continue;const l=o.group||"other";i[l]=(i[l]||0)+1,["in_progress","review","ready"].includes(o.status)&&(s[l]=(s[l]||0)+1)}return Object.entries(i).sort((o,a)=>(s[a[0]]||0)-(s[o[0]]||0)||a[1]-o[1]||o[0].localeCompare(a[0])).map(([o,a])=>({group:o,count:a,active:s[o]||0}))},[t]);return n.length<=1?null:h.jsx(h.Fragment,{children:n.map(({group:i,count:s,active:o})=>{const a=e==null?void 0:e.has(i);return h.jsxs("button",{onClick:()=>r==null?void 0:r(i),className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))",opacity:a?.4:1,fontWeight:o>0?500:400},children:[h.jsx("span",{className:"truncate flex-1 text-left",children:i}),o>0&&h.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--primary))"},children:o}),h.jsx("span",{className:"text-[10px] tabular-nums shrink-0",style:{color:"hsl(var(--muted-foreground))"},children:s})]},i)})})}function tF({onViewChange:t}){const e=Rs(n=>n.ideas),r=Xt.useMemo(()=>e.filter(n=>!n.priority||n.priority==="—").length,[e]);return r===0?null:h.jsxs("div",{className:"px-2 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Ideas"}),h.jsxs("button",{onClick:()=>t==null?void 0:t("ideabox"),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:"View untriaged ideas",children:[h.jsx(_i,{className:"h-3 w-3 shrink-0 text-amber-400"}),h.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function C1({items:t,gates:e,activeBuild:r,onViewChange:n,selectedPhase:i,onPhaseSelect:s,selectedTrack:o,onTrackSelect:a,visibleTracks:l,onToggleVisibleTrack:c,onShowAllTracks:u,hiddenGroups:d,onToggleGroup:p,searchQuery:f,onSearchChange:m,connected:x,agentActivity:g,agentErrors:y,spawnedAgents:b,agentRelays:k,sessionState:T,onSelectItem:_,onStopAgent:w,onThemeChange:N,onNewItem:B,widthPx:I}){const E=t||[],P=e||[],z=Xt.useMemo(()=>y1(E,P),[E,P]),[q,R]=Xt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Xt.useEffect(()=>{if(typeof document>"u")return;const M=new MutationObserver(()=>{R(document.documentElement.classList.contains("dark"))});return M.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>M.disconnect()},[]);const F=Xt.useCallback(()=>{const M=!q,D=M?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",M);try{localStorage.setItem("compose:theme",D)}catch{}N&&N({ui:{theme:D}})},[q,N]);return Xt.useCallback(M=>{s&&s(q3(i,M))},[s,i]),h.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:I??208},children:[h.jsxs("div",{className:"p-3 pb-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"Compose"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[!x&&h.jsx("span",{className:"text-[10px] text-destructive",children:"disconnected"}),B&&h.jsxs("button",{onClick:B,className:"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-xs text-muted-foreground hover:text-foreground bg-sidebar-accent/50 hover:bg-sidebar-accent transition-colors",title:"New item (⌘N)",children:[h.jsx(Fb,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"New"})]}),h.jsx("button",{onClick:F,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:q?"Switch to light mode":"Switch to dark mode",children:q?h.jsx(WM,{className:"h-3.5 w-3.5"}):h.jsx(vM,{className:"h-3.5 w-3.5"})})]})]}),h.jsx(Z3,{items:E,gates:P})]}),h.jsx(X3,{activeBuild:r}),h.jsx(z3,{agentActivity:g,agentErrors:y,sessionState:T,onSelectItem:_,onStopAgent:w,spawnedAgents:b,agentRelays:k}),z.attentionCount>0&&h.jsxs(h.Fragment,{children:[h.jsx(Zl,{className:"bg-sidebar-border"}),h.jsx(K3,{items:E,gates:P,onSelectItem:_,onViewChange:n})]}),h.jsx(tF,{onViewChange:n}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("div",{className:"relative",children:[h.jsx(ni,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Hc,{placeholder:"Search...",value:f,onChange:M=>m(M.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),h.jsx(Zl,{className:"bg-sidebar-border"}),h.jsx(Kn,{className:"flex-1",children:h.jsxs("div",{className:"p-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Groups"}),h.jsx(J3,{items:E,hiddenGroups:d,onToggleGroup:p})]})})]})}function eF({level:t,size:e=4}){return h.jsx("div",{className:"flex items-center gap-px",children:[0,1,2,3].map(r=>h.jsx("div",{className:"rounded-full",style:{width:e,height:e,background:r<t?t>=3?"hsl(var(--success))":t>=2?"hsl(var(--accent))":"hsl(var(--destructive))":"transparent",border:`1px solid ${r<t?t>=3?"hsl(var(--success))":t>=2?"hsl(var(--accent))":"hsl(var(--destructive))":"hsl(var(--border))"}`}},r))})}function ka({featureCode:t,active:e,onToggle:r}){return t?h.jsxs("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${e?"#f59e0b":"#334155"}`,background:e?"#f59e0b20":"#1e293b",color:e?"#f59e0b":"#94a3b8"},children:["Focus: ",t]}):null}const kg=[{key:"all",label:"All",statuses:null},{key:"active",label:"Active",statuses:["planned","ready","in_progress","review"]},{key:"done",label:"Done",statuses:["complete"]},{key:"blocked",label:"Blocked",statuses:["blocked","parked"]}],rF=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function vg({active:t,onClick:e,children:r}){return h.jsx("button",{onClick:e,style:{fontSize:11,padding:"2px 7px",borderRadius:4,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function k1({item:t,children:e,depth:r,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o}){const a=e.length>0,l=o.has(t.id),c=n===t.id,u=br[t.type]||br.task,d=Xn[t.status]||Xn.planned,{newIds:p,changedIds:f}=C.useContext(qc),m=p.has(t.id),x=f.has(t.id);return h.jsxs("div",{children:[h.jsxs("div",{"data-item-id":t.id,onClick:()=>i(t.id),className:rt("flex items-center gap-1.5 py-1 px-2 cursor-pointer transition-colors rounded-md","hover:bg-accent/5",c&&"bg-accent/10",m&&"bg-green-500/5 border-l-2 border-l-green-500",x&&!m&&"bg-amber-500/5 border-l-2 border-l-amber-500"),style:{paddingLeft:`${r*20+8}px`},children:[h.jsx("button",{onClick:g=>{g.stopPropagation(),a&&s(t.id)},className:rt("shrink-0 w-4 h-4 flex items-center justify-center rounded",a?"text-muted-foreground hover:text-foreground":"invisible"),children:a&&(l?h.jsx(Ca,{className:"h-3.5 w-3.5"}):h.jsx(Ps,{className:"h-3.5 w-3.5"}))}),h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:d}}),h.jsx("span",{className:"text-[9px] uppercase tracking-wider shrink-0 w-12",style:{color:u},children:t.type}),h.jsx("span",{className:rt("text-sm text-foreground truncate flex-1",t.status==="killed"&&"line-through opacity-50"),children:t.title}),h.jsx(eF,{level:t.confidence||0}),t.phase&&h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-3.5 shrink-0",children:t.phase})]}),a&&l&&h.jsx("div",{children:e.map(g=>h.jsx(k1,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function v1({items:t,connections:e,selectedItemId:r,onSelect:n,onCreate:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,c]=C.useState(()=>new Set),[u,d]=C.useState(""),[p,f]=C.useState("all"),[m,x]=C.useState("all"),g=C.useCallback(_=>{c(w=>{const N=new Set(w);return N.has(_)?N.delete(_):N.add(_),N})},[]),y=C.useMemo(()=>{let _=t;const w=kg.find(N=>N.key===p);if(w!=null&&w.statuses&&(_=_.filter(N=>w.statuses.includes(N.status||"planned"))),m!=="all"&&(_=_.filter(N=>N.type===m)),u){const N=u.toLowerCase();_=_.filter(B=>(B.title||"").toLowerCase().includes(N)||(B.description||"").toLowerCase().includes(N)||(B.type||"").toLowerCase().includes(N)||(B.phase||"").toLowerCase().includes(N))}return o&&s&&(_=_.filter(N=>{var B;return N.featureCode===s||((B=N.lifecycle)==null?void 0:B.featureCode)===s||(N.title||"").includes(s)})),_},[t,u,p,m,o,s]),b=C.useMemo(()=>{const _=new Set(y.map(E=>E.id)),w=new Map;for(const E of y)w.set(E.id,{...E,_children:[]});const N=new Map;for(const E of e)!_.has(E.fromId)||!_.has(E.toId)||(E.type==="informs"?N.has(E.toId)||N.set(E.toId,E.fromId):(E.type==="supports"||E.type==="blocks")&&(N.has(E.fromId)||N.set(E.fromId,E.toId)));for(const E of t)E.parentId&&w.has(E.parentId)&&N.set(E.id,E.parentId);for(const[E]of N){const P=new Set;let z=E;for(;z&&N.has(z);){if(P.has(z)){N.delete(z);break}P.add(z),z=N.get(z)}}const B=[];for(const E of w.values()){const P=N.get(E.id);P&&w.has(P)?w.get(P)._children.push(E):B.push(E)}const I=E=>{E.sort((P,z)=>(P.confidence||0)-(z.confidence||0));for(const P of E)P._children.length>0&&I(P._children)};return I(B),B},[y,e]);Xt.useEffect(()=>{if(u){const _=new Set,w=N=>{for(const B of N)B._children.length>0&&(_.add(B.id),w(B._children))};w(b),c(_)}else l.size===0&&b.length>0&&c(new Set(b.map(_=>_.id)))},[b,u]),Xt.useEffect(()=>{if(!r||b.length===0)return;const _=[],w=(N,B)=>{for(const I of N){if(I.id===B)return!0;if(I._children.length>0&&w(I._children,B))return _.push(I.id),!0}return!1};w(b,r),_.length>0&&c(N=>{const B=new Set(N);for(const I of _)B.add(I);return B}),requestAnimationFrame(()=>{const N=document.querySelector(`[data-item-id="${r}"]`);N&&N.scrollIntoView({block:"center",behavior:"smooth"})})},[r,b]);const k=C.useCallback(()=>{const _=new Set,w=N=>{for(const B of N)B._children.length>0&&(_.add(B.id),w(B._children))};w(b),c(_)},[b]),T=C.useCallback(()=>{c(new Set)},[]);return b.filter(_=>_._children.length>0).length,h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[h.jsx(ka,{featureCode:s,active:o,onToggle:a}),h.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[h.jsx(ni,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Hc,{placeholder:"Search items...",value:u,onChange:_=>d(_.target.value),className:"h-7 pl-7 pr-7 text-xs"}),u&&h.jsx("button",{onClick:()=>d(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h.jsx(dn,{className:"h-3 w-3"})})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Status:"}),kg.map(_=>h.jsx(vg,{active:p===_.key,onClick:()=>f(_.key),children:_.label},_.key))]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Type:"}),rF.map(_=>h.jsx(vg,{active:m===_.key,onClick:()=>x(_.key),children:_.label},_.key))]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[y.length,u||p!=="all"||m!=="all"?`/${t.length}`:""]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:k,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Expand"}),h.jsx("button",{onClick:T,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Collapse"}),i&&h.jsx("button",{onClick:i,title:"Create item",style:{width:24,height:24,borderRadius:4,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},className:"hover:border-blue-500 hover:text-white",children:h.jsx(Fb,{className:"h-3.5 w-3.5"})})]}),h.jsx(Kn,{className:"flex-1",children:h.jsx("div",{className:"py-1",children:b.length===0?h.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No items to display"}):b.map(_=>h.jsx(k1,{item:_,children:_._children,depth:0,selectedItemId:r,onSelect:n,onToggle:g,expandedIds:l},_.id))})})]})}try{ma.use(uy)}catch{}try{ma.use(b_)}catch{}const Ql={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},nF=Object.fromEntries(Object.entries(br).map(([t,e])=>{const r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16),s=[15,23,42],o=.15,a=[Math.round(s[0]*(1-o)+r*o),Math.round(s[1]*(1-o)+n*o),Math.round(s[2]*(1-o)+i*o)];return[t,`#${a.map(l=>l.toString(16).padStart(2,"0")).join("")}`]})),iF=[1,1.5,2,2.5,3],Ku={informs:{color:"#64748b",style:"solid"},supports:{color:"#22c55e",style:"solid"},blocks:{color:"#ef4444",style:"solid"},contradicts:{color:"#f472b6",style:"dashed"},implements:{color:"#a78bfa",style:"solid"}},wg=[{key:"all",label:"All",statuses:null},{key:"active",label:"Active",statuses:["planned","ready","in_progress","review"]},{key:"complete",label:"Done",statuses:["complete"]},{key:"blocked",label:"Blocked",statuses:["blocked","parked"]}];function Bo(t){return t.group||"other"}const Sg=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,Hh=24;function sF(t){if(!t||t.length<=Hh)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>Hh-1)break;r=i}return(r||t.slice(0,Hh-1))+"…"}function oF(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&Sg.test(e))return e;if(t.id&&Sg.test(t.id)&&t.id.length<=32)return t.id;const n=(t.title||"").replace(/`/g,"").trim().match(/^([A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?)\b/);return n&&n[1].length>=3?n[1]:t.slug?sF(t.slug):t.id?t.id.slice(0,12):"item"}function Tg(t,e=18){const r=t.split("-"),n=[];let i="";for(const s of r){const o=i?i+"-"+s:s;o.length>e&&i?(n.push(i),i=s):i=o}return i&&n.push(i),n.join(`
|
|
344
|
-
`)}function aF(t,e,r,n,i){var c;const s=[],o=new Set(t.map(u=>u.id));let a=null;if(n&&i){a=new Set(t.filter(u=>{var d;return u.featureCode===i||((d=u.lifecycle)==null?void 0:d.featureCode)===i||(u.title||"").startsWith(i)}).map(u=>u.id));for(const u of e)a.has(u.fromId)&&o.has(u.toId)&&a.add(u.toId),a.has(u.toId)&&o.has(u.fromId)&&a.add(u.fromId)}const l=new Set;if(r){const d=[...new Set(t.map(p=>Bo(p)).filter(Boolean))].map(p=>{const f=t.filter(y=>Bo(y)===p),m=f.filter(y=>["blocked","parked"].includes(y.status)).length,x=f.filter(y=>["in_progress","review","ready"].includes(y.status)).length,g=f.filter(y=>y.status==="planned").length;return{group:p,blocked:m,active:x,planned:g,total:f.length}});d.sort((p,f)=>f.active-p.active||f.blocked-p.blocked||f.planned-p.planned||p.group.localeCompare(f.group));for(const{group:p,active:f,total:m}of d){if(m<2)continue;l.add(p);const x=a&&t.some(g=>Bo(g)===p&&a.has(g.id));s.push({data:{id:`group-${p}`,label:`${Tg(p)}
|
|
345
|
-
(${f} active, ${m} total)`,isGroup:!0,groupType:p},...a&&!x?{classes:"focus-dimmed"}:{}})}}for(const u of t){const d=u.slug||u.id.slice(0,8),p=Tg(oF(u),14),f=Bo(u),m=a&&!a.has(u.id);s.push({data:{id:u.id,label:p,itemType:u.type||"task",status:u.status||"planned",phase:u.phase||"vision",confidence:u.confidence??0,title:u.title,description:u.description,slug:d,featureCode:((c=u.lifecycle)==null?void 0:c.featureCode)||u.featureCode||null,group:f||null,...r&&f&&l.has(f)?{parent:`group-${f}`}:{}},...m?{classes:"focus-dimmed"}:{}})}for(const u of e){if(!o.has(u.fromId)||!o.has(u.toId))continue;let d,p;u.type==="supports"||u.type==="blocks"?(d=u.toId,p=u.fromId):(d=u.fromId,p=u.toId);const f=Ku[u.type]||Ku.informs;s.push({data:{id:u.id||`${u.fromId}-${u.toId}`,source:d,target:p,edgeType:u.type,edgeColor:f.color,edgeStyle:f.style}})}return s}function lF(){return[{selector:"[?isGroup]",style:{label:"data(label)","text-valign":"top","text-halign":"center","font-size":"10px","font-weight":600,color:"#64748b","text-transform":"uppercase","letter-spacing":"0.08em","text-wrap":"wrap","text-max-width":"160px","background-color":"#1a2537","border-width":1,"border-color":"#283548","border-style":"solid",padding:"24px","text-margin-y":-4}},{selector:"node[status]",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"9px","font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", monospace',"font-weight":500,color:"#e2e8f0","text-wrap":"wrap","text-max-width":"130px",width:"150px",height:"60px",shape:"round-rectangle","background-color":"#1e293b","border-style":"solid","border-width":2,"border-color":"#3b82f6"}},...Object.entries(Ql).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(nF).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...iF.map((t,e)=>({selector:`node[confidence=${e}]`,style:{"border-width":t}})),{selector:"node:selected",style:{"background-color":"#1e3a5f","border-width":3,"border-color":"#60a5fa"}},{selector:"edge",style:{width:1.5,"line-color":"data(edgeColor)","target-arrow-color":"data(edgeColor)","target-arrow-shape":"triangle","arrow-scale":.8,"curve-style":"bezier",opacity:.6}},{selector:'edge[edgeStyle="dashed"]',style:{"line-style":"dashed","line-dash-pattern":[6,3],"target-arrow-shape":"diamond"}},{selector:'edge[edgeType="blocks"]',style:{"target-arrow-shape":"tee"}},{selector:".dimmed",style:{opacity:.35}},{selector:".focus-dimmed",style:{opacity:.15,events:"no"}},{selector:".highlighted",style:{"border-width":3,"border-color":"#60a5fa"}},{selector:".build-building",style:{"border-color":"#3b82f6","border-width":3,"shadow-color":"#3b82f6","shadow-opacity":.6,"shadow-blur":12}},{selector:".build-gate-pending",style:{"border-color":"#f59e0b","border-width":3,"shadow-color":"#f59e0b","shadow-opacity":.5,"shadow-blur":8}},{selector:".build-blocked-downstream",style:{opacity:.35,"border-color":"#94a3b8"}},{selector:".build-error",style:{"border-color":"#ef4444","border-width":3,"shadow-color":"#ef4444","shadow-opacity":.5,"shadow-blur":8}},{selector:"[?isAgentGroup]",style:{label:"data(label)","text-valign":"top","text-halign":"center","font-size":"9px",color:"#64748b","text-transform":"uppercase","background-color":"#0f1a2b","border-width":1,"border-color":"#1e3050","border-style":"dashed",padding:"14px"}},{selector:"[?isAgentNode]",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"8px","font-family":"monospace",color:"#e2e8f0","text-wrap":"wrap","text-max-width":"70px",width:"80px",height:"40px",shape:"diamond","background-color":"#1e293b","border-style":"solid","border-width":2,"border-color":"data(agentColor)"}},{selector:'[agentStatus="complete"]',style:{"border-style":"dashed",opacity:.6}},{selector:'[agentStatus="failed"]',style:{"border-color":"#ef4444","border-style":"dashed",opacity:.6}},{selector:"[?isRelayEdge]",style:{width:1,"line-color":"#475569","line-style":"dashed","line-dash-pattern":[8,4],"target-arrow-color":"#475569","target-arrow-shape":"triangle","arrow-scale":.6,"curve-style":"bezier",opacity:.4}},{selector:".relay-active",style:{width:2,"line-color":"#3b82f6",opacity:.8,"target-arrow-color":"#3b82f6"}},{selector:".relay-result",style:{width:2,"line-color":"#10b981",opacity:.8,"target-arrow-color":"#10b981"}},{selector:".idea-node",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"8px","font-family":"monospace",color:"#fbbf24","text-wrap":"wrap","text-max-width":"70px",width:"70px",height:"70px",shape:"ellipse","background-color":"#451a0310","border-style":"dashed","border-width":1.5,"border-color":"#f59e0b",opacity:.85}},{selector:'edge[edgeType="idea"]',style:{width:1,"line-color":"#f59e0b","line-style":"dashed","line-dash-pattern":[6,3],"target-arrow-color":"#f59e0b","target-arrow-shape":"triangle","arrow-scale":.7,"curve-style":"bezier",opacity:.5}}]}function cF({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=Ql[n.status]||Ql.planned,s=br[n.itemType]||"#94a3b8",o=e+300>window.innerWidth?e-294:e+14,a=Math.min(r-10,window.innerHeight-200);return h.jsxs("div",{style:{position:"fixed",left:o,top:a,zIndex:9999,pointerEvents:"none",maxWidth:280,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 13px",fontSize:12,boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[h.jsx("div",{style:{fontWeight:700,fontSize:13,color:"#f8fafc",marginBottom:3},children:n.slug}),h.jsx("div",{style:{color:"#94a3b8",marginBottom:6,lineHeight:1.4},children:n.title}),h.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[h.jsx(Uh,{color:i,children:(n.status||"planned").replace("_"," ")}),h.jsx(Uh,{color:s,children:n.itemType}),n.phase&&h.jsx(Uh,{color:"#94a3b8",children:$l[n.phase]||n.phase})]}),n.description&&h.jsx("div",{style:{marginTop:8,color:"#94a3b8",fontSize:11,lineHeight:1.4},children:n.description.length>140?n.description.slice(0,140)+"…":n.description}),h.jsxs("div",{style:{marginTop:6,color:"#64748b",fontSize:10},children:[uf[n.confidence||0]," confidence"]})]})}function hF({data:t,onApply:e,onClose:r}){const{x:n,y:i,currentGroup:s}=t,[o,a]=C.useState(s||""),l=C.useRef(null);C.useEffect(()=>{var p,f;(p=l.current)==null||p.focus(),(f=l.current)==null||f.select()},[]),C.useEffect(()=>{const p=f=>{f.key==="Escape"&&r()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),C.useEffect(()=>{const p=m=>{const x=document.getElementById("group-change-popover-root");x&&!x.contains(m.target)&&r()},f=setTimeout(()=>window.addEventListener("mousedown",p),0);return()=>{clearTimeout(f),window.removeEventListener("mousedown",p)}},[r]);const c=n+240>window.innerWidth?n-234:n+14,u=Math.min(i-10,window.innerHeight-120),d=()=>e(o.trim());return h.jsxs("div",{id:"group-change-popover-root","data-testid":"group-change-popover",style:{position:"fixed",left:c,top:u,zIndex:1e4,width:220,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 12px",boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[h.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Change group"}),h.jsx("input",{ref:l,type:"text",value:o,onChange:p=>a(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),d())},placeholder:"(no group)",style:{width:"100%",boxSizing:"border-box",fontSize:12,padding:"5px 7px",background:"#0f172a",color:"#f8fafc",border:"1px solid #334155",borderRadius:4,outline:"none"}}),h.jsxs("div",{style:{display:"flex",gap:6,marginTop:8,justifyContent:"flex-end"},children:[h.jsx("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"transparent",color:"#94a3b8",border:"1px solid #334155"},children:"Cancel"}),h.jsx("button",{onClick:d,"data-testid":"group-change-apply",style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"#2563eb",color:"#f8fafc",border:"1px solid #2563eb"},children:"Apply"})]})]})}function Uh({color:t,children:e}){return h.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,fontWeight:600,background:`${t}20`,color:t,border:`1px solid ${t}40`,textTransform:"uppercase",letterSpacing:"0.03em"},children:e})}const w1={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function xo({active:t,onClick:e,children:r}){return h.jsx("button",{onClick:e,style:{...w1,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function Gh({onClick:t,children:e,title:r}){return h.jsx("button",{onClick:t,title:r,style:{...w1,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function Xa(){return h.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const uF=["build-building","build-gate-pending","build-blocked-downstream","build-error"],dF={building:{bg:"#3b82f620",border:"#3b82f6",color:"#3b82f6",label:"⚙"},gate_pending:{bg:"#f59e0b20",border:"#f59e0b",color:"#f59e0b",label:"⚠"},error:{bg:"#ef444420",border:"#ef4444",color:"#ef4444",label:"✖"}};function fF({badge:t,onClick:e}){const r=dF[t.state];return r?h.jsx("div",{onClick:e,style:{position:"absolute",left:t.x,top:t.y,width:16,height:16,borderRadius:"50%",background:r.bg,border:`1.5px solid ${r.border}`,color:r.color,fontSize:9,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",cursor:e?"pointer":"default",zIndex:100,pointerEvents:e?"auto":"none"},title:t.state.replace(/_/g," "),children:r.label}):null}function pF({featureCode:t,gates:e,items:r,badgePositions:n,onResolve:i,onClose:s}){const o=n.find(u=>u.featureCode===t);if(!o)return null;const a=r.find(u=>{var d;return((d=u.lifecycle)==null?void 0:d.featureCode)===t||u.featureCode===t||u.title===t}),l=a&&(e==null?void 0:e.find(u=>u.itemId===a.id&&!u.resolvedAt));if(!l)return null;const c=l.stepId?l.stepId.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):"Gate";return h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{position:"fixed",inset:0,zIndex:199},onClick:s}),h.jsxs("div",{style:{position:"absolute",left:o.x-80,top:o.y+22,zIndex:200,width:200,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 12px",boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[h.jsx("div",{style:{fontSize:10,color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:4},children:c}),h.jsx("div",{style:{fontSize:12,color:"#f8fafc",fontWeight:600,marginBottom:8},children:t}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{onClick:()=>i(l.id,"approve"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#22c55e20",color:"#22c55e",border:"1px solid #22c55e40",cursor:"pointer"},children:"Approve"}),h.jsx("button",{onClick:()=>i(l.id,"revise"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#f59e0b20",color:"#f59e0b",border:"1px solid #f59e0b40",cursor:"pointer"},children:"Revise"}),h.jsx("button",{onClick:()=>i(l.id,"kill"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#ef444420",color:"#ef4444",border:"1px solid #ef444440",cursor:"pointer"},children:"Kill"})]})]})]})}function S1({items:t,connections:e,selectedItemId:r,onSelect:n,visibleTracks:i,hiddenGroups:s,buildStateMap:o,resolveGate:a,gates:l,spawnedAgents:c,agentRelays:u,agentOverlay:d,featureCode:p,focusActive:f,onToggleFocus:m}){const x=C.useRef(null),g=C.useRef(null),y=C.useRef({}),b=C.useRef(!1),k=C.useRef({}),T=C.useRef(null),[_,w]=C.useState(null),[N,B]=C.useState("active"),[I,E]=C.useState(!0),[P,z]=C.useState(!1),[q,R]=C.useState(null),[F,M]=C.useState(null),[D,O]=C.useState([]),[j,S]=C.useState(!1),[G,Q]=C.useState(!1),A=Rs(V=>V.ideas);C.useEffect(()=>{let V=!1;return Rt("/api/graph/layout").then(it=>it.ok?it.json():{positions:{}}).then(it=>{if(V)return;y.current=it.positions||{},b.current=!0;const ft=g.current;ft&&st(ft)}).catch(()=>{b.current=!0}),()=>{V=!0}},[]);const ct=C.useCallback(()=>{const V=k.current;k.current={},T.current=null,Object.keys(V).length&&Rt("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:V})}).catch(it=>console.warn("[graph-layout] save failed:",it))},[]),ut=C.useCallback(V=>{Object.assign(k.current,V),Object.assign(y.current,V),T.current&&clearTimeout(T.current),T.current=setTimeout(ct,500)},[ct]),st=C.useCallback(V=>{const it=y.current,ft={};V.nodes("node[status]").forEach(_t=>{const et=_t.data();if(et.isAgentNode||et.isIdeaNode)return;const bt=_t.id(),U=it[bt];if(U&&Number.isFinite(U.x)&&Number.isFinite(U.y))_t.position({x:U.x,y:U.y});else{const nt=_t.position();Number.isFinite(nt.x)&&Number.isFinite(nt.y)&&(ft[bt]={x:nt.x,y:nt.y})}}),Object.keys(ft).length&&ut(ft)},[ut]),It=C.useRef(!1);C.useEffect(()=>{const V=c==null?void 0:c.some(it=>it.status==="running");V&&!It.current?S(!0):!V&&It.current&&(c==null?void 0:c.length)>0&&S(!1),It.current=!!V},[c]);const ht=C.useMemo(()=>t.filter(V=>{const it=V.title||"";return!it.startsWith("`docs/")&&!it.startsWith("docs/")}),[t]),ot=C.useMemo(()=>{let V=ht;const it=wg.find(ft=>ft.key===N);if(it!=null&&it.statuses&&(V=V.filter(ft=>it.statuses.includes(ft.status||"planned"))),i){const ft=_t=>{const et=(_t.description||"").match(/Track:\s*(\w+)/i);return et?et[1].toLowerCase():_t.type||"other"};V=V.filter(_t=>i.has(ft(_t)))}return(s==null?void 0:s.size)>0&&(V=V.filter(ft=>!s.has(Bo(ft)))),V},[ht,N,i,s]),Y=C.useMemo(()=>{const V=new Set(ot.map(it=>it.id));return e.filter(it=>V.has(it.fromId)&&V.has(it.toId))},[e,ot]),lt=C.useMemo(()=>!d||!d.nodes.length?[]:[...d.nodes,...d.edges],[c]),xt=C.useMemo(()=>{if(!G)return[];new Set(ot.map(it=>it.id));const V=[];for(const it of A){if(!it.mapsTo)continue;const ft=`idea-${it.id}`;V.push({data:{id:ft,label:`${it.id}
|
|
346
|
-
${it.title.slice(0,20)}${it.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:it.id},classes:"idea-node"});const _t=it.mapsTo.split(",").map(et=>et.trim()).filter(Boolean);for(const et of _t){const bt=ot.find(U=>{var nt;return((nt=U.lifecycle)==null?void 0:nt.featureCode)===et||U.featureCode===et||(U.title||"").startsWith(et)});bt&&V.push({data:{id:`idea-edge-${it.id}-${bt.id}`,source:ft,target:bt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return V},[G,A,ot]),Nt=C.useMemo(()=>{let it=aF(ot,Y,I,f,p);return j&<.length>0&&(it=[...it,...lt]),G&&xt.length>0&&(it=[...it,...xt]),it},[ot,Y,I,j,lt,G,xt,f,p]),Dt=C.useMemo(()=>lF(),[]);C.useEffect(()=>{if(!x.current)return;g.current&&(g.current.destroy(),g.current=null);const V=ma({container:x.current,elements:Nt,style:Dt,layout:{name:"fcose",quality:"proof",animate:!1,fit:!1,padding:20,nodeSeparation:80,idealEdgeLength:120,nodeRepulsion:6e3,gravity:.3,gravityRange:1.5,tilingPaddingVertical:12,tilingPaddingHorizontal:12},minZoom:.1,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});if(g.current=V,V.one("layoutstop",()=>{b.current&&st(V),V.fit(void 0,30)}),V.fit(void 0,30),V.on("dragfree","node[status]",it=>{const ft=it.target,_t=ft.data();if(_t.isAgentNode||_t.isIdeaNode)return;const et=ft.position();!Number.isFinite(et.x)||!Number.isFinite(et.y)||ut({[ft.id()]:{x:et.x,y:et.y}})}),r){const it=V.$id(r);it.length&&Yh(V,it)}return V.on("mouseover","node[status]",it=>{const ft=it.renderedPosition||it.position,_t=V.container().getBoundingClientRect();w({x:_t.left+ft.x,y:_t.top+ft.y,item:it.target.data()})}),V.on("mousemove","node[status]",it=>{const ft=it.renderedPosition||it.position,_t=V.container().getBoundingClientRect();w(et=>et?{x:_t.left+ft.x,y:_t.top+ft.y,item:et.item}:null)}),V.on("mouseout","node[status]",()=>w(null)),V.on("tap","node[status]",it=>{le.current=!0,Yh(V,it.target),n(it.target.id())}),V.on("tap",it=>{it.target===V&&V.elements().removeClass("dimmed highlighted")}),V.on("cxttap","node[status]",it=>{var bt;const ft=it.target.data();if(ft.isAgentNode||ft.isIdeaNode||ft.isGroup)return;try{(bt=it.originalEvent)==null||bt.preventDefault()}catch{}const _t=it.renderedPosition||it.position,et=V.container().getBoundingClientRect();M({x:et.left+_t.x,y:et.top+_t.y,itemId:it.target.id(),currentGroup:ft.group||""}),w(null)}),V.container().addEventListener("contextmenu",it=>it.preventDefault()),()=>{T.current&&(clearTimeout(T.current),ct()),V.destroy(),g.current=null}},[Nt,Dt]);const le=C.useRef(!1);C.useEffect(()=>{const V=g.current;if(!V||!r)return;const it=V.$id(r);it.length&&(V.elements().removeClass("dimmed highlighted"),Yh(V,it),le.current||V.animate({center:{eles:it},duration:200}),le.current=!1)},[r]),C.useEffect(()=>{const V=g.current;if(V&&(V.nodes().removeClass(uF.join(" ")),!(!o||Object.keys(o).length===0)))for(const[it,ft]of Object.entries(o)){const _t=`build-${ft.replace(/_/g,"-")}`,et=V.nodes().filter(bt=>{const U=bt.data();return U.slug===it||U.title===it||U.featureCode===it});et.length&&et.addClass(_t)}},[o]),C.useEffect(()=>{const V=g.current;if(!V||!o||!Object.values(o).includes("building"))return;let ft=!0;const _t=setInterval(()=>{const et=V.nodes(".build-building");et.length&&(ft=!ft,et.style("shadow-blur",ft?12:4),et.style("shadow-opacity",ft?.6:.2))},800);return()=>clearInterval(_t)},[o]),C.useEffect(()=>{var et;const V=g.current;if(!V||(V.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!j||!((et=d==null?void 0:d.activeEdgeIds)!=null&&et.size)))return;const it=new Set((c||[]).map(bt=>bt.agentId)),ft=bt=>bt==="session"?"agent-session":it.has(bt)?`agent-${bt}`:"agent-session";for(const bt of d.activeEdgeIds){const U=V.getElementById(bt);if(U.length){const nt=u==null?void 0:u.findLast(jt=>{const Wt=ft(jt.fromAgentId),Ut=ft(jt.toAgentId);return(jt.direction==="dispatch"?`relay-${Wt}-${Ut}`:`relay-${Ut}-${Wt}`)===bt});U.addClass((nt==null?void 0:nt.direction)==="result"?"relay-result":"relay-active")}}const _t=setInterval(()=>{const bt=V.edges(".relay-active, .relay-result");if(!bt.length)return;const U=Date.now()/20%100;bt.style("line-dash-offset",-U)},50);return()=>clearInterval(_t)},[j,d==null?void 0:d.activeEdgeIds,u]);const be=C.useCallback(()=>{const V=g.current;if(!V||!o||Object.keys(o).length===0){O([]);return}const it=[];for(const[ft,_t]of Object.entries(o)){if(_t!=="gate_pending"&&_t!=="error"&&_t!=="building")continue;const et=V.nodes().filter(nt=>{const jt=nt.data();return jt.slug===ft||jt.title===ft||jt.featureCode===ft});if(!et.length)continue;const bt=et.renderedPosition(),U=et.renderedOuterWidth();it.push({featureCode:ft,state:_t,x:bt.x+U/2-6,y:bt.y-et.renderedOuterHeight()/2-6,nodeId:et.id()})}O(it)},[o]);C.useEffect(()=>{const V=g.current;if(V)return V.on("render pan zoom",be),be(),()=>{V.removeListener("render pan zoom",be)}},[be]);const tr=C.useCallback(()=>{var V;return(V=g.current)==null?void 0:V.fit(void 0,40)},[]),Kt=C.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()*1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]),we=C.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()/1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]);return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",style:{background:"#0f172a"},children:[h.jsx("div",{className:"shrink-0",style:{background:"#1e293b",borderBottom:"1px solid #334155"},children:h.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ka,{featureCode:p,active:f,onToggle:m}),p&&h.jsx(Xa,{}),h.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),wg.map(V=>h.jsx(xo,{active:N===V.key,onClick:()=>B(V.key),children:V.label},V.key)),h.jsx(Xa,{}),h.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[ot.length," items · ",Y.length," edges"]})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(xo,{active:I,onClick:()=>E(!I),children:"Group"}),h.jsx(xo,{active:j,onClick:()=>S(V=>!V),title:"Show/hide agent topology",children:"Agents"}),h.jsx(xo,{active:G,onClick:()=>Q(V=>!V),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),h.jsx(Xa,{}),h.jsx(Gh,{onClick:we,title:"Zoom out",children:"−"}),h.jsx(Gh,{onClick:tr,title:"Fit to view",children:"Fit"}),h.jsx(Gh,{onClick:Kt,title:"Zoom in",children:"+"}),h.jsx(Xa,{}),h.jsx(xo,{active:P,onClick:()=>z(!P),children:"Legend"})]})]})}),ot.length===0&&!j?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsxs("div",{style:{textAlign:"center"},children:[h.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items match the current filters"}),h.jsx("div",{style:{fontSize:11,color:"#475569"},children:"Try adjusting the status or group filters"})]})}):h.jsxs("div",{className:"flex-1 relative min-h-0",children:[h.jsx("div",{ref:x,className:"w-full h-full"}),P&&h.jsxs("div",{style:{position:"absolute",bottom:16,left:16,zIndex:10,background:"#1e293b",border:"1px solid #334155",borderRadius:8,padding:"10px 13px",fontSize:11,maxHeight:"calc(100% - 32px)",overflowY:"auto"},children:[h.jsx(Vh,{title:"Types",children:Object.entries(br).map(([V,it])=>h.jsxs(Kh,{children:[h.jsx(_g,{color:it}),V]},V))}),h.jsx(Xh,{}),h.jsx(Vh,{title:"Status",children:Object.entries(Ql).map(([V,it])=>h.jsxs(Kh,{children:[h.jsx(_g,{color:it}),V.replace("_"," ")]},V))}),h.jsx(Xh,{}),h.jsx(Vh,{title:"Edges",children:Object.entries(Ku).map(([V,it])=>h.jsxs(Kh,{children:[h.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:h.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:it.color,strokeWidth:"1.5",strokeDasharray:it.style==="dashed"?"6,3":"none"})}),V]},V))}),h.jsx(Xh,{}),h.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",h.jsx("br",{}),"Click node to trace deps"]})]}),h.jsx(cF,{data:_}),F&&h.jsx(hF,{data:F,onClose:()=>M(null),onApply:V=>{const it=F.itemId;M(null),Rt(`/api/vision/items/${it}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:V||null})}).catch(ft=>console.warn("[graph] group update failed:",ft))}}),D.map(V=>h.jsx(fF,{badge:V,onClick:V.state==="gate_pending"?()=>R(q===V.featureCode?null:V.featureCode):V.state==="error"?()=>n(V.nodeId):void 0},V.featureCode)),q&&h.jsx(pF,{featureCode:q,gates:l,items:t,badgePositions:D,onResolve:(V,it)=>{a&&a(V,it),R(null)},onClose:()=>R(null)})]})]})}function Yh(t,e){t.elements().removeClass("dimmed highlighted");const r=e.union(e.predecessors("node[status]")).union(e.successors("node[status]")),n=r.edgesWith(r);t.nodes("[status]").not(r).addClass("dimmed"),t.edges().not(n).addClass("dimmed"),e.addClass("highlighted")}function Vh({title:t,children:e}){return h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:5,fontWeight:700},children:t}),e]})}function Xh(){return h.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function Kh({children:t}){return h.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function _g({color:t}){return h.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var wl={exports:{}},mF=wl.exports,Eg;function gF(){return Eg||(Eg=1,(function(t,e){(function(r,n){t.exports=n()})(mF,(function(){var r=1e3,n=6e4,i=36e5,s="millisecond",o="second",a="minute",l="hour",c="day",u="week",d="month",p="quarter",f="year",m="date",x="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(R){var F=["th","st","nd","rd"],M=R%100;return"["+R+(F[(M-20)%10]||F[M]||F[0])+"]"}},k=function(R,F,M){var D=String(R);return!D||D.length>=F?R:""+Array(F+1-D.length).join(M)+R},T={s:k,z:function(R){var F=-R.utcOffset(),M=Math.abs(F),D=Math.floor(M/60),O=M%60;return(F<=0?"+":"-")+k(D,2,"0")+":"+k(O,2,"0")},m:function R(F,M){if(F.date()<M.date())return-R(M,F);var D=12*(M.year()-F.year())+(M.month()-F.month()),O=F.clone().add(D,d),j=M-O<0,S=F.clone().add(D+(j?-1:1),d);return+(-(D+(M-O)/(j?O-S:S-O))||0)},a:function(R){return R<0?Math.ceil(R)||0:Math.floor(R)},p:function(R){return{M:d,y:f,w:u,d:c,D:m,h:l,m:a,s:o,ms:s,Q:p}[R]||String(R||"").toLowerCase().replace(/s$/,"")},u:function(R){return R===void 0}},_="en",w={};w[_]=b;var N="$isDayjsObject",B=function(R){return R instanceof z||!(!R||!R[N])},I=function R(F,M,D){var O;if(!F)return _;if(typeof F=="string"){var j=F.toLowerCase();w[j]&&(O=j),M&&(w[j]=M,O=j);var S=F.split("-");if(!O&&S.length>1)return R(S[0])}else{var G=F.name;w[G]=F,O=G}return!D&&O&&(_=O),O||!D&&_},E=function(R,F){if(B(R))return R.clone();var M=typeof F=="object"?F:{};return M.date=R,M.args=arguments,new z(M)},P=T;P.l=I,P.i=B,P.w=function(R,F){return E(R,{locale:F.$L,utc:F.$u,x:F.$x,$offset:F.$offset})};var z=(function(){function R(M){this.$L=I(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[N]=!0}var F=R.prototype;return F.parse=function(M){this.$d=(function(D){var O=D.date,j=D.utc;if(O===null)return new Date(NaN);if(P.u(O))return new Date;if(O instanceof Date)return new Date(O);if(typeof O=="string"&&!/Z$/i.test(O)){var S=O.match(g);if(S){var G=S[2]-1||0,Q=(S[7]||"0").substring(0,3);return j?new Date(Date.UTC(S[1],G,S[3]||1,S[4]||0,S[5]||0,S[6]||0,Q)):new Date(S[1],G,S[3]||1,S[4]||0,S[5]||0,S[6]||0,Q)}}return new Date(O)})(M),this.init()},F.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},F.$utils=function(){return P},F.isValid=function(){return this.$d.toString()!==x},F.isSame=function(M,D){var O=E(M);return this.startOf(D)<=O&&O<=this.endOf(D)},F.isAfter=function(M,D){return E(M)<this.startOf(D)},F.isBefore=function(M,D){return this.endOf(D)<E(M)},F.$g=function(M,D,O){return P.u(M)?this[D]:this.set(O,M)},F.unix=function(){return Math.floor(this.valueOf()/1e3)},F.valueOf=function(){return this.$d.getTime()},F.startOf=function(M,D){var O=this,j=!!P.u(D)||D,S=P.p(M),G=function(ot,Y){var lt=P.w(O.$u?Date.UTC(O.$y,Y,ot):new Date(O.$y,Y,ot),O);return j?lt:lt.endOf(c)},Q=function(ot,Y){return P.w(O.toDate()[ot].apply(O.toDate("s"),(j?[0,0,0,0]:[23,59,59,999]).slice(Y)),O)},A=this.$W,ct=this.$M,ut=this.$D,st="set"+(this.$u?"UTC":"");switch(S){case f:return j?G(1,0):G(31,11);case d:return j?G(1,ct):G(0,ct+1);case u:var It=this.$locale().weekStart||0,ht=(A<It?A+7:A)-It;return G(j?ut-ht:ut+(6-ht),ct);case c:case m:return Q(st+"Hours",0);case l:return Q(st+"Minutes",1);case a:return Q(st+"Seconds",2);case o:return Q(st+"Milliseconds",3);default:return this.clone()}},F.endOf=function(M){return this.startOf(M,!1)},F.$set=function(M,D){var O,j=P.p(M),S="set"+(this.$u?"UTC":""),G=(O={},O[c]=S+"Date",O[m]=S+"Date",O[d]=S+"Month",O[f]=S+"FullYear",O[l]=S+"Hours",O[a]=S+"Minutes",O[o]=S+"Seconds",O[s]=S+"Milliseconds",O)[j],Q=j===c?this.$D+(D-this.$W):D;if(j===d||j===f){var A=this.clone().set(m,1);A.$d[G](Q),A.init(),this.$d=A.set(m,Math.min(this.$D,A.daysInMonth())).$d}else G&&this.$d[G](Q);return this.init(),this},F.set=function(M,D){return this.clone().$set(M,D)},F.get=function(M){return this[P.p(M)]()},F.add=function(M,D){var O,j=this;M=Number(M);var S=P.p(D),G=function(ct){var ut=E(j);return P.w(ut.date(ut.date()+Math.round(ct*M)),j)};if(S===d)return this.set(d,this.$M+M);if(S===f)return this.set(f,this.$y+M);if(S===c)return G(1);if(S===u)return G(7);var Q=(O={},O[a]=n,O[l]=i,O[o]=r,O)[S]||1,A=this.$d.getTime()+M*Q;return P.w(A,this)},F.subtract=function(M,D){return this.add(-1*M,D)},F.format=function(M){var D=this,O=this.$locale();if(!this.isValid())return O.invalidDate||x;var j=M||"YYYY-MM-DDTHH:mm:ssZ",S=P.z(this),G=this.$H,Q=this.$m,A=this.$M,ct=O.weekdays,ut=O.months,st=O.meridiem,It=function(Y,lt,xt,Nt){return Y&&(Y[lt]||Y(D,j))||xt[lt].slice(0,Nt)},ht=function(Y){return P.s(G%12||12,Y,"0")},ot=st||function(Y,lt,xt){var Nt=Y<12?"AM":"PM";return xt?Nt.toLowerCase():Nt};return j.replace(y,(function(Y,lt){return lt||(function(xt){switch(xt){case"YY":return String(D.$y).slice(-2);case"YYYY":return P.s(D.$y,4,"0");case"M":return A+1;case"MM":return P.s(A+1,2,"0");case"MMM":return It(O.monthsShort,A,ut,3);case"MMMM":return It(ut,A);case"D":return D.$D;case"DD":return P.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return It(O.weekdaysMin,D.$W,ct,2);case"ddd":return It(O.weekdaysShort,D.$W,ct,3);case"dddd":return ct[D.$W];case"H":return String(G);case"HH":return P.s(G,2,"0");case"h":return ht(1);case"hh":return ht(2);case"a":return ot(G,Q,!0);case"A":return ot(G,Q,!1);case"m":return String(Q);case"mm":return P.s(Q,2,"0");case"s":return String(D.$s);case"ss":return P.s(D.$s,2,"0");case"SSS":return P.s(D.$ms,3,"0");case"Z":return S}return null})(Y)||S.replace(":","")}))},F.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},F.diff=function(M,D,O){var j,S=this,G=P.p(D),Q=E(M),A=(Q.utcOffset()-this.utcOffset())*n,ct=this-Q,ut=function(){return P.m(S,Q)};switch(G){case f:j=ut()/12;break;case d:j=ut();break;case p:j=ut()/3;break;case u:j=(ct-A)/6048e5;break;case c:j=(ct-A)/864e5;break;case l:j=ct/i;break;case a:j=ct/n;break;case o:j=ct/r;break;default:j=ct}return O?j:P.a(j)},F.daysInMonth=function(){return this.endOf(d).$D},F.$locale=function(){return w[this.$L]},F.locale=function(M,D){if(!M)return this.$L;var O=this.clone(),j=I(M,D,!0);return j&&(O.$L=j),O},F.clone=function(){return P.w(this.$d,this)},F.toDate=function(){return new Date(this.valueOf())},F.toJSON=function(){return this.isValid()?this.toISOString():null},F.toISOString=function(){return this.$d.toISOString()},F.toString=function(){return this.$d.toUTCString()},R})(),q=z.prototype;return E.prototype=q,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",c],["$M",d],["$y",f],["$D",m]].forEach((function(R){q[R[1]]=function(F){return this.$g(F,R[0],R[1])}})),E.extend=function(R,F){return R.$i||(R(F,z,E),R.$i=!0),E},E.locale=I,E.isDayjs=B,E.unix=function(R){return E(1e3*R)},E.en=w[_],E.Ls=w,E.p={},E}))})(wl)),wl.exports}var xF=gF();const yF=cf(xF);var T1=Object.defineProperty,v=(t,e)=>T1(t,"name",{value:e,configurable:!0}),bF=(t,e)=>{for(var r in e)T1(t,r,{get:e[r],enumerable:!0})},Cn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},tt={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},Yf=v(function(t="fatal"){let e=Cn.fatal;typeof t=="string"?t.toLowerCase()in Cn&&(e=Cn[t]):typeof t=="number"&&(e=t),tt.trace=()=>{},tt.debug=()=>{},tt.info=()=>{},tt.warn=()=>{},tt.error=()=>{},tt.fatal=()=>{},e<=Cn.fatal&&(tt.fatal=console.error?console.error.bind(console,Br("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Br("FATAL"))),e<=Cn.error&&(tt.error=console.error?console.error.bind(console,Br("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Br("ERROR"))),e<=Cn.warn&&(tt.warn=console.warn?console.warn.bind(console,Br("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Br("WARN"))),e<=Cn.info&&(tt.info=console.info?console.info.bind(console,Br("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Br("INFO"))),e<=Cn.debug&&(tt.debug=console.debug?console.debug.bind(console,Br("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Br("DEBUG"))),e<=Cn.trace&&(tt.trace=console.debug?console.debug.bind(console,Br("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Br("TRACE")))},"setLogLevel"),Br=v(t=>`%c${yF().format("ss.SSS")} : ${t} : `,"format");const Sl={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t),hsl2rgb:({h:t,s:e,l:r},n)=>{if(!e)return r*2.55;t/=360,e/=100,r/=100;const i=r<.5?r*(1+e):r+e-r*e,s=2*r-i;switch(n){case"r":return Sl.hue2rgb(s,i,t+1/3)*255;case"g":return Sl.hue2rgb(s,i,t)*255;case"b":return Sl.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:r},n)=>{t/=255,e/=255,r/=255;const i=Math.max(t,e,r),s=Math.min(t,e,r),o=(i+s)/2;if(n==="l")return o*100;if(i===s)return 0;const a=i-s,l=o>.5?a/(2-i-s):a/(i+s);if(n==="s")return l*100;switch(i){case t:return((e-r)/a+(e<r?6:0))*60;case e:return((r-t)/a+2)*60;case r:return((t-e)/a+4)*60;default:return-1}}},CF={clamp:(t,e,r)=>e>r?Math.min(e,Math.max(r,t)):Math.min(r,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},kF={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Ot={channel:Sl,lang:CF,unit:kF},zn={};for(let t=0;t<=255;t++)zn[t]=Ot.unit.dec2hex(t);const Ye={ALL:0,RGB:1,HSL:2};class vF{constructor(){this.type=Ye.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=Ye.ALL}is(e){return this.type===e}}class wF{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new vF}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=Ye.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Ot.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Ot.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Ot.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Ot.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Ot.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Ot.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(Ye.HSL)&&r!==void 0?r:(this._ensureHSL(),Ot.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(Ye.HSL)&&r!==void 0?r:(this._ensureHSL(),Ot.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(Ye.HSL)&&r!==void 0?r:(this._ensureHSL(),Ot.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(Ye.RGB)&&r!==void 0?r:(this._ensureRGB(),Ot.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(Ye.RGB)&&r!==void 0?r:(this._ensureRGB(),Ot.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(Ye.RGB)&&r!==void 0?r:(this._ensureRGB(),Ot.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Ye.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Ye.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(Ye.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Ye.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Ye.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Ye.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const Yc=new wF({r:0,g:0,b:0,a:0},"transparent"),gs={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(gs.re);if(!e)return;const r=e[1],n=parseInt(r,16),i=r.length,s=i%4===0,o=i>4,a=o?1:17,l=o?8:4,c=s?0:-1,u=o?255:15;return Yc.set({r:(n>>l*(c+3)&u)*a,g:(n>>l*(c+2)&u)*a,b:(n>>l*(c+1)&u)*a,a:s?(n&u)*a/255:1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`#${zn[Math.round(e)]}${zn[Math.round(r)]}${zn[Math.round(n)]}${zn[Math.round(i*255)]}`:`#${zn[Math.round(e)]}${zn[Math.round(r)]}${zn[Math.round(n)]}`}},yi={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(yi.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Ot.channel.clamp.h(parseFloat(r)*.9);case"rad":return Ot.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Ot.channel.clamp.h(parseFloat(r)*360)}}return Ot.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(yi.re);if(!r)return;const[,n,i,s,o,a]=r;return Yc.set({h:yi._hue2deg(n),s:Ot.channel.clamp.s(parseFloat(i)),l:Ot.channel.clamp.l(parseFloat(s)),a:o?Ot.channel.clamp.a(a?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:r,l:n,a:i}=t;return i<1?`hsla(${Ot.lang.round(e)}, ${Ot.lang.round(r)}%, ${Ot.lang.round(n)}%, ${i})`:`hsl(${Ot.lang.round(e)}, ${Ot.lang.round(r)}%, ${Ot.lang.round(n)}%)`}},Uo={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=Uo.colors[t];if(e)return gs.parse(e)},stringify:t=>{const e=gs.stringify(t);for(const r in Uo.colors)if(Uo.colors[r]===e)return r}},Ao={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const r=t.match(Ao.re);if(!r)return;const[,n,i,s,o,a,l,c,u]=r;return Yc.set({r:Ot.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Ot.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:Ot.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:c?Ot.channel.clamp.a(u?parseFloat(c)/100:parseFloat(c)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${Ot.lang.round(e)}, ${Ot.lang.round(r)}, ${Ot.lang.round(n)}, ${Ot.lang.round(i)})`:`rgb(${Ot.lang.round(e)}, ${Ot.lang.round(r)}, ${Ot.lang.round(n)})`}},cn={format:{keyword:Uo,hex:gs,rgb:Ao,rgba:Ao,hsl:yi,hsla:yi},parse:t=>{if(typeof t!="string")return t;const e=gs.parse(t)||Ao.parse(t)||yi.parse(t)||Uo.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Ye.HSL)||t.data.r===void 0?yi.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?Ao.stringify(t):gs.stringify(t)},_1=(t,e)=>{const r=cn.parse(t);for(const n in e)r[n]=Ot.channel.clamp[n](e[n]);return cn.stringify(r)},Gn=(t,e,r=0,n=1)=>{if(typeof t!="number")return _1(t,{a:e});const i=Yc.set({r:Ot.channel.clamp.r(t),g:Ot.channel.clamp.g(e),b:Ot.channel.clamp.b(r),a:Ot.channel.clamp.a(n)});return cn.stringify(i)},SF=t=>{const{r:e,g:r,b:n}=cn.parse(t),i=.2126*Ot.channel.toLinear(e)+.7152*Ot.channel.toLinear(r)+.0722*Ot.channel.toLinear(n);return Ot.lang.round(i)},TF=t=>SF(t)>=.5,Xr=t=>!TF(t),E1=(t,e,r)=>{const n=cn.parse(t),i=n[e],s=Ot.channel.clamp[e](i+r);return i!==s&&(n[e]=s),cn.stringify(n)},X=(t,e)=>E1(t,"l",e),K=(t,e)=>E1(t,"l",-e),L=(t,e)=>{const r=cn.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return _1(t,n)},_F=(t,e,r=50)=>{const{r:n,g:i,b:s,a:o}=cn.parse(t),{r:a,g:l,b:c,a:u}=cn.parse(e),d=r/100,p=d*2-1,f=o-u,x=((p*f===-1?p:(p+f)/(1+p*f))+1)/2,g=1-x,y=n*x+a*g,b=i*x+l*g,k=s*x+c*g,T=o*d+u*(1-d);return Gn(y,b,k,T)},H=(t,e=100)=>{const r=cn.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,_F(r,t,e)};/*! @license DOMPurify 3.4.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.8/LICENSE */function Ng(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function EF(t){if(Array.isArray(t))return t}function NF(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function jF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
347
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LF(t,e){return EF(t)||NF(t,e)||BF(t,e)||jF()}function BF(t,e){if(t){if(typeof t=="string")return Ng(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ng(t,e):void 0}}const N1=Object.entries,jg=Object.setPrototypeOf,AF=Object.isFrozen,MF=Object.getPrototypeOf,IF=Object.getOwnPropertyDescriptor;let cr=Object.freeze,Ir=Object.seal,as=Object.create,j1=typeof Reflect<"u"&&Reflect,Zu=j1.apply,Qu=j1.construct;cr||(cr=function(e){return e});Ir||(Ir=function(e){return e});Zu||(Zu=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(r,i)});Qu||(Qu=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return new e(...n)});const di=Be(Array.prototype.forEach),FF=Be(Array.prototype.lastIndexOf),Lg=Be(Array.prototype.pop),Yi=Be(Array.prototype.push),PF=Be(Array.prototype.splice),nr=Array.isArray,Mo=Be(String.prototype.toLowerCase),Zh=Be(String.prototype.toString),Bg=Be(String.prototype.match),Vi=Be(String.prototype.replace),Ag=Be(String.prototype.indexOf),DF=Be(String.prototype.trim),OF=Be(Number.prototype.toString),RF=Be(Boolean.prototype.toString),Mg=typeof BigInt>"u"?null:Be(BigInt.prototype.toString),Ig=typeof Symbol>"u"?null:Be(Symbol.prototype.toString),ve=Be(Object.prototype.hasOwnProperty),yo=Be(Object.prototype.toString),ze=Be(RegExp.prototype.test),Xi=$F(TypeError);function Be(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return Zu(t,e,n)}}function $F(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Qu(t,r)}}function Gt(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mo;if(jg&&jg(t,null),!nr(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(AF(e)||(e[n]=s),i=s)}t[i]=!0}return t}function zF(t){for(let e=0;e<t.length;e++)ve(t,e)||(t[e]=null);return t}function Ge(t){const e=as(null);for(const n of N1(t)){var r=LF(n,2);const i=r[0],s=r[1];ve(t,i)&&(nr(s)?e[i]=zF(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Ge(s):e[i]=s)}return e}function WF(t){switch(typeof t){case"string":return t;case"number":return OF(t);case"boolean":return RF(t);case"bigint":return Mg?Mg(t):"0";case"symbol":return Ig?Ig(t):"Symbol()";case"undefined":return yo(t);case"function":case"object":{if(t===null)return yo(t);const e=t,r=en(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:yo(n)}return yo(t)}default:return yo(t)}}function en(t,e){for(;t!==null;){const n=IF(t,e);if(n){if(n.get)return Be(n.get);if(typeof n.value=="function")return Be(n.value)}t=MF(t)}function r(){return null}return r}function qF(t){try{return ze(t,""),!0}catch{return!1}}const Fg=cr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Qh=cr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Jh=cr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),HF=cr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),tu=cr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),UF=cr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pg=cr(["#text"]),Dg=cr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),eu=cr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Og=cr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ka=cr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),GF=Ir(/{{[\w\W]*|^[\w\W]*}}/g),YF=Ir(/<%[\w\W]*|^[\w\W]*%>/g),VF=Ir(/\${[\w\W]*/g),XF=Ir(/^data-[\-\w.\u00B7-\uFFFF]+$/),KF=Ir(/^aria-[\-\w]+$/),Rg=Ir(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ZF=Ir(/^(?:\w+script|data):/i),QF=Ir(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),JF=Ir(/^html$/i),t4=Ir(/^[a-z][.\w]*(-[.\w]+)+$/i),Jr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},e4=function(){return typeof window>"u"?null:window},r4=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(n=r.getAttribute(i));const s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},$g=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function L1(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e4();const e=Ct=>L1(Ct);if(e.version="3.4.8",e.removed=[],!t||!t.document||t.document.nodeType!==Jr.document||!t.Element)return e.isSupported=!1,e;let r=t.document;const n=r,i=n.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,d=t.trustedTypes,p=a.prototype,f=en(p,"cloneNode"),m=en(p,"remove"),x=en(p,"nextSibling"),g=en(p,"childNodes"),y=en(p,"parentNode"),b=en(p,"shadowRoot"),k=en(p,"attributes"),T=o&&o.prototype?en(o.prototype,"nodeType"):null,_=o&&o.prototype?en(o.prototype,"nodeName"):null;if(typeof s=="function"){const Ct=r.createElement("template");Ct.content&&Ct.content.ownerDocument&&(r=Ct.content.ownerDocument)}let w,N="",B=0;const I=function($){if(B>0)throw Xi('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');B++;try{return w.createHTML($)}finally{B--}},E=r,P=E.implementation,z=E.createNodeIterator,q=E.createDocumentFragment,R=E.getElementsByTagName,F=n.importNode;let M=$g();e.isSupported=typeof N1=="function"&&typeof y=="function"&&P&&P.createHTMLDocument!==void 0;const D=GF,O=YF,j=VF,S=XF,G=KF,Q=ZF,A=QF,ct=t4;let ut=Rg,st=null;const It=Gt({},[...Fg,...Qh,...Jh,...tu,...Pg]);let ht=null;const ot=Gt({},[...Dg,...eu,...Og,...Ka]);let Y=Object.seal(as(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),lt=null,xt=null;const Nt=Object.seal(as(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Dt=!0,le=!0,be=!1,tr=!0,Kt=!1,we=!0,V=!1,it=!1,ft=!1,_t=!1,et=!1,bt=!1,U=!0,nt=!1;const jt="user-content-";let Wt=!0,Ut=!1,fe={},Ce=null;const de=Gt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Dr=null;const Re=Gt({},["audio","video","img","source","image","track"]);let Se=null;const jr=Gt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),He="http://www.w3.org/1998/Math/MathML",$i="http://www.w3.org/2000/svg",Lr="http://www.w3.org/1999/xhtml";let Mn=Lr,zi=!1,eo=null;const yh=Gt({},[He,$i,Lr],Zh);let xn=Gt({},["mi","mo","mn","ms","mtext"]),ro=Gt({},["annotation-xml"]);const no=Gt({},["title","style","font","a","script"]);let ai=null;const Aa=["application/xhtml+xml","text/html"],bh="text/html";let pe=null,yn=null;const Ma=r.createElement("form"),Ia=function($){return $ instanceof RegExp||$ instanceof Function},Wi=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yn&&yn===$)return;(!$||typeof $!="object")&&($={}),$=Ge($),ai=Aa.indexOf($.PARSER_MEDIA_TYPE)===-1?bh:$.PARSER_MEDIA_TYPE,pe=ai==="application/xhtml+xml"?Zh:Mo,st=ve($,"ALLOWED_TAGS")&&nr($.ALLOWED_TAGS)?Gt({},$.ALLOWED_TAGS,pe):It,ht=ve($,"ALLOWED_ATTR")&&nr($.ALLOWED_ATTR)?Gt({},$.ALLOWED_ATTR,pe):ot,eo=ve($,"ALLOWED_NAMESPACES")&&nr($.ALLOWED_NAMESPACES)?Gt({},$.ALLOWED_NAMESPACES,Zh):yh,Se=ve($,"ADD_URI_SAFE_ATTR")&&nr($.ADD_URI_SAFE_ATTR)?Gt(Ge(jr),$.ADD_URI_SAFE_ATTR,pe):jr,Dr=ve($,"ADD_DATA_URI_TAGS")&&nr($.ADD_DATA_URI_TAGS)?Gt(Ge(Re),$.ADD_DATA_URI_TAGS,pe):Re,Ce=ve($,"FORBID_CONTENTS")&&nr($.FORBID_CONTENTS)?Gt({},$.FORBID_CONTENTS,pe):de,lt=ve($,"FORBID_TAGS")&&nr($.FORBID_TAGS)?Gt({},$.FORBID_TAGS,pe):Ge({}),xt=ve($,"FORBID_ATTR")&&nr($.FORBID_ATTR)?Gt({},$.FORBID_ATTR,pe):Ge({}),fe=ve($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?Ge($.USE_PROFILES):$.USE_PROFILES:!1,Dt=$.ALLOW_ARIA_ATTR!==!1,le=$.ALLOW_DATA_ATTR!==!1,be=$.ALLOW_UNKNOWN_PROTOCOLS||!1,tr=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Kt=$.SAFE_FOR_TEMPLATES||!1,we=$.SAFE_FOR_XML!==!1,V=$.WHOLE_DOCUMENT||!1,_t=$.RETURN_DOM||!1,et=$.RETURN_DOM_FRAGMENT||!1,bt=$.RETURN_TRUSTED_TYPE||!1,ft=$.FORCE_BODY||!1,U=$.SANITIZE_DOM!==!1,nt=$.SANITIZE_NAMED_PROPS||!1,Wt=$.KEEP_CONTENT!==!1,Ut=$.IN_PLACE||!1,ut=qF($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:Rg,Mn=typeof $.NAMESPACE=="string"?$.NAMESPACE:Lr,xn=ve($,"MATHML_TEXT_INTEGRATION_POINTS")&&$.MATHML_TEXT_INTEGRATION_POINTS&&typeof $.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ge($.MATHML_TEXT_INTEGRATION_POINTS):Gt({},["mi","mo","mn","ms","mtext"]),ro=ve($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?Ge($.HTML_INTEGRATION_POINTS):Gt({},["annotation-xml"]);const J=ve($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?Ge($.CUSTOM_ELEMENT_HANDLING):as(null);if(Y=as(null),ve(J,"tagNameCheck")&&Ia(J.tagNameCheck)&&(Y.tagNameCheck=J.tagNameCheck),ve(J,"attributeNameCheck")&&Ia(J.attributeNameCheck)&&(Y.attributeNameCheck=J.attributeNameCheck),ve(J,"allowCustomizedBuiltInElements")&&typeof J.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=J.allowCustomizedBuiltInElements),Kt&&(le=!1),et&&(_t=!0),fe&&(st=Gt({},Pg),ht=as(null),fe.html===!0&&(Gt(st,Fg),Gt(ht,Dg)),fe.svg===!0&&(Gt(st,Qh),Gt(ht,eu),Gt(ht,Ka)),fe.svgFilters===!0&&(Gt(st,Jh),Gt(ht,eu),Gt(ht,Ka)),fe.mathMl===!0&&(Gt(st,tu),Gt(ht,Og),Gt(ht,Ka))),Nt.tagCheck=null,Nt.attributeCheck=null,ve($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?Nt.tagCheck=$.ADD_TAGS:nr($.ADD_TAGS)&&(st===It&&(st=Ge(st)),Gt(st,$.ADD_TAGS,pe))),ve($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?Nt.attributeCheck=$.ADD_ATTR:nr($.ADD_ATTR)&&(ht===ot&&(ht=Ge(ht)),Gt(ht,$.ADD_ATTR,pe))),ve($,"ADD_URI_SAFE_ATTR")&&nr($.ADD_URI_SAFE_ATTR)&&Gt(Se,$.ADD_URI_SAFE_ATTR,pe),ve($,"FORBID_CONTENTS")&&nr($.FORBID_CONTENTS)&&(Ce===de&&(Ce=Ge(Ce)),Gt(Ce,$.FORBID_CONTENTS,pe)),ve($,"ADD_FORBID_CONTENTS")&&nr($.ADD_FORBID_CONTENTS)&&(Ce===de&&(Ce=Ge(Ce)),Gt(Ce,$.ADD_FORBID_CONTENTS,pe)),Wt&&(st["#text"]=!0),V&&Gt(st,["html","head","body"]),st.table&&(Gt(st,["tbody"]),delete lt.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const dt=w;w=$.TRUSTED_TYPES_POLICY;try{N=I("")}catch(ee){throw w=dt,ee}}else w===void 0&&$.TRUSTED_TYPES_POLICY!==null&&(w=r4(d,i)),w&&typeof N=="string"&&(N=I(""));(M.uponSanitizeElement.length>0||M.uponSanitizeAttribute.length>0)&&st===It&&(st=Ge(st)),M.uponSanitizeAttribute.length>0&&ht===ot&&(ht=Ge(ht)),cr&&cr($),yn=$},Fa=Gt({},[...Qh,...Jh,...HF]),er=Gt({},[...tu,...UF]),Pa=function($){let J=y($);(!J||!J.tagName)&&(J={namespaceURI:Mn,tagName:"template"});const dt=Mo($.tagName),ee=Mo(J.tagName);return eo[$.namespaceURI]?$.namespaceURI===$i?J.namespaceURI===Lr?dt==="svg":J.namespaceURI===He?dt==="svg"&&(ee==="annotation-xml"||xn[ee]):!!Fa[dt]:$.namespaceURI===He?J.namespaceURI===Lr?dt==="math":J.namespaceURI===$i?dt==="math"&&ro[ee]:!!er[dt]:$.namespaceURI===Lr?J.namespaceURI===$i&&!ro[ee]||J.namespaceURI===He&&!xn[ee]?!1:!er[dt]&&(no[dt]||!Fa[dt]):!!(ai==="application/xhtml+xml"&&eo[$.namespaceURI]):!1},$e=function($){Yi(e.removed,{element:$});try{y($).removeChild($)}catch{m($)}},Or=function($,J){try{Yi(e.removed,{attribute:J.getAttributeNode($),from:J})}catch{Yi(e.removed,{attribute:null,from:J})}if(J.removeAttribute($),$==="is")if(_t||et)try{$e(J)}catch{}else try{J.setAttribute($,"")}catch{}},io=function($){let J=null,dt=null;if(ft)$="<remove></remove>"+$;else{const oe=Bg($,/^[\r\n\t ]+/);dt=oe&&oe[0]}ai==="application/xhtml+xml"&&Mn===Lr&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const ee=w?I($):$;if(Mn===Lr)try{J=new u().parseFromString(ee,ai)}catch{}if(!J||!J.documentElement){J=P.createDocument(Mn,"template",null);try{J.documentElement.innerHTML=zi?N:ee}catch{}}const Ht=J.body||J.documentElement;return $&&dt&&Ht.insertBefore(r.createTextNode(dt),Ht.childNodes[0]||null),Mn===Lr?R.call(J,V?"html":"body")[0]:V?J.documentElement:Ht},Da=function($){return z.call($.ownerDocument||$,$,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},so=function($){var J,dt;$.normalize();const ee=z.call($.ownerDocument||$,$,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let Ht=ee.nextNode();for(;Ht;){let Te=Ht.data;di([D,O,j],Ue=>{Te=Vi(Te,Ue," ")}),Ht.data=Te,Ht=ee.nextNode()}const oe=(J=(dt=$.querySelectorAll)===null||dt===void 0?void 0:dt.call($,"template"))!==null&&J!==void 0?J:[];di(Array.from(oe),Te=>{In(Te.content)&&so(Te.content)})},qi=function($){const J=_?_($):null;return typeof J!="string"||pe(J)!=="form"?!1:typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||$.attributes!==k($)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function"||$.nodeType!==T($)||$.childNodes!==g($)},In=function($){if(!T||typeof $!="object"||$===null)return!1;try{return T($)===Jr.documentFragment}catch{return!1}},Pe=function($){if(!T||typeof $!="object"||$===null)return!1;try{return typeof T($)=="number"}catch{return!1}};function De(Ct,$,J){di(Ct,dt=>{dt.call(e,$,J,yn)})}const Oa=function($){let J=null;if(De(M.beforeSanitizeElements,$,null),qi($))return $e($),!0;const dt=pe(_?_($):$.nodeName);if(De(M.uponSanitizeElement,$,{tagName:dt,allowedTags:st}),we&&$.hasChildNodes()&&!Pe($.firstElementChild)&&ze(/<[/\w!]/g,$.innerHTML)&&ze(/<[/\w!]/g,$.textContent)||we&&$.namespaceURI===Lr&&dt==="style"&&Pe($.firstElementChild)||$.nodeType===Jr.progressingInstruction||we&&$.nodeType===Jr.comment&&ze(/<[/\w]/g,$.data))return $e($),!0;if(lt[dt]||!(Nt.tagCheck instanceof Function&&Nt.tagCheck(dt))&&!st[dt]){if(!lt[dt]&&li(dt)&&(Y.tagNameCheck instanceof RegExp&&ze(Y.tagNameCheck,dt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(dt)))return!1;if(Wt&&!Ce[dt]){const Ht=y($),oe=g($);if(oe&&Ht){const Te=oe.length;for(let Ue=Te-1;Ue>=0;--Ue){const kr=f(oe[Ue],!0);Ht.insertBefore(kr,x($))}}}return $e($),!0}return(T?T($):$.nodeType)===Jr.element&&!Pa($)||(dt==="noscript"||dt==="noembed"||dt==="noframes")&&ze(/<\/no(script|embed|frames)/i,$.innerHTML)?($e($),!0):(Kt&&$.nodeType===Jr.text&&(J=$.textContent,di([D,O,j],Ht=>{J=Vi(J,Ht," ")}),$.textContent!==J&&(Yi(e.removed,{element:$.cloneNode()}),$.textContent=J)),De(M.afterSanitizeElements,$,null),!1)},oo=function($,J,dt){if(xt[J]||U&&(J==="id"||J==="name")&&(dt in r||dt in Ma))return!1;const ee=ht[J]||Nt.attributeCheck instanceof Function&&Nt.attributeCheck(J,$);if(!(le&&!xt[J]&&ze(S,J))){if(!(Dt&&ze(G,J))){if(!ee||xt[J]){if(!(li($)&&(Y.tagNameCheck instanceof RegExp&&ze(Y.tagNameCheck,$)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck($))&&(Y.attributeNameCheck instanceof RegExp&&ze(Y.attributeNameCheck,J)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(J,$))||J==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&ze(Y.tagNameCheck,dt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(dt))))return!1}else if(!Se[J]){if(!ze(ut,Vi(dt,A,""))){if(!((J==="src"||J==="xlink:href"||J==="href")&&$!=="script"&&Ag(dt,"data:")===0&&Dr[$])){if(!(be&&!ze(Q,Vi(dt,A,"")))){if(dt)return!1}}}}}}return!0},ao=Gt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),li=function($){return!ao[Mo($)]&&ze(ct,$)},Ra=function($){De(M.beforeSanitizeAttributes,$,null);const J=$.attributes;if(!J||qi($))return;const dt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ht,forceKeepAttr:void 0};let ee=J.length;for(;ee--;){const Ht=J[ee],oe=Ht.name,Te=Ht.namespaceURI,Ue=Ht.value,kr=pe(oe),lo=Ue;let Ne=oe==="value"?lo:DF(lo);if(dt.attrName=kr,dt.attrValue=Ne,dt.keepAttr=!0,dt.forceKeepAttr=void 0,De(M.uponSanitizeAttribute,$,dt),Ne=dt.attrValue,nt&&(kr==="id"||kr==="name")&&Ag(Ne,jt)!==0&&(Or(oe,$),Ne=jt+Ne),we&&ze(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ne)){Or(oe,$);continue}if(kr==="attributename"&&Bg(Ne,"href")){Or(oe,$);continue}if(dt.forceKeepAttr)continue;if(!dt.keepAttr){Or(oe,$);continue}if(!tr&&ze(/\/>/i,Ne)){Or(oe,$);continue}Kt&&di([D,O,j],ci=>{Ne=Vi(Ne,ci," ")});const $a=pe($.nodeName);if(!oo($a,kr,Ne)){Or(oe,$);continue}if(w&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Te)switch(d.getAttributeType($a,kr)){case"TrustedHTML":{Ne=I(Ne);break}case"TrustedScriptURL":{Ne=w.createScriptURL(Ne);break}}if(Ne!==lo)try{Te?$.setAttributeNS(Te,oe,Ne):$.setAttribute(oe,Ne),qi($)?$e($):Lg(e.removed)}catch{Or(oe,$)}}De(M.afterSanitizeAttributes,$,null)},Hi=function($){let J=null;const dt=Da($);for(De(M.beforeSanitizeShadowDOM,$,null);J=dt.nextNode();)if(De(M.uponSanitizeShadowNode,J,null),Oa(J),Ra(J),In(J.content)&&Hi(J.content),(T?T(J):J.nodeType)===Jr.element){const Ht=b?b(J):J.shadowRoot;In(Ht)&&(Fn(Ht),Hi(Ht))}De(M.afterSanitizeShadowDOM,$,null)},Fn=function($){const J=T?T($):$.nodeType;if(J===Jr.element){const Ht=b?b($):$.shadowRoot;In(Ht)&&(Fn(Ht),Hi(Ht))}const dt=g?g($):$.childNodes;if(!dt)return;const ee=[];di(dt,Ht=>{Yi(ee,Ht)});for(const Ht of ee)Fn(Ht);if(J===Jr.element){const Ht=_?_($):null;if(typeof Ht=="string"&&pe(Ht)==="template"){const oe=$.content;In(oe)&&Fn(oe)}}};return e.sanitize=function(Ct){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=null,dt=null,ee=null,Ht=null;if(zi=!Ct,zi&&(Ct="<!-->"),typeof Ct!="string"&&!Pe(Ct)&&(Ct=WF(Ct),typeof Ct!="string"))throw Xi("dirty is not a string, aborting");if(!e.isSupported)return Ct;if(it||Wi($),e.removed=[],typeof Ct=="string"&&(Ut=!1),Ut){const Ue=_?_(Ct):Ct.nodeName;if(typeof Ue=="string"){const kr=pe(Ue);if(!st[kr]||lt[kr])throw Xi("root node is forbidden and cannot be sanitized in-place")}if(qi(Ct))throw Xi("root node is clobbered and cannot be sanitized in-place");Fn(Ct)}else if(Pe(Ct))J=io("<!---->"),dt=J.ownerDocument.importNode(Ct,!0),dt.nodeType===Jr.element&&dt.nodeName==="BODY"||dt.nodeName==="HTML"?J=dt:J.appendChild(dt),Fn(dt);else{if(!_t&&!Kt&&!V&&Ct.indexOf("<")===-1)return w&&bt?I(Ct):Ct;if(J=io(Ct),!J)return _t?null:bt?N:""}J&&ft&&$e(J.firstChild);const oe=Da(Ut?Ct:J);for(;ee=oe.nextNode();)Oa(ee),Ra(ee),In(ee.content)&&Hi(ee.content);if(Ut)return Kt&&so(Ct),Ct;if(_t){if(Kt&&so(J),et)for(Ht=q.call(J.ownerDocument);J.firstChild;)Ht.appendChild(J.firstChild);else Ht=J;return(ht.shadowroot||ht.shadowrootmode)&&(Ht=F.call(n,Ht,!0)),Ht}let Te=V?J.outerHTML:J.innerHTML;return V&&st["!doctype"]&&J.ownerDocument&&J.ownerDocument.doctype&&J.ownerDocument.doctype.name&&ze(JF,J.ownerDocument.doctype.name)&&(Te="<!DOCTYPE "+J.ownerDocument.doctype.name+`>
|
|
348
|
-
`+Te),Kt&&di([D,O,j],Ue=>{Te=Vi(Te,Ue," ")}),w&&bt?I(Te):Te},e.setConfig=function(){let Ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wi(Ct),it=!0},e.clearConfig=function(){yn=null,it=!1},e.isValidAttribute=function(Ct,$,J){yn||Wi({});const dt=pe(Ct),ee=pe($);return oo(dt,ee,J)},e.addHook=function(Ct,$){typeof $=="function"&&Yi(M[Ct],$)},e.removeHook=function(Ct,$){if($!==void 0){const J=FF(M[Ct],$);return J===-1?void 0:PF(M[Ct],J,1)[0]}return Lg(M[Ct])},e.removeHooks=function(Ct){M[Ct]=[]},e.removeAllHooks=function(){M=$g()},e}var $s=L1(),B1=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Go=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,n4=/\s*%%.*\n/gm,ks,A1=(ks=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(ks,"UnknownDiagramError"),ks),Ei={},Vf=v(function(t,e){t=t.replace(B1,"").replace(Go,"").replace(n4,`
|
|
349
|
-
`);for(const[r,{detector:n}]of Object.entries(Ei))if(n(t,e))return r;throw new A1(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),Ju=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)M1(e,r,n)},"registerLazyLoadedDiagrams"),M1=v((t,e,r)=>{Ei[t]&&tt.warn(`Detector with key ${t} already exists. Overwriting.`),Ei[t]={detector:e,loader:r},tt.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),i4=v(t=>Ei[t].loader,"getDiagramLoader"),td=v((t,e,{depth:r=2,clobber:n=!1}={})=>{const i={depth:r,clobber:n};return Array.isArray(e)&&!Array.isArray(t)?(e.forEach(s=>td(t,s,i)),t):Array.isArray(e)&&Array.isArray(t)?(e.forEach(s=>{t.includes(s)||t.push(s)}),t):t===void 0||r<=0?t!=null&&typeof t=="object"&&typeof e=="object"?Object.assign(t,e):e:(e!==void 0&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(s=>{typeof e[s]=="object"&&e[s]!==null&&(t[s]===void 0||typeof t[s]=="object")?(t[s]===void 0&&(t[s]=Array.isArray(e[s])?[]:{}),t[s]=td(t[s],e[s],{depth:r-1,clobber:n})):(n||typeof t[s]!="object"&&typeof e[s]!="object")&&(t[s]=e[s])}),t)},"assignWithDepth"),Ie=td,pn="#ffffff",mn="#f2f2f2",Pt=v((t,e)=>e?L(t,{s:-40,l:10}):L(t,{s:-40,l:-10}),"mkBorder"),vs,s4=(vs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,N,B,I,E,P,z,q,R,F,M,D,O,j;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||X(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||K(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||K(this.mainBkg,10)):(this.rowOdd=this.rowOdd||X(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||X(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.darkMode)for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=K(this["cScale"+S],75);else for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=K(this["cScale"+S],25);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleInv"+S]=this["cScaleInv"+S]||H(this["cScale"+S]);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this.darkMode?this["cScalePeer"+S]=this["cScalePeer"+S]||X(this["cScale"+S],10):this["cScalePeer"+S]=this["cScalePeer"+S]||K(this["cScale"+S],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleLabel"+S]=this["cScaleLabel"+S]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let S=0;S<5;S++)this["surface"+S]=this["surface"+S]||L(this.mainBkg,{h:180,s:-15,l:e*(5+S*3)}),this["surfacePeer"+S]=this["surfacePeer"+S]||L(this.mainBkg,{h:180,s:-15,l:e*(8+S*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??L(this.primaryColor,{l:-30}),this.venn2=this.venn2??L(this.secondaryColor,{l:-30}),this.venn3=this.venn3??L(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??L(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??L(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??L(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??L(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??L(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.radar={axisColor:((r=this.radar)==null?void 0:r.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((i=this.radar)==null?void 0:i.axisLabelFontSize)||12,curveOpacity:((s=this.radar)==null?void 0:s.curveOpacity)||.5,curveStrokeWidth:((o=this.radar)==null?void 0:o.curveStrokeWidth)||2,graticuleColor:((a=this.radar)==null?void 0:a.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((l=this.radar)==null?void 0:l.graticuleStrokeWidth)||1,graticuleOpacity:((c=this.radar)==null?void 0:c.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((p=this.wardley)==null?void 0:p.backgroundColor)||this.background,axisColor:((f=this.wardley)==null?void 0:f.axisColor)||this.lineColor,axisTextColor:((m=this.wardley)==null?void 0:m.axisTextColor)||this.primaryTextColor,gridColor:((x=this.wardley)==null?void 0:x.gridColor)||this.gridColor,componentFill:((g=this.wardley)==null?void 0:g.componentFill)||this.background,componentStroke:((y=this.wardley)==null?void 0:y.componentStroke)||this.lineColor,componentLabelColor:((b=this.wardley)==null?void 0:b.componentLabelColor)||this.primaryTextColor,linkStroke:((k=this.wardley)==null?void 0:k.linkStroke)||this.lineColor,evolutionStroke:((T=this.wardley)==null?void 0:T.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((_=this.wardley)==null?void 0:_.annotationStroke)||this.lineColor,annotationTextColor:((w=this.wardley)==null?void 0:w.annotationTextColor)||this.primaryTextColor,annotationFill:((N=this.wardley)==null?void 0:N.annotationFill)||this.background},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((B=this.xyChart)==null?void 0:B.backgroundColor)||this.background,titleColor:((I=this.xyChart)==null?void 0:I.titleColor)||this.primaryTextColor,dataLabelColor:((E=this.xyChart)==null?void 0:E.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((P=this.xyChart)==null?void 0:P.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((z=this.xyChart)==null?void 0:z.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((q=this.xyChart)==null?void 0:q.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((R=this.xyChart)==null?void 0:R.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((F=this.xyChart)==null?void 0:F.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((D=this.xyChart)==null?void 0:D.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((O=this.xyChart)==null?void 0:O.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((j=this.xyChart)==null?void 0:j.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(vs,"Theme"),vs),o4=v(t=>{const e=new s4;return e.calculate(t),e},"getThemeVariables"),ws,a4=(ws=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=L(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=X(H("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Gn(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=K("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=K(this.sectionBkgColor,10),this.taskBorderColor=Gn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Gn(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||X(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||K(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,N,B,I,E,P,z,q,R,F,M,D,O;this.secondBkg=X(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=X(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=X(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=H(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330});for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||H(this["cScale"+j]);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],10);for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{h:30,s:-30,l:-(-10+j*4)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{h:30,s:-30,l:-(-7+j*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["pie"+j]=this["cScale"+j];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.mainContrastColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.mainContrastColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7";for(let j=0;j<8;j++)this["venn"+(j+1)]=this["venn"+(j+1)]??X(this["cScale"+j],30);this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,dataLabelColor:((n=this.xyChart)==null?void 0:n.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((m=this.radar)==null?void 0:m.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((g=this.radar)==null?void 0:g.curveOpacity)||.5,curveStrokeWidth:((y=this.radar)==null?void 0:y.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((k=this.radar)==null?void 0:k.graticuleStrokeWidth)||1,graticuleOpacity:((T=this.radar)==null?void 0:T.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#ff6b6b",this.wardley={backgroundColor:((N=this.wardley)==null?void 0:N.backgroundColor)||this.background,axisColor:((B=this.wardley)==null?void 0:B.axisColor)||this.lineColor,axisTextColor:((I=this.wardley)==null?void 0:I.axisTextColor)||this.primaryTextColor,gridColor:((E=this.wardley)==null?void 0:E.gridColor)||this.gridColor,componentFill:((P=this.wardley)==null?void 0:P.componentFill)||this.mainBkg,componentStroke:((z=this.wardley)==null?void 0:z.componentStroke)||this.lineColor,componentLabelColor:((q=this.wardley)==null?void 0:q.componentLabelColor)||this.primaryTextColor,linkStroke:((R=this.wardley)==null?void 0:R.linkStroke)||this.lineColor,evolutionStroke:((F=this.wardley)==null?void 0:F.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((M=this.wardley)==null?void 0:M.annotationStroke)||this.lineColor,annotationTextColor:((D=this.wardley)==null?void 0:D.annotationTextColor)||this.primaryTextColor,annotationFill:((O=this.wardley)==null?void 0:O.annotationFill)||this.mainBkg},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=X(this.secondaryColor,20),this.git1=X(this.pie2||this.secondaryColor,20),this.git2=X(this.pie3||this.tertiaryColor,20),this.git3=X(this.pie4||L(this.primaryColor,{h:-30}),20),this.git4=X(this.pie5||L(this.primaryColor,{h:-60}),20),this.git5=X(this.pie6||L(this.primaryColor,{h:-90}),10),this.git6=X(this.pie7||L(this.primaryColor,{h:60}),10),this.git7=X(this.pie8||L(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"#2d2d2d",this.emUiStroke=this.emUiStroke||"#555",this.emProcessorFill=this.emProcessorFill||X("#5a3d5c",10),this.emProcessorStroke=this.emProcessorStroke||"#8a6d8c",this.emReadModelFill=this.emReadModelFill||X("#3d5a2d",10),this.emReadModelStroke=this.emReadModelStroke||"#6d8c5c",this.emCommandFill=this.emCommandFill||X("#2d3d5a",10),this.emCommandStroke=this.emCommandStroke||"#5c6d8c",this.emEventFill=this.emEventFill||X("#5a452d",10),this.emEventStroke=this.emEventStroke||"#8c755c",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||X(this.background,5),this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||X(this.background,12),this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||X(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ws,"Theme"),ws),l4=v(t=>{const e=new a4;return e.calculate(t),e},"getThemeVariables"),Ss,c4=(Ss=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=L(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=L(this.primaryColor,{h:-160}),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=Gn(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,N,B,I,E,P,z,q,R,F,M,D,O;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||K(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||K(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=K(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||K(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||L(this["cScale"+j],{h:180});for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{h:30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{h:30,l:-(7+j*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||H(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||H(this.labelTextColor);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||X(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||X(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||L(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-30}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||L(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||L(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??L(this.primaryColor,{l:-30}),this.venn2=this.venn2??L(this.secondaryColor,{l:-30}),this.venn3=this.venn3??L(this.tertiaryColor,{l:-40}),this.venn4=this.venn4??L(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??L(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??L(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??L(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??L(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((n=this.radar)==null?void 0:n.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((a=this.radar)==null?void 0:a.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.axisColor)||this.lineColor,axisTextColor:((f=this.wardley)==null?void 0:f.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((k=this.wardley)==null?void 0:k.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((T=this.wardley)==null?void 0:T.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((w=this.wardley)==null?void 0:w.annotationFill)||this.background},this.xyChart={backgroundColor:((N=this.xyChart)==null?void 0:N.backgroundColor)||this.background,titleColor:((B=this.xyChart)==null?void 0:B.titleColor)||this.primaryTextColor,dataLabelColor:((I=this.xyChart)==null?void 0:I.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((E=this.xyChart)==null?void 0:E.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((P=this.xyChart)==null?void 0:P.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((z=this.xyChart)==null?void 0:z.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((q=this.xyChart)==null?void 0:q.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((R=this.xyChart)==null?void 0:R.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((F=this.xyChart)==null?void 0:F.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((M=this.xyChart)==null?void 0:M.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((D=this.xyChart)==null?void 0:D.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((O=this.xyChart)==null?void 0:O.plotColorPalette)||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||K(H(this.git0),25),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(Object.keys(this).forEach(n=>{this[n]==="calculated"&&(this[n]=void 0)}),typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ss,"Theme"),Ss),h4=v(t=>{const e=new c4;return e.calculate(t),e},"getThemeVariables"),Ts,u4=(Ts=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=X("#cde498",10),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.primaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,N,B,I,E,P,z,q,R,F,M,D,O;this.actorBorder=K(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||K(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||K(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=K(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||K(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||L(this["cScale"+j],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{h:30,s:-30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{h:30,s:-30,l:-(8+j*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||X(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||X(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||L(this.primaryColor,{l:-30}),this.pie5=this.pie5||L(this.secondaryColor,{l:-30}),this.pie6=this.pie6||L(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||L(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??L(this.primaryColor,{l:-30}),this.venn2=this.venn2??L(this.secondaryColor,{l:-30}),this.venn3=this.venn3??L(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??L(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??L(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??L(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??L(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??L(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((n=this.radar)==null?void 0:n.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((a=this.radar)==null?void 0:a.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.axisColor)||this.lineColor,axisTextColor:((f=this.wardley)==null?void 0:f.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((k=this.wardley)==null?void 0:k.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((T=this.wardley)==null?void 0:T.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((w=this.wardley)==null?void 0:w.annotationFill)||this.background},this.xyChart={backgroundColor:((N=this.xyChart)==null?void 0:N.backgroundColor)||this.background,titleColor:((B=this.xyChart)==null?void 0:B.titleColor)||this.primaryTextColor,dataLabelColor:((I=this.xyChart)==null?void 0:I.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((E=this.xyChart)==null?void 0:E.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((P=this.xyChart)==null?void 0:P.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((z=this.xyChart)==null?void 0:z.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((q=this.xyChart)==null?void 0:q.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((R=this.xyChart)==null?void 0:R.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((F=this.xyChart)==null?void 0:F.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((M=this.xyChart)==null?void 0:M.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((D=this.xyChart)==null?void 0:D.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((O=this.xyChart)==null?void 0:O.plotColorPalette)||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ts,"Theme"),Ts),d4=v(t=>{const e=new u4;return e.calculate(t),e},"getThemeVariables"),_s,f4=(_s=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=X(this.contrast,55),this.background="#ffffff",this.tertiaryColor=L(this.primaryColor,{h:-160}),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||X(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,N,B,I,E,P,z,q,R,F,M,D,O;this.secondBkg=X(this.contrast,55),this.border2=this.contrast,this.actorBorder=X(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||H(this["cScale"+j]);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this.darkMode?this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],10):this["cScalePeer"+j]=this["cScalePeer"+j]||K(this["cScale"+j],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{l:-(8+j*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=X(this.contrast,30),this.sectionBkgColor2=X(this.contrast,30),this.taskBorderColor=K(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=X(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=K(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(this.secondaryColor,{h:128});for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["pie"+j]=this["cScale"+j];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7";for(let j=0;j<8;j++)this["venn"+(j+1)]=this["venn"+(j+1)]??this["cScale"+j];this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,dataLabelColor:((n=this.xyChart)==null?void 0:n.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((m=this.radar)==null?void 0:m.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((g=this.radar)==null?void 0:g.curveOpacity)||.5,curveStrokeWidth:((y=this.radar)==null?void 0:y.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((k=this.radar)==null?void 0:k.graticuleStrokeWidth)||1,graticuleOpacity:((T=this.radar)==null?void 0:T.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((N=this.wardley)==null?void 0:N.backgroundColor)||this.background,axisColor:((B=this.wardley)==null?void 0:B.axisColor)||this.lineColor,axisTextColor:((I=this.wardley)==null?void 0:I.axisTextColor)||this.primaryTextColor,gridColor:((E=this.wardley)==null?void 0:E.gridColor)||this.gridColor,componentFill:((P=this.wardley)==null?void 0:P.componentFill)||this.background,componentStroke:((z=this.wardley)==null?void 0:z.componentStroke)||this.lineColor,componentLabelColor:((q=this.wardley)==null?void 0:q.componentLabelColor)||this.primaryTextColor,linkStroke:((R=this.wardley)==null?void 0:R.linkStroke)||this.lineColor,evolutionStroke:((F=this.wardley)==null?void 0:F.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((M=this.wardley)==null?void 0:M.annotationStroke)||this.lineColor,annotationTextColor:((D=this.wardley)==null?void 0:D.annotationTextColor)||this.primaryTextColor,annotationFill:((O=this.wardley)==null?void 0:O.annotationFill)||this.background},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=K(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||L(this.primaryColor,{h:-30}),this.git4=this.pie5||L(this.primaryColor,{h:-60}),this.git5=this.pie6||L(this.primaryColor,{h:-90}),this.git6=this.pie7||L(this.primaryColor,{h:60}),this.git7=this.pie8||L(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(_s,"Theme"),_s),p4=v(t=>{const e=new f4;return e.calculate(t),e},"getThemeVariables"),Es,m4=(Es=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var s,o,a,l,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=L(e,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||X(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||e,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||n,this.cScale3=this.cScale3||L(e,{h:30}),this.cScale4=this.cScale4||L(e,{h:60}),this.cScale5=this.cScale5||L(e,{h:90}),this.cScale6=this.cScale6||L(e,{h:120}),this.cScale7=this.cScale7||L(e,{h:150}),this.cScale8=this.cScale8||L(e,{h:210,l:150}),this.cScale9=this.cScale9||L(e,{h:270}),this.cScale10=this.cScale10||L(e,{h:300}),this.cScale11=this.cScale11||L(e,{h:330}),this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||X(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||L(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||L(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||L(e,{h:64}),this.fillType3=this.fillType3||L(r,{h:64}),this.fillType4=this.fillType4||L(e,{h:-64}),this.fillType5=this.fillType5||L(r,{h:-64}),this.fillType6=this.fillType6||L(e,{h:128}),this.fillType7=this.fillType7||L(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||L(e,{l:-10}),this.pie5=this.pie5||L(r,{l:-10}),this.pie6=this.pie6||L(n,{l:-10}),this.pie7=this.pie7||L(e,{h:60,l:-10}),this.pie8=this.pie8||L(e,{h:-60,l:-10}),this.pie9=this.pie9||L(e,{h:120,l:0}),this.pie10=this.pie10||L(e,{h:60,l:-20}),this.pie11=this.pie11||L(e,{h:-60,l:-20}),this.pie12=this.pie12||L(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||L(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((l=this.xyChart)==null?void 0:l.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((c=this.xyChart)==null?void 0:c.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||L(e,{h:-30}),this.git4=this.git4||L(e,{h:-60}),this.git5=this.git5||L(e,{h:-90}),this.git6=this.git6||L(e,{h:60}),this.git7=this.git7||L(e,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Es,"Theme"),Es),g4=v(t=>{const e=new m4;return e.calculate(t),e},"getThemeVariables"),Ns,x4=(Ns=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=L(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=X(H("#323D47"),10),this.border1="#ccc",this.border2=Gn(255,255,255,.25),this.arrowheadColor=H(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||X(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=K(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=K(this["cScale"+f],25);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||X(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||K(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=this["cScaleLabel"+f]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||L(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||L(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||"#0b0000",this.git1=this.git1||"#4d1037",this.git2=this.git2||"#3f5258",this.git3=this.git3||"#4f2f1b",this.git4=this.git4||"#6e0a0a",this.git5=this.git5||"#3b0048",this.git6=this.git6||"#995a01",this.git7=this.git7||"#154706",this.gitDarkMode=!0,this.gitDarkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ns,"Theme"),Ns),y4=v(t=>{const e=new x4;return e.calculate(t),e},"getThemeVariables"),js,b4=(js=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Pt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var s,o,a,l,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=L(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||X(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=this.mainBkg;if(this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||X(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||L(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||L(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||L(e,{h:64}),this.fillType3=this.fillType3||L(r,{h:64}),this.fillType4=this.fillType4||L(e,{h:-64}),this.fillType5=this.fillType5||L(r,{h:-64}),this.fillType6=this.fillType6||L(e,{h:128}),this.fillType7=this.fillType7||L(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||L(e,{l:-10}),this.pie5=this.pie5||L(r,{l:-10}),this.pie6=this.pie6||L(n,{l:-10}),this.pie7=this.pie7||L(e,{h:60,l:-10}),this.pie8=this.pie8||L(e,{h:-60,l:-10}),this.pie9=this.pie9||L(e,{h:120,l:0}),this.pie10=this.pie10||L(e,{h:60,l:-20}),this.pie11=this.pie11||L(e,{h:-60,l:-20}),this.pie12=this.pie12||L(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||L(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((l=this.xyChart)==null?void 0:l.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((c=this.xyChart)==null?void 0:c.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.requirementEdgeLabelBackground="#FFFFFF",this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||L(e,{h:-30}),this.git4=this.git4||L(e,{h:-60}),this.git5=this.git5||L(e,{h:-90}),this.git6=this.git6||L(e,{h:60}),this.git7=this.git7||L(e,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.erEdgeLabelBackground="#FFFFFF",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(js,"Theme"),js),C4=v(t=>{const e=new b4;return e.calculate(t),e},"getThemeVariables"),Ls,k4=(Ls=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=L(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=X(H("#323D47"),10),this.border1="#ccc",this.border2=Gn(255,255,255,.25),this.arrowheadColor=H(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||X(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=K(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=K(this["cScale"+f],25);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||X(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||K(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=this["cScaleLabel"+f]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||L(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||L(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.requirementEdgeLabelBackground="#16141F",this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.erEdgeLabelBackground="#16141F",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ls,"Theme"),Ls),v4=v(t=>{const e=new k4;return e.calculate(t),e},"getThemeVariables"),Bs,w4=(Bs=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var s,o,a,l,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=L(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||X(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||X(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||L(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||L(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||L(e,{h:64}),this.fillType3=this.fillType3||L(r,{h:64}),this.fillType4=this.fillType4||L(e,{h:-64}),this.fillType5=this.fillType5||L(r,{h:-64}),this.fillType6=this.fillType6||L(e,{h:128}),this.fillType7=this.fillType7||L(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||L(e,{l:-10}),this.pie5=this.pie5||L(r,{l:-10}),this.pie6=this.pie6||L(n,{l:-10}),this.pie7=this.pie7||L(e,{h:60,l:-10}),this.pie8=this.pie8||L(e,{h:-60,l:-10}),this.pie9=this.pie9||L(e,{h:120,l:0}),this.pie10=this.pie10||L(e,{h:60,l:-20}),this.pie11=this.pie11||L(e,{h:-60,l:-20}),this.pie12=this.pie12||L(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||L(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((l=this.xyChart)==null?void 0:l.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((c=this.xyChart)==null?void 0:c.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||L(e,{h:-30}),this.git4=this.git4||L(e,{h:-60}),this.git5=this.git5||L(e,{h:-90}),this.git6=this.git6||L(e,{h:60}),this.git7=this.git7||L(e,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLineColor=this.commitLineColor??"#BDBCCC",this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.fontWeight=600,this.erEdgeLabelBackground="#FFFFFF",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Bs,"Theme"),Bs),S4=v(t=>{const e=new w4;return e.calculate(t),e},"getThemeVariables"),As,T4=(As=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=L(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=X(H("#323D47"),10),this.border1="#ccc",this.border2=Gn(255,255,255,.25),this.arrowheadColor=H(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||X(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||X(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||K(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=K(this["cScale"+f],75);const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||L(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||L(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Xr(this.quadrant1Fill)?X(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.fontWeight=600,this.erEdgeLabelBackground="#16141F",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||pn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||mn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(As,"Theme"),As),_4=v(t=>{const e=new T4;return e.calculate(t),e},"getThemeVariables"),Sn={base:{getThemeVariables:o4},dark:{getThemeVariables:l4},default:{getThemeVariables:h4},forest:{getThemeVariables:d4},neutral:{getThemeVariables:p4},neo:{getThemeVariables:g4},"neo-dark":{getThemeVariables:y4},redux:{getThemeVariables:C4},"redux-dark":{getThemeVariables:v4},"redux-color":{getThemeVariables:S4},"redux-dark-color":{getThemeVariables:_4}},rr={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},I1={...rr,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:Sn.default.getThemeVariables(),sequence:{...rr.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...rr.gantt,tickInterval:void 0,useWidth:void 0},c4:{...rr.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...rr.flowchart,inheritDir:!1},external_personFont:v(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:v(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:v(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:v(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:v(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:v(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:v(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:v(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:v(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:v(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:v(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:v(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:v(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:v(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:v(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:v(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:v(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:v(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:v(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:v(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...rr.pie,useWidth:984},xyChart:{...rr.xyChart,useWidth:void 0},requirement:{...rr.requirement,useWidth:void 0},packet:{...rr.packet},eventmodeling:{...rr.eventmodeling},treeView:{...rr.treeView,useWidth:void 0},radar:{...rr.radar},ishikawa:{...rr.ishikawa},sankey:{...rr.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...rr.venn}},F1=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...F1(t[n],"")]:[...r,e+n],[]),"keyify"),E4=new Set(F1(I1,"")),P1=I1,Jl=v(t=>{if(tt.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>Jl(e));return}for(const e of Object.keys(t)){if(tt.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!E4.has(e)||t[e]==null){tt.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){if(e==="nodeColors"){const n=/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i;for(const i of Object.keys(t[e]))(typeof t[e][i]!="string"||!n.test(t[e][i]))&&(tt.debug("sanitize deleting invalid color:",i,t[e][i]),delete t[e][i])}else tt.debug("sanitizing object",e),Jl(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(tt.debug("sanitizing css option",e),t[e]=D1(t[e]))}if(t.themeVariables)for(const e of Object.keys(t.themeVariables)){const r=t.themeVariables[e];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[e]="")}tt.debug("After sanitization",t)}},"sanitizeDirective"),D1=v(t=>{let e=0,r=0;for(const n of t){if(e<r)return"{ /* ERROR: Unbalanced CSS */ }";n==="{"?e++:n==="}"&&r++}return e!==r?"{ /* ERROR: Unbalanced CSS */ }":t},"sanitizeCss"),zs=Object.freeze(P1),Ln=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),mr=Ie({},zs),tc,Ni=[],Yo=Ie({},zs),Vc=v((t,e)=>{let r=Ie({},t),n={};for(const i of e)$1(i),n=Ie(n,i);if(r=Ie(r,n),n.theme&&n.theme in Sn){const i=Ie({},tc),s=Ie(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in Sn&&(r.themeVariables=Sn[r.theme].getThemeVariables(s))}return Yo=r,W1(Yo),Yo},"updateCurrentConfig"),N4=v(t=>(mr=Ie({},zs),mr=Ie(mr,t),t.theme&&Sn[t.theme]&&(mr.themeVariables=Sn[t.theme].getThemeVariables(t.themeVariables)),Vc(mr,Ni),mr),"setSiteConfig"),j4=v(t=>{tc=Ie({},t)},"saveConfigFromInitialize"),L4=v(t=>(mr=Ie(mr,t),Vc(mr,Ni),mr),"updateSiteConfig"),O1=v(()=>Ie({},mr),"getSiteConfig"),R1=v(t=>(W1(t),Ie(Yo,t),ye()),"setConfig"),ye=v(()=>Ie({},Yo),"getConfig"),$1=v(t=>{t&&(["secure",...mr.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(tt.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])}),Object.keys(t).forEach(e=>{e.startsWith("__")&&delete t[e]}),Object.keys(t).forEach(e=>{typeof t[e]=="string"&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],typeof t[e]=="object"&&$1(t[e])}))},"sanitize"),B4=v(t=>{var e;Jl(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),Ni.push(t),Vc(mr,Ni)},"addDirective"),ec=v((t=mr)=>{Ni=[],Vc(t,Ni)},"reset"),A4={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},zg={},z1=v(t=>{zg[t]||(tt.warn(A4[t]),zg[t]=!0)},"issueWarning"),W1=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&z1("LAZY_LOAD_DEPRECATED")},"checkConfig"),aZ=v(()=>{let t={};tc&&(t=Ie(t,tc));for(const e of Ni)t=Ie(t,e);return t},"getUserDefinedConfig"),hr=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&z1("FLOWCHART_HTML_LABELS_DEPRECATED"),Ln(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),va=/<br\s*\/?>/gi,M4=v(t=>t?U1(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),I4=(()=>{let t=!1;return()=>{t||(q1(),t=!0)}})();function q1(){const t="data-temp-href-target";$s.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),$s.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute(t)&&(e.setAttribute("target",e.getAttribute(t)??""),e.removeAttribute(t),e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener"))})}v(q1,"setupDompurifyHooks");var H1=v(t=>(I4(),$s.sanitize(t)),"removeScript"),Wg=v((t,e)=>{if(hr(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=H1(t):r!=="loose"&&(t=U1(t),t=t.replace(/</g,"<").replace(/>/g,">"),t=t.replace(/=/g,"="),t=O4(t))}return t},"sanitizeMore"),Vr=v((t,e)=>t&&(e.dompurifyConfig?t=$s.sanitize(Wg(t,e),e.dompurifyConfig).toString():t=$s.sanitize(Wg(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),F4=v((t,e)=>typeof t=="string"?Vr(t,e):t.flat().map(r=>Vr(r,e)),"sanitizeTextOrArray"),P4=v(t=>va.test(t),"hasBreaks"),D4=v(t=>t.split(va),"splitBreaks"),O4=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),U1=v(t=>t.replace(va,"#br#"),"breakToPlaceholder"),R4=v(t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=CSS.escape(e)),e},"getUrl"),$4=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),z4=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),qg=v(function(t){const e=t.split(/(,)/),r=[];for(let n=0;n<e.length;n++){let i=e[n];if(i===","&&n>0&&n+1<e.length){const s=e[n-1],o=e[n+1];W4(s,o)&&(i=s+","+o,n++,r.pop())}r.push(q4(i))}return r.join("")},"parseGenericTypes"),ed=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),W4=v((t,e)=>{const r=ed(t,"~"),n=ed(e,"~");return r===1&&n===1},"shouldCombineSets"),q4=v(t=>{const e=ed(t,"~");let r=!1;if(e<=1)return t;e%2!==0&&t.startsWith("~")&&(t=t.substring(1),r=!0);const n=[...t];let i=n.indexOf("~"),s=n.lastIndexOf("~");for(;i!==-1&&s!==-1&&i!==s;)n[i]="<",n[s]=">",i=n.indexOf("~"),s=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),Hg=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),rd=/\$\$(.*)\$\$/g,ra=v(t=>{var e;return(((e=t.match(rd))==null?void 0:e.length)??0)>0},"hasKatex"),lZ=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await G1(t,e),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0";const n=document.querySelector("body");n==null||n.insertAdjacentElement("beforeend",r);const i={width:r.clientWidth,height:r.clientHeight};return r.remove(),i},"calculateMathMLDimensions"),H4=v(async(t,e)=>{if(!ra(t))return t;if(!(Hg()||e.legacyMathML||e.forceLegacyMathML))return t.replace(rd,"MathML is unsupported in this environment.");{const{default:r}=await Jt(async()=>{const{default:i}=await import("./katex-C5jXJg4s.js");return{default:i}},[]),n=e.forceLegacyMathML||!Hg()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(va).map(i=>ra(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(rd,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),G1=v(async(t,e)=>Vr(await H4(t,e),e),"renderKatexSanitized"),wa={getRows:M4,sanitizeText:Vr,sanitizeTextOrArray:F4,hasBreaks:P4,splitBreaks:D4,lineBreakRegex:va,removeScript:H1,getUrl:R4,evaluate:Ln,getMax:$4,getMin:z4},U4=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),G4=v(function(t,e,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${e}px;`)):(n.set("height",t),n.set("width",e)),n},"calculateSvgSizeAttrs"),Y1=v(function(t,e,r,n){const i=G4(e,r,n);U4(t,i)},"configureSvgSize"),Y4=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;tt.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;tt.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,tt.info(`Calculated bounds: ${a}x${l}`),Y1(e,l,a,n);const c=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;e.attr("viewBox",c)},"setupGraphViewbox"),Tl={};function nd(t){return[...t.cssRules].map(e=>e.cssText).join(`
|
|
350
|
-
`)}v(nd,"cssStyleSheetToString");var V4=v((t,e,r,n)=>{let i="";return t in Tl&&Tl[t]?i=Tl[t]({...r,svgId:n}):tt.warn(`No theme found for ${t}`),` & {
|
|
351
|
-
font-family: ${r.fontFamily};
|
|
352
|
-
font-size: ${r.fontSize};
|
|
353
|
-
fill: ${r.textColor}
|
|
354
|
-
}
|
|
355
|
-
@keyframes edge-animation-frame {
|
|
356
|
-
from {
|
|
357
|
-
stroke-dashoffset: 0;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
@keyframes dash {
|
|
361
|
-
to {
|
|
362
|
-
stroke-dashoffset: 0;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
& .edge-animation-slow {
|
|
366
|
-
stroke-dasharray: 9,5 !important;
|
|
367
|
-
stroke-dashoffset: 900;
|
|
368
|
-
animation: dash 50s linear infinite;
|
|
369
|
-
stroke-linecap: round;
|
|
370
|
-
}
|
|
371
|
-
& .edge-animation-fast {
|
|
372
|
-
stroke-dasharray: 9,5 !important;
|
|
373
|
-
stroke-dashoffset: 900;
|
|
374
|
-
animation: dash 20s linear infinite;
|
|
375
|
-
stroke-linecap: round;
|
|
376
|
-
}
|
|
377
|
-
/* Classes common for multiple diagrams */
|
|
378
|
-
|
|
379
|
-
& .error-icon {
|
|
380
|
-
fill: ${r.errorBkgColor};
|
|
381
|
-
}
|
|
382
|
-
& .error-text {
|
|
383
|
-
fill: ${r.errorTextColor};
|
|
384
|
-
stroke: ${r.errorTextColor};
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
& .edge-thickness-normal {
|
|
388
|
-
stroke-width: ${r.strokeWidth??1}px;
|
|
389
|
-
}
|
|
390
|
-
& .edge-thickness-thick {
|
|
391
|
-
stroke-width: 3.5px
|
|
392
|
-
}
|
|
393
|
-
& .edge-pattern-solid {
|
|
394
|
-
stroke-dasharray: 0;
|
|
395
|
-
}
|
|
396
|
-
& .edge-thickness-invisible {
|
|
397
|
-
stroke-width: 0;
|
|
398
|
-
fill: none;
|
|
399
|
-
}
|
|
400
|
-
& .edge-pattern-dashed{
|
|
401
|
-
stroke-dasharray: 3;
|
|
402
|
-
}
|
|
403
|
-
.edge-pattern-dotted {
|
|
404
|
-
stroke-dasharray: 2;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
& .marker {
|
|
408
|
-
fill: ${r.lineColor};
|
|
409
|
-
stroke: ${r.lineColor};
|
|
410
|
-
}
|
|
411
|
-
& .marker.cross {
|
|
412
|
-
stroke: ${r.lineColor};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
& svg {
|
|
416
|
-
font-family: ${r.fontFamily};
|
|
417
|
-
font-size: ${r.fontSize};
|
|
418
|
-
}
|
|
419
|
-
& p {
|
|
420
|
-
margin: 0
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
${i}
|
|
424
|
-
.node .neo-node {
|
|
425
|
-
stroke: ${r.nodeBorder};
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
[data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
|
|
429
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
430
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
[data-look="neo"].node path {
|
|
435
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
436
|
-
stroke-width: ${r.strokeWidth??1}px;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
[data-look="neo"].node .outer-path {
|
|
440
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
[data-look="neo"].node .neo-line path {
|
|
444
|
-
stroke: ${r.nodeBorder};
|
|
445
|
-
filter: none;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
[data-look="neo"].node circle{
|
|
449
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
450
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
[data-look="neo"].node circle .state-start{
|
|
454
|
-
fill: #000000;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
[data-look="neo"].icon-shape .icon {
|
|
458
|
-
fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
459
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
[data-look="neo"].icon-shape .icon-neo path {
|
|
463
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
464
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
${e}
|
|
468
|
-
`},"getStyles"),X4=v((t,e)=>{e!==void 0&&(Tl[t]=e)},"addStylesForDiagram"),K4=V4,V1={};bF(V1,{clear:()=>Z4,getAccDescription:()=>eP,getAccTitle:()=>J4,getDiagramTitle:()=>nP,setAccDescription:()=>tP,setAccTitle:()=>Q4,setDiagramTitle:()=>rP});var Xf="",Kf="",Zf="",Qf=v(t=>Vr(t,ye()),"sanitizeText"),Z4=v(()=>{Xf="",Zf="",Kf=""},"clear"),Q4=v(t=>{Xf=Qf(t).replace(/^\s+/g,"")},"setAccTitle"),J4=v(()=>Xf,"getAccTitle"),tP=v(t=>{Zf=Qf(t).replace(/\n\s+/g,`
|
|
469
|
-
`)},"setAccDescription"),eP=v(()=>Zf,"getAccDescription"),rP=v(t=>{Kf=Qf(t)},"setDiagramTitle"),nP=v(()=>Kf,"getDiagramTitle"),Ug=tt,iP=Yf,re=ye,cZ=R1,hZ=zs,Jf=v(t=>Vr(t,re()),"sanitizeText"),sP=Y4,oP=v(()=>V1,"getCommonDb"),rc={},nc=v((t,e,r)=>{var n;rc[t]&&Ug.warn(`Diagram with id ${t} already registered. Overwriting.`),rc[t]=e,r&&M1(t,r),X4(t,e.styles),(n=e.injectUtils)==null||n.call(e,Ug,iP,re,Jf,sP,oP(),()=>{})},"registerDiagram"),id=v(t=>{if(t in rc)return rc[t];throw new aP(t)},"getDiagram"),Ms,aP=(Ms=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(Ms,"DiagramNotFoundError"),Ms),lP={value:()=>{}};function X1(){for(var t=0,e=arguments.length,r={},n;t<e;++t){if(!(n=arguments[t]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new _l(r)}function _l(t){this._=t}function cP(t,e){return t.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}_l.prototype=X1.prototype={constructor:_l,on:function(t,e){var r=this._,n=cP(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=hP(r[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=n[s]).type)r[i]=Gg(r[i],t.name,e);else if(e==null)for(i in r)r[i]=Gg(r[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new _l(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,s;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],n=0,i=s.length;n<i;++n)s[n].value.apply(e,r)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};function hP(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function Gg(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=lP,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var sd="http://www.w3.org/1999/xhtml";const Yg={svg:"http://www.w3.org/2000/svg",xhtml:sd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),Yg.hasOwnProperty(e)?{space:Yg[e],local:t}:t}function uP(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===sd&&e.documentElement.namespaceURI===sd?e.createElement(t):e.createElementNS(r,t)}}function dP(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function K1(t){var e=Xc(t);return(e.local?dP:uP)(e)}function fP(){}function tp(t){return t==null?fP:function(){return this.querySelector(t)}}function pP(t){typeof t!="function"&&(t=tp(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=t.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new Er(n,this._parents)}function mP(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function gP(){return[]}function Z1(t){return t==null?gP:function(){return this.querySelectorAll(t)}}function xP(t){return function(){return mP(t.apply(this,arguments))}}function yP(t){typeof t=="function"?t=xP(t):t=Z1(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(t.call(l,l.__data__,c,o)),i.push(l));return new Er(n,i)}function Q1(t){return function(){return this.matches(t)}}function J1(t){return function(e){return e.matches(t)}}var bP=Array.prototype.find;function CP(t){return function(){return bP.call(this.children,t)}}function kP(){return this.firstElementChild}function vP(t){return this.select(t==null?kP:CP(typeof t=="function"?t:J1(t)))}var wP=Array.prototype.filter;function SP(){return Array.from(this.children)}function TP(t){return function(){return wP.call(this.children,t)}}function _P(t){return this.selectAll(t==null?SP:TP(typeof t=="function"?t:J1(t)))}function EP(t){typeof t!="function"&&(t=Q1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new Er(n,this._parents)}function tC(t){return new Array(t.length)}function NP(){return new Er(this._enter||this._groups.map(tC),this._parents)}function ic(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}ic.prototype={constructor:ic,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function jP(t){return function(){return t}}function LP(t,e,r,n,i,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new ic(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function BP(t,e,r,n,i,s,o){var a,l,c=new Map,u=e.length,d=s.length,p=new Array(u),f;for(a=0;a<u;++a)(l=e[a])&&(p[a]=f=o.call(l,l.__data__,a,e)+"",c.has(f)?i[a]=l:c.set(f,l));for(a=0;a<d;++a)f=o.call(t,s[a],a,s)+"",(l=c.get(f))?(n[a]=l,l.__data__=s[a],c.delete(f)):r[a]=new ic(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(i[a]=l)}function AP(t){return t.__data__}function MP(t,e){if(!arguments.length)return Array.from(this,AP);var r=e?BP:LP,n=this._parents,i=this._groups;typeof t!="function"&&(t=jP(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],d=i[c],p=d.length,f=IP(t.call(u,u&&u.__data__,c,n)),m=f.length,x=a[c]=new Array(m),g=o[c]=new Array(m),y=l[c]=new Array(p);r(u,d,x,g,y,f,e);for(var b=0,k=0,T,_;b<m;++b)if(T=x[b]){for(b>=k&&(k=b+1);!(_=g[k])&&++k<m;);T._next=_||null}}return o=new Er(o,n),o._enter=a,o._exit=l,o}function IP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function FP(){return new Er(this._exit||this._groups.map(tC),this._parents)}function PP(t,e,r){var n=this.enter(),i=this,s=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),r==null?s.remove():r(s),n&&i?n.merge(i).order():i}function DP(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,o=Math.min(i,s),a=new Array(i),l=0;l<o;++l)for(var c=r[l],u=n[l],d=c.length,p=a[l]=new Array(d),f,m=0;m<d;++m)(f=c[m]||u[m])&&(p[m]=f);for(;l<i;++l)a[l]=r[l];return new Er(a,this._parents)}function OP(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n=t[e],i=n.length-1,s=n[i],o;--i>=0;)(o=n[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function RP(t){t||(t=$P);function e(d,p){return d&&p?t(d.__data__,p.__data__):!d-!p}for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var o=r[s],a=o.length,l=i[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new Er(i,this._parents).order()}function $P(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function zP(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function WP(){return Array.from(this)}function qP(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var o=n[i];if(o)return o}return null}function HP(){let t=0;for(const e of this)++t;return t}function UP(){return!this.node()}function GP(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i=e[r],s=0,o=i.length,a;s<o;++s)(a=i[s])&&t.call(a,a.__data__,s,i);return this}function YP(t){return function(){this.removeAttribute(t)}}function VP(t){return function(){this.removeAttributeNS(t.space,t.local)}}function XP(t,e){return function(){this.setAttribute(t,e)}}function KP(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ZP(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function QP(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function JP(t,e){var r=Xc(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((e==null?r.local?VP:YP:typeof e=="function"?r.local?QP:ZP:r.local?KP:XP)(r,e))}function eC(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function tD(t){return function(){this.style.removeProperty(t)}}function eD(t,e,r){return function(){this.style.setProperty(t,e,r)}}function rD(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function nD(t,e,r){return arguments.length>1?this.each((e==null?tD:typeof e=="function"?rD:eD)(t,e,r??"")):Ws(this.node(),t)}function Ws(t,e){return t.style.getPropertyValue(e)||eC(t).getComputedStyle(t,null).getPropertyValue(e)}function iD(t){return function(){delete this[t]}}function sD(t,e){return function(){this[t]=e}}function oD(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function aD(t,e){return arguments.length>1?this.each((e==null?iD:typeof e=="function"?oD:sD)(t,e)):this.node()[t]}function rC(t){return t.trim().split(/^|\s+/)}function ep(t){return t.classList||new nC(t)}function nC(t){this._node=t,this._names=rC(t.getAttribute("class")||"")}nC.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function iC(t,e){for(var r=ep(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function sC(t,e){for(var r=ep(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function lD(t){return function(){iC(this,t)}}function cD(t){return function(){sC(this,t)}}function hD(t,e){return function(){(e.apply(this,arguments)?iC:sC)(this,t)}}function uD(t,e){var r=rC(t+"");if(arguments.length<2){for(var n=ep(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?hD:e?lD:cD)(r,e))}function dD(){this.textContent=""}function fD(t){return function(){this.textContent=t}}function pD(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function mD(t){return arguments.length?this.each(t==null?dD:(typeof t=="function"?pD:fD)(t)):this.node().textContent}function gD(){this.innerHTML=""}function xD(t){return function(){this.innerHTML=t}}function yD(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function bD(t){return arguments.length?this.each(t==null?gD:(typeof t=="function"?yD:xD)(t)):this.node().innerHTML}function CD(){this.nextSibling&&this.parentNode.appendChild(this)}function kD(){return this.each(CD)}function vD(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wD(){return this.each(vD)}function SD(t){var e=typeof t=="function"?t:K1(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function TD(){return null}function _D(t,e){var r=typeof t=="function"?t:K1(t),n=e==null?TD:typeof e=="function"?e:tp(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function ED(){var t=this.parentNode;t&&t.removeChild(this)}function ND(){return this.each(ED)}function jD(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function LD(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function BD(t){return this.select(t?LD:jD)}function AD(t){return arguments.length?this.property("__data__",t):this.node().__data__}function MD(t){return function(e){t.call(this,e,this.__data__)}}function ID(t){return t.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");return n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function FD(t){return function(){var e=this.__on;if(e){for(var r=0,n=-1,i=e.length,s;r<i;++r)s=e[r],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function PD(t,e,r){return function(){var n=this.__on,i,s=MD(e);if(n){for(var o=0,a=n.length;o<a;++o)if((i=n[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=r),i.value=e;return}}this.addEventListener(t.type,s,r),i={type:t.type,name:t.name,value:e,listener:s,options:r},n?n.push(i):this.__on=[i]}}function DD(t,e,r){var n=ID(t+""),i,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(i=0,u=a[l];i<s;++i)if((o=n[i]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?PD:FD,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function oC(t,e,r){var n=eC(t),i=n.CustomEvent;typeof i=="function"?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function OD(t,e){return function(){return oC(this,t,e)}}function RD(t,e){return function(){return oC(this,t,e.apply(this,arguments))}}function $D(t,e){return this.each((typeof e=="function"?RD:OD)(t,e))}function*zD(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length,o;i<s;++i)(o=n[i])&&(yield o)}var aC=[null];function Er(t,e){this._groups=t,this._parents=e}function Sa(){return new Er([[document.documentElement]],aC)}function WD(){return this}Er.prototype=Sa.prototype={constructor:Er,select:pP,selectAll:yP,selectChild:vP,selectChildren:_P,filter:EP,data:MP,enter:NP,exit:FP,join:PP,merge:DP,selection:WD,order:OP,sort:RP,call:zP,nodes:WP,node:qP,size:HP,empty:UP,each:GP,attr:JP,style:nD,property:aD,classed:uD,text:mD,html:bD,raise:kD,lower:wD,append:SD,insert:_D,remove:ND,clone:BD,datum:AD,on:DD,dispatch:$D,[Symbol.iterator]:zD};function Yt(t){return typeof t=="string"?new Er([[document.querySelector(t)]],[document.documentElement]):new Er([[t]],aC)}function rp(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function lC(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Ta(){}var na=.7,sc=1/na,xs="\\s*([+-]?\\d+)\\s*",ia="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ln="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qD=/^#([0-9a-f]{3,8})$/,HD=new RegExp(`^rgb\\(${xs},${xs},${xs}\\)$`),UD=new RegExp(`^rgb\\(${ln},${ln},${ln}\\)$`),GD=new RegExp(`^rgba\\(${xs},${xs},${xs},${ia}\\)$`),YD=new RegExp(`^rgba\\(${ln},${ln},${ln},${ia}\\)$`),VD=new RegExp(`^hsl\\(${ia},${ln},${ln}\\)$`),XD=new RegExp(`^hsla\\(${ia},${ln},${ln},${ia}\\)$`),Vg={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};rp(Ta,sa,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Xg,formatHex:Xg,formatHex8:KD,formatHsl:ZD,formatRgb:Kg,toString:Kg});function Xg(){return this.rgb().formatHex()}function KD(){return this.rgb().formatHex8()}function ZD(){return cC(this).formatHsl()}function Kg(){return this.rgb().formatRgb()}function sa(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=qD.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?Zg(e):r===3?new xr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Za(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Za(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=HD.exec(t))?new xr(e[1],e[2],e[3],1):(e=UD.exec(t))?new xr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=GD.exec(t))?Za(e[1],e[2],e[3],e[4]):(e=YD.exec(t))?Za(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=VD.exec(t))?tx(e[1],e[2]/100,e[3]/100,1):(e=XD.exec(t))?tx(e[1],e[2]/100,e[3]/100,e[4]):Vg.hasOwnProperty(t)?Zg(Vg[t]):t==="transparent"?new xr(NaN,NaN,NaN,0):null}function Zg(t){return new xr(t>>16&255,t>>8&255,t&255,1)}function Za(t,e,r,n){return n<=0&&(t=e=r=NaN),new xr(t,e,r,n)}function QD(t){return t instanceof Ta||(t=sa(t)),t?(t=t.rgb(),new xr(t.r,t.g,t.b,t.opacity)):new xr}function od(t,e,r,n){return arguments.length===1?QD(t):new xr(t,e,r,n??1)}function xr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}rp(xr,od,lC(Ta,{brighter(t){return t=t==null?sc:Math.pow(sc,t),new xr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?na:Math.pow(na,t),new xr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new xr(wi(this.r),wi(this.g),wi(this.b),oc(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Qg,formatHex:Qg,formatHex8:JD,formatRgb:Jg,toString:Jg}));function Qg(){return`#${bi(this.r)}${bi(this.g)}${bi(this.b)}`}function JD(){return`#${bi(this.r)}${bi(this.g)}${bi(this.b)}${bi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Jg(){const t=oc(this.opacity);return`${t===1?"rgb(":"rgba("}${wi(this.r)}, ${wi(this.g)}, ${wi(this.b)}${t===1?")":`, ${t})`}`}function oc(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function wi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function bi(t){return t=wi(t),(t<16?"0":"")+t.toString(16)}function tx(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new qr(t,e,r,n)}function cC(t){if(t instanceof qr)return new qr(t.h,t.s,t.l,t.opacity);if(t instanceof Ta||(t=sa(t)),!t)return new qr;if(t instanceof qr)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(r-n)/a+(r<n)*6:r===s?o=(n-e)/a+2:o=(e-r)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new qr(o,a,l,t.opacity)}function tO(t,e,r,n){return arguments.length===1?cC(t):new qr(t,e,r,n??1)}function qr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}rp(qr,tO,lC(Ta,{brighter(t){return t=t==null?sc:Math.pow(sc,t),new qr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?na:Math.pow(na,t),new qr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new xr(ru(t>=240?t-240:t+120,i,n),ru(t,i,n),ru(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new qr(ex(this.h),Qa(this.s),Qa(this.l),oc(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=oc(this.opacity);return`${t===1?"hsl(":"hsla("}${ex(this.h)}, ${Qa(this.s)*100}%, ${Qa(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ex(t){return t=(t||0)%360,t<0?t+360:t}function Qa(t){return Math.max(0,Math.min(1,t||0))}function ru(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const np=t=>()=>t;function hC(t,e){return function(r){return t+r*e}}function eO(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function uZ(t,e){var r=e-t;return r?hC(t,r>180||r<-180?r-360*Math.round(r/360):r):np(isNaN(t)?e:t)}function rO(t){return(t=+t)==1?uC:function(e,r){return r-e?eO(e,r,t):np(isNaN(e)?r:e)}}function uC(t,e){var r=e-t;return r?hC(t,r):np(isNaN(t)?e:t)}const rx=(function t(e){var r=rO(e);function n(i,s){var o=r((i=od(i)).r,(s=od(s)).r),a=r(i.g,s.g),l=r(i.b,s.b),c=uC(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return n.gamma=t,n})(1);function qn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var ad=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nu=new RegExp(ad.source,"g");function nO(t){return function(){return t}}function iO(t){return function(e){return t(e)+""}}function sO(t,e){var r=ad.lastIndex=nu.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=ad.exec(t))&&(i=nu.exec(e));)(s=i.index)>r&&(s=e.slice(r,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:qn(n,i)})),r=nu.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?iO(l[0].x):nO(e):(e=l.length,function(c){for(var u=0,d;u<e;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}var nx=180/Math.PI,ld={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function dC(t,e,r,n,i,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,l/=a),t*n<e*r&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*nx,skewX:Math.atan(l)*nx,scaleX:o,scaleY:a}}var Ja;function oO(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ld:dC(e.a,e.b,e.c,e.d,e.e,e.f)}function aO(t){return t==null||(Ja||(Ja=document.createElementNS("http://www.w3.org/2000/svg","g")),Ja.setAttribute("transform",t),!(t=Ja.transform.baseVal.consolidate()))?ld:(t=t.matrix,dC(t.a,t.b,t.c,t.d,t.e,t.f))}function fC(t,e,r,n){function i(c){return c.length?c.pop()+" ":""}function s(c,u,d,p,f,m){if(c!==d||u!==p){var x=f.push("translate(",null,e,null,r);m.push({i:x-4,x:qn(c,d)},{i:x-2,x:qn(u,p)})}else(d||p)&&f.push("translate("+d+e+p+r)}function o(c,u,d,p){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),p.push({i:d.push(i(d)+"rotate(",null,n)-2,x:qn(c,u)})):u&&d.push(i(d)+"rotate("+u+n)}function a(c,u,d,p){c!==u?p.push({i:d.push(i(d)+"skewX(",null,n)-2,x:qn(c,u)}):u&&d.push(i(d)+"skewX("+u+n)}function l(c,u,d,p,f,m){if(c!==d||u!==p){var x=f.push(i(f)+"scale(",null,",",null,")");m.push({i:x-4,x:qn(c,d)},{i:x-2,x:qn(u,p)})}else(d!==1||p!==1)&&f.push(i(f)+"scale("+d+","+p+")")}return function(c,u){var d=[],p=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,p),o(c.rotate,u.rotate,d,p),a(c.skewX,u.skewX,d,p),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,p),c=u=null,function(f){for(var m=-1,x=p.length,g;++m<x;)d[(g=p[m]).i]=g.x(f);return d.join("")}}}var lO=fC(oO,"px, ","px)","deg)"),cO=fC(aO,", ",")",")"),qs=0,Io=0,bo=0,pC=1e3,ac,Fo,lc=0,ji=0,Kc=0,oa=typeof performance=="object"&&performance.now?performance:Date,mC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ip(){return ji||(mC(hO),ji=oa.now()+Kc)}function hO(){ji=0}function cc(){this._call=this._time=this._next=null}cc.prototype=gC.prototype={constructor:cc,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?ip():+r)+(e==null?0:+e),!this._next&&Fo!==this&&(Fo?Fo._next=this:ac=this,Fo=this),this._call=t,this._time=r,cd()},stop:function(){this._call&&(this._call=null,this._time=1/0,cd())}};function gC(t,e,r){var n=new cc;return n.restart(t,e,r),n}function uO(){ip(),++qs;for(var t=ac,e;t;)(e=ji-t._time)>=0&&t._call.call(void 0,e),t=t._next;--qs}function ix(){ji=(lc=oa.now())+Kc,qs=Io=0;try{uO()}finally{qs=0,fO(),ji=0}}function dO(){var t=oa.now(),e=t-lc;e>pC&&(Kc-=e,lc=t)}function fO(){for(var t,e=ac,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:ac=r);Fo=t,cd(n)}function cd(t){if(!qs){Io&&(Io=clearTimeout(Io));var e=t-ji;e>24?(t<1/0&&(Io=setTimeout(ix,t-oa.now()-Kc)),bo&&(bo=clearInterval(bo))):(bo||(lc=oa.now(),bo=setInterval(dO,pC)),qs=1,mC(ix))}}function sx(t,e,r){var n=new cc;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var pO=X1("start","end","cancel","interrupt"),mO=[],xC=0,ox=1,hd=2,El=3,ax=4,ud=5,Nl=6;function Zc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;gO(t,r,{name:e,index:n,group:i,on:pO,tween:mO,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:xC})}function sp(t,e){var r=Kr(t,e);if(r.state>xC)throw new Error("too late; already scheduled");return r}function gn(t,e){var r=Kr(t,e);if(r.state>El)throw new Error("too late; already running");return r}function Kr(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function gO(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=gC(s,0,r.time);function s(c){r.state=ox,r.timer.restart(o,r.delay,r.time),r.delay<=c&&o(c-r.delay)}function o(c){var u,d,p,f;if(r.state!==ox)return l();for(u in n)if(f=n[u],f.name===r.name){if(f.state===El)return sx(o);f.state===ax?(f.state=Nl,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete n[u]):+u<e&&(f.state=Nl,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete n[u])}if(sx(function(){r.state===El&&(r.state=ax,r.timer.restart(a,r.delay,r.time),a(c))}),r.state=hd,r.on.call("start",t,t.__data__,r.index,r.group),r.state===hd){for(r.state=El,i=new Array(p=r.tween.length),u=0,d=-1;u<p;++u)(f=r.tween[u].value.call(t,t.__data__,r.index,r.group))&&(i[++d]=f);i.length=d+1}}function a(c){for(var u=c<r.duration?r.ease.call(null,c/r.duration):(r.timer.restart(l),r.state=ud,1),d=-1,p=i.length;++d<p;)i[d].call(t,u);r.state===ud&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=Nl,r.timer.stop(),delete n[e];for(var c in n)return;delete t.__transition}}function xO(t,e){var r=t.__transition,n,i,s=!0,o;if(r){e=e==null?null:e+"";for(o in r){if((n=r[o]).name!==e){s=!1;continue}i=n.state>hd&&n.state<ud,n.state=Nl,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function yO(t){return this.each(function(){xO(this,t)})}function bO(t,e){var r,n;return function(){var i=gn(this,t),s=i.tween;if(s!==r){n=r=s;for(var o=0,a=n.length;o<a;++o)if(n[o].name===e){n=n.slice(),n.splice(o,1);break}}i.tween=n}}function CO(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var s=gn(this,t),o=s.tween;if(o!==n){i=(n=o).slice();for(var a={name:e,value:r},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function kO(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=Kr(this.node(),r).tween,i=0,s=n.length,o;i<s;++i)if((o=n[i]).name===t)return o.value;return null}return this.each((e==null?bO:CO)(r,t,e))}function op(t,e,r){var n=t._id;return t.each(function(){var i=gn(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return Kr(i,n).value[e]}}function yC(t,e){var r;return(typeof e=="number"?qn:e instanceof sa?rx:(r=sa(e))?(e=r,rx):sO)(t,e)}function vO(t){return function(){this.removeAttribute(t)}}function wO(t){return function(){this.removeAttributeNS(t.space,t.local)}}function SO(t,e,r){var n,i=r+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===n?s:s=e(n=o,r)}}function TO(t,e,r){var n,i=r+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===n?s:s=e(n=o,r)}}function _O(t,e,r){var n,i,s;return function(){var o,a=r(this),l;return a==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=a+"",o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a)))}}function EO(t,e,r){var n,i,s;return function(){var o,a=r(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=a+"",o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a)))}}function NO(t,e){var r=Xc(t),n=r==="transform"?cO:yC;return this.attrTween(t,typeof e=="function"?(r.local?EO:_O)(r,n,op(this,"attr."+t,e)):e==null?(r.local?wO:vO)(r):(r.local?TO:SO)(r,n,e))}function jO(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function LO(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function BO(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&LO(t,s)),r}return i._value=e,i}function AO(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&jO(t,s)),r}return i._value=e,i}function MO(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;var n=Xc(t);return this.tween(r,(n.local?BO:AO)(n,e))}function IO(t,e){return function(){sp(this,t).delay=+e.apply(this,arguments)}}function FO(t,e){return e=+e,function(){sp(this,t).delay=e}}function PO(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?IO:FO)(e,t)):Kr(this.node(),e).delay}function DO(t,e){return function(){gn(this,t).duration=+e.apply(this,arguments)}}function OO(t,e){return e=+e,function(){gn(this,t).duration=e}}function RO(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?DO:OO)(e,t)):Kr(this.node(),e).duration}function $O(t,e){if(typeof e!="function")throw new Error;return function(){gn(this,t).ease=e}}function zO(t){var e=this._id;return arguments.length?this.each($O(e,t)):Kr(this.node(),e).ease}function WO(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;gn(this,t).ease=r}}function qO(t){if(typeof t!="function")throw new Error;return this.each(WO(this._id,t))}function HO(t){typeof t!="function"&&(t=Q1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new En(n,this._parents,this._name,this._id)}function UO(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),o=new Array(n),a=0;a<s;++a)for(var l=e[a],c=r[a],u=l.length,d=o[a]=new Array(u),p,f=0;f<u;++f)(p=l[f]||c[f])&&(d[f]=p);for(;a<n;++a)o[a]=e[a];return new En(o,this._parents,this._name,this._id)}function GO(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function YO(t,e,r){var n,i,s=GO(e)?sp:gn;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function VO(t,e){var r=this._id;return arguments.length<2?Kr(this.node(),r).on.on(t):this.each(YO(r,t,e))}function XO(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function KO(){return this.on("end.remove",XO(this._id))}function ZO(t){var e=this._name,r=this._id;typeof t!="function"&&(t=tp(t));for(var n=this._groups,i=n.length,s=new Array(i),o=0;o<i;++o)for(var a=n[o],l=a.length,c=s[o]=new Array(l),u,d,p=0;p<l;++p)(u=a[p])&&(d=t.call(u,u.__data__,p,a))&&("__data__"in u&&(d.__data__=u.__data__),c[p]=d,Zc(c[p],e,r,p,c,Kr(u,r)));return new En(s,this._parents,e,r)}function QO(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Z1(t));for(var n=this._groups,i=n.length,s=[],o=[],a=0;a<i;++a)for(var l=n[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var p=t.call(u,u.__data__,d,l),f,m=Kr(u,r),x=0,g=p.length;x<g;++x)(f=p[x])&&Zc(f,e,r,x,p,m);s.push(p),o.push(u)}return new En(s,o,e,r)}var JO=Sa.prototype.constructor;function tR(){return new JO(this._groups,this._parents)}function eR(t,e){var r,n,i;return function(){var s=Ws(this,t),o=(this.style.removeProperty(t),Ws(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function bC(t){return function(){this.style.removeProperty(t)}}function rR(t,e,r){var n,i=r+"",s;return function(){var o=Ws(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function nR(t,e,r){var n,i,s;return function(){var o=Ws(this,t),a=r(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),Ws(this,t))),o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a))}}function iR(t,e){var r,n,i,s="style."+e,o="end."+s,a;return function(){var l=gn(this,t),c=l.on,u=l.value[s]==null?a||(a=bC(e)):void 0;(c!==r||i!==u)&&(n=(r=c).copy()).on(o,i=u),l.on=n}}function sR(t,e,r){var n=(t+="")=="transform"?lO:yC;return e==null?this.styleTween(t,eR(t,n)).on("end.style."+t,bC(t)):typeof e=="function"?this.styleTween(t,nR(t,n,op(this,"style."+t,e))).each(iR(this._id,t)):this.styleTween(t,rR(t,n,e),r).on("end.style."+t,null)}function oR(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function aR(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&oR(t,o,r)),n}return s._value=e,s}function lR(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,aR(t,e,r??""))}function cR(t){return function(){this.textContent=t}}function hR(t){return function(){var e=t(this);this.textContent=e??""}}function uR(t){return this.tween("text",typeof t=="function"?hR(op(this,"text",t)):cR(t==null?"":t+""))}function dR(t){return function(e){this.textContent=t.call(this,e)}}function fR(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&dR(i)),e}return n._value=t,n}function pR(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,fR(t))}function mR(){for(var t=this._name,e=this._id,r=CC(),n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,l,c=0;c<a;++c)if(l=o[c]){var u=Kr(l,e);Zc(l,t,r,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new En(n,this._parents,t,r)}function gR(){var t,e,r=this,n=r._id,i=r.size();return new Promise(function(s,o){var a={value:o},l={value:function(){--i===0&&s()}};r.each(function(){var c=gn(this,n),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),i===0&&s()})}var xR=0;function En(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function CC(){return++xR}var kn=Sa.prototype;En.prototype={constructor:En,select:ZO,selectAll:QO,selectChild:kn.selectChild,selectChildren:kn.selectChildren,filter:HO,merge:UO,selection:tR,transition:mR,call:kn.call,nodes:kn.nodes,node:kn.node,size:kn.size,empty:kn.empty,each:kn.each,on:VO,attr:NO,attrTween:MO,style:sR,styleTween:lR,text:uR,textTween:pR,remove:KO,tween:kO,delay:PO,duration:RO,ease:zO,easeVarying:qO,end:gR,[Symbol.iterator]:kn[Symbol.iterator]};function yR(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var bR={time:null,delay:0,duration:250,ease:yR};function CR(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}function kR(t){var e,r;t instanceof En?(e=t._id,t=t._name):(e=CC(),(r=bR).time=ip(),t=t==null?null:t+"");for(var n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&Zc(l,t,e,c,o,r||CR(l,e));return new En(n,this._parents,t,e)}Sa.prototype.interrupt=yO;Sa.prototype.transition=kR;const dd=Math.PI,fd=2*dd,mi=1e-6,vR=fd-mi;function kC(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function wR(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return kC;const r=10**e;return function(n){this._+=n[0];for(let i=1,s=n.length;i<s;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class SR{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?kC:wR(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,s,o){this._append`C${+e},${+r},${+n},${+i},${this._x1=+s},${this._y1=+o}`}arcTo(e,r,n,i,s){if(e=+e,r=+r,n=+n,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,l=n-e,c=i-r,u=o-e,d=a-r,p=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(p>mi)if(!(Math.abs(d*l-c*u)>mi)||!s)this._append`L${this._x1=e},${this._y1=r}`;else{let f=n-o,m=i-a,x=l*l+c*c,g=f*f+m*m,y=Math.sqrt(x),b=Math.sqrt(p),k=s*Math.tan((dd-Math.acos((x+p-g)/(2*y*b)))/2),T=k/b,_=k/y;Math.abs(T-1)>mi&&this._append`L${e+T*u},${r+T*d}`,this._append`A${s},${s},0,0,${+(d*f>u*m)},${this._x1=e+_*l},${this._y1=r+_*c}`}}arc(e,r,n,i,s,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),l=n*Math.sin(i),c=e+a,u=r+l,d=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>mi||Math.abs(this._y1-u)>mi)&&this._append`L${c},${u}`,n&&(p<0&&(p=p%fd+fd),p>vR?this._append`A${n},${n},0,1,${d},${e-a},${r-l}A${n},${n},0,1,${d},${this._x1=c},${this._y1=u}`:p>mi&&this._append`A${n},${n},0,${+(p>=dd)},${d},${this._x1=e+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ki(t){return function(){return t}}const dZ=Math.abs,fZ=Math.atan2,pZ=Math.cos,mZ=Math.max,gZ=Math.min,xZ=Math.sin,yZ=Math.sqrt,lx=1e-12,ap=Math.PI,cx=ap/2,bZ=2*ap;function CZ(t){return t>1?0:t<-1?ap:Math.acos(t)}function kZ(t){return t>=1?cx:t<=-1?-cx:Math.asin(t)}function TR(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new SR(e)}function _R(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function vC(t){this._context=t}vC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Vo(t){return new vC(t)}function ER(t){return t[0]}function NR(t){return t[1]}function jR(t,e){var r=Ki(!0),n=null,i=Vo,s=null,o=TR(a);t=typeof t=="function"?t:t===void 0?ER:Ki(t),e=typeof e=="function"?e:e===void 0?NR:Ki(e);function a(l){var c,u=(l=_R(l)).length,d,p=!1,f;for(n==null&&(s=i(f=o())),c=0;c<=u;++c)!(c<u&&r(d=l[c],c,l))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+t(d,c,l),+e(d,c,l));if(f)return s=null,f+""||null}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:Ki(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Ki(+l),a):e},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Ki(!!l),a):r},a.curve=function(l){return arguments.length?(i=l,n!=null&&(s=i(n)),a):i},a.context=function(l){return arguments.length?(l==null?n=s=null:s=i(n=l),a):n},a}class wC{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function SC(t){return new wC(t,!0)}function TC(t){return new wC(t,!1)}function Zn(){}function hc(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function Qc(t){this._context=t}Qc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:hc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:hc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function pd(t){return new Qc(t)}function _C(t){this._context=t}_C.prototype={areaStart:Zn,areaEnd:Zn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:hc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function LR(t){return new _C(t)}function EC(t){this._context=t}EC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:hc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function BR(t){return new EC(t)}function NC(t,e){this._basis=new Qc(t),this._beta=e}NC.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n=t[0],i=e[0],s=t[r]-n,o=e[r]-i,a=-1,l;++a<=r;)l=a/r,this._basis.point(this._beta*t[a]+(1-this._beta)*(n+l*s),this._beta*e[a]+(1-this._beta)*(i+l*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const AR=(function t(e){function r(n){return e===1?new Qc(n):new NC(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function uc(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function lp(t,e){this._context=t,this._k=(1-e)/6}lp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:uc(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:uc(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const jC=(function t(e){function r(n){return new lp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function cp(t,e){this._context=t,this._k=(1-e)/6}cp.prototype={areaStart:Zn,areaEnd:Zn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:uc(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const MR=(function t(e){function r(n){return new cp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function hp(t,e){this._context=t,this._k=(1-e)/6}hp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:uc(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const IR=(function t(e){function r(n){return new hp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function up(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>lx){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>lx){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,s,o,t._x2,t._y2)}function LC(t,e){this._context=t,this._alpha=e}LC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:up(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const BC=(function t(e){function r(n){return e?new LC(n,e):new lp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function AC(t,e){this._context=t,this._alpha=e}AC.prototype={areaStart:Zn,areaEnd:Zn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:up(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const FR=(function t(e){function r(n){return e?new AC(n,e):new cp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function MC(t,e){this._context=t,this._alpha=e}MC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:up(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const PR=(function t(e){function r(n){return e?new MC(n,e):new hp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function IC(t){this._context=t}IC.prototype={areaStart:Zn,areaEnd:Zn,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function DR(t){return new IC(t)}function hx(t){return t<0?-1:1}function ux(t,e,r){var n=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),a=(s*i+o*n)/(n+i);return(hx(s)+hx(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function dx(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function iu(t,e,r){var n=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-n)/3;t._context.bezierCurveTo(n+a,i+a*e,s-a,o-a*r,s,o)}function dc(t){this._context=t}dc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:iu(this,this._t0,dx(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,iu(this,dx(this,r=ux(this,t,e)),r);break;default:iu(this,this._t0,r=ux(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function FC(t){this._context=new PC(t)}(FC.prototype=Object.create(dc.prototype)).point=function(t,e){dc.prototype.point.call(this,e,t)};function PC(t){this._context=t}PC.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,s){this._context.bezierCurveTo(e,t,n,r,s,i)}};function DC(t){return new dc(t)}function OC(t){return new FC(t)}function RC(t){this._context=t}RC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=fx(t),i=fx(e),s=0,o=1;o<r;++s,++o)this._context.bezierCurveTo(n[0][s],i[0][s],n[1][s],i[1][s],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function fx(t){var e,r=t.length-1,n,i=new Array(r),s=new Array(r),o=new Array(r);for(i[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,s[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/s[e-1],s[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/s[r-1],e=r-2;e>=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function $C(t){return new RC(t)}function Jc(t,e){this._context=t,this._t=e}Jc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function zC(t){return new Jc(t,.5)}function WC(t){return new Jc(t,0)}function qC(t){return new Jc(t,1)}function Po(t,e,r){this.k=t,this.x=e,this.y=r}Po.prototype={constructor:Po,scale:function(t){return t===1?this:new Po(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Po(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Po.prototype;var OR=v(t=>{var i;const{securityLevel:e}=re();let r=Yt("body");if(e==="sandbox"){const o=((i=Yt(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=Yt(o.body)}return r.select(`#${t}`)},"selectSvgElement");function dp(t){return typeof t>"u"||t===null}v(dp,"isNothing");function HC(t){return typeof t=="object"&&t!==null}v(HC,"isObject");function UC(t){return Array.isArray(t)?t:dp(t)?[]:[t]}v(UC,"toArray");function GC(t,e){var r,n,i,s;if(e)for(s=Object.keys(e),r=0,n=s.length;r<n;r+=1)i=s[r],t[i]=e[i];return t}v(GC,"extend");function YC(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(YC,"repeat");function VC(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(VC,"isNegativeZero");var RR=dp,$R=HC,zR=UC,WR=YC,qR=VC,HR=GC,Fe={isNothing:RR,isObject:$R,toArray:zR,repeat:WR,isNegativeZero:qR,extend:HR};function fp(t,e){var r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
|
|
470
|
-
|
|
471
|
-
`+t.mark.snippet),n+" "+r):n}v(fp,"formatError");function Hs(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=fp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}v(Hs,"YAMLException$1");Hs.prototype=Object.create(Error.prototype);Hs.prototype.constructor=Hs;Hs.prototype.toString=v(function(e){return this.name+": "+fp(this,e)},"toString");var gr=Hs;function jl(t,e,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-e>a&&(s=" ... ",e=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+t.slice(e,r).replace(/\t/g,"→")+o,pos:n-e+s.length}}v(jl,"getLine");function Ll(t,e){return Fe.repeat(" ",e-t.length)+t}v(Ll,"padStart");function XC(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=r.exec(t.buffer);)i.push(s.index),n.push(s.index+s[0].length),t.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",l,c,u=Math.min(t.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+u+3);for(l=1;l<=e.linesBefore&&!(o-l<0);l++)c=jl(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Fe.repeat(" ",e.indent)+Ll((t.line-l+1).toString(),u)+" | "+c.str+`
|
|
472
|
-
`+a;for(c=jl(t.buffer,n[o],i[o],t.position,d),a+=Fe.repeat(" ",e.indent)+Ll((t.line+1).toString(),u)+" | "+c.str+`
|
|
473
|
-
`,a+=Fe.repeat("-",e.indent+u+3+c.pos)+`^
|
|
474
|
-
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=jl(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Fe.repeat(" ",e.indent)+Ll((t.line+l+1).toString(),u)+" | "+c.str+`
|
|
475
|
-
`;return a.replace(/\n$/,"")}v(XC,"makeSnippet");var UR=XC,GR=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],YR=["scalar","sequence","mapping"];function KC(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v(KC,"compileStyleAliases");function ZC(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(GR.indexOf(r)===-1)throw new gr('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=KC(e.styleAliases||null),YR.indexOf(this.kind)===-1)throw new gr('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(ZC,"Type$1");var Ze=ZC;function md(t,e){var r=[];return t[e].forEach(function(n){var i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}v(md,"compileList");function QC(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,r;function n(i){i.multi?(t.multi[i.kind].push(i),t.multi.fallback.push(i)):t[i.kind][i.tag]=t.fallback[i.tag]=i}for(v(n,"collectType"),e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(n);return t}v(QC,"compileMap");function fc(t){return this.extend(t)}v(fc,"Schema$1");fc.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Ze)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new gr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ze))throw new gr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new gr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new gr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof Ze))throw new gr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(fc.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=md(i,"implicit"),i.compiledExplicit=md(i,"explicit"),i.compiledTypeMap=QC(i.compiledImplicit,i.compiledExplicit),i},"extend");var VR=fc,XR=new Ze("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),KR=new Ze("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),ZR=new Ze("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),QR=new VR({explicit:[XR,KR,ZR]});function JC(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(JC,"resolveYamlNull");function tk(){return null}v(tk,"constructYamlNull");function ek(t){return t===null}v(ek,"isNull");var JR=new Ze("tag:yaml.org,2002:null",{kind:"scalar",resolve:JC,construct:tk,predicate:ek,represent:{canonical:v(function(){return"~"},"canonical"),lowercase:v(function(){return"null"},"lowercase"),uppercase:v(function(){return"NULL"},"uppercase"),camelcase:v(function(){return"Null"},"camelcase"),empty:v(function(){return""},"empty")},defaultStyle:"lowercase"});function rk(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}v(rk,"resolveYamlBoolean");function nk(t){return t==="true"||t==="True"||t==="TRUE"}v(nk,"constructYamlBoolean");function ik(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(ik,"isBoolean");var t$=new Ze("tag:yaml.org,2002:bool",{kind:"scalar",resolve:rk,construct:nk,predicate:ik,represent:{lowercase:v(function(t){return t?"true":"false"},"lowercase"),uppercase:v(function(t){return t?"TRUE":"FALSE"},"uppercase"),camelcase:v(function(t){return t?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function sk(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(sk,"isHexCode");function ok(t){return 48<=t&&t<=55}v(ok,"isOctCode");function ak(t){return 48<=t&&t<=57}v(ak,"isDecCode");function lk(t){if(t===null)return!1;var e=t.length,r=0,n=!1,i;if(!e)return!1;if(i=t[r],(i==="-"||i==="+")&&(i=t[++r]),i==="0"){if(r+1===e)return!0;if(i=t[++r],i==="b"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!sk(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!ok(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!ak(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(lk,"resolveYamlInteger");function ck(t){var e=t,r=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}v(ck,"constructYamlInteger");function hk(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Fe.isNegativeZero(t)}v(hk,"isInteger");var e$=new Ze("tag:yaml.org,2002:int",{kind:"scalar",resolve:lk,construct:ck,predicate:hk,represent:{binary:v(function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},"binary"),octal:v(function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},"octal"),decimal:v(function(t){return t.toString(10)},"decimal"),hexadecimal:v(function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),r$=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function uk(t){return!(t===null||!r$.test(t)||t[t.length-1]==="_")}v(uk,"resolveYamlFloat");function dk(t){var e,r;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}v(dk,"constructYamlFloat");var n$=/^[-+]?[0-9]+e/;function fk(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Fe.isNegativeZero(t))return"-0.0";return r=t.toString(10),n$.test(r)?r.replace("e",".e"):r}v(fk,"representYamlFloat");function pk(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Fe.isNegativeZero(t))}v(pk,"isFloat");var i$=new Ze("tag:yaml.org,2002:float",{kind:"scalar",resolve:uk,construct:dk,predicate:pk,represent:fk,defaultStyle:"lowercase"}),mk=QR.extend({implicit:[JR,t$,e$,i$]}),s$=mk,gk=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),xk=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function yk(t){return t===null?!1:gk.exec(t)!==null||xk.exec(t)!==null}v(yk,"resolveYamlTimestamp");function bk(t){var e,r,n,i,s,o,a,l=0,c=null,u,d,p;if(e=gk.exec(t),e===null&&(e=xk.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(r,n,i));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],d=+(e[11]||0),c=(u*60+d)*6e4,e[9]==="-"&&(c=-c)),p=new Date(Date.UTC(r,n,i,s,o,a,l)),c&&p.setTime(p.getTime()-c),p}v(bk,"constructYamlTimestamp");function Ck(t){return t.toISOString()}v(Ck,"representYamlTimestamp");var o$=new Ze("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:yk,construct:bk,instanceOf:Date,represent:Ck});function kk(t){return t==="<<"||t===null}v(kk,"resolveYamlMerge");var a$=new Ze("tag:yaml.org,2002:merge",{kind:"scalar",resolve:kk}),pp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
476
|
-
\r`;function vk(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=pp;for(r=0;r<i;r++)if(e=s.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}v(vk,"resolveYamlBinary");function wk(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=pp,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return r=i%4*6,r===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):r===18?(a.push(o>>10&255),a.push(o>>2&255)):r===12&&a.push(o>>4&255),new Uint8Array(a)}v(wk,"constructYamlBinary");function Sk(t){var e="",r=0,n,i,s=t.length,o=pp;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]),r=(r<<8)+t[n];return i=s%3,i===0?(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]):i===2?(e+=o[r>>10&63],e+=o[r>>4&63],e+=o[r<<2&63],e+=o[64]):i===1&&(e+=o[r>>2&63],e+=o[r<<4&63],e+=o[64],e+=o[64]),e}v(Sk,"representYamlBinary");function Tk(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(Tk,"isBinary");var l$=new Ze("tag:yaml.org,2002:binary",{kind:"scalar",resolve:vk,construct:wk,predicate:Tk,represent:Sk}),c$=Object.prototype.hasOwnProperty,h$=Object.prototype.toString;function _k(t){if(t===null)return!0;var e=[],r,n,i,s,o,a=t;for(r=0,n=a.length;r<n;r+=1){if(i=a[r],o=!1,h$.call(i)!=="[object Object]")return!1;for(s in i)if(c$.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}v(_k,"resolveYamlOmap");function Ek(t){return t!==null?t:[]}v(Ek,"constructYamlOmap");var u$=new Ze("tag:yaml.org,2002:omap",{kind:"sequence",resolve:_k,construct:Ek}),d$=Object.prototype.toString;function Nk(t){if(t===null)return!0;var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1){if(n=o[e],d$.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}v(Nk,"resolveYamlPairs");function jk(t){if(t===null)return[];var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1)n=o[e],i=Object.keys(n),s[e]=[i[0],n[i[0]]];return s}v(jk,"constructYamlPairs");var f$=new Ze("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Nk,construct:jk}),p$=Object.prototype.hasOwnProperty;function Lk(t){if(t===null)return!0;var e,r=t;for(e in r)if(p$.call(r,e)&&r[e]!==null)return!1;return!0}v(Lk,"resolveYamlSet");function Bk(t){return t!==null?t:{}}v(Bk,"constructYamlSet");var m$=new Ze("tag:yaml.org,2002:set",{kind:"mapping",resolve:Lk,construct:Bk}),Ak=s$.extend({implicit:[o$,a$],explicit:[l$,u$,f$,m$]}),Qn=Object.prototype.hasOwnProperty,pc=1,Mk=2,Ik=3,mc=4,su=1,g$=2,px=3,x$=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,y$=/[\x85\u2028\u2029]/,b$=/[,\[\]\{\}]/,Fk=/^(?:!|!!|![a-z\-]+!)$/i,Pk=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function gd(t){return Object.prototype.toString.call(t)}v(gd,"_class");function Gr(t){return t===10||t===13}v(Gr,"is_EOL");function Yn(t){return t===9||t===32}v(Yn,"is_WHITE_SPACE");function sr(t){return t===9||t===32||t===10||t===13}v(sr,"is_WS_OR_EOL");function Ci(t){return t===44||t===91||t===93||t===123||t===125}v(Ci,"is_FLOW_INDICATOR");function Dk(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(Dk,"fromHexCode");function Ok(t){return t===120?2:t===117?4:t===85?8:0}v(Ok,"escapedHexLen");function Rk(t){return 48<=t&&t<=57?t-48:-1}v(Rk,"fromDecimalCode");function xd(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
|
|
477
|
-
`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"
":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}v(xd,"simpleEscapeSequence");function $k(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v($k,"charFromCodepoint");function mp(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(mp,"setProperty");var zk=new Array(256),Wk=new Array(256);for(fi=0;fi<256;fi++)zk[fi]=xd(fi)?1:0,Wk[fi]=xd(fi);var fi;function qk(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Ak,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}v(qk,"State$1");function gp(t,e){var r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=UR(r),new gr(e,r)}v(gp,"generateError");function Et(t,e){throw gp(t,e)}v(Et,"throwError");function aa(t,e){t.onWarning&&t.onWarning.call(null,gp(t,e))}v(aa,"throwWarning");var mx={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&Et(e,"duplication of %YAML directive"),n.length!==1&&Et(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Et(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Et(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&aa(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&Et(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],Fk.test(i)||Et(e,"ill-formed tag handle (first argument) of the TAG directive"),Qn.call(e.tagMap,i)&&Et(e,'there is a previously declared suffix for "'+i+'" tag handle'),Pk.test(s)||Et(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Et(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function Tn(t,e,r,n){var i,s,o,a;if(e<r){if(a=t.input.slice(e,r),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||Et(t,"expected valid JSON character");else x$.test(a)&&Et(t,"the stream contains non-printable characters");t.result+=a}}v(Tn,"captureSegment");function yd(t,e,r,n){var i,s,o,a;for(Fe.isObject(r)||Et(t,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),o=0,a=i.length;o<a;o+=1)s=i[o],Qn.call(e,s)||(mp(e,s,r[s]),n[s]=!0)}v(yd,"mergeMappings");function ki(t,e,r,n,i,s,o,a,l){var c,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,u=i.length;c<u;c+=1)Array.isArray(i[c])&&Et(t,"nested arrays are not supported inside keys"),typeof i=="object"&&gd(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&gd(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,u=s.length;c<u;c+=1)yd(t,e,s[c],r);else yd(t,e,s,r);else!t.json&&!Qn.call(r,i)&&Qn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,Et(t,"duplicated mapping key")),mp(e,i,s),delete r[i];return e}v(ki,"storeMappingPair");function th(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):Et(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v(th,"readLineBreak");function Ee(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;Yn(i);)i===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&i===35)do i=t.input.charCodeAt(++t.position);while(i!==10&&i!==13&&i!==0);if(Gr(i))for(th(t),i=t.input.charCodeAt(t.position),n++,t.lineIndent=0;i===32;)t.lineIndent++,i=t.input.charCodeAt(++t.position);else break}return r!==-1&&n!==0&&t.lineIndent<r&&aa(t,"deficient indentation"),n}v(Ee,"skipSeparationSpace");function _a(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||sr(r)))}v(_a,"testDocumentSeparator");function eh(t,e){e===1?t.result+=" ":e>1&&(t.result+=Fe.repeat(`
|
|
478
|
-
`,e-1))}v(eh,"writeFoldedLines");function Hk(t,e,r){var n,i,s,o,a,l,c,u,d=t.kind,p=t.result,f;if(f=t.input.charCodeAt(t.position),sr(f)||Ci(f)||f===35||f===38||f===42||f===33||f===124||f===62||f===39||f===34||f===37||f===64||f===96||(f===63||f===45)&&(i=t.input.charCodeAt(t.position+1),sr(i)||r&&Ci(i)))return!1;for(t.kind="scalar",t.result="",s=o=t.position,a=!1;f!==0;){if(f===58){if(i=t.input.charCodeAt(t.position+1),sr(i)||r&&Ci(i))break}else if(f===35){if(n=t.input.charCodeAt(t.position-1),sr(n))break}else{if(t.position===t.lineStart&&_a(t)||r&&Ci(f))break;if(Gr(f))if(l=t.line,c=t.lineStart,u=t.lineIndent,Ee(t,!1,-1),t.lineIndent>=e){a=!0,f=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=l,t.lineStart=c,t.lineIndent=u;break}}a&&(Tn(t,s,o,!1),eh(t,t.line-l),s=o=t.position,a=!1),Yn(f)||(o=t.position+1),f=t.input.charCodeAt(++t.position)}return Tn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=p,!1)}v(Hk,"readPlainScalar");function Uk(t,e){var r,n,i;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=i=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(Tn(t,n,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)n=t.position,t.position++,i=t.position;else return!0;else Gr(r)?(Tn(t,n,i,!0),eh(t,Ee(t,!1,e)),n=i=t.position):t.position===t.lineStart&&_a(t)?Et(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);Et(t,"unexpected end of the stream within a single quoted scalar")}v(Uk,"readSingleQuotedScalar");function Gk(t,e){var r,n,i,s,o,a;if(a=t.input.charCodeAt(t.position),a!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(a=t.input.charCodeAt(t.position))!==0;){if(a===34)return Tn(t,r,t.position,!0),t.position++,!0;if(a===92){if(Tn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),Gr(a))Ee(t,!1,e);else if(a<256&&zk[a])t.result+=Wk[a],t.position++;else if((o=Ok(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=Dk(a))>=0?s=(s<<4)+o:Et(t,"expected hexadecimal character");t.result+=$k(s),t.position++}else Et(t,"unknown escape sequence");r=n=t.position}else Gr(a)?(Tn(t,r,n,!0),eh(t,Ee(t,!1,e)),r=n=t.position):t.position===t.lineStart&&_a(t)?Et(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}Et(t,"unexpected end of the stream within a double quoted scalar")}v(Gk,"readDoubleQuotedScalar");function Yk(t,e){var r=!0,n,i,s,o=t.tag,a,l=t.anchor,c,u,d,p,f,m=Object.create(null),x,g,y,b;if(b=t.input.charCodeAt(t.position),b===91)u=93,f=!1,a=[];else if(b===123)u=125,f=!0,a={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),b=t.input.charCodeAt(++t.position);b!==0;){if(Ee(t,!0,e),b=t.input.charCodeAt(t.position),b===u)return t.position++,t.tag=o,t.anchor=l,t.kind=f?"mapping":"sequence",t.result=a,!0;r?b===44&&Et(t,"expected the node content, but found ','"):Et(t,"missed comma between flow collection entries"),g=x=y=null,d=p=!1,b===63&&(c=t.input.charCodeAt(t.position+1),sr(c)&&(d=p=!0,t.position++,Ee(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,Li(t,e,pc,!1,!0),g=t.tag,x=t.result,Ee(t,!0,e),b=t.input.charCodeAt(t.position),(p||t.line===n)&&b===58&&(d=!0,b=t.input.charCodeAt(++t.position),Ee(t,!0,e),Li(t,e,pc,!1,!0),y=t.result),f?ki(t,a,m,g,x,y,n,i,s):d?a.push(ki(t,null,m,g,x,y,n,i,s)):a.push(x),Ee(t,!0,e),b=t.input.charCodeAt(t.position),b===44?(r=!0,b=t.input.charCodeAt(++t.position)):r=!1}Et(t,"unexpected end of the stream within a flow collection")}v(Yk,"readFlowCollection");function Vk(t,e){var r,n,i=su,s=!1,o=!1,a=e,l=0,c=!1,u,d;if(d=t.input.charCodeAt(t.position),d===124)n=!1;else if(d===62)n=!0;else return!1;for(t.kind="scalar",t.result="";d!==0;)if(d=t.input.charCodeAt(++t.position),d===43||d===45)su===i?i=d===43?px:g$:Et(t,"repeat of a chomping mode identifier");else if((u=Rk(d))>=0)u===0?Et(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Et(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(Yn(d)){do d=t.input.charCodeAt(++t.position);while(Yn(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!Gr(d)&&d!==0)}for(;d!==0;){for(th(t),t.lineIndent=0,d=t.input.charCodeAt(t.position);(!o||t.lineIndent<a)&&d===32;)t.lineIndent++,d=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>a&&(a=t.lineIndent),Gr(d)){l++;continue}if(t.lineIndent<a){i===px?t.result+=Fe.repeat(`
|
|
479
|
-
`,s?1+l:l):i===su&&s&&(t.result+=`
|
|
480
|
-
`);break}for(n?Yn(d)?(c=!0,t.result+=Fe.repeat(`
|
|
481
|
-
`,s?1+l:l)):c?(c=!1,t.result+=Fe.repeat(`
|
|
482
|
-
`,l+1)):l===0?s&&(t.result+=" "):t.result+=Fe.repeat(`
|
|
483
|
-
`,l):t.result+=Fe.repeat(`
|
|
484
|
-
`,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!Gr(d)&&d!==0;)d=t.input.charCodeAt(++t.position);Tn(t,r,t.position,!1)}return!0}v(Vk,"readBlockScalar");function bd(t,e){var r,n=t.tag,i=t.anchor,s=[],o,a=!1,l;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=s),l=t.input.charCodeAt(t.position);l!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Et(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!sr(o))));){if(a=!0,t.position++,Ee(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,Li(t,e,Ik,!1,!0),s.push(t.result),Ee(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)Et(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return a?(t.tag=n,t.anchor=i,t.kind="sequence",t.result=s,!0):!1}v(bd,"readBlockSequence");function Xk(t,e,r){var n,i,s,o,a,l,c=t.tag,u=t.anchor,d={},p=Object.create(null),f=null,m=null,x=null,g=!1,y=!1,b;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=d),b=t.input.charCodeAt(t.position);b!==0;){if(!g&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Et(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(b===63||b===58)&&sr(n))b===63?(g&&(ki(t,d,p,f,m,null,o,a,l),f=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):Et(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,b=n;else{if(o=t.line,a=t.lineStart,l=t.position,!Li(t,r,Mk,!1,!0))break;if(t.line===s){for(b=t.input.charCodeAt(t.position);Yn(b);)b=t.input.charCodeAt(++t.position);if(b===58)b=t.input.charCodeAt(++t.position),sr(b)||Et(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(ki(t,d,p,f,m,null,o,a,l),f=m=x=null),y=!0,g=!1,i=!1,f=t.tag,m=t.result;else if(y)Et(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=c,t.anchor=u,!0}else if(y)Et(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=c,t.anchor=u,!0}if((t.line===s||t.lineIndent>e)&&(g&&(o=t.line,a=t.lineStart,l=t.position),Li(t,e,mc,!0,i)&&(g?m=t.result:x=t.result),g||(ki(t,d,p,f,m,x,o,a,l),f=m=x=null),Ee(t,!0,-1),b=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&b!==0)Et(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&ki(t,d,p,f,m,null,o,a,l),y&&(t.tag=c,t.anchor=u,t.kind="mapping",t.result=d),y}v(Xk,"readBlockMapping");function Kk(t){var e,r=!1,n=!1,i,s,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&Et(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(r=!0,o=t.input.charCodeAt(++t.position)):o===33?(n=!0,i="!!",o=t.input.charCodeAt(++t.position)):i="!",e=t.position,r){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(s=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):Et(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!sr(o);)o===33&&(n?Et(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),Fk.test(i)||Et(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);s=t.input.slice(e,t.position),b$.test(s)&&Et(t,"tag suffix cannot contain flow indicator characters")}s&&!Pk.test(s)&&Et(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Et(t,"tag name is malformed: "+s)}return r?t.tag=s:Qn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:Et(t,'undeclared tag handle "'+i+'"'),!0}v(Kk,"readTagProperty");function Zk(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&Et(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!sr(r)&&!Ci(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&Et(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(Zk,"readAnchorProperty");function Qk(t){var e,r,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!sr(n)&&!Ci(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&Et(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Qn.call(t.anchorMap,r)||Et(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],Ee(t,!0,-1),!0}v(Qk,"readAlias");function Li(t,e,r,n,i){var s,o,a,l=1,c=!1,u=!1,d,p,f,m,x,g;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,s=o=a=mc===r||Ik===r,n&&Ee(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;Kk(t)||Zk(t);)Ee(t,!0,-1)?(c=!0,a=s,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||mc===r)&&(pc===r||Mk===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&(bd(t,g)||Xk(t,g,x))||Yk(t,x)?u=!0:(o&&Vk(t,x)||Uk(t,x)||Gk(t,x)?u=!0:Qk(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&Et(t,"alias node should not have any properties")):Hk(t,x,pc===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&bd(t,g))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&Et(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,p=t.implicitTypes.length;d<p;d+=1)if(m=t.implicitTypes[d],m.resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(Qn.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,f=t.typeMap.multi[t.kind||"fallback"],d=0,p=f.length;d<p;d+=1)if(t.tag.slice(0,f[d].tag.length)===f[d].tag){m=f[d];break}m||Et(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&Et(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):Et(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||u}v(Li,"composeNode");function Jk(t){var e=t.position,r,n,i,s=!1,o;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(o=t.input.charCodeAt(t.position))!==0&&(Ee(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||o!==37));){for(s=!0,o=t.input.charCodeAt(++t.position),r=t.position;o!==0&&!sr(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&Et(t,"directive name must not be less than one character in length");o!==0;){for(;Yn(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!Gr(o));break}if(Gr(o))break;for(r=t.position;o!==0&&!sr(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&th(t),Qn.call(mx,n)?mx[n](t,n,i):aa(t,'unknown document directive "'+n+'"')}if(Ee(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,Ee(t,!0,-1)):s&&Et(t,"directives end mark is expected"),Li(t,t.lineIndent-1,mc,!1,!0),Ee(t,!0,-1),t.checkLineBreaks&&y$.test(t.input.slice(e,t.position))&&aa(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&_a(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,Ee(t,!0,-1));return}if(t.position<t.length-1)Et(t,"end of the stream or a document separator is expected");else return}v(Jk,"readDocument");function xp(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
|
|
485
|
-
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new qk(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,Et(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Jk(r);return r.documents}v(xp,"loadDocuments");function C$(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=xp(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(C$,"loadAll$1");function tv(t,e){var r=xp(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new gr("expected a single document in the stream, but found more")}}v(tv,"load$1");var k$=tv,v$={load:k$},ev=Object.prototype.toString,rv=Object.prototype.hasOwnProperty,yp=65279,w$=9,la=10,S$=13,T$=32,_$=33,E$=34,Cd=35,N$=37,j$=38,L$=39,B$=42,nv=44,A$=45,gc=58,M$=61,I$=62,F$=63,P$=64,iv=91,sv=93,D$=96,ov=123,O$=124,av=125,Je={};Je[0]="\\0";Je[7]="\\a";Je[8]="\\b";Je[9]="\\t";Je[10]="\\n";Je[11]="\\v";Je[12]="\\f";Je[13]="\\r";Je[27]="\\e";Je[34]='\\"';Je[92]="\\\\";Je[133]="\\N";Je[160]="\\_";Je[8232]="\\L";Je[8233]="\\P";var R$=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],$$=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function lv(t,e){var r,n,i,s,o,a,l;if(e===null)return{};for(r={},n=Object.keys(e),i=0,s=n.length;i<s;i+=1)o=n[i],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=t.compiledTypeMap.fallback[o],l&&rv.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}v(lv,"compileStyleMap");function cv(t){var e,r,n;if(e=t.toString(16).toUpperCase(),t<=255)r="x",n=2;else if(t<=65535)r="u",n=4;else if(t<=4294967295)r="U",n=8;else throw new gr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Fe.repeat("0",n-e.length)+e}v(cv,"encodeHex");var z$=1,ca=2;function hv(t){this.schema=t.schema||Ak,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Fe.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=lv(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?ca:z$,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}v(hv,"State");function kd(t,e){for(var r=Fe.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
|
|
486
|
-
`,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
|
|
487
|
-
`&&(s+=r),s+=o;return s}v(kd,"indentString");function xc(t,e){return`
|
|
488
|
-
`+Fe.repeat(" ",t.indent*e)}v(xc,"generateNextLine");function uv(t,e){var r,n,i;for(r=0,n=t.implicitTypes.length;r<n;r+=1)if(i=t.implicitTypes[r],i.resolve(e))return!0;return!1}v(uv,"testImplicitResolving");function ha(t){return t===T$||t===w$}v(ha,"isWhitespace");function Us(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==yp||65536<=t&&t<=1114111}v(Us,"isPrintable");function vd(t){return Us(t)&&t!==yp&&t!==S$&&t!==la}v(vd,"isNsCharOrWhitespace");function wd(t,e,r){var n=vd(t),i=n&&!ha(t);return(r?n:n&&t!==nv&&t!==iv&&t!==sv&&t!==ov&&t!==av)&&t!==Cd&&!(e===gc&&!i)||vd(e)&&!ha(e)&&t===Cd||e===gc&&i}v(wd,"isPlainSafe");function dv(t){return Us(t)&&t!==yp&&!ha(t)&&t!==A$&&t!==F$&&t!==gc&&t!==nv&&t!==iv&&t!==sv&&t!==ov&&t!==av&&t!==Cd&&t!==j$&&t!==B$&&t!==_$&&t!==O$&&t!==M$&&t!==I$&&t!==L$&&t!==E$&&t!==N$&&t!==P$&&t!==D$}v(dv,"isPlainSafeFirst");function fv(t){return!ha(t)&&t!==gc}v(fv,"isPlainSafeLast");function us(t,e){var r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}v(us,"codePointAt");function bp(t){var e=/^\n* /;return e.test(t)}v(bp,"needIndentIndicator");var pv=1,Sd=2,mv=3,gv=4,ls=5;function xv(t,e,r,n,i,s,o,a){var l,c=0,u=null,d=!1,p=!1,f=n!==-1,m=-1,x=dv(us(t,0))&&fv(us(t,t.length-1));if(e||o)for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=us(t,l),!Us(c))return ls;x=x&&wd(c,u,a),u=c}else{for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=us(t,l),c===la)d=!0,f&&(p=p||l-m-1>n&&t[m+1]!==" ",m=l);else if(!Us(c))return ls;x=x&&wd(c,u,a),u=c}p=p||f&&l-m-1>n&&t[m+1]!==" "}return!d&&!p?x&&!o&&!i(t)?pv:s===ca?ls:Sd:r>9&&bp(t)?ls:o?s===ca?ls:Sd:p?gv:mv}v(xv,"chooseScalarStyle");function yv(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===ca?'""':"''";if(!t.noCompatMode&&(R$.indexOf(e)!==-1||$$.test(e)))return t.quotingType===ca?'"'+e+'"':"'"+e+"'";var s=t.indent*Math.max(1,r),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-s),a=n||t.flowLevel>-1&&r>=t.flowLevel;function l(c){return uv(t,c)}switch(v(l,"testAmbiguity"),xv(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case pv:return e;case Sd:return"'"+e.replace(/'/g,"''")+"'";case mv:return"|"+Td(e,t.indent)+_d(kd(e,s));case gv:return">"+Td(e,t.indent)+_d(kd(bv(e,o),s));case ls:return'"'+Cv(e)+'"';default:throw new gr("impossible error: invalid scalar style")}})()}v(yv,"writeScalar");function Td(t,e){var r=bp(t)?String(e):"",n=t[t.length-1]===`
|
|
489
|
-
`,i=n&&(t[t.length-2]===`
|
|
490
|
-
`||t===`
|
|
491
|
-
`),s=i?"+":n?"":"-";return r+s+`
|
|
492
|
-
`}v(Td,"blockHeader");function _d(t){return t[t.length-1]===`
|
|
493
|
-
`?t.slice(0,-1):t}v(_d,"dropEndingNewline");function bv(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var c=t.indexOf(`
|
|
494
|
-
`);return c=c!==-1?c:t.length,r.lastIndex=c,Ed(t.slice(0,c),e)})(),i=t[0]===`
|
|
495
|
-
`||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
|
|
496
|
-
`:"")+Ed(l,e),i=s}return n}v(bv,"foldString");function Ed(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,n,i=0,s,o=0,a=0,l="";n=r.exec(t);)a=n.index,a-i>e&&(s=o>i?o:a,l+=`
|
|
497
|
-
`+t.slice(i,s),i=s+1),o=a;return l+=`
|
|
498
|
-
`,t.length-i>e&&o>i?l+=t.slice(i,o)+`
|
|
499
|
-
`+t.slice(o+1):l+=t.slice(i),l.slice(1)}v(Ed,"foldLine");function Cv(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=us(t,i),n=Je[r],!n&&Us(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||cv(r);return e}v(Cv,"escapeString");function kv(t,e,r){var n="",i=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(hn(t,e,a,!1,!1)||typeof a>"u"&&hn(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}v(kv,"writeFlowSequence");function Nd(t,e,r,n){var i="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(hn(t,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&hn(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=xc(t,e)),t.dump&&la===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v(Nd,"writeBlockSequence");function vv(t,e,r){var n="",i=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),hn(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),hn(t,e,c,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}v(vv,"writeFlowMapping");function wv(t,e,r,n){var i="",s=t.tag,o=Object.keys(r),a,l,c,u,d,p;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new gr("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)p="",(!n||i!=="")&&(p+=xc(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),hn(t,e+1,c,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&la===t.dump.charCodeAt(0)?p+="?":p+="? "),p+=t.dump,d&&(p+=xc(t,e)),hn(t,e+1,u,!0,d)&&(t.dump&&la===t.dump.charCodeAt(0)?p+=":":p+=": ",p+=t.dump,i+=p));t.tag=s,t.dump=i||"{}"}v(wv,"writeBlockMapping");function jd(t,e,r){var n,i,s,o,a,l;for(i=r?t.explicitTypes:t.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,ev.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(rv.call(a.represent,l))n=a.represent[l](e,l);else throw new gr("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}v(jd,"detectType");function hn(t,e,r,n,i,s,o){t.tag=null,t.dump=r,jd(t,r,!1)||jd(t,r,!0);var a=ev.call(t.dump),l=n,c;n&&(n=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",d,p;if(u&&(d=t.duplicates.indexOf(r),p=d!==-1),(t.tag!==null&&t.tag!=="?"||p||t.indent!==2&&e>0)&&(i=!1),p&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(u&&p&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),a==="[object Object]")n&&Object.keys(t.dump).length!==0?(wv(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(vv(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?Nd(t,e-1,t.dump,i):Nd(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(kv(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&yv(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new gr("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}v(hn,"writeNode");function Sv(t,e){var r=[],n=[],i,s;for(yc(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v(Sv,"getDuplicateReferences");function yc(t,e,r){var n,i,s;if(t!==null&&typeof t=="object")if(i=e.indexOf(t),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(e.push(t),Array.isArray(t))for(i=0,s=t.length;i<s;i+=1)yc(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)yc(t[n[i]],e,r)}v(yc,"inspectNode");function W$(t,e){e=e||{};var r=new hv(e);r.noRefs||Sv(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),hn(r,0,n,!0,!0)?r.dump+`
|
|
500
|
-
`:""}v(W$,"dump$1");function q$(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}v(q$,"renamed");var H$=mk,U$=v$.load;/*! Bundled license information:
|
|
501
|
-
|
|
502
|
-
js-yaml/dist/js-yaml.mjs:
|
|
503
|
-
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
504
|
-
*/var Co=v((t,e)=>{if(e)return"translate("+-t.width/2+", "+-t.height/2+")";const r=t.x??0,n=t.y??0;return"translate("+-(r+t.width/2)+", "+-(n+t.height/2)+")"},"computeLabelTransform"),Ve={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4,arrow_barb:0,arrow_barb_neo:5.5},gx={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function Do(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=ge(t),e=ge(e);const[r,n]=[t.x,t.y],[i,s]=[e.x,e.y],o=i-r,a=s-n;return{angle:Math.atan(a/o),deltaX:o,deltaY:a}}v(Do,"calculateDeltaAndAngle");var ge=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),G$=v(t=>({x:v(function(e,r,n){let i=0;const s=ge(n[0]).x<ge(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(Ve,t.arrowTypeStart)){const{angle:f,deltaX:m}=Do(n[0],n[1]);i=Ve[t.arrowTypeStart]*Math.cos(f)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ve,t.arrowTypeEnd)){const{angle:f,deltaX:m}=Do(n[n.length-1],n[n.length-2]);i=Ve[t.arrowTypeEnd]*Math.cos(f)*(m>=0?1:-1)}const o=Math.abs(ge(e).x-ge(n[n.length-1]).x),a=Math.abs(ge(e).y-ge(n[n.length-1]).y),l=Math.abs(ge(e).x-ge(n[0]).x),c=Math.abs(ge(e).y-ge(n[0]).y),u=Ve[t.arrowTypeStart],d=Ve[t.arrowTypeEnd],p=1;if(o<d&&o>0&&a<d){let f=d+p-o;f*=s==="right"?-1:1,i-=f}if(l<u&&l>0&&c<u){let f=u+p-l;f*=s==="right"?-1:1,i+=f}return ge(e).x+i},"x"),y:v(function(e,r,n){let i=0;const s=ge(n[0]).y<ge(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(Ve,t.arrowTypeStart)){const{angle:f,deltaY:m}=Do(n[0],n[1]);i=Ve[t.arrowTypeStart]*Math.abs(Math.sin(f))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ve,t.arrowTypeEnd)){const{angle:f,deltaY:m}=Do(n[n.length-1],n[n.length-2]);i=Ve[t.arrowTypeEnd]*Math.abs(Math.sin(f))*(m>=0?1:-1)}const o=Math.abs(ge(e).y-ge(n[n.length-1]).y),a=Math.abs(ge(e).x-ge(n[n.length-1]).x),l=Math.abs(ge(e).y-ge(n[0]).y),c=Math.abs(ge(e).x-ge(n[0]).x),u=Ve[t.arrowTypeStart],d=Ve[t.arrowTypeEnd],p=1;if(o<d&&o>0&&a<d){let f=d+p-o;f*=s==="up"?-1:1,i-=f}if(l<u&&l>0&&c<u){let f=u+p-l;f*=s==="up"?-1:1,i+=f}return ge(e).y+i},"y")}),"getLineFunctionsWithOffset"),tl={},Me={},xx;function Y$(){return xx||(xx=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.BLANK_URL=Me.relativeFirstCharacters=Me.whitespaceEscapeCharsRegex=Me.urlSchemeRegex=Me.ctrlCharactersRegex=Me.htmlCtrlEntityRegex=Me.htmlEntitiesRegex=Me.invalidProtocolRegex=void 0,Me.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,Me.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,Me.htmlCtrlEntityRegex=/&(newline|tab);/gi,Me.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Me.urlSchemeRegex=/^.+(:|:)/gim,Me.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Me.relativeFirstCharacters=[".","/"],Me.BLANK_URL="about:blank"),Me}var yx;function V$(){if(yx)return tl;yx=1,Object.defineProperty(tl,"__esModule",{value:!0}),tl.sanitizeUrl=s;var t=Y$();function e(o){return t.relativeFirstCharacters.indexOf(o[0])>-1}function r(o){var a=o.replace(t.ctrlCharactersRegex,"");return a.replace(t.htmlEntitiesRegex,function(l,c){return String.fromCharCode(c)})}function n(o){return URL.canParse(o)}function i(o){try{return decodeURIComponent(o)}catch{return o}}function s(o){if(!o)return t.BLANK_URL;var a,l=i(o.trim());do l=r(l).replace(t.htmlCtrlEntityRegex,"").replace(t.ctrlCharactersRegex,"").replace(t.whitespaceEscapeCharsRegex,"").trim(),l=i(l),a=l.match(t.ctrlCharactersRegex)||l.match(t.htmlEntitiesRegex)||l.match(t.htmlCtrlEntityRegex)||l.match(t.whitespaceEscapeCharsRegex);while(a&&a.length>0);var c=l;if(!c)return t.BLANK_URL;if(e(c))return c;var u=c.trimStart(),d=u.match(t.urlSchemeRegex);if(!d)return c;var p=d[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(p))return t.BLANK_URL;var f=u.replace(/\\/g,"/");if(p==="mailto:"||p.includes("://"))return f;if(p==="http:"||p==="https:"){if(!n(f))return t.BLANK_URL;var m=new URL(f);return m.protocol=m.protocol.toLowerCase(),m.hostname=m.hostname.toLowerCase(),m.toString()}return f}return tl}var X$=V$();function ou(t){var r;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const n=t[Symbol.toStringTag];return n==null||!((r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&r.writable)?!1:t.toString()===`[object ${n}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function K$(){}function Tv(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Cp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Z$="[object RegExp]",_v="[object String]",Ev="[object Number]",Nv="[object Boolean]",jv="[object Arguments]",Q$="[object Symbol]",J$="[object Date]",t6="[object Map]",e6="[object Set]",r6="[object Array]",n6="[object ArrayBuffer]",i6="[object Object]",s6="[object DataView]",o6="[object Uint8Array]",a6="[object Uint8ClampedArray]",l6="[object Uint16Array]",c6="[object Uint32Array]",h6="[object Int8Array]",u6="[object Int16Array]",d6="[object Int32Array]",f6="[object Float32Array]",p6="[object Float64Array]",bx=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();function kp(t){return typeof bx.Buffer<"u"&&bx.Buffer.isBuffer(t)}function m6(t){return Number.isSafeInteger(t)&&t>=0}function Lv(t){return t!=null&&typeof t!="function"&&m6(t.length)}function g6(t){return t==="__proto__"}function vp(t){return t==null||typeof t!="object"&&typeof t!="function"}function wp(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function x6(t,e){return ds(t,void 0,t,new Map,e)}function ds(t,e,r,n=new Map,i=void 0){const s=i==null?void 0:i(t,e,r,n);if(s!==void 0)return s;if(vp(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){const o=new Array(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=ds(t[a],a,r,n,i);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;n.set(t,o);for(const[a,l]of t)o.set(a,ds(l,a,r,n,i));return o}if(t instanceof Set){const o=new Set;n.set(t,o);for(const a of t)o.add(ds(a,void 0,r,n,i));return o}if(kp(t))return t.subarray();if(wp(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=ds(t[a],a,r,n,i);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return n.set(t,o),$r(o,t,r,n,i),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return n.set(t,o),$r(o,t,r,n,i),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return n.set(t,o),$r(o,t,r,n,i),o}if(t instanceof Error){const o=structuredClone(t);return n.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,o.constructor=t.constructor,$r(o,t,r,n,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return n.set(t,o),$r(o,t,r,n,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return n.set(t,o),$r(o,t,r,n,i),o}if(t instanceof String){const o=new String(t.valueOf());return n.set(t,o),$r(o,t,r,n,i),o}if(typeof t=="object"&&y6(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),$r(o,t,r,n,i),o}return t}function $r(t,e,r=t,n,i){const s=[...Object.keys(e),...Tv(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=ds(e[a],a,r,n,i))}}function y6(t){switch(Cp(t)){case jv:case r6:case n6:case s6:case Nv:case J$:case f6:case p6:case h6:case u6:case d6:case t6:case Ev:case i6:case Z$:case e6:case _v:case Q$:case o6:case a6:case l6:case c6:return!0;default:return!1}}function b6(t,e){return x6(t,(r,n,i,s)=>{if(typeof t=="object"){if(Cp(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),$r(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case Ev:case _v:case Nv:{const o=new t.constructor(t==null?void 0:t.valueOf());return $r(o,t),o}case jv:{const o={};return $r(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Cx(t){return b6(t)}function Ld(t){return t!==null&&typeof t=="object"&&Cp(t)==="[object Arguments]"}function Bd(t){return typeof t=="object"&&t!==null}function C6(t){return Bd(t)&&Lv(t)}function Ea(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");const r=function(...n){const i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);const o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Ea.Cache||Map),r}Ea.Cache=Map;function Bl(t){return wp(t)}function k6(t){const e=t==null?void 0:t.constructor;return t===(typeof e=="function"?e.prototype:Object.prototype)}function v6(t){if(vp(t))return t;if(Array.isArray(t)||wp(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t);if(e==null)return Object.assign(Object.create(e),t);const r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const n=new r(t);return n.lastIndex=t.lastIndex,n}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){let n;return t instanceof AggregateError?n=new r(t.errors,t.message,{cause:t.cause}):n=new r(t.message,{cause:t.cause}),n.stack=t.stack,Object.assign(n,t),n}return typeof File<"u"&&t instanceof File?new r([t],t.name,{type:t.type,lastModified:t.lastModified}):typeof t=="object"?Object.assign(Object.create(e),t):t}function w6(t,...e){const r=e.slice(0,-1),n=e[e.length-1];let i=t;for(let s=0;s<r.length;s++){const o=r[s];i=Al(i,o,n,new Map)}return i}function Al(t,e,r,n){if(vp(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return v6(n.get(e));if(n.set(e,t),Array.isArray(e)){e=e.slice();for(let s=0;s<e.length;s++)e[s]=e[s]??void 0}const i=[...Object.keys(e),...Tv(e)];for(let s=0;s<i.length;s++){const o=i[s];if(g6(o))continue;let a=e[o],l=t[o];if(Ld(a)&&(a={...a}),Ld(l)&&(l={...l}),kp(a)&&(a=Cx(a)),Array.isArray(a))if(Array.isArray(l)){const u=[],d=Reflect.ownKeys(l);for(let p=0;p<d.length;p++){const f=d[p];u[f]=l[f]}l=u}else if(C6(l)){const u=[];for(let d=0;d<l.length;d++)u[d]=l[d];l=u}else l=[];const c=r(l,a,o,t,e,n);c!==void 0?t[o]=c:Array.isArray(a)||Bd(l)&&Bd(a)&&(ou(l)||ou(a)||Bl(l)||Bl(a))?t[o]=Al(l,a,r,n):l==null&&ou(a)?t[o]=Al({},a,r,n):l==null&&Bl(a)?t[o]=Cx(a):(l===void 0||a!==void 0)&&(t[o]=a)}return t}function S6(t,...e){return w6(t,...e,K$)}function kx(t){if(t==null)return!0;if(Lv(t))return typeof t.splice!="function"&&typeof t!="string"&&!kp(t)&&!Bl(t)&&!Ld(t)?!1:t.length===0;if(typeof t=="object"){if(t instanceof Map||t instanceof Set)return t.size===0;const e=Object.keys(t);return k6(t)?e.filter(r=>r!=="constructor").length===0:e.length===0}return!0}var T6="",_6={curveBasis:pd,curveBasisClosed:LR,curveBasisOpen:BR,curveBumpX:SC,curveBumpY:TC,curveBundle:AR,curveCardinalClosed:MR,curveCardinalOpen:IR,curveCardinal:jC,curveCatmullRomClosed:FR,curveCatmullRomOpen:PR,curveCatmullRom:BC,curveLinear:Vo,curveLinearClosed:DR,curveMonotoneX:DC,curveMonotoneY:OC,curveNatural:$C,curveStep:zC,curveStepAfter:qC,curveStepBefore:WC},E6=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,N6=v(function(t,e){const r=Bv(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);Jl(o),n=Ie(n,[...o])}else n=r.args;if(!n)return;let i=Vf(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),Bv=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${E6.source})(?=[}][%]{2}).*
|
|
505
|
-
`,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),tt.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=Go.exec(t))!==null;)if(s.index===Go.lastIndex&&Go.lastIndex++,s&&!e||e&&((r=s[1])!=null&&r.match(e))||e&&((n=s[2])!=null&&n.match(e))){const a=s[1]?s[1]:s[2],l=s[3]?s[3].trim():s[4]?JSON.parse(s[4].trim()):null;o.push({type:a,args:l})}return o.length===0?{type:t,args:null}:o.length===1?o[0]:o}catch(i){return tt.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),j6=v(function(t){return t.replace(Go,"")},"removeDirectives"),L6=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function Sp(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return _6[r]??e}v(Sp,"interpolateToCurve");function Av(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?X$.sanitizeUrl(r):r}v(Av,"formatUrl");var B6=v((t,...e)=>{const r=t.split("."),n=r.length-1,i=r[n];let s=window;for(let o=0;o<n;o++)if(s=s[r[o]],!s){tt.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function Tp(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(Tp,"distance");function Mv(t){let e,r=0;t.forEach(i=>{r+=Tp(i,e),e=i});const n=r/2;return _p(t,n)}v(Mv,"traverseEdge");function Iv(t){return t.length===1?t[0]:Mv(t)}v(Iv,"calcLabelPosition");var vx=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),_p=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=Tp(i,r);if(s===0)return r;if(s<n)n-=s;else{const o=n/s;if(o<=0)return r;if(o>=1)return{x:i.x,y:i.y};if(o>0&&o<1)return{x:vx((1-o)*r.x+o*i.x,5),y:vx((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),A6=v((t,e,r)=>{tt.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=_p(e,25),s=t?10:5,o=Math.atan2(e[0].y-i.y,e[0].x-i.x),a={x:0,y:0};return a.x=Math.sin(o)*s+(e[0].x+i.x)/2,a.y=-Math.cos(o)*s+(e[0].y+i.y)/2,a},"calcCardinalityPosition");function Fv(t,e,r){const n=structuredClone(r);tt.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=_p(n,i),o=10+t*.5,a=Math.atan2(n[0].y-s.y,n[0].x-s.x),l={x:0,y:0};return e==="start_left"?(l.x=Math.sin(a+Math.PI)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a+Math.PI)*o+(n[0].y+s.y)/2):e==="end_right"?(l.x=Math.sin(a-Math.PI)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a-Math.PI)*o+(n[0].y+s.y)/2-5):e==="end_left"?(l.x=Math.sin(a)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2-5):(l.x=Math.sin(a)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2),l}v(Fv,"calcTerminalLabelPosition");function Pv(t){let e="",r="";for(const n of t)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":e=e+n+";");return{style:e,labelStyle:r}}v(Pv,"getStylesFromArray");var wx=0,M6=v(()=>(wx++,"id-"+Math.random().toString(36).substr(2,12)+"-"+wx),"generateId");function Dv(t){let e="";const r="0123456789abcdef",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}v(Dv,"makeRandomHex");var I6=v(t=>Dv(t.length),"random"),F6=v(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),P6=v(function(t,e){const r=e.text.replace(wa.lineBreakRegex," "),[,n]=rh(e.fontSize),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.style("text-anchor",e.anchor),i.style("font-family",e.fontFamily),i.style("font-size",n),i.style("font-weight",e.fontWeight),i.attr("fill",e.fill),e.class!==void 0&&i.attr("class",e.class);const s=i.append("tspan");return s.attr("x",e.x+e.textMargin*2),s.attr("fill",e.fill),s.text(r),i},"drawSimpleText"),D6=Ea((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),wa.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const l=Nn(`${o} `,r),c=Nn(s,r);if(l>e){const{hyphenatedStrings:p,remainingWord:f}=O6(o,e,"-",r);i.push(s,...p),s=f}else c+l>=e?(i.push(s),s=o):s=[s,o].filter(Boolean).join(" ");a+1===n.length&&i.push(s)}),i.filter(o=>o!=="").join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),O6=Ea((t,e,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);const i=[...t],s=[];let o="";return i.forEach((a,l)=>{const c=`${o}${a}`;if(Nn(c,n)>=e){const d=l+1,p=i.length===d,f=`${c}${r}`;s.push(p?c:f),o=""}else o=c}),{hyphenatedStrings:s,remainingWord:o}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function Ov(t,e){return Ep(t,e).height}v(Ov,"calculateTextHeight");function Nn(t,e){return Ep(t,e).width}v(Nn,"calculateTextWidth");var Ep=Ea((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=rh(r),o=["sans-serif",n],a=t.split(wa.lineBreakRegex),l=[],c=Yt("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const u=c.append("svg");for(const p of o){let f=0;const m={width:0,height:0,lineHeight:0};for(const x of a){const g=F6();g.text=x||T6;const y=P6(u,g).style("font-size",s).style("font-weight",i).style("font-family",p),b=(y._groups||y)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,b.width)),f=Math.round(b.height),m.height+=f,m.lineHeight=Math.round(Math.max(m.lineHeight,f))}l.push(m)}u.remove();const d=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[d]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),Is,R6=(Is=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},v(Is,"InitIDGenerator"),Is),el,$6=v(function(t){return el=el||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),el.innerHTML=t,unescape(el.textContent)},"entityDecode");function Np(t){return"str"in t}v(Np,"isDetailedError");var z6=v((t,e,r,n)=>{var s;if(!n)return;const i=(s=t.node())==null?void 0:s.getBBox();i&&t.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",e)},"insertTitle"),rh=v(t=>{if(typeof t=="number")return[t,t+"px"];const e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");function jp(t,e){return S6({},t,e)}v(jp,"cleanAndMerge");var Hr={assignWithDepth:Ie,wrapLabel:D6,calculateTextHeight:Ov,calculateTextWidth:Nn,calculateTextDimensions:Ep,cleanAndMerge:jp,detectInit:N6,detectDirective:Bv,isSubstringInArray:L6,interpolateToCurve:Sp,calcLabelPosition:Iv,calcCardinalityPosition:A6,calcTerminalLabelPosition:Fv,formatUrl:Av,getStylesFromArray:Pv,generateId:M6,random:I6,runFunc:B6,entityDecode:$6,insertTitle:z6,isLabelCoordinateInPath:Rv,parseFontSize:rh,InitIDGenerator:R6},W6=v(function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){const n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"fl°°"+n+"¶ß":"fl°"+n+"¶ß"}),e},"encodeEntities"),Bi=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),vZ=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function Oe(t){return t??null}v(Oe,"handleUndefinedAttr");function Rv(t,e){const r=Math.round(t.x),n=Math.round(t.y),i=e.replace(/(\d+\.\d+)/g,s=>Math.round(parseFloat(s)).toString());return i.includes(r.toString())||i.includes(n.toString())}v(Rv,"isLabelCoordinateInPath");var Lp=v(({flowchart:t})=>{var i,s;const e=((i=t==null?void 0:t.subGraphTitleMargin)==null?void 0:i.top)??0,r=((s=t==null?void 0:t.subGraphTitleMargin)==null?void 0:s.bottom)??0,n=e+r;return{subGraphTitleTopMargin:e,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins");async function $v(t,e){const r=t.getElementsByTagName("img");if(!r||r.length===0)return;const n=e.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...r].map(i=>new Promise(s=>{function o(){if(i.style.display="flex",i.style.flexDirection="column",n){const a=re().fontSize?re().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[c=P1.fontSize]=rh(a),u=c*l+"px";i.style.minWidth=u,i.style.maxWidth=u}else i.style.width="100%";s(i)}v(o,"setupImage"),setTimeout(()=>{i.complete&&o()}),i.addEventListener("error",o),i.addEventListener("load",o)})))}v($v,"configureLabelImages");var q6=v(t=>{const{handDrawnSeed:e}=re();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Zs=v(t=>{const e=H6([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),H6=v(t=>{const e=new Map;return t.forEach(r=>{const[n,i]=r.split(":");e.set(n.trim(),i==null?void 0:i.trim())}),e},"styles2Map"),zv=v(t=>t==="color"||t==="font-size"||t==="font-family"||t==="font-weight"||t==="font-style"||t==="text-decoration"||t==="text-align"||t==="text-transform"||t==="line-height"||t==="letter-spacing"||t==="word-spacing"||t==="text-shadow"||t==="text-overflow"||t==="white-space"||t==="word-wrap"||t==="word-break"||t==="overflow-wrap"||t==="hyphens","isLabelStyle"),vt=v(t=>{const{stylesArray:e}=Zs(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];zv(a)?r.push(o.join(":")+" !important"):(n.push(o.join(":")+" !important"),a.includes("stroke")&&i.push(o.join(":")+" !important"),a==="fill"&&s.push(o.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:e,borderStyles:i,backgroundStyles:s}},"styles2String"),kt=v((t,e)=>{var l;const{themeVariables:r,handDrawnSeed:n}=re(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Zs(t);return Object.assign({roughness:.7,fill:o.get("fill")||s,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:o.get("stroke")||i,seed:n,strokeWidth:((l=o.get("stroke-width"))==null?void 0:l.replace("px",""))||1.3,fillLineDash:[0,0],strokeLineDash:U6(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),U6=v(t=>{if(!t)return[0,0];const e=t.trim().split(/\s+/).map(Number);if(e.length===1){const i=isNaN(e[0])?0:e[0];return[i,i]}const r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?0:e[1];return[r,n]},"getStrokeDashArray");const G6=Object.freeze({left:0,top:0,width:16,height:16}),bc=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Wv=Object.freeze({...G6,...bc}),Y6=Object.freeze({...Wv,body:"",hidden:!1}),V6=Object.freeze({width:null,height:null}),X6=Object.freeze({...V6,...bc}),K6=(t,e,r,n="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;n=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const a=i.pop(),l=i.pop(),c={provider:i.length>0?i[0]:n,prefix:l,name:a};return au(c)?c:null}const s=i[0],o=s.split("-");if(o.length>1){const a={provider:n,prefix:o.shift(),name:o.join("-")};return au(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return au(a,r)?a:null}return null},au=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function Z6(t,e){const r={};!t.hFlip!=!e.hFlip&&(r.hFlip=!0),!t.vFlip!=!e.vFlip&&(r.vFlip=!0);const n=((t.rotate||0)+(e.rotate||0))%4;return n&&(r.rotate=n),r}function Sx(t,e){const r=Z6(t,e);for(const n in Y6)n in bc?n in t&&!(n in r)&&(r[n]=bc[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function Q6(t,e){const r=t.icons,n=t.aliases||Object.create(null),i=Object.create(null);function s(o){if(r[o])return i[o]=[];if(!(o in i)){i[o]=null;const a=n[o]&&n[o].parent,l=a&&s(a);l&&(i[o]=[a].concat(l))}return i[o]}return(e||Object.keys(r).concat(Object.keys(n))).forEach(s),i}function Tx(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=Sx(n[a]||i[a],s)}return o(e),r.forEach(o),Sx(t,s)}function J6(t,e){if(t.icons[e])return Tx(t,e,[]);const r=Q6(t,[e])[e];return r?Tx(t,e,r):null}const tz=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ez=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function _x(t,e,r){if(e===1)return t;if(r=r||100,typeof t=="number")return Math.ceil(t*e*r)/r;if(typeof t!="string")return t;const n=t.split(tz);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=ez.test(s);for(;;){if(o){const a=parseFloat(s);isNaN(a)?i.push(s):i.push(Math.ceil(a*e*r)/r)}else i.push(s);if(s=n.shift(),s===void 0)return i.join("");o=!o}}function rz(t,e="defs"){let r="";const n=t.indexOf("<"+e);for(;n>=0;){const i=t.indexOf(">",n),s=t.indexOf("</"+e);if(i===-1||s===-1)break;const o=t.indexOf(">",s);if(o===-1)break;r+=t.slice(i+1,s).trim(),t=t.slice(0,n).trim()+t.slice(o+1)}return{defs:r,content:t}}function nz(t,e){return t?"<defs>"+t+"</defs>"+e:e}function iz(t,e,r){const n=rz(t);return nz(n.defs,e+n.content+r)}const sz=t=>t==="unset"||t==="undefined"||t==="none";function oz(t,e){const r={...Wv,...t},n={...X6,...e},i={left:r.left,top:r.top,width:r.width,height:r.height};let s=r.body;[r,n].forEach(x=>{const g=[],y=x.hFlip,b=x.vFlip;let k=x.rotate;y?b?k+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):b&&(g.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),g.push("scale(1 -1)"),i.top=i.left=0);let T;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:T=i.height/2+i.top,g.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:T=i.width/2+i.left,g.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}k%2===1&&(i.left!==i.top&&(T=i.left,i.left=i.top,i.top=T),i.width!==i.height&&(T=i.width,i.width=i.height,i.height=T)),g.length&&(s=iz(s,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=n.width,a=n.height,l=i.width,c=i.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?c:a,u=_x(d,l/c)):(u=o==="auto"?l:o,d=a===null?_x(u,c/l):a==="auto"?c:a);const p={},f=(x,g)=>{sz(g)||(p[x]=g.toString())};f("width",u),f("height",d);const m=[i.left,i.top,l,c];return p.viewBox=m.join(" "),{attributes:p,viewBox:m,body:s}}const az=/\sid="(\S+)"/g,Ex=new Map;function lz(t){t=t.replace(/[0-9]+$/,"")||"a";const e=Ex.get(t)||0;return Ex.set(t,e+1),e?`${t}${e}`:t}function cz(t){const e=[];let r;for(;r=az.exec(t);)e.push(r[1]);if(!e.length)return t;const n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return e.forEach(i=>{const s=lz(i),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+s+n+"$3")}),t=t.replace(new RegExp(n,"g"),""),t}function hz(t,e){let r=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)r+=" "+n+'="'+e[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+t+"</svg>"}function Bp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oi=Bp();function qv(t){Oi=t}var Xo={exec:()=>null};function ne(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(or.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var uz=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),or={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},dz=/^(?:[ \t]*(?:\n|$))+/,fz=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,pz=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Na=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,mz=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ap=/(?:[*+-]|\d{1,9}[.)])/,Hv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uv=ne(Hv).replace(/bull/g,Ap).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),gz=ne(Hv).replace(/bull/g,Ap).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Mp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xz=/^[^\n]+/,Ip=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,yz=ne(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ip).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),bz=ne(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ap).getRegex(),nh="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Fp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Cz=ne("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Fp).replace("tag",nh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Gv=ne(Mp).replace("hr",Na).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nh).getRegex(),kz=ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Gv).getRegex(),Pp={blockquote:kz,code:fz,def:yz,fences:pz,heading:mz,hr:Na,html:Cz,lheading:Uv,list:bz,newline:dz,paragraph:Gv,table:Xo,text:xz},Nx=ne("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Na).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nh).getRegex(),vz={...Pp,lheading:gz,table:Nx,paragraph:ne(Mp).replace("hr",Na).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Nx).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nh).getRegex()},wz={...Pp,html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Fp).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Xo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(Mp).replace("hr",Na).replace("heading",` *#{1,6} *[^
|
|
506
|
-
]`).replace("lheading",Uv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Sz=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Tz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Yv=/^( {2,}|\\)\n(?!\s*$)/,_z=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ih=/[\p{P}\p{S}]/u,Dp=/[\s\p{P}\p{S}]/u,Vv=/[^\s\p{P}\p{S}]/u,Ez=ne(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Dp).getRegex(),Xv=/(?!~)[\p{P}\p{S}]/u,Nz=/(?!~)[\s\p{P}\p{S}]/u,jz=/(?:[^\s\p{P}\p{S}]|~)/u,Lz=ne(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",uz?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Kv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Bz=ne(Kv,"u").replace(/punct/g,ih).getRegex(),Az=ne(Kv,"u").replace(/punct/g,Xv).getRegex(),Zv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Mz=ne(Zv,"gu").replace(/notPunctSpace/g,Vv).replace(/punctSpace/g,Dp).replace(/punct/g,ih).getRegex(),Iz=ne(Zv,"gu").replace(/notPunctSpace/g,jz).replace(/punctSpace/g,Nz).replace(/punct/g,Xv).getRegex(),Fz=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Vv).replace(/punctSpace/g,Dp).replace(/punct/g,ih).getRegex(),Pz=ne(/\\(punct)/,"gu").replace(/punct/g,ih).getRegex(),Dz=ne(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Oz=ne(Fp).replace("(?:-->|$)","-->").getRegex(),Rz=ne("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Oz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,$z=ne(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Cc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Qv=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",Cc).replace("ref",Ip).getRegex(),Jv=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ip).getRegex(),zz=ne("reflink|nolink(?!\\()","g").replace("reflink",Qv).replace("nolink",Jv).getRegex(),jx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Op={_backpedal:Xo,anyPunctuation:Pz,autolink:Dz,blockSkip:Lz,br:Yv,code:Tz,del:Xo,emStrongLDelim:Bz,emStrongRDelimAst:Mz,emStrongRDelimUnd:Fz,escape:Sz,link:$z,nolink:Jv,punctuation:Ez,reflink:Qv,reflinkSearch:zz,tag:Rz,text:_z,url:Xo},Wz={...Op,link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",Cc).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Cc).getRegex()},Ad={...Op,emStrongRDelimAst:Iz,emStrongLDelim:Az,url:ne(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",jx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ne(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",jx).getRegex()},qz={...Ad,br:ne(Yv).replace("{2,}","*").getRegex(),text:ne(Ad.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},rl={normal:Pp,gfm:vz,pedantic:wz},ko={normal:Op,gfm:Ad,breaks:qz,pedantic:Wz},Hz={"&":"&","<":"<",">":">",'"':""","'":"'"},Lx=t=>Hz[t];function rn(t,e){if(e){if(or.escapeTest.test(t))return t.replace(or.escapeReplace,Lx)}else if(or.escapeTestNoEncode.test(t))return t.replace(or.escapeReplaceNoEncode,Lx);return t}function Bx(t){try{t=encodeURI(t).replace(or.percentDecode,"%")}catch{return null}return t}function Ax(t,e){var s;let r=t.replace(or.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(or.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!((s=n.at(-1))!=null&&s.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(or.slashPipe,"|");return n}function vo(t,e,r){let n=t.length;if(n===0)return"";let i=0;for(;i<n&&t.charAt(n-i-1)===e;)i++;return t.slice(0,n-i)}function Uz(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function Mx(t,e,r,n,i){let s=e.href,o=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:s,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function Gz(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
|
|
507
|
-
`).map(s=>{let o=s.match(r.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
|
|
508
|
-
`)}var kc=class{constructor(e){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=e||Oi}space(e){let r=this.rules.block.newline.exec(e);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(e){let r=this.rules.block.code.exec(e);if(r){let n=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:vo(n,`
|
|
509
|
-
`)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=Gz(n,r[3]||"",this.rules);return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:i}}}heading(e){let r=this.rules.block.heading.exec(e);if(r){let n=r[2].trim();if(this.rules.other.endingHash.test(n)){let i=vo(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let r=this.rules.block.hr.exec(e);if(r)return{type:"hr",raw:vo(r[0],`
|
|
510
|
-
`)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=vo(r[0],`
|
|
511
|
-
`).split(`
|
|
512
|
-
`),i="",s="",o=[];for(;n.length>0;){let a=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),a=!0;else if(!a)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
|
|
513
|
-
`),d=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
514
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
515
|
-
${u}`:u,s=s?`${s}
|
|
516
|
-
${d}`:d;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=p,n.length===0)break;let f=o.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let m=f,x=m.raw+`
|
|
517
|
-
`+n.join(`
|
|
518
|
-
`),g=this.blockquote(x);o[o.length-1]=g,i=i.substring(0,i.length-m.raw.length)+g.raw,s=s.substring(0,s.length-m.text.length)+g.text;break}else if((f==null?void 0:f.type)==="list"){let m=f,x=m.raw+`
|
|
519
|
-
`+n.join(`
|
|
520
|
-
`),g=this.list(x);o[o.length-1]=g,i=i.substring(0,i.length-f.raw.length)+g.raw,s=s.substring(0,s.length-m.raw.length)+g.raw,n=x.substring(o.at(-1).raw.length).split(`
|
|
521
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){let r=this.rules.block.list.exec(e);if(r){let n=r[1].trim(),i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;e;){let c=!1,u="",d="";if(!(r=o.exec(e))||this.rules.block.hr.test(e))break;u=r[0],e=e.substring(u.length);let p=r[2].split(`
|
|
522
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),f=e.split(`
|
|
523
|
-
`,1)[0],m=!p.trim(),x=0;if(this.options.pedantic?(x=2,d=p.trimStart()):m?x=r[1].length+1:(x=r[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=p.slice(x),x+=r[1].length),m&&this.rules.other.blankLine.test(f)&&(u+=f+`
|
|
524
|
-
`,e=e.substring(f.length+1),c=!0),!c){let b=this.rules.other.nextBulletRegex(x),k=this.rules.other.hrRegex(x),T=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),w=this.rules.other.htmlBeginRegex(x);for(;e;){let N=e.split(`
|
|
525
|
-
`,1)[0],B;if(f=N,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),B=f):B=f.replace(this.rules.other.tabCharGlobal," "),T.test(f)||_.test(f)||w.test(f)||b.test(f)||k.test(f))break;if(B.search(this.rules.other.nonSpaceChar)>=x||!f.trim())d+=`
|
|
526
|
-
`+B.slice(x);else{if(m||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(p)||_.test(p)||k.test(p))break;d+=`
|
|
527
|
-
`+f}!m&&!f.trim()&&(m=!0),u+=N+`
|
|
528
|
-
`,e=e.substring(N.length+1),p=B.slice(x)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0));let g=null,y;this.options.gfm&&(g=this.rules.other.listIsTask.exec(d),g&&(y=g[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:u,task:!!g,checked:y,loose:!1,text:d,tokens:[]}),s.raw+=u}let l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){let u=s.items[c].tokens.filter(p=>p.type==="space"),d=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));s.loose=d}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(e){let r=this.rules.block.html.exec(e);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(e){let r=this.rules.block.def.exec(e);if(r){let n=r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:i,title:s}}}table(e){var a;let r=this.rules.block.table.exec(e);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let n=Ax(r[1]),i=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=r[3])!=null&&a.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
529
|
-
`):[],o={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let l of i)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<n.length;l++)o.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:o.align[l]});for(let l of s)o.rows.push(Ax(l,o.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:o.align[u]})));return o}}lheading(e){let r=this.rules.block.lheading.exec(e);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(e){let r=this.rules.block.paragraph.exec(e);if(r){let n=r[1].charAt(r[1].length-1)===`
|
|
530
|
-
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let r=this.rules.block.text.exec(e);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(e){let r=this.rules.inline.escape.exec(e);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(e){let r=this.rules.inline.tag.exec(e);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(e){let r=this.rules.inline.link.exec(e);if(r){let n=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=vo(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=Uz(r[2],"()");if(o===-2)return;if(o>-1){let a=(r[0].indexOf("!")===0?5:4)+r[1].length+o;r[2]=r[2].substring(0,o),r[0]=r[0].substring(0,a).trim(),r[3]=""}}let i=r[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[3])}else s=r[3]?r[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),Mx(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(e,r){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=r[i.toLowerCase()];if(!s){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Mx(n,s,n[0],this.lexer,this.rules)}}emStrong(e,r,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...i[0]].length-1,o,a,l=s,c=0,u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,r=r.slice(-1*e.length+s);(i=u.exec(r))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(a=[...o].length,i[3]||i[4]){l+=a;continue}else if((i[5]||i[6])&&s%3&&!((s+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let d=[...i[0]][0].length,p=e.slice(0,s+i.index+d+a);if(Math.min(s,a)%2){let m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let f=p.slice(2,-2);return{type:"strong",raw:p,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){let r=this.rules.inline.code.exec(e);if(r){let n=r[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:r[0],text:n}}}br(e){let r=this.rules.inline.br.exec(e);if(r)return{type:"br",raw:r[0]}}del(e){let r=this.rules.inline.del.exec(e);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(e){let r=this.rules.inline.autolink.exec(e);if(r){let n,i;return r[2]==="@"?(n=r[1],i="mailto:"+n):(n=r[1],i=n),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let r;if(r=this.rules.inline.url.exec(e)){let i,s;if(r[2]==="@")i=r[0],s="mailto:"+i;else{let o;do o=r[0],r[0]=((n=this.rules.inline._backpedal.exec(r[0]))==null?void 0:n[0])??"";while(o!==r[0]);i=r[0],r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let r=this.rules.inline.text.exec(e);if(r){let n=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:n}}}},zr=class Md{constructor(e){ie(this,"tokens");ie(this,"options");ie(this,"state");ie(this,"tokenizer");ie(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Oi,this.options.tokenizer=this.options.tokenizer||new kc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:or,block:rl.normal,inline:ko.normal};this.options.pedantic?(r.block=rl.pedantic,r.inline=ko.pedantic):this.options.gfm&&(r.block=rl.gfm,this.options.breaks?r.inline=ko.breaks:r.inline=ko.gfm),this.tokenizer.rules=r}static get rules(){return{block:rl,inline:ko}}static lex(e,r){return new Md(r).lex(e)}static lexInline(e,r){return new Md(r).inlineTokens(e)}lex(e){e=e.replace(or.carriageReturn,`
|
|
531
|
-
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var i,s,o;for(this.options.pedantic&&(e=e.replace(or.tabCharGlobal," ").replace(or.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=r.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
532
|
-
`:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
533
|
-
`)?"":`
|
|
534
|
-
`)+a.raw,c.text+=`
|
|
535
|
-
`+a.text,this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
536
|
-
`)?"":`
|
|
537
|
-
`)+a.raw,c.text+=`
|
|
538
|
-
`+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},r.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),r.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=r.at(-1);n&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
539
|
-
`)?"":`
|
|
540
|
-
`)+a.raw,c.text+=`
|
|
541
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a),n=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
542
|
-
`)?"":`
|
|
543
|
-
`)+a.raw,c.text+=`
|
|
544
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var l,c,u,d,p;let n=e,i=null;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)f.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)s=i[2]?i[2].length:0,n=n.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},n))??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let f;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(x=>(f=x.call({lexer:this},e,r))?(e=e.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.escape(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.tag(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.link(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(f.raw.length);let x=r.at(-1);f.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=f.raw,x.text+=f.text):r.push(f);continue}if(f=this.tokenizer.emStrong(e,n,a)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.codespan(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.br(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.del(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.autolink(e)){e=e.substring(f.raw.length),r.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(e))){e=e.substring(f.raw.length),r.push(f);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let x=1/0,g=e.slice(1),y;this.options.extensions.startInline.forEach(b=>{y=b.call({lexer:this},g),typeof y=="number"&&y>=0&&(x=Math.min(x,y))}),x<1/0&&x>=0&&(m=e.substring(0,x+1))}if(f=this.tokenizer.inlineText(m)){e=e.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(a=f.raw.slice(-1)),o=!0;let x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=f.raw,x.text+=f.text):r.push(f);continue}if(e){let x="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},vc=class{constructor(e){ie(this,"options");ie(this,"parser");this.options=e||Oi}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(or.notSpaceStart))==null?void 0:o[0],s=e.replace(or.endingNewline,"")+`
|
|
545
|
-
`;return i?'<pre><code class="language-'+rn(i)+'">'+(n?s:rn(s,!0))+`</code></pre>
|
|
546
|
-
`:"<pre><code>"+(n?s:rn(s,!0))+`</code></pre>
|
|
547
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
548
|
-
${this.parser.parse(e)}</blockquote>
|
|
549
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
|
|
550
|
-
`}hr(e){return`<hr>
|
|
551
|
-
`}list(e){let r=e.ordered,n=e.start,i="";for(let a=0;a<e.items.length;a++){let l=e.items[a];i+=this.listitem(l)}let s=r?"ol":"ul",o=r&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
|
|
552
|
-
`+i+"</"+s+`>
|
|
553
|
-
`}listitem(e){var n;let r="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+rn(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):r+=i+" "}return r+=this.parser.parse(e.tokens,!!e.loose),`<li>${r}</li>
|
|
554
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
555
|
-
`}table(e){let r="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);r+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let a=0;a<o.length;a++)n+=this.tablecell(o[a]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
556
|
-
<thead>
|
|
557
|
-
`+r+`</thead>
|
|
558
|
-
`+i+`</table>
|
|
559
|
-
`}tablerow({text:e}){return`<tr>
|
|
560
|
-
${e}</tr>
|
|
561
|
-
`}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
|
|
562
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${rn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:r,tokens:n}){let i=this.parser.parseInline(n),s=Bx(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+rn(r)+'"'),o+=">"+i+"</a>",o}image({href:e,title:r,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=Bx(e);if(s===null)return rn(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${rn(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:rn(e.text)}},Rp=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Wr=class Id{constructor(e){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=e||Oi,this.options.renderer=this.options.renderer||new vc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rp}static parse(e,r){return new Id(r).parse(e)}static parseInline(e,r){return new Id(r).parseInline(e)}parse(e,r=!0){var i,s;let n="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=u||"";continue}}let l=a;switch(l.type){case"space":{n+=this.renderer.space(l);continue}case"hr":{n+=this.renderer.hr(l);continue}case"heading":{n+=this.renderer.heading(l);continue}case"code":{n+=this.renderer.code(l);continue}case"table":{n+=this.renderer.table(l);continue}case"blockquote":{n+=this.renderer.blockquote(l);continue}case"list":{n+=this.renderer.list(l);continue}case"html":{n+=this.renderer.html(l);continue}case"def":{n+=this.renderer.def(l);continue}case"paragraph":{n+=this.renderer.paragraph(l);continue}case"text":{let c=l,u=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],u+=`
|
|
563
|
-
`+this.renderer.text(c);r?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(e,r=this.renderer){var i,s;let n="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=c||"";continue}}let l=a;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=r.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},kl,Oo=(kl=class{constructor(e){ie(this,"options");ie(this,"block");this.options=e||Oi}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?zr.lex:zr.lexInline}provideParser(){return this.block?Wr.parse:Wr.parseInline}},ie(kl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(kl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),kl),Yz=class{constructor(...e){ie(this,"defaults",Bp());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",Wr);ie(this,"Renderer",vc);ie(this,"TextRenderer",Rp);ie(this,"Lexer",zr);ie(this,"Tokenizer",kc);ie(this,"Hooks",Oo);this.use(...e)}walkTokens(e,r){var i,s;let n=[];for(let o of e)switch(n=n.concat(r.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)n=n.concat(this.walkTokens(l.tokens,r));for(let l of a.rows)for(let c of l)n=n.concat(this.walkTokens(c.tokens,r));break}case"list":{let a=o;n=n.concat(this.walkTokens(a.items,r));break}default:{let a=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);n=n.concat(this.walkTokens(c,r))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,r)))}}return n}use(...e){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=r.renderers[s.name];o?r.renderers[s.name]=function(...a){let l=s.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:r.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=r[s.level];o?o.unshift(s.tokenizer):r[s.level]=[s.tokenizer],s.start&&(s.level==="block"?r.startBlock?r.startBlock.push(s.start):r.startBlock=[s.start]:s.level==="inline"&&(r.startInline?r.startInline.push(s.start):r.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(r.childTokens[s.name]=s.childTokens)}),i.extensions=r),n.renderer){let s=this.defaults.renderer||new vc(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=n.renderer[a],c=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new kc(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=n.tokenizer[a],c=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Oo;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=n.hooks[a],c=s[a];Oo.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&Oo.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await l.call(s,u);return c.call(s,p)})();let d=l.call(s,u);return c.call(s,d)}:s[a]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(s,u);return p===!1&&(p=await c.apply(s,u)),p})();let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),s&&(l=l.concat(s.call(this,a))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,r){return zr.lex(e,r??this.defaults)}parser(e,r){return Wr.parse(e,r??this.defaults)}parseMarkdown(e){return(r,n)=>{let i={...n},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(r):r,l=await(s.hooks?await s.hooks.provideLexer():e?zr.lex:zr.lexInline)(a,s),c=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?Wr.parse:Wr.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(o);try{s.hooks&&(r=s.hooks.preprocess(r));let a=(s.hooks?s.hooks.provideLexer():e?zr.lex:zr.lexInline)(r,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():e?Wr.parse:Wr.parseInline)(a,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,r){return n=>{if(n.message+=`
|
|
564
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+rn(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},Ai=new Yz;function se(t,e){return Ai.parse(t,e)}se.options=se.setOptions=function(t){return Ai.setOptions(t),se.defaults=Ai.defaults,qv(se.defaults),se};se.getDefaults=Bp;se.defaults=Oi;se.use=function(...t){return Ai.use(...t),se.defaults=Ai.defaults,qv(se.defaults),se};se.walkTokens=function(t,e){return Ai.walkTokens(t,e)};se.parseInline=Ai.parseInline;se.Parser=Wr;se.parser=Wr.parse;se.Renderer=vc;se.TextRenderer=Rp;se.Lexer=zr;se.lexer=zr.lex;se.Tokenizer=kc;se.Hooks=Oo;se.parse=se;se.options;se.setOptions;se.use;se.walkTokens;se.parseInline;Wr.parse;zr.lex;function tw(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=Array.from(typeof t=="string"?[t]:t);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,"");var i=n.reduce(function(a,l){var c=l.match(/\n([\t ]+|(?!\s).)/g);return c?a.concat(c.map(function(u){var d,p;return(p=(d=u.match(/[\t ]/g))===null||d===void 0?void 0:d.length)!==null&&p!==void 0?p:0})):a},[]);if(i.length){var s=new RegExp(`
|
|
565
|
-
[ ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(a){return a.replace(s,`
|
|
566
|
-
`)})}n[0]=n[0].replace(/^\r?\n/,"");var o=n[0];return e.forEach(function(a,l){var c=o.match(/(?:^|\n)( *)$/),u=c?c[1]:"",d=a;typeof a=="string"&&a.includes(`
|
|
567
|
-
`)&&(d=String(a).split(`
|
|
568
|
-
`).map(function(p,f){return f===0?p:""+u+p}).join(`
|
|
569
|
-
`)),o+=d+n[l+1]}),o}var Vz={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},Fd=new Map,ew=new Map,Xz=v(t=>{for(const e of t){if(!e.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(tt.debug("Registering icon pack:",e.name),"loader"in e)ew.set(e.name,e.loader);else if("icons"in e)Fd.set(e.name,e.icons);else throw tt.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),rw=v(async(t,e)=>{const r=K6(t,!0,e!==void 0);if(!r)throw new Error(`Invalid icon name: ${t}`);const n=r.prefix||e;if(!n)throw new Error(`Icon name must contain a prefix: ${t}`);let i=Fd.get(n);if(!i){const o=ew.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},Fd.set(n,i)}catch(a){throw tt.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=J6(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),Kz=v(async t=>{try{return await rw(t),!0}catch{return!1}},"isIconAvailable"),ja=v(async(t,e,r)=>{let n;try{n=await rw(t,e==null?void 0:e.fallbackPrefix)}catch(o){tt.error(o),n=Vz}const i=oz(n,e),s=hz(cz(i.body),{...i.attributes,...r});return Vr(s,ye())},"getIconSVG");function nw(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
|
|
570
|
-
`).replace(/\n{2,}/g,`
|
|
571
|
-
`);return tw(n)}v(nw,"preprocessMarkdown");function iw(t){return t.split(/\\n|\n|<br\s*\/?>/gi).map(e=>{var r;return((r=e.trim().match(/<[^>]+>|[^\s<>]+/g))==null?void 0:r.map(n=>({content:n,type:"normal"})))??[]})}v(iw,"nonMarkdownToLines");function sw(t,e={}){const r=nw(t,e),n=se.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
|
|
572
|
-
`).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(p=>{p=p.replace(/'/g,"'"),p&&i[s].push({content:p,type:l})})}):a.type==="strong"||a.type==="em"?a.tokens.forEach(c=>{o(c,a.type)}):a.type==="html"&&i[s].push({content:a.text,type:"normal"})}return v(o,"processNode"),n.forEach(a=>{var l;a.type==="paragraph"?(l=a.tokens)==null||l.forEach(c=>{o(c)}):a.type==="html"?i[s].push({content:a.text,type:"normal"}):i[s].push({content:a.raw,type:"normal"})}),i}v(sw,"markdownToLines");function ow(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(ow,"nonMarkdownToHTML");function aw(t,{markdownAutoWrap:e}={}){const r=se.lexer(t);function n(i){var s,o,a;return i.type==="text"?e===!1?i.text.replace(/\n */g,"<br/>").replace(/ /g," "):i.text.replace(/\n */g,"<br/>"):i.type==="strong"?`<strong>${(s=i.tokens)==null?void 0:s.map(n).join("")}</strong>`:i.type==="em"?`<em>${(o=i.tokens)==null?void 0:o.map(n).join("")}</em>`:i.type==="paragraph"?`<p>${(a=i.tokens)==null?void 0:a.map(n).join("")}</p>`:i.type==="space"?"":i.type==="html"?`${i.text}`:i.type==="escape"?i.text:(tt.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(aw,"markdownToHTML");function lw(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(lw,"splitTextToChars");function cw(t,e){const r=lw(e.content);return $p(t,[],r,e.type)}v(cw,"splitWordToFitWidth");function $p(t,e,r,n){if(r.length===0)return[{content:e.join(""),type:n},{content:"",type:n}];const[i,...s]=r,o=[...e,i];return t([{content:o.join(""),type:n}])?$p(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v($p,"splitWordToFitWidthRecursion");function hw(t,e){if(t.some(({content:r})=>r.includes(`
|
|
573
|
-
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return wc(t,e)}v(hw,"splitLineToFitWidth");function wc(t,e,r=[],n=[]){if(t.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let i="";t[0].content===" "&&(i=" ",t.shift());const s=t.shift()??{content:" ",type:"normal"},o=[...n];if(i!==""&&o.push({content:i,type:"normal"}),o.push(s),e(o))return wc(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=cw(e,s);r.push([a]),l.content&&t.unshift(l)}return wc(t,e,r)}v(wc,"splitLineToFitWidthRecursion");function Pd(t,e){e&&t.attr("style",e)}v(Pd,"applyStyle");var Ix=16384;async function uw(t,e,r,n,i=!1,s=ye()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,Ix)}px`),o.attr("height",`${Math.min(10*r,Ix)}px`);const a=o.append("xhtml:div"),l=ra(e.label)?await G1(e.label.replace(wa.lineBreakRegex,`
|
|
574
|
-
`),s):Vr(e.label,s),c=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),Pd(u,e.labelStyle),u.attr("class",`${c} ${n}`),Pd(a,e.labelStyle),a.style("display","table-cell"),a.style("white-space","nowrap"),a.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(a.style("max-width",r+"px"),a.style("text-align","center")),a.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&a.attr("class","labelBkg");let d=a.node().getBoundingClientRect();return d.width===r&&(a.style("display","table"),a.style("white-space","break-spaces"),a.style("width",r+"px"),d=a.node().getBoundingClientRect()),o.node()}v(uw,"addHtmlSpan");function sh(t,e,r,n=!1){const i=t.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*r-.1+"em").attr("dy",r+"em");return n&&i.attr("text-anchor","middle"),i}v(sh,"createTspan");function dw(t,e,r){const n=t.append("text"),i=sh(n,1,e);oh(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(dw,"computeWidthOfText");function Zz(t,e,r){var o;const n=t.append("text"),i=sh(n,1,e);oh(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(Zz,"computeDimensionOfText");function fw(t,e,r,n=!1,i=!1){const o=e.append("g"),a=o.insert("rect").attr("class","background").attr("style","stroke: none"),l=o.append("text").attr("y","-10.1");i&&l.attr("text-anchor","middle");let c=0;for(const u of r){const d=v(f=>dw(o,1.1,f)<=t,"checkWidth"),p=d(u)?[u]:hw(u,d);for(const f of p){const m=sh(l,c,1.1,i);oh(m,f),c++}}if(n){const u=l.node().getBBox(),d=2;return a.attr("x",u.x-d).attr("y",u.y-d).attr("width",u.width+2*d).attr("height",u.height+2*d),o.node()}else return l.node()}v(fw,"createFormattedText");function Dd(t){const e=/&(amp|lt|gt);/g;return t.replace(e,(r,n)=>{switch(n){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return r}})}v(Dd,"decodeHTMLEntities");function oh(t,e){t.text(""),e.forEach((r,n)=>{const i=t.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?i.text(Dd(r.content)):i.text(" "+Dd(r.content))})}v(oh,"updateTextContentAndStyles");async function pw(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await Kz(a)?await ja(a,void 0,{class:"label-icon"}):`<i class='${Vr(i,e).replace(":"," ")}'></i>`})()),i));const n=await Promise.all(r);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}v(pw,"replaceIconSubstring");var Bn=v(async(t,e="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:s=!0,markdown:o=!0,isNode:a=!0,width:l=200,addSvgBackground:c=!1}={},u)=>{if(tt.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",c),s){const d=o?aw(e,u):ow(e),p=await pw(Bi(d),u),f=e.replace(/\\\\/g,"\\"),m={isNode:a,label:ra(e)?f:p,labelStyle:r.replace("fill:","color:")};return await uw(t,m,l,i,c,u)}else{const d=Bi(e.replace(/<br\s*\/?>/g,"<br/>")),p=o?sw(d.replace("<br>","<br/>"),u):iw(d),f=fw(l,t,p,e?c:!1,!a);if(a){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Yt(f).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Yt(f).select("rect").attr("style",m.replace(/background:/g,"fill:"));const x=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Yt(f).select("text").attr("style",x)}return n?Yt(f).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Yt(f).selectAll("tspan.text-outer-tspan").classed("row",!0),f}},"createText");function lu(t,e,r){if(t&&t.length){const[n,i]=e,s=Math.PI/180*r,o=Math.cos(s),a=Math.sin(s);for(const l of t){const[c,u]=l;l[0]=(c-n)*o-(u-i)*a+n,l[1]=(c-n)*a+(u-i)*o+i}}}function Qz(t,e){return t[0]===e[0]&&t[1]===e[1]}function Jz(t,e,r,n=1){const i=r,s=Math.max(e,.1),o=t[0]&&t[0][0]&&typeof t[0][0]=="number"?[t]:t,a=[0,0];if(i)for(const c of o)lu(c,a,i);const l=(function(c,u,d){const p=[];for(const b of c){const k=[...b];Qz(k[0],k[k.length-1])||k.push([k[0][0],k[0][1]]),k.length>2&&p.push(k)}const f=[];u=Math.max(u,.1);const m=[];for(const b of p)for(let k=0;k<b.length-1;k++){const T=b[k],_=b[k+1];if(T[1]!==_[1]){const w=Math.min(T[1],_[1]);m.push({ymin:w,ymax:Math.max(T[1],_[1]),x:w===T[1]?T[0]:_[0],islope:(_[0]-T[0])/(_[1]-T[1])})}}if(m.sort(((b,k)=>b.ymin<k.ymin?-1:b.ymin>k.ymin?1:b.x<k.x?-1:b.x>k.x?1:b.ymax===k.ymax?0:(b.ymax-k.ymax)/Math.abs(b.ymax-k.ymax))),!m.length)return f;let x=[],g=m[0].ymin,y=0;for(;x.length||m.length;){if(m.length){let b=-1;for(let k=0;k<m.length&&!(m[k].ymin>g);k++)b=k;m.splice(0,b+1).forEach((k=>{x.push({s:g,edge:k})}))}if(x=x.filter((b=>!(b.edge.ymax<=g))),x.sort(((b,k)=>b.edge.x===k.edge.x?0:(b.edge.x-k.edge.x)/Math.abs(b.edge.x-k.edge.x))),(d!==1||y%u==0)&&x.length>1)for(let b=0;b<x.length;b+=2){const k=b+1;if(k>=x.length)break;const T=x[b].edge,_=x[k].edge;f.push([[Math.round(T.x),g],[Math.round(_.x),g]])}g+=d,x.forEach((b=>{b.edge.x=b.edge.x+d*b.edge.islope})),y++}return f})(o,s,n);if(i){for(const c of o)lu(c,a,-i);(function(c,u,d){const p=[];c.forEach((f=>p.push(...f))),lu(p,u,d)})(l,a,-i)}return l}function La(t,e){var r;const n=e.hachureAngle+90;let i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.round(Math.max(i,.1));let s=1;return e.roughness>=1&&(((r=e.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(s=i),Jz(t,i,n,s||1)}class zp{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=La(e,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(e,r){const n=[];for(const i of e)n.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],r));return n}}function ah(t){const e=t[0],r=t[1];return Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2))}class t8 extends zp{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=La(e,Object.assign({},r,{hachureGap:n})),s=Math.PI/180*r.hachureAngle,o=[],a=.5*n*Math.cos(s),l=.5*n*Math.sin(s);for(const[c,u]of i)ah([c,u])&&o.push([[c[0]-a,c[1]+l],[...u]],[[c[0]+a,c[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(o,r)}}}class e8 extends zp{fillPolygons(e,r){const n=this._fillPolygons(e,r),i=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),s=this._fillPolygons(e,i);return n.ops=n.ops.concat(s.ops),n}}class r8{constructor(e){this.helper=e}fillPolygons(e,r){const n=La(e,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(e,r){const n=[];let i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);let s=r.fillWeight;s<0&&(s=r.strokeWidth/2);const o=i/4;for(const a of e){const l=ah(a),c=l/i,u=Math.ceil(c)-1,d=l-u*i,p=(a[0][0]+a[1][0])/2-i/4,f=Math.min(a[0][1],a[1][1]);for(let m=0;m<u;m++){const x=f+d+m*i,g=p-o+2*Math.random()*o,y=x-o+2*Math.random()*o,b=this.helper.ellipse(g,y,s,s,r);n.push(...b.ops)}}return{type:"fillSketch",ops:n}}}class n8{constructor(e){this.helper=e}fillPolygons(e,r){const n=La(e,r);return{type:"fillSketch",ops:this.dashedLine(n,r)}}dashedLine(e,r){const n=r.dashOffset<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashOffset,i=r.dashGap<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashGap,s=[];return e.forEach((o=>{const a=ah(o),l=Math.floor(a/(n+i)),c=(a+i-l*(n+i))/2;let u=o[0],d=o[1];u[0]>d[0]&&(u=o[1],d=o[0]);const p=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let f=0;f<l;f++){const m=f*(n+i),x=m+n,g=[u[0]+m*Math.cos(p)+c*Math.cos(p),u[1]+m*Math.sin(p)+c*Math.sin(p)],y=[u[0]+x*Math.cos(p)+c*Math.cos(p),u[1]+x*Math.sin(p)+c*Math.sin(p)];s.push(...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],r))}})),s}}class i8{constructor(e){this.helper=e}fillPolygons(e,r){const n=r.hachureGap<0?4*r.strokeWidth:r.hachureGap,i=r.zigzagOffset<0?n:r.zigzagOffset,s=La(e,r=Object.assign({},r,{hachureGap:n+i}));return{type:"fillSketch",ops:this.zigzagLines(s,i,r)}}zigzagLines(e,r,n){const i=[];return e.forEach((s=>{const o=ah(s),a=Math.round(o/(2*r));let l=s[0],c=s[1];l[0]>c[0]&&(l=s[1],c=s[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let d=0;d<a;d++){const p=2*d*r,f=2*(d+1)*r,m=Math.sqrt(2*Math.pow(r,2)),x=[l[0]+p*Math.cos(u),l[1]+p*Math.sin(u)],g=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],y=[x[0]+m*Math.cos(u+Math.PI/4),x[1]+m*Math.sin(u+Math.PI/4)];i.push(...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],n),...this.helper.doubleLineOps(y[0],y[1],g[0],g[1],n))}})),i}}const fr={};class s8{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const o8=0,cu=1,Fx=2,nl={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function hu(t,e){return t.type===e}function Wp(t){const e=[],r=(function(o){const a=new Array;for(;o!=="";)if(o.match(/^([ \t\r\n,]+)/))o=o.substr(RegExp.$1.length);else if(o.match(/^([aAcChHlLmMqQsStTvVzZ])/))a[a.length]={type:o8,text:RegExp.$1},o=o.substr(RegExp.$1.length);else{if(!o.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];a[a.length]={type:cu,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:Fx,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!hu(s,Fx);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return Wp("M0,0"+t);i++,o=nl[s.text],n=s.text}else hu(s,cu)?o=nl[n]:(i++,o=nl[s.text],n=s.text);if(!(i+o<r.length))throw new Error("Path data ended short");for(let l=i;l<i+o;l++){const c=r[l];if(!hu(c,cu))throw new Error("Param not a number: "+n+","+c.text);a[a.length]=+c.text}if(typeof nl[n]!="number")throw new Error("Bad segment: "+n);{const l={key:n,data:a};e.push(l),i+=o,s=r[i],n==="M"&&(n="L"),n==="m"&&(n="l")}}return e}function mw(t){let e=0,r=0,n=0,i=0;const s=[];for(const{key:o,data:a}of t)switch(o){case"M":s.push({key:"M",data:[...a]}),[e,r]=a,[n,i]=a;break;case"m":e+=a[0],r+=a[1],s.push({key:"M",data:[e,r]}),n=e,i=r;break;case"L":s.push({key:"L",data:[...a]}),[e,r]=a;break;case"l":e+=a[0],r+=a[1],s.push({key:"L",data:[e,r]});break;case"C":s.push({key:"C",data:[...a]}),e=a[4],r=a[5];break;case"c":{const l=a.map(((c,u)=>u%2?c+r:c+e));s.push({key:"C",data:l}),e=l[4],r=l[5];break}case"Q":s.push({key:"Q",data:[...a]}),e=a[2],r=a[3];break;case"q":{const l=a.map(((c,u)=>u%2?c+r:c+e));s.push({key:"Q",data:l}),e=l[2],r=l[3];break}case"A":s.push({key:"A",data:[...a]}),e=a[5],r=a[6];break;case"a":e+=a[5],r+=a[6],s.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],e,r]});break;case"H":s.push({key:"H",data:[...a]}),e=a[0];break;case"h":e+=a[0],s.push({key:"H",data:[e]});break;case"V":s.push({key:"V",data:[...a]}),r=a[0];break;case"v":r+=a[0],s.push({key:"V",data:[r]});break;case"S":s.push({key:"S",data:[...a]}),e=a[2],r=a[3];break;case"s":{const l=a.map(((c,u)=>u%2?c+r:c+e));s.push({key:"S",data:l}),e=l[2],r=l[3];break}case"T":s.push({key:"T",data:[...a]}),e=a[0],r=a[1];break;case"t":e+=a[0],r+=a[1],s.push({key:"T",data:[e,r]});break;case"Z":case"z":s.push({key:"Z",data:[]}),e=n,r=i}return s}function gw(t){const e=[];let r="",n=0,i=0,s=0,o=0,a=0,l=0;for(const{key:c,data:u}of t){switch(c){case"M":e.push({key:"M",data:[...u]}),[n,i]=u,[s,o]=u;break;case"C":e.push({key:"C",data:[...u]}),n=u[4],i=u[5],a=u[2],l=u[3];break;case"L":e.push({key:"L",data:[...u]}),[n,i]=u;break;case"H":n=u[0],e.push({key:"L",data:[n,i]});break;case"V":i=u[0],e.push({key:"L",data:[n,i]});break;case"S":{let d=0,p=0;r==="C"||r==="S"?(d=n+(n-a),p=i+(i-l)):(d=n,p=i),e.push({key:"C",data:[d,p,...u]}),a=u[0],l=u[1],n=u[2],i=u[3];break}case"T":{const[d,p]=u;let f=0,m=0;r==="Q"||r==="T"?(f=n+(n-a),m=i+(i-l)):(f=n,m=i);const x=n+2*(f-n)/3,g=i+2*(m-i)/3,y=d+2*(f-d)/3,b=p+2*(m-p)/3;e.push({key:"C",data:[x,g,y,b,d,p]}),a=f,l=m,n=d,i=p;break}case"Q":{const[d,p,f,m]=u,x=n+2*(d-n)/3,g=i+2*(p-i)/3,y=f+2*(d-f)/3,b=m+2*(p-m)/3;e.push({key:"C",data:[x,g,y,b,f,m]}),a=d,l=p,n=f,i=m;break}case"A":{const d=Math.abs(u[0]),p=Math.abs(u[1]),f=u[2],m=u[3],x=u[4],g=u[5],y=u[6];d===0||p===0?(e.push({key:"C",data:[n,i,g,y,g,y]}),n=g,i=y):(n!==g||i!==y)&&(xw(n,i,g,y,d,p,f,m,x).forEach((function(b){e.push({key:"C",data:b})})),n=g,i=y);break}case"Z":e.push({key:"Z",data:[]}),n=s,i=o}r=c}return e}function wo(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function xw(t,e,r,n,i,s,o,a,l,c){const u=(d=o,Math.PI*d/180);var d;let p=[],f=0,m=0,x=0,g=0;if(c)[f,m,x,g]=c;else{[t,e]=wo(t,e,-u),[r,n]=wo(r,n,-u);const q=(t-r)/2,R=(e-n)/2;let F=q*q/(i*i)+R*R/(s*s);F>1&&(F=Math.sqrt(F),i*=F,s*=F);const M=i*i,D=s*s,O=M*D-M*R*R-D*q*q,j=M*R*R+D*q*q,S=(a===l?-1:1)*Math.sqrt(Math.abs(O/j));x=S*i*R/s+(t+r)/2,g=S*-s*q/i+(e+n)/2,f=Math.asin(parseFloat(((e-g)/s).toFixed(9))),m=Math.asin(parseFloat(((n-g)/s).toFixed(9))),t<x&&(f=Math.PI-f),r<x&&(m=Math.PI-m),f<0&&(f=2*Math.PI+f),m<0&&(m=2*Math.PI+m),l&&f>m&&(f-=2*Math.PI),!l&&m>f&&(m-=2*Math.PI)}let y=m-f;if(Math.abs(y)>120*Math.PI/180){const q=m,R=r,F=n;m=l&&m>f?f+120*Math.PI/180*1:f+120*Math.PI/180*-1,p=xw(r=x+i*Math.cos(m),n=g+s*Math.sin(m),R,F,i,s,o,0,l,[m,q,x,g])}y=m-f;const b=Math.cos(f),k=Math.sin(f),T=Math.cos(m),_=Math.sin(m),w=Math.tan(y/4),N=4/3*i*w,B=4/3*s*w,I=[t,e],E=[t+N*k,e-B*b],P=[r+N*_,n-B*T],z=[r,n];if(E[0]=2*I[0]-E[0],E[1]=2*I[1]-E[1],c)return[E,P,z].concat(p);{p=[E,P,z].concat(p);const q=[];for(let R=0;R<p.length;R+=3){const F=wo(p[R][0],p[R][1],u),M=wo(p[R+1][0],p[R+1][1],u),D=wo(p[R+2][0],p[R+2][1],u);q.push([F[0],F[1],M[0],M[1],D[0],D[1]])}return q}}const a8={randOffset:function(t,e){return Ft(t,e)},randOffsetWithRange:function(t,e,r){return Sc(t,e,r)},ellipse:function(t,e,r,n,i){const s=bw(r,n,i);return Od(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Jn(t,e,r,n,i,!0)}};function yw(t,e,r,n,i){return{type:"path",ops:Jn(t,e,r,n,i)}}function Ml(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Jn(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Jn(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?yw(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function l8(t,e,r,n,i){return(function(s,o){return Ml(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function Px(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=il(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:il(r[0],1.5*(1+.22*e.roughness),Rx(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=il(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:il(o,1.5*(1+.22*e.roughness),Rx(e));for(const c of a)c.op!=="move"&&n.push(c);for(const c of l)c.op!=="move"&&i.push(c)}}return{type:"path",ops:n.concat(i)}}return{type:"path",ops:[]}}function bw(t,e,r){const n=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),i=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*n)),s=2*Math.PI/i;let o=Math.abs(t/2),a=Math.abs(e/2);const l=1-r.curveFitting;return o+=Ft(o*l,r),a+=Ft(a*l,r),{increment:s,rx:o,ry:a}}function Od(t,e,r,n){const[i,s]=$x(n.increment,t,e,n.rx,n.ry,1,n.increment*Sc(.1,Sc(.4,1,r),r),r);let o=Tc(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=$x(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=Tc(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function Dx(t,e,r,n,i,s,o,a,l){const c=t,u=e;let d=Math.abs(r/2),p=Math.abs(n/2);d+=Ft(.01*d,l),p+=Ft(.01*p,l);let f=i,m=s;for(;f<0;)f+=2*Math.PI,m+=2*Math.PI;m-f>2*Math.PI&&(f=0,m=2*Math.PI);const x=2*Math.PI/l.curveStepCount,g=Math.min(x/2,(m-f)/2),y=zx(g,c,u,d,p,f,m,1,l);if(!l.disableMultiStroke){const b=zx(g,c,u,d,p,f,m,1.5,l);y.push(...b)}return o&&(a?y.push(...Jn(c,u,c+d*Math.cos(f),u+p*Math.sin(f),l),...Jn(c,u,c+d*Math.cos(m),u+p*Math.sin(m),l)):y.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+d*Math.cos(f),u+p*Math.sin(f)]})),{type:"path",ops:y}}function Ox(t,e){const r=gw(mw(Wp(t))),n=[];let i=[0,0],s=[0,0];for(const{key:o,data:a}of r)switch(o){case"M":s=[a[0],a[1]],i=[a[0],a[1]];break;case"L":n.push(...Jn(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[l,c,u,d,p,f]=a;n.push(...c8(l,c,u,d,p,f,s,e)),s=[p,f];break}case"Z":n.push(...Jn(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function uu(t,e){const r=[];for(const n of t)if(n.length){const i=e.maxRandomnessOffset||0,s=n.length;if(s>2){r.push({op:"move",data:[n[0][0]+Ft(i,e),n[0][1]+Ft(i,e)]});for(let o=1;o<s;o++)r.push({op:"lineTo",data:[n[o][0]+Ft(i,e),n[o][1]+Ft(i,e)]})}}return{type:"fillPath",ops:r}}function Zi(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!fr[i])switch(i){case"zigzag":fr[i]||(fr[i]=new t8(n));break;case"cross-hatch":fr[i]||(fr[i]=new e8(n));break;case"dots":fr[i]||(fr[i]=new r8(n));break;case"dashed":fr[i]||(fr[i]=new n8(n));break;case"zigzag-line":fr[i]||(fr[i]=new i8(n));break;default:i="hachure",fr[i]||(fr[i]=new zp(n))}return fr[i]})(e,a8).fillPolygons(t,e)}function Rx(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function Cw(t){return t.randomizer||(t.randomizer=new s8(t.seed||0)),t.randomizer.next()}function Sc(t,e,r,n=1){return r.roughness*n*(Cw(r)*(e-t)+t)}function Ft(t,e,r=1){return Sc(-t,t,e,r)}function Jn(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=Rd(t,e,r,n,i,!0,!1);if(o)return a;const l=Rd(t,e,r,n,i,!0,!0);return a.concat(l)}function Rd(t,e,r,n,i,s,o){const a=Math.pow(t-r,2)+Math.pow(e-n,2),l=Math.sqrt(a);let c=1;c=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>a&&(u=l/10);const d=u/2,p=.2+.2*Cw(i);let f=i.bowing*i.maxRandomnessOffset*(n-e)/200,m=i.bowing*i.maxRandomnessOffset*(t-r)/200;f=Ft(f,i,c),m=Ft(m,i,c);const x=[],g=()=>Ft(d,i,c),y=()=>Ft(u,i,c),b=i.preserveVertices;return o?x.push({op:"move",data:[t+(b?0:g()),e+(b?0:g())]}):x.push({op:"move",data:[t+(b?0:Ft(u,i,c)),e+(b?0:Ft(u,i,c))]}),o?x.push({op:"bcurveTo",data:[f+t+(r-t)*p+g(),m+e+(n-e)*p+g(),f+t+2*(r-t)*p+g(),m+e+2*(n-e)*p+g(),r+(b?0:g()),n+(b?0:g())]}):x.push({op:"bcurveTo",data:[f+t+(r-t)*p+y(),m+e+(n-e)*p+y(),f+t+2*(r-t)*p+y(),m+e+2*(n-e)*p+y(),r+(b?0:y()),n+(b?0:y())]}),x}function il(t,e,r){if(!t.length)return[];const n=[];n.push([t[0][0]+Ft(e,r),t[0][1]+Ft(e,r)]),n.push([t[0][0]+Ft(e,r),t[0][1]+Ft(e,r)]);for(let i=1;i<t.length;i++)n.push([t[i][0]+Ft(e,r),t[i][1]+Ft(e,r)]),i===t.length-1&&n.push([t[i][0]+Ft(e,r),t[i][1]+Ft(e,r)]);return Tc(n,null,r)}function Tc(t,e,r){const n=t.length,i=[];if(n>3){const s=[],o=1-r.curveTightness;i.push({op:"move",data:[t[1][0],t[1][1]]});for(let a=1;a+2<n;a++){const l=t[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*t[a+1][0]-o*t[a-1][0])/6,l[1]+(o*t[a+1][1]-o*t[a-1][1])/6],s[2]=[t[a+1][0]+(o*t[a][0]-o*t[a+2][0])/6,t[a+1][1]+(o*t[a][1]-o*t[a+2][1])/6],s[3]=[t[a+1][0],t[a+1][1]],i.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}}else n===3?(i.push({op:"move",data:[t[1][0],t[1][1]]}),i.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):n===2&&i.push(...Rd(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function $x(t,e,r,n,i,s,o,a){const l=[],c=[];if(a.roughness===0){t/=4,c.push([e+n*Math.cos(-t),r+i*Math.sin(-t)]);for(let u=0;u<=2*Math.PI;u+=t){const d=[e+n*Math.cos(u),r+i*Math.sin(u)];l.push(d),c.push(d)}c.push([e+n*Math.cos(0),r+i*Math.sin(0)]),c.push([e+n*Math.cos(t),r+i*Math.sin(t)])}else{const u=Ft(.5,a)-Math.PI/2;c.push([Ft(s,a)+e+.9*n*Math.cos(u-t),Ft(s,a)+r+.9*i*Math.sin(u-t)]);const d=2*Math.PI+u-.01;for(let p=u;p<d;p+=t){const f=[Ft(s,a)+e+n*Math.cos(p),Ft(s,a)+r+i*Math.sin(p)];l.push(f),c.push(f)}c.push([Ft(s,a)+e+n*Math.cos(u+2*Math.PI+.5*o),Ft(s,a)+r+i*Math.sin(u+2*Math.PI+.5*o)]),c.push([Ft(s,a)+e+.98*n*Math.cos(u+o),Ft(s,a)+r+.98*i*Math.sin(u+o)]),c.push([Ft(s,a)+e+.9*n*Math.cos(u+.5*o),Ft(s,a)+r+.9*i*Math.sin(u+.5*o)])}return[c,l]}function zx(t,e,r,n,i,s,o,a,l){const c=s+Ft(.1,l),u=[];u.push([Ft(a,l)+e+.9*n*Math.cos(c-t),Ft(a,l)+r+.9*i*Math.sin(c-t)]);for(let d=c;d<=o;d+=t)u.push([Ft(a,l)+e+n*Math.cos(d),Ft(a,l)+r+i*Math.sin(d)]);return u.push([e+n*Math.cos(o),r+i*Math.sin(o)]),u.push([e+n*Math.cos(o),r+i*Math.sin(o)]),Tc(u,null,l)}function c8(t,e,r,n,i,s,o,a){const l=[],c=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let u=[0,0];const d=a.disableMultiStroke?1:2,p=a.preserveVertices;for(let f=0;f<d;f++)f===0?l.push({op:"move",data:[o[0],o[1]]}):l.push({op:"move",data:[o[0]+(p?0:Ft(c[0],a)),o[1]+(p?0:Ft(c[0],a))]}),u=p?[i,s]:[i+Ft(c[f],a),s+Ft(c[f],a)],l.push({op:"bcurveTo",data:[t+Ft(c[f],a),e+Ft(c[f],a),r+Ft(c[f],a),n+Ft(c[f],a),u[0],u[1]]});return l}function So(t){return[...t]}function Wx(t,e=0){const r=t.length;if(r<3)throw new Error("A curve must have at least three points.");const n=[];if(r===3)n.push(So(t[0]),So(t[1]),So(t[2]),So(t[2]));else{const i=[];i.push(t[0],t[0]);for(let a=1;a<t.length;a++)i.push(t[a]),a===t.length-1&&i.push(t[a]);const s=[],o=1-e;n.push(So(i[0]));for(let a=1;a+2<i.length;a++){const l=i[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*i[a+1][0]-o*i[a-1][0])/6,l[1]+(o*i[a+1][1]-o*i[a-1][1])/6],s[2]=[i[a+1][0]+(o*i[a][0]-o*i[a+2][0])/6,i[a+1][1]+(o*i[a][1]-o*i[a+2][1])/6],s[3]=[i[a+1][0],i[a+1][1]],n.push(s[1],s[2],s[3])}}return n}function Il(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function h8(t,e,r){const n=Il(e,r);if(n===0)return Il(t,e);let i=((t[0]-e[0])*(r[0]-e[0])+(t[1]-e[1])*(r[1]-e[1]))/n;return i=Math.max(0,Math.min(1,i)),Il(t,gi(e,r,i))}function gi(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function $d(t,e,r,n){const i=n||[];if((function(a,l){const c=a[l+0],u=a[l+1],d=a[l+2],p=a[l+3];let f=3*u[0]-2*c[0]-p[0];f*=f;let m=3*u[1]-2*c[1]-p[1];m*=m;let x=3*d[0]-2*p[0]-c[0];x*=x;let g=3*d[1]-2*p[1]-c[1];return g*=g,f<x&&(f=x),m<g&&(m=g),f+m})(t,e)<r){const a=t[e+0];i.length?(s=i[i.length-1],o=a,Math.sqrt(Il(s,o))>1&&i.push(a)):i.push(a),i.push(t[e+3])}else{const l=t[e+0],c=t[e+1],u=t[e+2],d=t[e+3],p=gi(l,c,.5),f=gi(c,u,.5),m=gi(u,d,.5),x=gi(p,f,.5),g=gi(f,m,.5),y=gi(x,g,.5);$d([l,p,x,y],0,r,i),$d([y,g,m,d],0,r,i)}var s,o;return i}function u8(t,e){return _c(t,0,t.length,e)}function _c(t,e,r,n,i){const s=i||[],o=t[e],a=t[r-1];let l=0,c=1;for(let u=e+1;u<r-1;++u){const d=h8(t[u],o,a);d>l&&(l=d,c=u)}return Math.sqrt(l)>n?(_c(t,e,c+1,n,s),_c(t,c,r,n,s)):(s.length||s.push(o),s.push(a)),s}function du(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)$d(t,3*s,e,n);return r&&r>0?_c(n,0,n.length,r):n}const vr="none";class Ec{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,r,n){return{shape:e,sets:r||[],options:n||this.defaultOptions}}line(e,r,n,i,s){const o=this._o(s);return this._d("line",[yw(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=l8(e,r,n,i,o);if(o.fill){const c=[[e,r],[e+n,r],[e+n,r+i],[e,r+i]];o.fillStyle==="solid"?a.push(uu([c],o)):a.push(Zi([c],o))}return o.stroke!==vr&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=bw(n,i,o),c=Od(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=Od(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push(Zi([c.estimatedPoints],o));return o.stroke!==vr&&a.push(c.opset),this._d("ellipse",a,o)}circle(e,r,n,i){const s=this.ellipse(e,r,n,n,i);return s.shape="circle",s}linearPath(e,r){const n=this._o(r);return this._d("linearPath",[Ml(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,l){const c=this._o(l),u=[],d=Dx(e,r,n,i,s,o,a,!0,c);if(a&&c.fill)if(c.fillStyle==="solid"){const p=Object.assign({},c);p.disableMultiStroke=!0;const f=Dx(e,r,n,i,s,o,!0,!1,p);f.type="fillPath",u.push(f)}else u.push((function(p,f,m,x,g,y,b){const k=p,T=f;let _=Math.abs(m/2),w=Math.abs(x/2);_+=Ft(.01*_,b),w+=Ft(.01*w,b);let N=g,B=y;for(;N<0;)N+=2*Math.PI,B+=2*Math.PI;B-N>2*Math.PI&&(N=0,B=2*Math.PI);const I=(B-N)/b.curveStepCount,E=[];for(let P=N;P<=B;P+=I)E.push([k+_*Math.cos(P),T+w*Math.sin(P)]);return E.push([k+_*Math.cos(B),T+w*Math.sin(B)]),E.push([k,T]),Zi([E],b)})(e,r,n,i,s,o,c));return c.stroke!==vr&&u.push(d),this._d("arc",u,c)}curve(e,r){const n=this._o(r),i=[],s=Px(e,n);if(n.fill&&n.fill!==vr)if(n.fillStyle==="solid"){const o=Px(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(o.ops)})}else{const o=[],a=e;if(a.length){const l=typeof a[0][0]=="number"?[a]:a;for(const c of l)c.length<3?o.push(...c):c.length===3?o.push(...du(Wx([c[0],c[0],c[1],c[2]]),10,(1+n.roughness)/2)):o.push(...du(Wx(c),10,(1+n.roughness)/2))}o.length&&i.push(Zi([o],n))}return n.stroke!==vr&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=Ml(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(uu([e],n)):i.push(Zi([e],n))),n.stroke!==vr&&i.push(s),this._d("polygon",i,n)}path(e,r){const n=this._o(r),i=[];if(!e)return this._d("path",i,n);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const s=n.fill&&n.fill!=="transparent"&&n.fill!==vr,o=n.stroke!==vr,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,p){const f=gw(mw(Wp(u))),m=[];let x=[],g=[0,0],y=[];const b=()=>{y.length>=4&&x.push(...du(y,d)),y=[]},k=()=>{b(),x.length&&(m.push(x),x=[])};for(const{key:_,data:w}of f)switch(_){case"M":k(),g=[w[0],w[1]],x.push(g);break;case"L":b(),x.push([w[0],w[1]]);break;case"C":if(!y.length){const N=x.length?x[x.length-1]:g;y.push([N[0],N[1]])}y.push([w[0],w[1]]),y.push([w[2],w[3]]),y.push([w[4],w[5]]);break;case"Z":b(),x.push([g[0],g[1]])}if(k(),!p)return m;const T=[];for(const _ of m){const w=u8(_,p);w.length&&T.push(w)}return T})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),c=Ox(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=Ox(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else i.push(uu(l,n));else i.push(Zi(l,n));return o&&(a?l.forEach((u=>{i.push(Ml(u,!1,n))})):i.push(c)),this._d("path",i,n)}opsToPath(e,r){let n="";for(const i of e.ops){const s=typeof r=="number"&&r>=0?i.data.map((o=>+o.toFixed(r))):i.data;switch(i.op){case"move":n+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":n+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":n+=`L${s[0]} ${s[1]} `}}return n.trim()}toPaths(e){const r=e.sets||[],n=e.options||this.defaultOptions,i=[];for(const s of r){let o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:vr};break;case"fillPath":o={d:this.opsToPath(s),stroke:vr,strokeWidth:0,fill:n.fill||vr};break;case"fillSketch":o=this.fillSketch(s,n)}o&&i.push(o)}return i}fillSketch(e,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(e),stroke:r.fill||vr,strokeWidth:n,fill:vr}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class d8{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new Ec(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.ctx,s=e.options.fixedDecimalPlaceDigits;for(const o of r)switch(o.type){case"path":i.save(),i.strokeStyle=n.stroke==="none"?"transparent":n.stroke,i.lineWidth=n.strokeWidth,n.strokeLineDash&&i.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(i.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(i,o,s),i.restore();break;case"fillPath":{i.save(),i.fillStyle=n.fill||"";const a=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,o,s,a),i.restore();break}case"fillSketch":this.fillSketch(i,o,n)}}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2),e.save(),n.fillLineDash&&e.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(e.lineDashOffset=n.fillLineDashOffset),e.strokeStyle=n.fill||"",e.lineWidth=i,this._drawToContext(e,r,n.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,r,n,i="nonzero"){e.beginPath();for(const s of r.ops){const o=typeof n=="number"&&n>=0?s.data.map((a=>+a.toFixed(n))):s.data;switch(s.op){case"move":e.moveTo(o[0],o[1]);break;case"bcurveTo":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":e.lineTo(o[0],o[1])}}r.type==="fillPath"?e.fill(i):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,r,n,i,s){const o=this.gen.line(e,r,n,i,s);return this.draw(o),o}rectangle(e,r,n,i,s){const o=this.gen.rectangle(e,r,n,i,s);return this.draw(o),o}ellipse(e,r,n,i,s){const o=this.gen.ellipse(e,r,n,i,s);return this.draw(o),o}circle(e,r,n,i){const s=this.gen.circle(e,r,n,i);return this.draw(s),s}linearPath(e,r){const n=this.gen.linearPath(e,r);return this.draw(n),n}polygon(e,r){const n=this.gen.polygon(e,r);return this.draw(n),n}arc(e,r,n,i,s,o,a=!1,l){const c=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(c),c}curve(e,r){const n=this.gen.curve(e,r);return this.draw(n),n}path(e,r){const n=this.gen.path(e,r);return this.draw(n),n}}const sl="http://www.w3.org/2000/svg";class f8{constructor(e,r){this.svg=e,this.gen=new Ec(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(sl,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(sl,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=i.createElementNS(sl,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),e.shape!=="curve"&&e.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(i,a,n)}l&&s.appendChild(l)}return s}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);const s=e.createElementNS(sl,"path");return s.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),s.setAttribute("stroke",n.fill||""),s.setAttribute("stroke-width",i+""),s.setAttribute("fill","none"),n.fillLineDash&&s.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&s.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),s}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,r){return this.gen.opsToPath(e,r)}line(e,r,n,i,s){const o=this.gen.line(e,r,n,i,s);return this.draw(o)}rectangle(e,r,n,i,s){const o=this.gen.rectangle(e,r,n,i,s);return this.draw(o)}ellipse(e,r,n,i,s){const o=this.gen.ellipse(e,r,n,i,s);return this.draw(o)}circle(e,r,n,i){const s=this.gen.circle(e,r,n,i);return this.draw(s)}linearPath(e,r){const n=this.gen.linearPath(e,r);return this.draw(n)}polygon(e,r){const n=this.gen.polygon(e,r);return this.draw(n)}arc(e,r,n,i,s,o,a=!1,l){const c=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(c)}curve(e,r){const n=this.gen.curve(e,r);return this.draw(n)}path(e,r){const n=this.gen.path(e,r);return this.draw(n)}}var yt={canvas:(t,e)=>new d8(t,e),svg:(t,e)=>new f8(t,e),generator:t=>new Ec(t),newSeed:()=>Ec.newSeed()},Mt=v(async(t,e,r)=>{var f,m;let n;const i=e.useHtmlLabels||Ln((f=re())==null?void 0:f.htmlLabels);r?n=r:n="node default";const s=t.insert("g").attr("class",n).attr("id",e.domId||e.id),o=s.insert("g").attr("class","label").attr("style",Oe(e.labelStyle));let a;e.label===void 0?a="":a=typeof e.label=="string"?e.label:e.label[0];const l=!!e.icon||!!e.img,c=e.labelType==="markdown",u=await Bn(o,Vr(Bi(a),re()),{useHtmlLabels:i,width:e.width||((m=re().flowchart)==null?void 0:m.wrappingWidth),classes:c?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:c},re());let d=u.getBBox();const p=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=Yt(u);await $v(x,a),d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height)}return i?o.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"):o.attr("transform","translate(0, "+-d.height/2+")"),e.centerLabel&&o.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:s,bbox:d,halfPadding:p,label:o}},"labelHelper"),fu=v(async(t,e,r)=>{var l,c;const n=r.useHtmlLabels??hr(re()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await Bn(i,Vr(Bi(e),re()),{useHtmlLabels:n,width:r.width||((c=(l=re())==null?void 0:l.flowchart)==null?void 0:c.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let o=s.getBBox();const a=r.padding/2;if(hr(re())){const u=s.children[0],d=Yt(s);o=u.getBoundingClientRect(),d.attr("width",o.width),d.attr("height",o.height)}return n?i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):i.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:t,bbox:o,halfPadding:a,label:i}},"insertLabel"),wt=v((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),At=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Qt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Qt,"createPathFromPoints");function ti(t,e,r,n,i,s){const o=[],l=r-t,c=n-e,u=l/s,d=2*Math.PI/u,p=e+c/2;for(let f=0;f<=50;f++){const m=f/50,x=t+m*l,g=p+i*Math.sin(d*(x-t));o.push({x,y:g})}return o}v(ti,"generateFullSineWavePoints");function ua(t,e,r,n,i,s){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(ua,"generateCirclePoints");function zd(t){const e=Array.from(t.childNodes).filter(l=>l.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=e.map(l=>l.getAttribute("d")).filter(l=>l!==null).join(" ");r.setAttribute("d",n);const i=e.find(l=>l.getAttribute("fill")!=="none"),s=e.find(l=>l.getAttribute("stroke")!=="none"),o=v((l,c)=>(l==null?void 0:l.getAttribute(c))??void 0,"getAttr");if(i){const l={fill:o(i,"fill"),"fill-opacity":o(i,"fill-opacity")??"1"};Object.entries(l).forEach(([c,u])=>{u&&r.setAttribute(c,u)})}if(s){const l={stroke:o(s,"stroke"),"stroke-width":o(s,"stroke-width")??"1","stroke-opacity":o(s,"stroke-opacity")??"1"};Object.entries(l).forEach(([c,u])=>{u&&r.setAttribute(c,u)})}const a=document.createElementNS("http://www.w3.org/2000/svg","g");return a.appendChild(r),a}v(zd,"mergePaths");var p8=v((t,e)=>{var r=t.x,n=t.y,i=e.x-r,s=e.y-n,o=t.width/2,a=t.height/2,l,c;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),l=s===0?0:a*i/s,c=a):(i<0&&(o=-o),l=o,c=i===0?0:o*s/i),{x:r+l,y:n+c}},"intersectRect"),Qs=p8,m8=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=re(),a=hr(o);return await Bn(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),Hn=m8,oi=v((t,e,r,n,i)=>["M",t+i,e,"H",t+r-i,"A",i,i,0,0,1,t+r,e+i,"V",e+n-i,"A",i,i,0,0,1,t+r-i,e+n,"H",t+i,"A",i,i,0,0,1,t,e+n-i,"V",e+i,"A",i,i,0,0,1,t+i,e,"Z"].join(" "),"createRoundedRectPathD"),kw=v(async(t,e)=>{tt.info("Creating subgraph rect for ",e.id,e);const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=vt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=hr(r),f=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await Bn(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width}):m=await Hn(f,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(hr(r)){const N=m.children[0],B=Yt(m);x=N.getBoundingClientRect(),B.attr("width",x.width),B.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,b=e.x-g/2,k=e.y-y/2;tt.trace("Data ",e,JSON.stringify(e));let T;if(e.look==="handDrawn"){const N=yt.svg(d),B=kt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),I=N.path(oi(b,k,g,y,0),B);T=d.insert(()=>(tt.debug("Rough node insert CXC",I),I),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=d.insert("rect",":first-child"),T.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",k).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=Lp(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const N=f.select("span");N&&N.attr("style",a)}const w=T.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(N){return Qs(e,N)},{cluster:d,labelBBox:x}},"rect"),g8=v((t,e)=>{const r=t.insert("g").attr("class","note-cluster").attr("id",e.domId),n=r.insert("rect",":first-child"),i=0*e.padding,s=i/2;n.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-s).attr("y",e.y-e.height/2-s).attr("width",e.width+i).attr("height",e.height+i).attr("fill","none");const o=n.node().getBBox();return e.width=o.width,e.height=o.height,e.intersect=function(a){return Qs(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),x8=v(async(t,e)=>{const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:s,compositeBackground:o,compositeTitleBackground:a,nodeBorder:l}=n,c=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-id",e.id).attr("data-look",e.look),u=c.insert("g",":first-child"),d=c.insert("g").attr("class","cluster-label");let p=c.append("rect");const f=await Hn(d,e.label,e.labelStyle,void 0,!0);let m=f.getBBox();if(hr(r)){const I=f.children[0],E=Yt(f);m=I.getBoundingClientRect(),E.attr("width",m.width),E.attr("height",m.height)}const x=0*e.padding,g=x/2,y=(e.width<=m.width+e.padding?m.width+e.padding:e.width)+x;e.width<=m.width+e.padding?e.diff=(y-e.width)/2-e.padding:e.diff=-e.padding;const b=e.height+x,k=e.height+x-m.height-6,T=e.x-y/2,_=e.y-b/2;e.width=y;const w=e.y-e.height/2-g+m.height+2;let N;if(e.look==="handDrawn"){const I=e.cssClasses.includes("statediagram-cluster-alt"),E=yt.svg(c),P=e.rx||e.ry?E.path(oi(T,_,y,b,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):E.rectangle(T,_,y,b,{seed:i});N=c.insert(()=>P,":first-child");const z=E.rectangle(T,w,y,k,{fill:I?s:o,fillStyle:I?"hachure":"solid",stroke:l,seed:i});N=c.insert(()=>P,":first-child"),p=c.insert(()=>z)}else N=u.insert("rect",":first-child"),N.attr("class","outer").attr("x",T).attr("y",_).attr("width",y).attr("height",b).attr("data-look",e.look),p.attr("class","inner").attr("x",T).attr("y",w).attr("width",y).attr("height",k);d.attr("transform",`translate(${e.x-m.width/2}, ${_+1-(hr(r)?0:3)})`);const B=N.node().getBBox();return e.height=B.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(I){return Qs(e,I)},{cluster:c,labelBBox:m}},"roundedWithTitle"),y8=v(async(t,e)=>{tt.info("Creating subgraph rect for ",e.id,e);const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=vt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=hr(r),f=d.insert("g").attr("class","cluster-label "),m=await Bn(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width});let x=m.getBBox();if(hr(r)){const N=m.children[0],B=Yt(m);x=N.getBoundingClientRect(),B.attr("width",x.width),B.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,b=e.x-g/2,k=e.y-y/2;tt.trace("Data ",e,JSON.stringify(e));let T;if(e.look==="handDrawn"){const N=yt.svg(d),B=kt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),I=N.path(oi(b,k,g,y,e.rx),B);T=d.insert(()=>(tt.debug("Rough node insert CXC",I),I),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=d.insert("rect",":first-child"),T.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",k).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=Lp(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const N=f.select("span");N&&N.attr("style",a)}const w=T.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(N){return Qs(e,N)},{cluster:d,labelBBox:x}},"kanbanSection"),b8=v((t,e)=>{const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{nodeBorder:s}=n,o=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-look",e.look),a=o.insert("g",":first-child"),l=0*e.padding,c=e.width+l;e.diff=-e.padding;const u=e.height+l,d=e.x-c/2,p=e.y-u/2;e.width=c;let f;if(e.look==="handDrawn"){const g=yt.svg(o).rectangle(d,p,c,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:s,seed:i});f=o.insert(()=>g,":first-child")}else{f=a.insert("rect",":first-child");let x="outer";e.look,x="divider",f.attr("class",x).attr("x",d).attr("y",p).attr("width",c).attr("height",u).attr("data-look",e.look)}const m=f.node().getBBox();return e.height=m.height,e.offsetX=0,e.offsetY=0,e.intersect=function(x){return Qs(e,x)},{cluster:o,labelBBox:{}}},"divider"),C8=kw,k8={rect:kw,squareRect:C8,roundedWithTitle:x8,noteGroup:g8,divider:b8,kanbanSection:y8},vw=new Map,v8=v(async(t,e)=>{const r=e.shape||"rect",n=await k8[r](t,e);return vw.set(e.id,n),n},"insertCluster"),NZ=v(()=>{vw=new Map},"clear");function ww(t,e){return t.intersect(e)}v(ww,"intersectNode");var w8=ww;function Sw(t,e,r,n){var i=t.x,s=t.y,o=i-n.x,a=s-n.y,l=Math.sqrt(e*e*a*a+r*r*o*o),c=Math.abs(e*r*o/l);n.x<i&&(c=-c);var u=Math.abs(e*r*a/l);return n.y<s&&(u=-u),{x:i+c,y:s+u}}v(Sw,"intersectEllipse");var Tw=Sw;function _w(t,e,r){return Tw(t,e,e,r)}v(_w,"intersectCircle");var S8=_w;function Ew(t,e,r,n){{const i=e.y-t.y,s=t.x-e.x,o=e.x*t.y-t.x*e.y,a=i*r.x+s*r.y+o,l=i*n.x+s*n.y+o,c=1e-6;if(a!==0&&l!==0&&Wd(a,l))return;const u=n.y-r.y,d=r.x-n.x,p=n.x*r.y-r.x*n.y,f=u*t.x+d*t.y+p,m=u*e.x+d*e.y+p;if(Math.abs(f)<c&&Math.abs(m)<c&&Wd(f,m))return;const x=i*d-u*s;if(x===0)return;const g=Math.abs(x/2);let y=s*p-d*o;const b=y<0?(y-g)/x:(y+g)/x;y=u*o-i*p;const k=y<0?(y-g)/x:(y+g)/x;return{x:b,y:k}}}v(Ew,"intersectLine");function Wd(t,e){return t*e>0}v(Wd,"sameSign");var T8=Ew;function Nw(t,e,r){let n=t.x,i=t.y,s=[],o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;typeof e.forEach=="function"?e.forEach(function(u){o=Math.min(o,u.x),a=Math.min(a,u.y)}):(o=Math.min(o,e.x),a=Math.min(a,e.y));let l=n-t.width/2-o,c=i-t.height/2-a;for(let u=0;u<e.length;u++){let d=e[u],p=e[u<e.length-1?u+1:0],f=T8(t,r,{x:l+d.x,y:c+d.y},{x:l+p.x,y:c+p.y});f&&s.push(f)}return s.length?(s.length>1&&s.sort(function(u,d){let p=u.x-r.x,f=u.y-r.y,m=Math.sqrt(p*p+f*f),x=d.x-r.x,g=d.y-r.y,y=Math.sqrt(x*x+g*g);return m<y?-1:m===y?0:1}),s[0]):t}v(Nw,"intersectPolygon");var _8=Nw,pt={node:w8,circle:S8,ellipse:Tw,polygon:_8,rect:Qs};function jw(t,e){const{labelStyles:r}=vt(e);e.labelStyle=r;const n=At(e);let i=n;n||(i="anchor");const s=t.insert("g").attr("class",i).attr("id",e.domId||e.id),o=1,{cssStyles:a}=e,l=yt.svg(s),c=kt(e,{fill:"black",stroke:"none",fillStyle:"solid"});e.look!=="handDrawn"&&(c.roughness=0);const u=l.circle(0,0,o*2,c),d=s.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",Oe(a)),wt(e,d),e.intersect=function(p){return tt.info("Circle intersect",e,o,p),pt.circle(e,o,p)},s}v(jw,"anchor");function qd(t,e,r,n,i,s,o){const l=(t+r)/2,c=(e+n)/2,u=Math.atan2(n-e,r-t),d=(r-t)/2,p=(n-e)/2,f=d/i,m=p/s,x=Math.sqrt(f**2+m**2);if(x>1)throw new Error("The given radii are too small to create an arc between the points.");const g=Math.sqrt(1-x**2),y=l+g*s*Math.sin(u)*(o?-1:1),b=c-g*i*Math.cos(u)*(o?-1:1),k=Math.atan2((e-b)/s,(t-y)/i);let _=Math.atan2((n-b)/s,(r-y)/i)-k;o&&_<0&&(_+=2*Math.PI),!o&&_>0&&(_-=2*Math.PI);const w=[];for(let N=0;N<20;N++){const B=N/19,I=k+B*_,E=y+i*Math.cos(I),P=b+s*Math.sin(I);w.push({x:E,y:P})}return w}v(qd,"generateArcPoints");function Lw(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(Lw,"calculateArcSagitta");async function Bw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=v(I=>I+o,"calcTotalHeight"),l=v(I=>{const E=I/2;return[E/(2.5+I/50),E]},"calcEllipseRadius"),{shapeSvg:c,bbox:u}=await Mt(t,e,At(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[p,f]=l(d),m=Lw(d,p,f),g=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2+m-m,y=d,{cssStyles:b}=e,k=[{x:g/2,y:-y/2},{x:-g/2,y:-y/2},...qd(-g/2,-y/2,-g/2,y/2,p,f,!1),{x:g/2,y:y/2},...qd(g/2,y/2,g/2,-y/2,p,f,!0)],T=yt.svg(c),_=kt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=Qt(k),N=T.path(w,_),B=c.insert(()=>N,":first-child");return B.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",n),B.attr("transform",`translate(${p/2}, 0)`),wt(e,B),e.intersect=function(I){return pt.polygon(e,k,I)},c}v(Bw,"bowTieRect");function An(t,e,r,n){return t.insert("polygon",":first-child").attr("points",n.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}v(An,"insertPolygonShape");var ol=12;async function Aw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?28:i,o=e.look==="neo"?24:i,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s+ol),u=((e==null?void 0:e.height)??l.height)+(e.look==="neo"?o*2:o),d=0,p=c,f=-u,m=0,x=[{x:d+ol,y:f},{x:p,y:f},{x:p,y:m},{x:d,y:m},{x:d,y:f+ol},{x:d+ol,y:f}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const b=yt.svg(a),k=kt(e,{}),T=Qt(x),_=b.path(T,k);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-c/2}, ${u/2})`),y&&g.attr("style",y)}else g=An(a,c,u,x);return n&&g.attr("style",n),wt(e,g),e.intersect=function(b){return pt.polygon(e,x,b)},a}v(Aw,"card");function Mw(t,e){const{nodeStyles:r}=vt(e);e.label="";const n=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),{cssStyles:i}=e,s=Math.max(28,e.width??0),o=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}],a=yt.svg(n),l=kt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Qt(o),u=a.path(c,l),d=n.insert(()=>u,":first-child");return i&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",i),r&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",r),e.width=28,e.height=28,e.intersect=function(p){return pt.polygon(e,o,p)},n}v(Mw,"choice");async function qp(t,e,r){const{labelStyles:n,nodeStyles:i}=vt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await Mt(t,e,At(e)),l=16,c=(r==null?void 0:r.padding)??a,u=e.look==="neo"?o.width/2+l*2:o.width/2+c;let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const f=yt.svg(s),m=kt(e,{}),x=f.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",Oe(p))}else d=s.insert("circle",":first-child").attr("class","basic label-container").attr("style",i).attr("r",u).attr("cx",0).attr("cy",0);return wt(e,d),e.calcIntersect=function(f,m){const x=f.width/2;return pt.circle(f,x,m)},e.intersect=function(f){return tt.info("Circle intersect",e,u,f),pt.circle(e,u,f)},s}v(qp,"circle");function Iw(t){const e=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=t*2,i={x:n/2*e,y:n/2*r},s={x:-(n/2)*e,y:n/2*r},o={x:-(n/2)*e,y:-(n/2)*r},a={x:n/2*e,y:-(n/2)*r};return`M ${s.x},${s.y} L ${a.x},${a.y}
|
|
575
|
-
M ${i.x},${i.y} L ${o.x},${o.y}`}v(Iw,"createLine");function Fw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r,e.label="";const i=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),s=Math.max(30,(e==null?void 0:e.width)??0),{cssStyles:o}=e,a=yt.svg(i),l=kt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=a.circle(0,0,s*2,l),u=Iw(s),d=a.path(u,l),p=i.insert(()=>c,":first-child");return p.insert(()=>d),p.attr("class","outer-path"),o&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",o),n&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",n),wt(e,p),e.intersect=function(f){return tt.info("crossedCircle intersect",e,{radius:s,point:f}),pt.circle(e,s,f)},i}v(Fw,"crossedCircle");function vn(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(vn,"generateCirclePoints");async function Pw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,At(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+a,u=s.height+l,d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...vn(c/2,-u/2,d,30,-90,0),{x:-c/2-d,y:d},...vn(c/2+d*2,-d,d,20,-180,-270),...vn(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:-u/2},...vn(c/2,u/2,d,20,0,90)],m=[{x:c/2,y:-u/2-d},{x:-c/2,y:-u/2-d},...vn(c/2,-u/2,d,20,-90,0),{x:-c/2-d,y:-d},...vn(c/2+c*.1,-d,d,20,-180,-270),...vn(c/2+c*.1,d,d,20,-90,-180),{x:-c/2-d,y:u/2},...vn(c/2,u/2,d,20,0,90),{x:-c/2,y:u/2+d},{x:c/2,y:u/2+d}],x=yt.svg(i),g=kt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Qt(f).replace("Z",""),k=x.path(b,g),T=Qt(m),_=x.path(T,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":first-child").attr("stroke-opacity",0),w.insert(()=>k,":first-child"),w.attr("class","text"),p&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${d}, 0)`),o.attr("transform",`translate(${-c/2+d-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),wt(e,w),e.intersect=function(N){return pt.polygon(e,m,N)},i}v(Pw,"curlyBraceLeft");function wn(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:f,y:m})}return o}v(wn,"generateCirclePoints");async function Dw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,At(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...wn(c/2,-u/2,d,20,-90,0),{x:c/2+d,y:-d},...wn(c/2+d*2,-d,d,20,-180,-270),...wn(c/2+d*2,d,d,20,-90,-180),{x:c/2+d,y:u/2},...wn(c/2,u/2,d,20,0,90)],m=[{x:-c/2,y:-u/2-d},{x:c/2,y:-u/2-d},...wn(c/2,-u/2,d,20,-90,0),{x:c/2+d,y:-d},...wn(c/2+d*2,-d,d,20,-180,-270),...wn(c/2+d*2,d,d,20,-90,-180),{x:c/2+d,y:u/2},...wn(c/2,u/2,d,20,0,90),{x:c/2,y:u/2+d},{x:-c/2,y:u/2+d}],x=yt.svg(i),g=kt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Qt(f).replace("Z",""),k=x.path(b,g),T=Qt(m),_=x.path(T,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":first-child").attr("stroke-opacity",0),w.insert(()=>k,":first-child"),w.attr("class","text"),p&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${-d}, 0)`),o.attr("transform",`translate(${-c/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),wt(e,w),e.intersect=function(N){return pt.polygon(e,m,N)},i}v(Dw,"curlyBraceRight");function We(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(We,"generateCirclePoints");async function Ow(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,At(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...We(c/2,-u/2,d,30,-90,0),{x:-c/2-d,y:d},...We(c/2+d*2,-d,d,20,-180,-270),...We(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:-u/2},...We(c/2,u/2,d,20,0,90)],m=[...We(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...We(-c/2-d/2,-d,d,20,0,90),...We(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...We(-c/2+d+d/2,u/2,d,30,-180,-270)],x=[{x:c/2,y:-u/2-d},{x:-c/2,y:-u/2-d},...We(c/2,-u/2,d,20,-90,0),{x:-c/2-d,y:-d},...We(c/2+d*2,-d,d,20,-180,-270),...We(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:u/2},...We(c/2,u/2,d,20,0,90),{x:-c/2,y:u/2+d},{x:c/2-d-d/2,y:u/2+d},...We(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...We(-c/2-d/2,-d,d,20,0,90),...We(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...We(-c/2+d+d/2,u/2,d,30,-180,-270)],g=yt.svg(i),y=kt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const k=Qt(f).replace("Z",""),T=g.path(k,y),w=Qt(m).replace("Z",""),N=g.path(w,y),B=Qt(x),I=g.path(B,{...y}),E=i.insert("g",":first-child");return E.insert(()=>I,":first-child").attr("stroke-opacity",0),E.insert(()=>T,":first-child"),E.insert(()=>N,":first-child"),E.attr("class","text"),p&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(${d-d/4}, 0)`),o.attr("transform",`translate(${-c/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),wt(e,E),e.intersect=function(P){return pt.polygon(e,x,P)},i}v(Ow,"curlyBraces");async function Rw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=20,l=5,{shapeSvg:c,bbox:u}=await Mt(t,e,At(e)),d=Math.max(a,(u.width+s*2)*1.25,(e==null?void 0:e.width)??0),p=Math.max(l,u.height+o*2,(e==null?void 0:e.height)??0),f=p/2,{cssStyles:m}=e,x=yt.svg(c),g=kt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,b=p,k=y-f,T=b/4,_=[{x:k,y:0},{x:T,y:0},{x:0,y:b/2},{x:T,y:b},{x:k,y:b},...ua(-k,-b/2,f,50,270,90)],w=Qt(_),N=x.path(w,g),B=c.insert(()=>N,":first-child");return B.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&B.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&B.selectChildren("path").attr("style",n),B.attr("transform",`translate(${-d/2}, ${-p/2})`),wt(e,B),e.intersect=function(I){return pt.polygon(e,_,I)},c}v(Rw,"curvedTrapezoid");var E8=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),N8=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),j8=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),qx=8,Hx=8;async function $w(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?24:i,o=e.look==="neo"?24:i;if(e.width||e.height){const g=e.width??0;e.width=(e.width??0)-o,e.width<Hx&&(e.width=Hx);const b=g/2/(2.5+g/50);e.height=(e.height??0)-s-b*3,e.height<qx&&(e.height=qx)}const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,At(e)),u=(e.width?e.width:l.width)+o,d=u/2,p=d/(2.5+u/50),f=(e.height?e.height:l.height)+s+p;let m;const{cssStyles:x}=e;if(e.look==="handDrawn"){const g=yt.svg(a),y=N8(0,0,u,f,d,p),b=j8(0,p,u,f,d,p),k=kt(e,{}),T=g.path(y,k),_=g.path(b,kt(e,{fill:"none"}));m=a.insert(()=>_,":first-child"),m=a.insert(()=>T,":first-child"),m.attr("class","basic label-container"),x&&m.attr("style",x)}else{const g=E8(0,0,u,f,d,p);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",Oe(x)).attr("style",n)}return m.attr("label-offset-y",p),m.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),wt(e,m),c.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+(e.padding??0)/1.5-(l.y-(l.top??0))})`),e.intersect=function(g){const y=pt.rect(e,g),b=y.x-(e.x??0);if(d!=0&&(Math.abs(b)<(e.width??0)/2||Math.abs(b)==(e.width??0)/2&&Math.abs(y.y-(e.y??0))>(e.height??0)/2-p)){let k=p*p*(1-b*b/(d*d));k>0&&(k=Math.sqrt(k)),k=p-k,g.y-(e.y??0)>0&&(k=-k),y.y+=k}return y},a}v($w,"cylinder");async function Js(t,e,r){const{labelStyles:n,nodeStyles:i}=vt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await Mt(t,e,At(e)),a=Math.max(o.width+r.labelPaddingX*2,(e==null?void 0:e.width)||0),l=Math.max(o.height+r.labelPaddingY*2,(e==null?void 0:e.height)||0),c=-a/2,u=-l/2;let d,{rx:p,ry:f}=e;const{cssStyles:m}=e;if(r!=null&&r.rx&&r.ry&&(p=r.rx,f=r.ry),e.look==="handDrawn"){const x=yt.svg(s),g=kt(e,{}),y=p||f?x.path(oi(c,u,a,l,p||0),g):x.rectangle(c,u,a,l,g);d=s.insert(()=>y,":first-child"),d.attr("class","basic label-container").attr("style",Oe(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",Oe(p)).attr("ry",Oe(f)).attr("x",c).attr("y",u).attr("width",a).attr("height",l);return wt(e,d),e.calcIntersect=function(x,g){return pt.rect(x,g)},e.intersect=function(x){return pt.rect(e,x)},s}v(Js,"drawRect");async function zw(t,e){const{cssClasses:r,labelPaddingX:n,labelPaddingY:i,padding:s,width:o,height:a}=e,l={rx:0,ry:0,labelPaddingX:n??(s??0)*2,labelPaddingY:i??s??0},c=await Js(t,e,l);if(e.look==="handDrawn"){const f=yt.svg(c),m=kt(e,{}),x=c.select(".basic.label-container > path:nth-child(2)"),g=x.node();if(!g)return c;let y=null;if(g instanceof SVGGraphicsElement)y=g.getBBox();else return c;return c.insert(()=>f.line(y.x,y.y,y.x+y.width,y.y,m),".basic.label-container g.label"),c.insert(()=>f.line(y.x,y.y+y.height,y.x+y.width,y.y+y.height,m),".basic.label-container g.label"),x.remove(),c}const u=c.select(".basic.label-container"),d=(Number(u.attr("width"))||o)??0,p=(Number(u.attr("height"))||a)??0;return d>0&&p>0&&u.attr("stroke-dasharray",`${d} ${p}`),c}v(zw,"datastore");async function Ww(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?16:e.padding??0,{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,At(e)),c=a.width+i,u=a.height+s,d=u*.2,p=-c/2,f=-u/2-d/2,{cssStyles:m}=e,x=yt.svg(o),g=kt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:p,y:f+d},{x:-p,y:f+d},{x:-p,y:-f},{x:p,y:-f},{x:p,y:f},{x:-p,y:f},{x:-p,y:f+d}],b=x.polygon(y.map(T=>[T.x,T.y]),g),k=o.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),l.attr("transform",`translate(${p+(e.padding??0)/2-(a.x-(a.left??0))}, ${f+d+(e.padding??0)/2-(a.y-(a.top??0))})`),wt(e,k),e.intersect=function(T){return pt.rect(e,T)},o}v(Ww,"dividedRectangle");async function qw(t,e){var f,m;const{labelStyles:r,nodeStyles:n}=vt(e),i=e.look==="neo"?12:5;e.labelStyle=r;const s=e.padding??0,o=e.look==="neo"?16:s,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=(e!=null&&e.width?(e==null?void 0:e.width)/2:l.width/2)+(o??0),u=c-i;let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const x=yt.svg(a),g=kt(e,{roughness:.2,strokeWidth:2.5}),y=kt(e,{roughness:.2,strokeWidth:1.5}),b=x.circle(0,0,c*2,g),k=x.circle(0,0,u*2,y);d=a.insert("g",":first-child"),d.attr("class",Oe(e.cssClasses)).attr("style",Oe(p)),(f=d.node())==null||f.appendChild(b),(m=d.node())==null||m.appendChild(k)}else{d=a.insert("g",":first-child");const x=d.insert("circle",":first-child"),g=d.insert("circle");d.attr("class","basic label-container").attr("style",n),x.attr("class","outer-circle").attr("style",n).attr("r",c).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",n).attr("r",u).attr("cx",0).attr("cy",0)}return wt(e,d),e.intersect=function(x){return tt.info("DoubleCircle intersect",e,c,x),pt.circle(e,c,x)},a}v(qw,"doublecircle");function Hw(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=vt(e);e.label="",e.labelStyle=n;const s=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),o=7,{cssStyles:a}=e,l=yt.svg(s),{nodeBorder:c}=r,u=kt(e,{fillStyle:"solid"});e.look!=="handDrawn"&&(u.roughness=0);const d=l.circle(0,0,o*2,u),p=s.insert(()=>d,":first-child");return p.selectAll("path").attr("style",`fill: ${c} !important;`),a&&a.length>0&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",a),i&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",i),wt(e,p),e.intersect=function(f){return tt.info("filledCircle intersect",e,{radius:o,point:f}),pt.circle(e,o,f)},s}v(Hw,"filledCircle");var Ux=10,Gx=10;async function Uw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?i*2:i;(e.width||e.height)&&(e.height=(e==null?void 0:e.height)??0,e.height<Ux&&(e.height=Ux),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<Gx&&(e.width=Gx));const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,At(e)),c=(e!=null&&e.width?e==null?void 0:e.width:a.width)+(s??0),u=e!=null&&e.height?e==null?void 0:e.height:c+a.height,d=u,p=[{x:0,y:-u},{x:d,y:-u},{x:d/2,y:0}],{cssStyles:f}=e,m=yt.svg(o),x=kt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Qt(p),y=m.path(g,x),b=o.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`).attr("class","outer-path");return f&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),e.width=c,e.height=u,wt(e,b),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-u/2+(e.padding??0)/2+(a.y-(a.top??0))})`),e.intersect=function(k){return tt.info("Triangle intersect",e,p,k),pt.polygon(e,p,k)},o}v(Uw,"flippedTriangle");function Gw(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=vt(e);e.label="";const o=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),{cssStyles:a}=e;let l=Math.max(70,(e==null?void 0:e.width)??0),c=Math.max(10,(e==null?void 0:e.height)??0);r==="LR"&&(l=Math.max(10,(e==null?void 0:e.width)??0),c=Math.max(70,(e==null?void 0:e.height)??0));const u=-1*l/2,d=-1*c/2,p=yt.svg(o),f=kt(e,{stroke:i.lineColor,fill:i.lineColor});e.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const m=p.rectangle(u,d,l,c,f),x=o.insert(()=>m,":first-child");a&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",a),s&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",s),wt(e,x);const g=(n==null?void 0:n.padding)??0;return e.width&&e.height&&(e.width+=g/2||0,e.height+=g/2||0),e.intersect=function(y){return pt.rect(e,y)},o}v(Gw,"forkJoin");async function Yw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=15,s=10,o=e.look==="neo"?16:e.padding??0,a=e.look==="neo"?12:e.padding??0;(e.width||e.height)&&(e.height=((e==null?void 0:e.height)??0)-a*2,e.height<s&&(e.height=s),e.width=((e==null?void 0:e.width)??0)-o*2,e.width<i&&(e.width=i));const{shapeSvg:l,bbox:c}=await Mt(t,e,At(e)),u=(e!=null&&e.width?e==null?void 0:e.width:Math.max(i,c.width))+o*2,d=(e!=null&&e.height?e==null?void 0:e.height:Math.max(s,c.height))+a*2,p=d/2,{cssStyles:f}=e,m=yt.svg(l),x=kt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-u/2,y:-d/2},{x:u/2-p,y:-d/2},...ua(-u/2+p,0,p,50,90,270),{x:u/2-p,y:d/2},{x:-u/2,y:d/2}],y=Qt(g),b=m.path(y,x),k=l.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),wt(e,k),e.intersect=function(T){return tt.info("Pill intersect",e,{radius:p,point:T}),pt.polygon(e,g,T)},l}v(Yw,"halfRoundedRectangle");var L8=v((t,e,r,n,i)=>[`M${t+i},${e}`,`L${t+r-i},${e}`,`L${t+r},${e-n/2}`,`L${t+r-i},${e-n}`,`L${t+i},${e-n}`,`L${t},${e-n/2}`,"Z"].join(" "),"createHexagonPathD");async function Vw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e),i=e.look==="neo"?3.5:4;e.labelStyle=r;const s=e.padding??0,o=70,a=32,l=e.look==="neo"?o:s,c=e.look==="neo"?a:s;if(e.width||e.height){const k=(e.height??0)/i;e.width=((e==null?void 0:e.width)??0)-2*k-c,e.height=(e.height??0)-l}const{shapeSvg:u,bbox:d}=await Mt(t,e,At(e)),p=(e!=null&&e.height?e==null?void 0:e.height:d.height)+l,f=p/i,m=(e!=null&&e.width?e==null?void 0:e.width:d.width)+2*f+c,x=[{x:f,y:0},{x:m-f,y:0},{x:m,y:-p/2},{x:m-f,y:-p},{x:f,y:-p},{x:0,y:-p/2}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const b=yt.svg(u),k=kt(e,{}),T=L8(0,0,m,p,f),_=b.path(T,k);g=u.insert(()=>_,":first-child").attr("transform",`translate(${-m/2}, ${p/2})`),y&&g.attr("style",y)}else g=An(u,m,p,x);return n&&g.attr("style",n),e.width=m,e.height=p,wt(e,g),e.intersect=function(b){return pt.polygon(e,x,b)},u}v(Vw,"hexagon");async function Xw(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await Mt(t,e,At(e)),s=Math.max(30,(e==null?void 0:e.width)??0),o=Math.max(30,(e==null?void 0:e.height)??0),{cssStyles:a}=e,l=yt.svg(i),c=kt(e,{});e.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const u=[{x:0,y:0},{x:s,y:0},{x:0,y:o},{x:s,y:o}],d=Qt(u),p=l.path(d,c),f=i.insert(()=>p,":first-child");return f.attr("class","basic label-container outer-path"),a&&e.look!=="handDrawn"&&f.selectChildren("path").attr("style",a),n&&e.look!=="handDrawn"&&f.selectChildren("path").attr("style",n),f.attr("transform",`translate(${-s/2}, ${-o/2})`),wt(e,f),e.intersect=function(m){return tt.info("Pill intersect",e,{points:u}),pt.polygon(e,u,m)},i}v(Xw,"hourglass");async function Kw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=vt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,label:d}=await Mt(t,e,"icon-shape default"),p=e.pos==="t",f=a,m=a,{nodeBorder:x}=r,{stylesMap:g}=Zs(e),y=-m/2,b=-f/2,k=e.label?8:0,T=yt.svg(c),_=kt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=T.rectangle(y,b,m,f,_),N=Math.max(m,u.width),B=f+u.height+k,I=T.rectangle(-N/2,-B/2,N,B,{..._,fill:"transparent",stroke:"none"}),E=c.insert(()=>w,":first-child"),P=c.insert(()=>I);if(e.icon){const z=c.append("g");z.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const q=z.node().getBBox(),R=q.width,F=q.height,M=q.x,D=q.y;z.attr("transform",`translate(${-R/2-M},${p?u.height/2+k/2-F/2-D:-u.height/2-k/2-F/2-D})`),z.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-B/2:B/2-u.height})`),E.attr("transform",`translate(0,${p?u.height/2+k/2:-u.height/2-k/2})`),wt(e,P),e.intersect=function(z){if(tt.info("iconSquare intersect",e,z),!e.label)return pt.rect(e,z);const q=e.x??0,R=e.y??0,F=e.height??0;let M=[];return p?M=[{x:q-u.width/2,y:R-F/2},{x:q+u.width/2,y:R-F/2},{x:q+u.width/2,y:R-F/2+u.height+k},{x:q+m/2,y:R-F/2+u.height+k},{x:q+m/2,y:R+F/2},{x:q-m/2,y:R+F/2},{x:q-m/2,y:R-F/2+u.height+k},{x:q-u.width/2,y:R-F/2+u.height+k}]:M=[{x:q-m/2,y:R-F/2},{x:q+m/2,y:R-F/2},{x:q+m/2,y:R-F/2+f},{x:q+u.width/2,y:R-F/2+f},{x:q+u.width/2/2,y:R+F/2},{x:q-u.width/2,y:R+F/2},{x:q-u.width/2,y:R-F/2+f},{x:q-m/2,y:R-F/2+f}],pt.polygon(e,M,z)},c}v(Kw,"icon");async function Zw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=vt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,label:d}=await Mt(t,e,"icon-shape default"),p=20,f=e.label?8:0,m=e.pos==="t",{nodeBorder:x,mainBkg:g}=r,{stylesMap:y}=Zs(e),b=yt.svg(c),k=kt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const T=y.get("fill");k.stroke=T??g;const _=c.append("g");e.icon&&_.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const w=_.node().getBBox(),N=w.width,B=w.height,I=w.x,E=w.y,P=Math.max(N,B)*Math.SQRT2+p*2,z=b.circle(0,0,P,k),q=Math.max(P,u.width),R=P+u.height+f,F=b.rectangle(-q/2,-R/2,q,R,{...k,fill:"transparent",stroke:"none"}),M=c.insert(()=>z,":first-child"),D=c.insert(()=>F);return _.attr("transform",`translate(${-N/2-I},${m?u.height/2+f/2-B/2-E:-u.height/2-f/2-B/2-E})`),_.attr("style",`color: ${y.get("stroke")??x};`),d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${m?-R/2:R/2-u.height})`),M.attr("transform",`translate(0,${m?u.height/2+f/2:-u.height/2-f/2})`),wt(e,D),e.intersect=function(O){return tt.info("iconSquare intersect",e,O),pt.rect(e,O)},c}v(Zw,"iconCircle");async function Qw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=vt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,halfPadding:d,label:p}=await Mt(t,e,"icon-shape default"),f=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:b}=Zs(e),k=-x/2,T=-m/2,_=e.label?8:0,w=yt.svg(c),N=kt(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const B=b.get("fill");N.stroke=B??y;const I=w.path(oi(k,T,x,m,5),N),E=Math.max(x,u.width),P=m+u.height+_,z=w.rectangle(-E/2,-P/2,E,P,{...N,fill:"transparent",stroke:"none"}),q=c.insert(()=>I,":first-child").attr("class","icon-shape2"),R=c.insert(()=>z);if(e.icon){const F=c.append("g");F.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const M=F.node().getBBox(),D=M.width,O=M.height,j=M.x,S=M.y;F.attr("transform",`translate(${-D/2-j},${f?u.height/2+_/2-O/2-S:-u.height/2-_/2-O/2-S})`),F.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-P/2:P/2-u.height})`),q.attr("transform",`translate(0,${f?u.height/2+_/2:-u.height/2-_/2})`),wt(e,R),e.intersect=function(F){if(tt.info("iconSquare intersect",e,F),!e.label)return pt.rect(e,F);const M=e.x??0,D=e.y??0,O=e.height??0;let j=[];return f?j=[{x:M-u.width/2,y:D-O/2},{x:M+u.width/2,y:D-O/2},{x:M+u.width/2,y:D-O/2+u.height+_},{x:M+x/2,y:D-O/2+u.height+_},{x:M+x/2,y:D+O/2},{x:M-x/2,y:D+O/2},{x:M-x/2,y:D-O/2+u.height+_},{x:M-u.width/2,y:D-O/2+u.height+_}]:j=[{x:M-x/2,y:D-O/2},{x:M+x/2,y:D-O/2},{x:M+x/2,y:D-O/2+m},{x:M+u.width/2,y:D-O/2+m},{x:M+u.width/2/2,y:D+O/2},{x:M-u.width/2,y:D+O/2},{x:M-u.width/2,y:D-O/2+m},{x:M-x/2,y:D-O/2+m}],pt.polygon(e,j,F)},c}v(Qw,"iconRounded");async function Jw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=vt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,halfPadding:d,label:p}=await Mt(t,e,"icon-shape default"),f=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:b}=Zs(e),k=-x/2,T=-m/2,_=e.label?8:0,w=yt.svg(c),N=kt(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const B=b.get("fill");N.stroke=B??y;const I=w.path(oi(k,T,x,m,.1),N),E=Math.max(x,u.width),P=m+u.height+_,z=w.rectangle(-E/2,-P/2,E,P,{...N,fill:"transparent",stroke:"none"}),q=c.insert(()=>I,":first-child"),R=c.insert(()=>z);if(e.icon){const F=c.append("g");F.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const M=F.node().getBBox(),D=M.width,O=M.height,j=M.x,S=M.y;F.attr("transform",`translate(${-D/2-j},${f?u.height/2+_/2-O/2-S:-u.height/2-_/2-O/2-S})`),F.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-P/2:P/2-u.height})`),q.attr("transform",`translate(0,${f?u.height/2+_/2:-u.height/2-_/2})`),wt(e,R),e.intersect=function(F){if(tt.info("iconSquare intersect",e,F),!e.label)return pt.rect(e,F);const M=e.x??0,D=e.y??0,O=e.height??0;let j=[];return f?j=[{x:M-u.width/2,y:D-O/2},{x:M+u.width/2,y:D-O/2},{x:M+u.width/2,y:D-O/2+u.height+_},{x:M+x/2,y:D-O/2+u.height+_},{x:M+x/2,y:D+O/2},{x:M-x/2,y:D+O/2},{x:M-x/2,y:D-O/2+u.height+_},{x:M-u.width/2,y:D-O/2+u.height+_}]:j=[{x:M-x/2,y:D-O/2},{x:M+x/2,y:D-O/2},{x:M+x/2,y:D-O/2+m},{x:M+u.width/2,y:D-O/2+m},{x:M+u.width/2/2,y:D+O/2},{x:M-u.width/2,y:D+O/2},{x:M-u.width/2,y:D-O/2+m},{x:M-x/2,y:D-O/2+m}],pt.polygon(e,j,F)},c}v(Jw,"iconSquare");async function t2(t,e,{config:{flowchart:r}}){const n=new Image;n.src=(e==null?void 0:e.img)??"",await n.decode();const i=Number(n.naturalWidth.toString().replace("px","")),s=Number(n.naturalHeight.toString().replace("px",""));e.imageAspectRatio=i/s;const{labelStyles:o}=vt(e);e.labelStyle=o;const a=r==null?void 0:r.wrappingWidth;e.defaultWidth=r==null?void 0:r.wrappingWidth;const l=Math.max(e.label?a??0:0,(e==null?void 0:e.assetWidth)??i),c=e.constraint==="on"&&e!=null&&e.assetHeight?e.assetHeight*e.imageAspectRatio:l,u=e.constraint==="on"?c/e.imageAspectRatio:(e==null?void 0:e.assetHeight)??s;e.width=Math.max(c,a??0);const{shapeSvg:d,bbox:p,label:f}=await Mt(t,e,"image-shape default"),m=e.pos==="t",x=-c/2,g=-u/2,y=e.label?8:0,b=yt.svg(d),k=kt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const T=b.rectangle(x,g,c,u,k),_=Math.max(c,p.width),w=u+p.height+y,N=b.rectangle(-_/2,-w/2,_,w,{...k,fill:"none",stroke:"none"}),B=d.insert(()=>T,":first-child"),I=d.insert(()=>N);if(e.img){const E=d.append("image");E.attr("href",e.img),E.attr("width",c),E.attr("height",u),E.attr("preserveAspectRatio","none"),E.attr("transform",`translate(${-c/2},${m?w/2-u:-w/2})`)}return f.attr("transform",`translate(${-p.width/2-(p.x-(p.left??0))},${m?-u/2-p.height/2-y/2:u/2-p.height/2+y/2})`),B.attr("transform",`translate(0,${m?p.height/2+y/2:-p.height/2-y/2})`),wt(e,I),e.intersect=function(E){if(tt.info("iconSquare intersect",e,E),!e.label)return pt.rect(e,E);const P=e.x??0,z=e.y??0,q=e.height??0;let R=[];return m?R=[{x:P-p.width/2,y:z-q/2},{x:P+p.width/2,y:z-q/2},{x:P+p.width/2,y:z-q/2+p.height+y},{x:P+c/2,y:z-q/2+p.height+y},{x:P+c/2,y:z+q/2},{x:P-c/2,y:z+q/2},{x:P-c/2,y:z-q/2+p.height+y},{x:P-p.width/2,y:z-q/2+p.height+y}]:R=[{x:P-c/2,y:z-q/2},{x:P+c/2,y:z-q/2},{x:P+c/2,y:z-q/2+u},{x:P+p.width/2,y:z-q/2+u},{x:P+p.width/2/2,y:z+q/2},{x:P-p.width/2,y:z+q/2},{x:P-p.width/2,y:z-q/2+u},{x:P-c/2,y:z-q/2+u}],pt.polygon(e,R,E)},d}v(t2,"imageSquare");async function e2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=Math.max(l.width+(o??0)*2,(e==null?void 0:e.width)??0),u=Math.max(l.height+(s??0)*2,(e==null?void 0:e.height)??0),d=[{x:0,y:0},{x:c,y:0},{x:c+3*u/6,y:-u},{x:-3*u/6,y:-u}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=yt.svg(a),x=kt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${u/2})`),f&&p.attr("style",f)}else p=An(a,c,u,d);return n&&p.attr("style",n),e.width=c,e.height=u,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(e2,"inv_trapezoid");async function r2(t,e){const{shapeSvg:r,bbox:n,label:i}=await Mt(t,e,"label"),s=r.insert("rect",":first-child");return s.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),i.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),wt(e,s),e.intersect=function(l){return pt.rect(e,l)},r}v(r2,"labelRect");async function n2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:0,y:0},{x:u+3*c/6,y:0},{x:u,y:-c},{x:-(3*c)/6,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=yt.svg(a),x=kt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=An(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(n2,"lean_left");async function i2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*c/6,y:0},{x:u,y:0},{x:u+3*c/6,y:-c},{x:0,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=yt.svg(a),x=kt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=An(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(i2,"lean_right");function s2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.label="",e.labelStyle=r;const i=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),{cssStyles:s}=e,o=Math.max(35,(e==null?void 0:e.width)??0),a=Math.max(35,(e==null?void 0:e.height)??0),l=7,c=[{x:o,y:0},{x:0,y:a+l/2},{x:o-2*l,y:a+l/2},{x:0,y:2*a},{x:o,y:a-l/2},{x:2*l,y:a-l/2}],u=yt.svg(i),d=kt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const p=Qt(c),f=u.path(p,d),m=i.insert(()=>f,":first-child");return m.attr("class","outer-path"),s&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",s),n&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",n),m.attr("transform",`translate(-${o/2},${-a})`),wt(e,m),e.intersect=function(x){return tt.info("lightningBolt intersect",e,x),pt.polygon(e,c,x)},i}v(s2,"lightningBolt");var B8=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),A8=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),M8=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Yx=10,Vx=10;async function o2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?24:i;if(e.width||e.height){const y=e.width??0;e.width=(e.width??0)-s,e.width<Vx&&(e.width=Vx);const k=y/2/(2.5+y/50);e.height=(e.height??0)-o-k*3,e.height<Yx&&(e.height=Yx)}const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,At(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=u/2,p=d/(2.5+u/50),f=(e!=null&&e.height?e==null?void 0:e.height:l.height)+p+o*2,m=f*.1;let x;const{cssStyles:g}=e;if(e.look==="handDrawn"){const y=yt.svg(a),b=A8(0,0,u,f,d,p,m),k=M8(0,p,u,f,d,p),T=kt(e,{}),_=y.path(b,T),w=y.path(k,T);a.insert(()=>w,":first-child").attr("class","line"),x=a.insert(()=>_,":first-child"),x.attr("class","basic label-container"),g&&x.attr("style",g)}else{const y=B8(0,0,u,f,d,p,m);x=a.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",Oe(g)).attr("style",n)}return x.attr("label-offset-y",p),x.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),wt(e,x),c.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+p-(l.y-(l.top??0))})`),e.intersect=function(y){const b=pt.rect(e,y),k=b.x-(e.x??0);if(d!=0&&(Math.abs(k)<(e.width??0)/2||Math.abs(k)==(e.width??0)/2&&Math.abs(b.y-(e.y??0))>(e.height??0)/2-p)){let T=p*p*(1-k*k/(d*d));T>0&&(T=Math.sqrt(T)),T=p-T,y.y-(e.y??0)>0&&(T=-T),b.y+=T}return b},a}v(o2,"linedCylinder");async function a2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;if(e.width||e.height){const T=e.width;e.width=(T??0)*10/11-s*2,e.width<10&&(e.width=10),e.height=((e==null?void 0:e.height)??0)-o*2,e.height<10&&(e.height=10)}const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,At(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+(s??0)*2,d=(e!=null&&e.height?e==null?void 0:e.height:l.height)+(o??0)*2,p=e.look==="neo"?d/4:d/8,f=d+p,{cssStyles:m}=e,x=yt.svg(a),g=kt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:-u/2-u/2*.1,y:-f/2},{x:-u/2-u/2*.1,y:f/2},...ti(-u/2-u/2*.1,f/2,u/2+u/2*.1,f/2,p,.8),{x:u/2+u/2*.1,y:-f/2},{x:-u/2-u/2*.1,y:-f/2},{x:-u/2,y:-f/2},{x:-u/2,y:f/2*1.1},{x:-u/2,y:-f/2}],b=x.polygon(y.map(T=>[T.x,T.y]),g),k=a.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(0,${-p/2})`),c.attr("transform",`translate(${-u/2+(e.padding??0)+u/2*.1/2-(l.x-(l.left??0))},${-d/2+(e.padding??0)-p/2-(l.y-(l.top??0))})`),wt(e,k),e.intersect=function(T){return pt.polygon(e,y,T)},a}v(a2,"linedWaveEdgedRect");async function l2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=e.look==="neo"?10:5;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-s*2-2*a,10),e.height=Math.max(((e==null?void 0:e.height)??0)-o*2-2*a,10));const{shapeSvg:l,bbox:c,label:u}=await Mt(t,e,At(e)),d=(e!=null&&e.width?e==null?void 0:e.width:c.width)+s*2+2*a,p=(e!=null&&e.height?e==null?void 0:e.height:c.height)+o*2+2*a,f=d-2*a,m=p-2*a,x=-f/2,g=-m/2,{cssStyles:y}=e,b=yt.svg(l),k=kt(e,{}),T=[{x:x-a,y:g+a},{x:x-a,y:g+m+a},{x:x+f-a,y:g+m+a},{x:x+f-a,y:g+m},{x:x+f,y:g+m},{x:x+f,y:g+m-a},{x:x+f+a,y:g+m-a},{x:x+f+a,y:g-a},{x:x+a,y:g-a},{x:x+a,y:g},{x,y:g},{x,y:g+a}],_=[{x,y:g+a},{x:x+f-a,y:g+a},{x:x+f-a,y:g+m},{x:x+f,y:g+m},{x:x+f,y:g},{x,y:g}];e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const w=Qt(T);let N=b.path(w,k);const B=Qt(_);let I=b.path(B,k);e.look!=="handDrawn"&&(N=zd(N),I=zd(I));const E=l.insert("g",":first-child");return E.insert(()=>N),E.insert(()=>I),E.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),u.attr("transform",`translate(${-(c.width/2)-a-(c.x-(c.left??0))}, ${-(c.height/2)+a-(c.y-(c.top??0))})`),wt(e,E),e.intersect=function(P){return pt.polygon(e,T,P)},l}v(l2,"multiRect");async function c2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,At(e)),a=e.padding??0,l=e.look==="neo"?16:a,c=e.look==="neo"?12:a;let u=!0;(e.width||e.height)&&(u=!1,e.width=((e==null?void 0:e.width)??0)-l*2,e.height=((e==null?void 0:e.height)??0)-c*3);const d=Math.max(s.width,(e==null?void 0:e.width)??0)+l*2,p=Math.max(s.height,(e==null?void 0:e.height)??0)+c*3,f=e.look==="neo"?p/4:p/8,m=p+(u?f/2:-f/2),x=-d/2,g=-m/2,y=10,{cssStyles:b}=e,k=ti(x-y,g+m+y,x+d-y,g+m+y,f,.8),T=k==null?void 0:k[k.length-1],_=[{x:x-y,y:g+y},{x:x-y,y:g+m+y},...k,{x:x+d-y,y:T.y-y},{x:x+d,y:T.y-y},{x:x+d,y:T.y-2*y},{x:x+d+y,y:T.y-2*y},{x:x+d+y,y:g-y},{x:x+y,y:g-y},{x:x+y,y:g},{x,y:g},{x,y:g+y}],w=[{x,y:g+y},{x:x+d-y,y:g+y},{x:x+d-y,y:T.y-y},{x:x+d,y:T.y-y},{x:x+d,y:g},{x,y:g}],N=yt.svg(i),B=kt(e,{});e.look!=="handDrawn"&&(B.roughness=0,B.fillStyle="solid");const I=Qt(_),E=N.path(I,B),P=Qt(w),z=N.path(P,B),q=i.insert(()=>E,":first-child");return q.insert(()=>z),q.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&q.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&q.selectAll("path").attr("style",n),q.attr("transform",`translate(0,${-f/2})`),o.attr("transform",`translate(${-(s.width/2)-y-(s.x-(s.left??0))}, ${-(s.height/2)+y-f/2-(s.y-(s.top??0))})`),wt(e,q),e.intersect=function(R){return pt.polygon(e,_,R)},i}v(c2,"multiWaveEdgedRectangle");async function h2(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=vt(e);e.labelStyle=n,e.useHtmlLabels||hr(ye())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,At(e)),c=Math.max(a.width+(e.padding??0)*2,(e==null?void 0:e.width)??0),u=Math.max(a.height+(e.padding??0)*2,(e==null?void 0:e.height)??0),d=-c/2,p=-u/2,{cssStyles:f}=e,m=yt.svg(o),x=kt(e,{fill:r.noteBkgColor,stroke:r.noteBorderColor});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=m.rectangle(d,p,c,u,x),y=o.insert(()=>g,":first-child");return y.attr("class","basic label-container outer-path"),l.attr("class","label noteLabel"),f&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",f),i&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",i),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),wt(e,y),e.intersect=function(b){return pt.rect(e,b)},o}v(h2,"note");var I8=v((t,e,r)=>[`M${t+r/2},${e}`,`L${t+r},${e-r/2}`,`L${t+r/2},${e-r}`,`L${t},${e-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function u2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Mt(t,e,At(e)),o=s.width+(e.padding??0),a=s.height+(e.padding??0),l=o+a,c=.5,u=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const f=yt.svg(i),m=kt(e,{}),x=I8(0,0,l),g=f.path(x,m);d=i.insert(()=>g,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),p&&d.attr("style",p)}else d=An(i,l,l,u),d.attr("transform",`translate(${-l/2+c}, ${l/2})`);return n&&d.attr("style",n),wt(e,d),e.calcIntersect=function(f,m){const x=f.width,g=[{x:x/2,y:0},{x,y:-x/2},{x:x/2,y:-x},{x:0,y:-x/2}],y=pt.polygon(f,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(f){return this.calcIntersect(e,f)},i}v(u2,"question");async function d2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?21:i??0,o=e.look==="neo"?12:i??0,{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,At(e)),u=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s),d=((e==null?void 0:e.height)??l.height)+(e.look==="neo"?o*2:o),p=-u/2,f=-d/2,m=f/2,x=[{x:p+m,y:f},{x:p,y:0},{x:p+m,y:-f},{x:-p,y:-f},{x:-p,y:f}],{cssStyles:g}=e,y=yt.svg(a),b=kt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const k=Qt(x),T=y.path(k,b),_=a.insert(()=>T,":first-child");return _.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",g),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${-m/2},0)`),c.attr("transform",`translate(${-m/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),wt(e,_),e.intersect=function(w){return pt.polygon(e,x,w)},a}v(d2,"rect_left_inv_arrow");async function f2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;let i;e.cssClasses?i="node "+e.cssClasses:i="node default";const s=t.insert("g").attr("class",i).attr("id",e.domId||e.id),o=s.insert("g"),a=s.insert("g").attr("class","label").attr("style",n),l=e.description,c=e.label,u=await Hn(a,c,e.labelStyle,!0,!0);let d={width:0,height:0};if(hr(re())){const B=u.children[0],I=Yt(u);d=B.getBoundingClientRect(),I.attr("width",d.width),I.attr("height",d.height)}tt.info("Text 2",l);const p=l||[],f=u.getBBox(),m=await Hn(a,Array.isArray(p)?p.join("<br/>"):p,e.labelStyle,!0,!0),x=m.children[0],g=Yt(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;Yt(m).attr("transform","translate( "+(d.width>f.width?0:(f.width-d.width)/2)+", "+(f.height+y+5)+")"),Yt(u).attr("transform","translate( "+(d.width<f.width?0:-(f.width-d.width)/2)+", 0)"),d=a.node().getBBox(),a.attr("transform","translate("+-d.width/2+", "+(-d.height/2-y+3)+")");const b=d.width+(e.padding||0),k=d.height+(e.padding||0),T=-d.width/2-y,_=-d.height/2-y;let w,N;if(e.look==="handDrawn"){const B=yt.svg(s),I=kt(e,{}),E=B.path(oi(T,_,b,k,e.rx||0),I),P=B.line(-d.width/2-y,-d.height/2-y+f.height+y,d.width/2+y,-d.height/2-y+f.height+y,I);N=s.insert(()=>(tt.debug("Rough node insert CXC",E),P),":first-child"),w=s.insert(()=>(tt.debug("Rough node insert CXC",E),E),":first-child")}else w=o.insert("rect",":first-child"),N=o.insert("line"),w.attr("class","outer title-state").attr("style",n).attr("x",-d.width/2-y).attr("y",-d.height/2-y).attr("width",d.width+(e.padding||0)).attr("height",d.height+(e.padding||0)),N.attr("class","divider").attr("x1",-d.width/2-y).attr("x2",d.width/2+y).attr("y1",-d.height/2-y+f.height+y).attr("y2",-d.height/2-y+f.height+y);return wt(e,w),e.intersect=function(B){return pt.rect(e,B)},s}v(f2,"rectWithTitle");async function p2(t,e,{config:{themeVariables:r}}){const n=(r==null?void 0:r.radius)??5,i={rx:n,ry:n,labelPaddingX:((e==null?void 0:e.padding)??0)*1,labelPaddingY:((e==null?void 0:e.padding)??0)*1};return Js(t,e,i)}v(p2,"roundedRect");var pi=8;async function m2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?12:e.padding??0,{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,At(e)),c=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?pi:pi*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=c-pi,p=u,f=pi-c/2,m=-u/2,{cssStyles:x}=e,g=yt.svg(o),y=kt(e,{});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=[{x:f,y:m},{x:f+d,y:m},{x:f+d,y:m+p},{x:f-pi,y:m+p},{x:f-pi,y:m},{x:f,y:m},{x:f,y:m+p}],k=g.polygon(b.map(_=>[_.x,_.y]),y),T=o.insert(()=>k,":first-child");return T.attr("class","basic label-container outer-path").attr("style",Oe(x)),n&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",n),l.attr("transform",`translate(${pi/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),wt(e,T),e.intersect=function(_){return pt.rect(e,_)},o}v(m2,"shadedProcess");async function g2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-s*2,10),e.height=Math.max(((e==null?void 0:e.height)??0)/1.5-o*2,10));const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,At(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=((e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2)*1.5,p=u,f=d/1.5,m=-p/2,x=-f/2,{cssStyles:g}=e,y=yt.svg(a),b=kt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const k=[{x:m,y:x},{x:m,y:x+f},{x:m+p,y:x+f},{x:m+p,y:x-f/2}],T=Qt(k),_=y.path(T,b),w=a.insert(()=>_,":first-child");return w.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&w.selectChildren("path").attr("style",g),n&&e.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),w.attr("transform",`translate(0, ${f/4})`),c.attr("transform",`translate(${-p/2+(e.padding??0)-(l.x-(l.left??0))}, ${-f/4+(e.padding??0)-(l.y-(l.top??0))})`),wt(e,w),e.intersect=function(N){return pt.polygon(e,k,N)},a}v(g2,"slopedRect");async function x2(t,e){const r=e.padding??0,n=e.look==="neo"?16:r*2,i=e.look==="neo"?12:r,s={rx:0,ry:0,labelPaddingX:e.labelPaddingX??n,labelPaddingY:i};return Js(t,e,s)}v(x2,"squareRect");async function y2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?20:i,o=e.look==="neo"?12:i,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=l.height+(e.look==="neo"?o*2:o),u=l.width+c/4+(e.look==="neo"?s*2:s),d=c/2,{cssStyles:p}=e,f=yt.svg(a),m=kt(e,{});e.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const x=[{x:-u/2+d,y:-c/2},{x:u/2-d,y:-c/2},...ua(-u/2+d,0,d,50,90,270),{x:u/2-d,y:c/2},...ua(u/2-d,0,d,50,270,450)],g=Qt(x),y=f.path(g,m),b=a.insert(()=>y,":first-child");return b.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",p),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),wt(e,b),e.intersect=function(k){return pt.polygon(e,x,k)},a}v(y2,"stadium");async function b2(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return Js(t,e,r)}v(b2,"state");function C2(t,e,{config:{themeVariables:r}}){var b,k;const{labelStyles:n,nodeStyles:i}=vt(e);e.labelStyle=n;const{cssStyles:s}=e,{lineColor:o,stateBorder:a,nodeBorder:l,nodeShadow:c}=r;(e.width||e.height)&&((e.width??0)<14&&(e.width=14),(e.height??0)<14&&(e.height=14)),e.width||(e.width=14),e.height||(e.height=14);const u=t.insert("g").attr("class","node default").attr("id",e.domId??e.id),d=yt.svg(u),p=kt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const f=d.circle(0,0,e.width,{...p,stroke:o,strokeWidth:2}),m=a??l,x=(e.width??0)*5/14,g=d.circle(0,0,x,{...p,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),y=u.insert(()=>f,":first-child");if(y.insert(()=>g),e.look!=="handDrawn"&&y.attr("class","outer-path"),s&&y.selectAll("path").attr("style",s),i&&y.selectAll("path").attr("style",i),e.width<25&&c&&e.look!=="handDrawn"){const T=((k=(b=t.node())==null?void 0:b.ownerSVGElement)==null?void 0:k.id)??"",_=T?`${T}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${_})`)}return wt(e,y),e.intersect=function(T){return pt.circle(e,(e.width??0)/2,T)},u}v(C2,"stateEnd");function k2(t,e,{config:{themeVariables:r}}){var a,l;const{lineColor:n,nodeShadow:i}=r;(e.width||e.height)&&((e.width??0)<14&&(e.width=14),(e.height??0)<14&&(e.height=14)),e.width||(e.width=14),e.height||(e.height=14);const s=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let o;if(e.look==="handDrawn"){const u=yt.svg(s).circle(0,0,e.width,q6(n));o=s.insert(()=>u),o.attr("class","state-start").attr("r",(e.width??7)/2).attr("width",e.width??14).attr("height",e.height??14)}else o=s.insert("circle",":first-child"),o.attr("class","state-start").attr("r",(e.width??7)/2).attr("width",e.width??14).attr("height",e.height??14);if(e.width<25&&i&&e.look!=="handDrawn"){const c=((l=(a=t.node())==null?void 0:a.ownerSVGElement)==null?void 0:l.id)??"",u=c?`${c}-drop-shadow-small`:"drop-shadow-small";o.attr("style",`filter:url(#${u})`)}return wt(e,o),e.intersect=function(c){return pt.circle(e,(e.width??7)/2,c)},s}v(k2,"stateStart");var Qi=8;async function v2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=(e==null?void 0:e.padding)??8,s=e.look==="neo"?28:i,o=e.look==="neo"?12:i,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=((e==null?void 0:e.width)??l.width)+2*Qi+s,u=((e==null?void 0:e.height)??l.height)+o,d=c-2*Qi,p=u,f=-c/2,m=-u/2,x=[{x:0,y:0},{x:d,y:0},{x:d,y:-p},{x:0,y:-p},{x:0,y:0},{x:-8,y:0},{x:d+8,y:0},{x:d+8,y:-p},{x:-8,y:-p},{x:-8,y:0}];if(e.look==="handDrawn"){const g=yt.svg(a),y=kt(e,{}),b=g.rectangle(f,m,d+16,p,y),k=g.line(f+Qi,m,f+Qi,m+p,y),T=g.line(f+Qi+d,m,f+Qi+d,m+p,y);a.insert(()=>k,":first-child"),a.insert(()=>T,":first-child");const _=a.insert(()=>b,":first-child"),{cssStyles:w}=e;_.attr("class","basic label-container").attr("style",Oe(w)),wt(e,_)}else{const g=An(a,d,p,x);n&&g.attr("style",n),wt(e,g)}return e.intersect=function(g){return pt.polygon(e,x,g)},a}v(v2,"subroutine");var pu=.2;async function w2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;(e.width||e.height)&&(e.height=Math.max(((e==null?void 0:e.height)??0)-o*2,10),e.width=Math.max(((e==null?void 0:e.width)??0)-s*2-pu*(e.height+o*2),10));const{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2,u=pu*c,d=pu*c,f=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2+u-u,m=c,x=-f/2,g=-m/2,{cssStyles:y}=e,b=yt.svg(a),k=kt(e,{}),T=[{x:x-u/2,y:g},{x:x+f+u/2,y:g},{x:x+f+u/2,y:g+m},{x:x-u/2,y:g+m}],_=[{x:x+f-u/2,y:g+m},{x:x+f+u/2,y:g+m},{x:x+f+u/2,y:g+m-d}];e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const w=Qt(T),N=b.path(w,k),B=Qt(_),I=b.path(B,{...k,fillStyle:"solid"}),E=a.insert(()=>I,":first-child");return E.insert(()=>N,":first-child"),E.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),wt(e,E),e.intersect=function(P){return pt.polygon(e,T,P)},a}v(w2,"taggedRect");async function S2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,At(e)),a=Math.max(s.width+(e.padding??0)*2,(e==null?void 0:e.width)??0),l=Math.max(s.height+(e.padding??0)*2,(e==null?void 0:e.height)??0),c=l/8,u=.2*a,d=.2*l,p=l+c,{cssStyles:f}=e,m=yt.svg(i),x=kt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:p/2},...ti(-a/2-a/2*.1,p/2,a/2+a/2*.1,p/2,c,.8),{x:a/2+a/2*.1,y:-p/2},{x:-a/2-a/2*.1,y:-p/2}],y=-a/2+a/2*.1,b=-p/2-d*.4,k=[{x:y+a-u,y:(b+l)*1.3},{x:y+a,y:b+l-d},{x:y+a,y:(b+l)*.9},...ti(y+a,(b+l)*1.25,y+a-u,(b+l)*1.3,-l*.02,.5)],T=Qt(g),_=m.path(T,x),w=Qt(k),N=m.path(w,{...x,fillStyle:"solid"}),B=i.insert(()=>N,":first-child");return B.insert(()=>_,":first-child"),B.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",n),B.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-a/2+(e.padding??0)-(s.x-(s.left??0))},${-l/2+(e.padding??0)-c/2-(s.y-(s.top??0))})`),wt(e,B),e.intersect=function(I){return pt.polygon(e,g,I)},i}v(S2,"taggedWaveEdgedRectangle");async function T2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Mt(t,e,At(e)),o=Math.max(s.width+(e.padding??0),(e==null?void 0:e.width)||0),a=Math.max(s.height+(e.padding??0),(e==null?void 0:e.height)||0),l=-o/2,c=-a/2,u=i.insert("rect",":first-child");return u.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",l).attr("y",c).attr("width",o).attr("height",a),wt(e,u),e.intersect=function(d){return pt.rect(e,d)},i}v(T2,"text");var F8=v((t,e,r,n,i,s)=>`M${t},${e}
|
|
576
|
-
a${i},${s} 0,0,1 0,${-n}
|
|
577
|
-
l${r},0
|
|
578
|
-
a${i},${s} 0,0,1 0,${n}
|
|
579
|
-
M${r},${-n}
|
|
580
|
-
a${i},${s} 0,0,0 0,${n}
|
|
581
|
-
l${-r},0`,"createCylinderPathD"),P8=v((t,e,r,n,i,s)=>[`M${t},${e}`,`M${t+r},${e}`,`a${i},${s} 0,0,0 0,${-n}`,`l${-r},0`,`a${i},${s} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),D8=v((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),Xx=5,Kx=10;async function _2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?12:i/2;if(e.width||e.height){const x=e.height??0;e.height=(e.height??0)-s,e.height<Xx&&(e.height=Xx);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<Kx&&(e.width=Kx)}const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,At(e)),c=(e.height?e.height:a.height)+s,u=c/2,d=u/(2.5+c/50),p=(e.width?e.width:a.width)+d+s,{cssStyles:f}=e;let m;if(e.look==="handDrawn"){const x=yt.svg(o),g=P8(0,0,p,c,d,u),y=D8(0,0,p,c,d,u),b=x.path(g,kt(e,{})),k=x.path(y,kt(e,{fill:"none"}));m=o.insert(()=>k,":first-child"),m=o.insert(()=>b,":first-child"),m.attr("class","basic label-container"),f&&m.attr("style",f)}else{const x=F8(0,0,p,c,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",Oe(f)).attr("style",n),m.attr("class","basic label-container outer-path"),f&&m.selectAll("path").attr("style",f),n&&m.selectAll("path").attr("style",n)}return m.attr("label-offset-x",d),m.attr("transform",`translate(${-p/2}, ${c/2} )`),l.attr("transform",`translate(${-(a.width/2)-d-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),wt(e,m),e.intersect=function(x){const g=pt.rect(e,x),y=g.y-(e.y??0);if(u!=0&&(Math.abs(y)<(e.height??0)/2||Math.abs(y)==(e.height??0)/2&&Math.abs(g.x-(e.x??0))>(e.width??0)/2-d)){let b=d*d*(1-y*y/(u*u));b!=0&&(b=Math.sqrt(Math.abs(b))),b=d-b,x.x-(e.x??0)>0&&(b=-b),g.x+=b}return g},o}v(_2,"tiltedCylinder");async function E2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=(e.look==="neo",i),o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*c/6,y:0},{x:u+3*c/6,y:0},{x:u,y:-c},{x:0,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=yt.svg(a),x=kt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=An(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(E2,"trapezoid");async function N2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=15,l=5;(e.width||e.height)&&(e.height=(e.height??0)-o*2,e.height<l&&(e.height=l),e.width=(e.width??0)-s*2,e.width<a&&(e.width=a));const{shapeSvg:c,bbox:u}=await Mt(t,e,At(e)),d=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2,p=(e!=null&&e.height?e==null?void 0:e.height:u.height)+o*2,{cssStyles:f}=e,m=yt.svg(c),x=kt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-d/2*.8,y:-p/2},{x:d/2*.8,y:-p/2},{x:d/2,y:-p/2*.6},{x:d/2,y:p/2},{x:-d/2,y:p/2},{x:-d/2,y:-p/2*.6}],y=Qt(g),b=m.path(y,x),k=c.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),wt(e,k),e.intersect=function(T){return pt.polygon(e,g,T)},c}v(N2,"trapezoidalPentagon");var Zx=10,Qx=10;async function j2(t,e){var T;const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?i*2:i;(e.width||e.height)&&(e.width=(((e==null?void 0:e.width)??0)-s)/2,e.width<Qx&&(e.width=Qx),e.height=(e==null?void 0:e.height)??0,e.height<Zx&&(e.height=Zx));const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,At(e)),c=Ln((T=re().flowchart)==null?void 0:T.htmlLabels),u=(e!=null&&e.width?e==null?void 0:e.width:a.width)+s,d=e!=null&&e.height?e==null?void 0:e.height:u+a.height,p=d,f=[{x:0,y:0},{x:p,y:0},{x:p/2,y:-d}],{cssStyles:m}=e,x=yt.svg(o),g=kt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Qt(f),b=x.path(y,g),k=o.insert(()=>b,":first-child").attr("transform",`translate(${-d/2}, ${d/2})`).attr("class","outer-path");return m&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),e.width=u,e.height=d,wt(e,k),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${d/2-(a.height+(e.padding??0)/(c?2:1)-(a.y-(a.top??0)))})`),e.intersect=function(_){return tt.info("Triangle intersect",e,f,_),pt.polygon(e,f,_)},o}v(j2,"triangle");async function L2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;let a=!0;(e.width||e.height)&&(a=!1,e.width=((e==null?void 0:e.width)??0)-s*2,e.width<10&&(e.width=10),e.height=((e==null?void 0:e.height)??0)-o*2,e.height<10&&(e.height=10));const{shapeSvg:l,bbox:c,label:u}=await Mt(t,e,At(e)),d=(e!=null&&e.width?e==null?void 0:e.width:c.width)+(s??0)*2,p=(e!=null&&e.height?e==null?void 0:e.height:c.height)+(o??0)*2,f=e.look==="neo"?p/4:p/8,m=p+(a?f:-f),{cssStyles:x}=e,y=14-d,b=y>0?y/2:0,k=yt.svg(l),T=kt(e,{});e.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const _=[{x:-d/2-b,y:m/2},...ti(-d/2-b,m/2,d/2+b,m/2,f,.8),{x:d/2+b,y:-m/2},{x:-d/2-b,y:-m/2}],w=Qt(_),N=k.path(w,T),B=l.insert(()=>N,":first-child");return B.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",n),B.attr("transform",`translate(0,${-f/2})`),u.attr("transform",`translate(${-d/2+(e.padding??0)-(c.x-(c.left??0))},${-p/2+(e.padding??0)-f-(c.y-(c.top??0))})`),wt(e,B),e.intersect=function(I){return pt.polygon(e,_,I)},l}v(L2,"waveEdgedRectangle");async function B2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?20:i;if(e.width||e.height){e.width=(e==null?void 0:e.width)??0,e.width<20&&(e.width=20),e.height=(e==null?void 0:e.height)??0,e.height<10&&(e.height=10);const T=Math.min(e.height*.2,e.height/4);e.height=Math.ceil(e.height-o-T*(20/9)),e.width=e.width-s*2}const{shapeSvg:a,bbox:l}=await Mt(t,e,At(e)),c=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,u=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o,d=u/8,p=u+d*2,{cssStyles:f}=e,m=yt.svg(a),x=kt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-c/2,y:p/2},...ti(-c/2,p/2,c/2,p/2,d,1),{x:c/2,y:-p/2},...ti(c/2,-p/2,-c/2,-p/2,d,-1)],y=Qt(g),b=m.path(y,x),k=a.insert(()=>b,":first-child");return k.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),wt(e,k),e.intersect=function(T){return pt.polygon(e,g,T)},a}v(B2,"waveRectangle");var ke=10;async function A2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?12:e.padding??0;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-i*2-ke,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-ke,10));const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,At(e)),c=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+ke,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+ke,d=c-ke,p=u-ke,f=-d/2,m=-p/2,{cssStyles:x}=e,g=yt.svg(o),y=kt(e,{}),b=[{x:f-ke,y:m-ke},{x:f-ke,y:m+p},{x:f+d,y:m+p},{x:f+d,y:m-ke}],k=`M${f-ke},${m-ke} L${f+d},${m-ke} L${f+d},${m+p} L${f-ke},${m+p} L${f-ke},${m-ke}
|
|
582
|
-
M${f-ke},${m} L${f+d},${m}
|
|
583
|
-
M${f},${m-ke} L${f},${m+p}`;e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const T=g.path(k,y),_=o.insert(()=>T,":first-child");return _.attr("transform",`translate(${ke/2}, ${ke/2})`),_.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),l.attr("transform",`translate(${-(a.width/2)+ke/2-(a.x-(a.left??0))}, ${-(a.height/2)+ke/2-(a.y-(a.top??0))})`),wt(e,_),e.intersect=function(w){return pt.polygon(e,b,w)},o}v(A2,"windowPane");var Jx=new Set(["redux-color","redux-dark-color"]),O8=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function Hp(t,e){var st,It,ht,ot;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=ye(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:Y}=ye(),{background:lt}=Y,xt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${lt}`]};await Hp(t,xt)}const c=ye();e.useHtmlLabels=c.htmlLabels;let u=((st=c.er)==null?void 0:st.diagramPadding)??10,d=((It=c.er)==null?void 0:It.entityPadding)??6;const{cssStyles:p}=e,{labelStyles:f,nodeStyles:m}=vt(e);if(r.attributes.length===0&&e.label){const Y={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};Nn(e.label,c)+Y.labelPaddingX*2<c.er.minEntityWidth&&(e.width=c.er.minEntityWidth);const lt=await Js(t,e,Y);if(n!=null&&Jx.has(n)){const xt=r.colorIndex??0;lt.attr("data-color-id",`color-${xt%l.length}`)}if(!Ln(c.htmlLabels)){const xt=lt.select("text"),Nt=(ht=xt.node())==null?void 0:ht.getBBox();xt.attr("transform",`translate(${-Nt.width/2}, 0)`)}return lt}c.htmlLabels||(u*=1.25,d*=1.25);let x=At(e);x||(x="node default");const g=t.insert("g").attr("class",x).attr("id",e.domId||e.id),y=await cs(g,e.label??"",c,0,0,["name"],f);y.height+=d;let b=0;const k=[],T=[];let _=0,w=0,N=0,B=0,I=!0,E=!0;for(const Y of r.attributes){const lt=await cs(g,Y.type,c,0,b,["attribute-type"],f);_=Math.max(_,lt.width+u);const xt=await cs(g,Y.name,c,0,b,["attribute-name"],f);w=Math.max(w,xt.width+u);const Nt=await cs(g,Y.keys.join(),c,0,b,["attribute-keys"],f);N=Math.max(N,Nt.width+u);const Dt=await cs(g,Y.comment,c,0,b,["attribute-comment"],f);B=Math.max(B,Dt.width+u);const le=Math.max(lt.height,xt.height,Nt.height,Dt.height)+d;T.push({yOffset:b,rowHeight:le}),b+=le}let P=4;N<=u&&(I=!1,N=0,P--),B<=u&&(E=!1,B=0,P--);const z=g.node().getBBox();if(y.width+u*2-(_+w+N+B)>0){const Y=y.width+u*2-(_+w+N+B);_+=Y/P,w+=Y/P,N>0&&(N+=Y/P),B>0&&(B+=Y/P)}const q=_+w+N+B,R=yt.svg(g),F=kt(e,{});e.look!=="handDrawn"&&(F.roughness=0,F.fillStyle="solid");let M=0;T.length>0&&(M=T.reduce((Y,lt)=>Y+((lt==null?void 0:lt.rowHeight)??0),0));const D=Math.max(z.width+u*2,(e==null?void 0:e.width)||0,q),O=Math.max((M??0)+y.height,(e==null?void 0:e.height)||0),j=-D/2,S=-O/2;if(g.selectAll("g:not(:first-child)").each((Y,lt,xt)=>{const Nt=Yt(xt[lt]),Dt=Nt.attr("transform");let le=0,be=0;if(Dt){const Kt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Dt);Kt&&(le=parseFloat(Kt[1]),be=parseFloat(Kt[2]),Nt.attr("class").includes("attribute-name")?le+=_:Nt.attr("class").includes("attribute-keys")?le+=_+w:Nt.attr("class").includes("attribute-comment")&&(le+=_+w+N))}Nt.attr("transform",`translate(${j+u/2+le}, ${be+S+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(S+d/2)+")"),n!=null&&Jx.has(n)){const Y=r.colorIndex??0;g.attr("data-color-id",`color-${Y%l.length}`)}const G=R.rectangle(j,S,D,O,F),Q=g.insert(()=>G,":first-child").attr("class","outer-path").attr("style",p.join(""));k.push(0);for(const[Y,lt]of T.entries()){const Nt=(Y+1)%2===0&<.yOffset!==0,Dt=R.rectangle(j,y.height+S+(lt==null?void 0:lt.yOffset),D,lt==null?void 0:lt.rowHeight,{...F,fill:Nt?s:o,stroke:a});g.insert(()=>Dt,"g.label").attr("style",p.join("")).attr("class",`row-rect-${Nt?"even":"odd"}`)}const A=1e-4;let ct=hs(j,y.height+S,D+j,y.height+S,A),ut=R.polygon(ct.map(Y=>[Y.x,Y.y]),F);if(g.insert(()=>ut).attr("class","divider"),ct=hs(_+j,y.height+S,_+j,O+S,A),ut=R.polygon(ct.map(Y=>[Y.x,Y.y]),F),g.insert(()=>ut).attr("class","divider"),I){const Y=_+w+j;ct=hs(Y,y.height+S,Y,O+S,A),ut=R.polygon(ct.map(lt=>[lt.x,lt.y]),F),g.insert(()=>ut).attr("class","divider")}if(E){const Y=_+w+N+j;ct=hs(Y,y.height+S,Y,O+S,A),ut=R.polygon(ct.map(lt=>[lt.x,lt.y]),F),g.insert(()=>ut).attr("class","divider")}for(const Y of k){const lt=y.height+S+Y;ct=hs(j,lt,D+j,lt,A),ut=R.polygon(ct.map(xt=>[xt.x,xt.y]),F),g.insert(()=>ut).attr("class","divider")}if(wt(e,Q),m&&e.look!=="handDrawn")if(n!=null&&O8.has(n))g.selectAll("path").attr("style",m);else{const Y=m.split(";"),lt=(ot=Y==null?void 0:Y.filter(xt=>xt.includes("stroke")))==null?void 0:ot.map(xt=>`${xt}`).join("; ");g.selectAll("path").attr("style",lt??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(Y){return pt.rect(e,Y)},g}v(Hp,"erBox");async function cs(t,e,r,n=0,i=0,s=[],o=""){const a=t.insert("g").attr("class",`label ${s.join(" ")}`).attr("transform",`translate(${n}, ${i})`).attr("style",o);e!==qg(e)&&(e=qg(e),e=e.replaceAll("<","<").replaceAll(">",">"));const l=a.node().appendChild(await Bn(a,e,{width:Nn(e,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(e.includes("<")||e.includes(">")){let u=l.children[0];for(u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">")}let c=l.getBBox();if(Ln(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const d=Yt(l);c=u.getBoundingClientRect(),d.attr("width",c.width),d.attr("height",c.height)}return c}v(cs,"addText");function hs(t,e,r,n,i){return t===r?[{x:t-i/2,y:e},{x:t+i/2,y:e},{x:r+i/2,y:n},{x:r-i/2,y:n}]:[{x:t,y:e-i/2},{x:t,y:e+i/2},{x:r,y:n+i/2},{x:r,y:n-i/2}]}v(hs,"lineToPolygon");async function M2(t,e,r,n,i=r.class.padding??12){const s=n?0:3,o=t.insert("g").attr("class",At(e)).attr("id",e.domId||e.id);let a=null,l=null,c=null,u=null,d=0,p=0,f=0;if(a=o.insert("g").attr("class","annotation-group text"),e.annotations.length>0){const b=e.annotations[0];await Ro(a,{text:`«${b}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await Ro(l,e,0,["font-weight: bolder"]);const m=l.node().getBBox();p=m.height,c=o.insert("g").attr("class","members-group text");let x=0;for(const b of e.members){const k=await Ro(c,b,x,[b.parseClassifier()]);x+=k+s}f=c.node().getBBox().height,f<=0&&(f=i/2),u=o.insert("g").attr("class","methods-group text");let g=0;for(const b of e.methods){const k=await Ro(u,b,g,[b.parseClassifier()]);g+=k+s}let y=o.node().getBBox();if(a!==null){const b=a.node().getBBox();a.attr("transform",`translate(${-b.width/2})`)}return l.attr("transform",`translate(${-m.width/2}, ${d})`),y=o.node().getBBox(),c.attr("transform",`translate(0, ${d+p+i*2})`),y=o.node().getBBox(),u.attr("transform",`translate(0, ${d+p+(f?f+i*4:i*2)})`),y=o.node().getBBox(),{shapeSvg:o,bbox:y}}v(M2,"textHelper");async function Ro(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=ye();let o="useHtmlLabels"in e?e.useHtmlLabels:Ln(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),ra(a)&&(o=!0);const l=await Bn(i,Jf(Bi(a)),{width:Nn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let c,u=1;if(o){const d=l.children[0],p=Yt(l);u=d.innerHTML.split("<br>").length,d.innerHTML.includes("</math>")&&(u+=d.innerHTML.split("<mrow>").length-1);const f=d.getElementsByTagName("img");if(f){const m=a.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...f].map(x=>new Promise(g=>{function y(){var b;if(x.style.display="flex",x.style.flexDirection="column",m){const k=((b=s.fontSize)==null?void 0:b.toString())??window.getComputedStyle(document.body).fontSize,_=parseInt(k,10)*5+"px";x.style.minWidth=_,x.style.maxWidth=_}else x.style.width="100%";g(x)}v(y,"setupImage"),setTimeout(()=>{x.complete&&y()}),x.addEventListener("error",y),x.addEventListener("load",y)})))}c=d.getBoundingClientRect(),p.attr("width",c.width),p.attr("height",c.height)}else{n.includes("font-weight: bolder")&&Yt(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const d=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(d.textContent=a[0]+a.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),a[1]===" "&&(d.textContent=d.textContent[0]+" "+d.textContent.substring(1))),d.textContent==="undefined"&&(d.textContent=""),c=l.getBBox()}return i.attr("transform","translate(0,"+(-c.height/(2*u)+r)+")"),c.height}v(Ro,"addText");async function I2(t,e){var R,F;const r=re(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??Ln(r.htmlLabels)??!0,l=e;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];const{shapeSvg:c,bbox:u}=await M2(t,e,r,a,o),{labelStyles:d,nodeStyles:p}=vt(e);e.labelStyle=d,e.cssStyles=l.styles||"";const f=((R=l.styles)==null?void 0:R.join(";"))||p||"";e.cssStyles||(e.cssStyles=f.replaceAll("!important","").split(";"));const m=l.members.length===0&&l.methods.length===0&&!((F=r.class)!=null&&F.hideEmptyMembersBox),x=yt.svg(c),g=kt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Math.max(e.width??0,u.width);let b=Math.max(e.height??0,u.height);const k=(e.height??0)>u.height;l.members.length===0&&l.methods.length===0?b+=o:l.members.length>0&&l.methods.length===0&&(b+=o*2);const T=-y/2,_=-b/2;let w=m?s*2:l.members.length===0&&l.methods.length===0?-s:0;k&&(w=s*2);const N=x.rectangle(T-s,_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0),y+2*s,b+2*s+w,g),B=c.insert(()=>N,":first-child");B.attr("class","basic label-container outer-path");const I=B.node().getBBox(),E=c.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,P=c.select(".label-group").node().getBBox().height-(m?s/2:0)||0,z=c.select(".members-group").node().getBBox().height-(m?s/2:0)||0,q=(E+P+_+s-(_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(c.selectAll(".text").each((M,D,O)=>{var ct,ut;const j=Yt(O[D]),S=j.attr("transform");let G=0;if(S){const It=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(S);It&&(G=parseFloat(It[2]))}let Q=G+_+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(j.attr("class").includes("methods-group")){const st=Math.max(z,o/2);k?Q=Math.max(q,E+P+st+_+o*2+s)+o*2:Q=E+P+st+_+o*4+s}l.members.length===0&&l.methods.length===0&&((ct=r.class)!=null&&ct.hideEmptyMembersBox)&&(l.annotations.length>0?Q=G-o:Q=G),a||(Q-=4);let A=T;(j.attr("class").includes("label-group")||j.attr("class").includes("annotation-group"))&&(A=-((ut=j.node())==null?void 0:ut.getBBox().width)/2||0,c.selectAll("text").each(function(st,It,ht){window.getComputedStyle(ht[It]).textAnchor==="middle"&&(A=0)})),j.attr("transform",`translate(${A}, ${Q})`)}),l.members.length>0||l.methods.length>0||m){const M=E+P+_+s,D=x.line(I.x,M,I.x+I.width,M+.001,g);c.insert(()=>D).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(m||l.members.length>0||l.methods.length>0){const M=E+P+z+_+o*2+s,D=x.line(I.x,k?Math.max(q,M):M,I.x+I.width,(k?Math.max(q,M):M)+.001,g);c.insert(()=>D).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(l.look!=="handDrawn"&&c.selectAll("path").attr("style",f),B.select(":nth-child(2)").attr("style",f),c.selectAll(".divider").select("path").attr("style",f),e.labelStyle?c.selectAll("span").attr("style",e.labelStyle):c.selectAll("span").attr("style",f),!a){const M=RegExp(/color\s*:\s*([^;]*)/),D=M.exec(f);if(D){const O=D[0].replace("color","fill");c.selectAll("tspan").attr("style",O)}else if(d){const O=M.exec(d);if(O){const j=O[0].replace("color","fill");c.selectAll("tspan").attr("style",j)}}}return wt(e,B),e.intersect=function(M){return pt.rect(e,M)},c}v(I2,"classBox");async function F2(t,e){var I,E;const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,c=At(e),{themeVariables:u}=re(),{borderColorArray:d,requirementEdgeLabelBackground:p}=u,f=t.insert("g").attr("class",c).attr("id",e.domId??e.id);let m;l?m=await nn(f,`<<${i.type}>>`,0,e.labelStyle):m=await nn(f,"<<Element>>",0,e.labelStyle);let x=m;const g=await nn(f,i.name,x,e.labelStyle+"; font-weight: bold;");if(x+=g+a,l){const P=await nn(f,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=P;const z=await nn(f,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=z;const q=await nn(f,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=q,await nn(f,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const P=await nn(f,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=P,await nn(f,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((I=f.node())==null?void 0:I.getBBox().width)??200)+o,b=(((E=f.node())==null?void 0:E.getBBox().height)??200)+o,k=-y/2,T=-b/2,_=yt.svg(f),w=kt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const N=_.rectangle(k,T,y,b,w),B=f.insert(()=>N,":first-child");if(B.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const P=e.colorIndex??0;f.attr("data-color-id",`color-${P%d.length}`)}if(f.selectAll(".label").each((P,z,q)=>{const R=Yt(q[z]),F=R.attr("transform");let M=0,D=0;if(F){const G=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(F);G&&(M=parseFloat(G[1]),D=parseFloat(G[2]))}const O=D-b/2;let j=k+o/2;(z===0||z===1)&&(j=M),R.attr("transform",`translate(${j}, ${O+o})`)}),x>m+g+a){const P=T+m+g+a;let z;if(e.look==="neo"){const F=[[k,P],[k+y,P],[k+y,P+.001],[k,P+.001]];z=_.polygon(F,w)}else z=_.line(k,P,k+y,P,w);f.insert(()=>z).attr("class","divider")}return wt(e,B),e.intersect=function(P){return pt.rect(e,P)},n&&e.look!=="handDrawn"&&(p||d!=null&&d.length)&&f.selectAll("path").attr("style",n),f}v(F2,"requirementBox");async function nn(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=re(),o=s.htmlLabels??!0,a=await Bn(i,Jf(Bi(e)),{width:Nn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let l;if(o){const c=a.children[0],u=Yt(a);l=c.getBoundingClientRect(),u.attr("width",l.width),u.attr("height",l.height)}else{const c=a.children[0];for(const u of c.children)n&&u.setAttribute("style",n);l=a.getBBox(),l.height+=6}return i.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}v(nn,"addText");var R8=v(t=>{switch(t){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function P2(t,e,{config:r}){var z,q;const{labelStyles:n,nodeStyles:i}=vt(e);e.labelStyle=n||"";const s=10,o=e.width;e.width=(e.width??200)-10;const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,At(e)),u=e.padding||10;let d="",p;"ticket"in e&&e.ticket&&((z=r==null?void 0:r.kanban)!=null&&z.ticketBaseUrl)&&(d=(q=r==null?void 0:r.kanban)==null?void 0:q.ticketBaseUrl.replace("#TICKET#",e.ticket),p=a.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",d).attr("target","_blank"));const f={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1};let m,x;p?{label:m,bbox:x}=await fu(p,"ticket"in e&&e.ticket||"",f):{label:m,bbox:x}=await fu(a,"ticket"in e&&e.ticket||"",f);const{label:g,bbox:y}=await fu(a,"assigned"in e&&e.assigned||"",f);e.width=o;const b=10,k=(e==null?void 0:e.width)||0,T=Math.max(x.height,y.height)/2,_=Math.max(l.height+b*2,(e==null?void 0:e.height)||0)+T,w=-k/2,N=-_/2;c.attr("transform","translate("+(u-k/2)+", "+(-T-l.height/2)+")"),m.attr("transform","translate("+(u-k/2)+", "+(-T+l.height/2)+")"),g.attr("transform","translate("+(u+k/2-y.width-2*s)+", "+(-T+l.height/2)+")");let B;const{rx:I,ry:E}=e,{cssStyles:P}=e;if(e.look==="handDrawn"){const R=yt.svg(a),F=kt(e,{}),M=I||E?R.path(oi(w,N,k,_,I||0),F):R.rectangle(w,N,k,_,F);B=a.insert(()=>M,":first-child"),B.attr("class","basic label-container").attr("style",P||null)}else{B=a.insert("rect",":first-child"),B.attr("class","basic label-container __APA__").attr("style",i).attr("rx",I??5).attr("ry",E??5).attr("x",w).attr("y",N).attr("width",k).attr("height",_);const R="priority"in e&&e.priority;if(R){const F=a.append("line"),M=w+2,D=N+Math.floor((I??0)/2),O=N+_-Math.floor((I??0)/2);F.attr("x1",M).attr("y1",D).attr("x2",M).attr("y2",O).attr("stroke-width","4").attr("stroke",R8(R))}}return wt(e,B),e.height=_,e.intersect=function(R){return pt.rect(e,R)},a}v(P2,"kanbanItem");async function D2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Mt(t,e,At(e)),l=s.width+10*o,c=s.height+8*o,u=.15*l,{cssStyles:d}=e,p=s.width+20,f=s.height+20,m=Math.max(l,p),x=Math.max(c,f);a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let g;const y=`M0 0
|
|
584
|
-
a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
|
|
585
|
-
a${u},${u} 1 0,0 ${m*.25},0
|
|
586
|
-
a${u},${u} 1 0,0 ${m*.25},0
|
|
587
|
-
a${u},${u} 1 0,0 ${m*.25},${x*.1}
|
|
588
|
-
|
|
589
|
-
a${u},${u} 1 0,0 ${m*.15},${x*.33}
|
|
590
|
-
a${u*.8},${u*.8} 1 0,0 0,${x*.34}
|
|
591
|
-
a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
|
|
592
|
-
|
|
593
|
-
a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
|
|
594
|
-
a${u},${u} 1 0,0 ${-1*m*.25},0
|
|
595
|
-
a${u},${u} 1 0,0 ${-1*m*.25},0
|
|
596
|
-
a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
|
|
597
|
-
|
|
598
|
-
a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
|
|
599
|
-
a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
|
|
600
|
-
a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
|
|
601
|
-
H0 V0 Z`;if(e.look==="handDrawn"){const b=yt.svg(i),k=kt(e,{}),T=b.path(y,k);g=i.insert(()=>T,":first-child"),g.attr("class","basic label-container").attr("style",Oe(d))}else g=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return g.attr("transform",`translate(${-m/2}, ${-x/2})`),wt(e,g),e.calcIntersect=function(b,k){return pt.rect(b,k)},e.intersect=function(b){return tt.info("Bang intersect",e,b),pt.rect(e,b)},i}v(D2,"bang");async function O2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Mt(t,e,At(e)),l=s.width+2*o,c=s.height+2*o,u=.15*l,d=.25*l,p=.35*l,f=.2*l,{cssStyles:m}=e;let x;const g=`M0 0
|
|
602
|
-
a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
|
|
603
|
-
a${p},${p} 1 0,1 ${l*.4},${-1*l*.1}
|
|
604
|
-
a${d},${d} 1 0,1 ${l*.35},${l*.2}
|
|
605
|
-
|
|
606
|
-
a${u},${u} 1 0,1 ${l*.15},${c*.35}
|
|
607
|
-
a${f},${f} 1 0,1 ${-1*l*.15},${c*.65}
|
|
608
|
-
|
|
609
|
-
a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
|
|
610
|
-
a${p},${p} 1 0,1 ${-1*l*.5},0
|
|
611
|
-
a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
|
|
612
|
-
|
|
613
|
-
a${u},${u} 1 0,1 ${-1*l*.1},${-1*c*.35}
|
|
614
|
-
a${f},${f} 1 0,1 ${l*.1},${-1*c*.65}
|
|
615
|
-
H0 V0 Z`;if(e.look==="handDrawn"){const y=yt.svg(i),b=kt(e,{}),k=y.path(g,b);x=i.insert(()=>k,":first-child"),x.attr("class","basic label-container").attr("style",Oe(m))}else x=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",g);return a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),x.attr("transform",`translate(${-l/2}, ${-c/2})`),wt(e,x),e.calcIntersect=function(y,b){return pt.rect(y,b)},e.intersect=function(y){return tt.info("Cloud intersect",e,y),pt.rect(e,y)},i}v(O2,"cloud");async function R2(t,e){const{labelStyles:r,nodeStyles:n}=vt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Mt(t,e,At(e)),l=s.width+8*o,c=s.height+2*o,u=5,d=e.look==="neo"?`
|
|
616
|
-
M${-l/2} ${c/2-u}
|
|
617
|
-
v${-c+2*u}
|
|
618
|
-
q0,-${u} ${u},-${u}
|
|
619
|
-
h${l-2*u}
|
|
620
|
-
q${u},0 ${u},${u}
|
|
621
|
-
v${c-u}
|
|
622
|
-
H${-l/2}
|
|
623
|
-
Z
|
|
624
|
-
`:`
|
|
625
|
-
M${-l/2} ${c/2-u}
|
|
626
|
-
v${-c+2*u}
|
|
627
|
-
q0,-${u} ${u},-${u}
|
|
628
|
-
h${l-2*u}
|
|
629
|
-
q${u},0 ${u},${u}
|
|
630
|
-
v${c-2*u}
|
|
631
|
-
q0,${u} ${-u},${u}
|
|
632
|
-
h${-(l-2*u)}
|
|
633
|
-
q${-u},0 ${-u},${-u}
|
|
634
|
-
Z
|
|
635
|
-
`;if(!e.domId)throw new Error(`defaultMindmapNode: node "${e.id}" is missing a domId — was render.ts domId prefixing skipped?`);const p=i.append("path").attr("id",e.domId).attr("class","node-bkg node-"+e.type).attr("style",n).attr("d",d);return i.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),i.append(()=>a.node()),wt(e,p),e.calcIntersect=function(f,m){return pt.rect(f,m)},e.intersect=function(f){return pt.rect(e,f)},i}v(R2,"defaultMindmapNode");async function $2(t,e){const r={padding:e.padding??0};return qp(t,e,r)}v($2,"mindmapCircle");var $8=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:x2},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:p2},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:y2},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:v2},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:$w},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:zw},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:qp},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:D2},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:O2},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:u2},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Vw},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:i2},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:n2},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:E2},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:e2},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:qw},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:T2},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Aw},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:m2},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:k2},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:C2},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Gw},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Xw},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Pw},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Dw},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:Ow},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:s2},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:L2},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Yw},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:_2},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:o2},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Rw},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:Ww},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:j2},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:A2},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Hw},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:N2},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Uw},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:g2},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:c2},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:l2},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Bw},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Fw},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:S2},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:w2},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:B2},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:d2},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:a2}],z8=v(()=>{const e=[...Object.entries({state:b2,choice:Mw,note:h2,rectWithTitle:f2,labelRect:r2,iconSquare:Jw,iconCircle:Zw,icon:Kw,iconRounded:Qw,imageSquare:t2,anchor:jw,kanbanItem:P2,mindmapCircle:$2,defaultMindmapNode:R2,classBox:I2,erBox:Hp,requirementBox:F2}),...$8.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),z2=z8();function W8(t){return t in z2}v(W8,"isValidShape");var lh=new Map;async function W2(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?z2[e.shape]:void 0;if(!s)throw new Error(`No such shape: ${e.shape}. Please check your syntax.`);if(e.link){let o;r.config.securityLevel==="sandbox"?o="_top":e.linkTarget&&(o=e.linkTarget||"_blank"),n=t.insert("svg:a").attr("xlink:href",e.link).attr("target",o??null),i=await s(n,e,r)}else i=await s(t,e,r),n=i;return n.attr("data-look",Oe(e.look)),e.tooltip&&i.attr("title",e.tooltip),lh.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(W2,"insertNode");var jZ=v((t,e)=>{lh.set(e.id,t)},"setNodeElem"),LZ=v(()=>{lh.clear()},"clear"),BZ=v(t=>{const e=lh.get(t.id);tt.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const r=8,n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-r)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},"positionNode"),q8=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&t0(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&t0(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),H8={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_barb_neo:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},U8=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],t0=v((t,e,r,n,i,s,o=!1,a)=>{var m;const l=H8[r],c=l&&U8.includes(l.type);if(!l){tt.warn(`Unknown arrow type: ${r}`);return}const u=l.type,f=`${i}_${s}-${u}${e==="start"?"Start":"End"}${o&&c?"-margin":""}`;if(a&&a.trim()!==""){const x=a.replace(/[^\dA-Za-z]/g,"_"),g=`${f}_${x}`;if(!document.getElementById(g)){const y=document.getElementById(f);if(y){const b=y.cloneNode(!0);b.id=g,b.querySelectorAll("path, circle, line").forEach(T=>{T.setAttribute("stroke",a),l.fill&&T.setAttribute("fill",a)}),(m=y.parentNode)==null||m.appendChild(b)}}t.attr(`marker-${e}`,`url(${n}#${g})`)}else t.attr(`marker-${e}`,`url(${n}#${f})`)},"addEdgeMarker"),G8=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=re())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),Nc=new Map,qe=new Map,AZ=v(()=>{Nc.clear(),qe.clear()},"clear"),To=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),Y8=v(async(t,e)=>{const r=re();let n=hr(r);const{labelStyles:i}=vt(e);e.labelStyle=i;const s=t.insert("g").attr("class","edgeLabel"),o=s.insert("g").attr("class","label").attr("data-id",e.id),a=e.labelType==="markdown",c=await Bn(t,e.label,{style:To(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(c),tt.info("abc82",e,e.labelType);let u=c.getBBox(),d=u;if(n){const f=c.children[0],m=Yt(c);u=f.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const f=Yt(c).select("text").node();f&&typeof f.getBBox=="function"&&(d=f.getBBox())}o.attr("transform",Co(d,n)),Nc.set(e.id,s),e.width=u.width,e.height=u.height;let p;if(e.startLabelLeft){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Hn(m,e.startLabelLeft,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Yt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),qe.get(e.id)||qe.set(e.id,{}),qe.get(e.id).startLeft=f,$o(p,e.startLabelLeft)}if(e.startLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Hn(m,e.startLabelRight,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Yt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),qe.get(e.id)||qe.set(e.id,{}),qe.get(e.id).startRight=f,$o(p,e.startLabelRight)}if(e.endLabelLeft){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Hn(f,e.endLabelLeft,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Yt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),qe.get(e.id)||qe.set(e.id,{}),qe.get(e.id).endLeft=f,$o(p,e.endLabelLeft)}if(e.endLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Hn(f,e.endLabelRight,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Yt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),qe.get(e.id)||qe.set(e.id,{}),qe.get(e.id).endRight=f,$o(p,e.endLabelRight)}return c},"insertEdgeLabel");function $o(t,e){hr(re())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v($o,"setTerminalWidth");var V8=v((t,e)=>{tt.debug("Moving label abc88 ",t.id,t.label,Nc.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=re(),{subGraphTitleTotalMargin:i}=Lp(n);if(t.label){const s=Nc.get(t.id);let o=t.x,a=t.y;if(r){const l=Hr.calcLabelPosition(r);tt.debug("Moving label "+t.label+" from (",o,",",a,") to (",l.x,",",l.y,") abc88"),e.updatedPath&&(o=l.x,a=l.y)}s.attr("transform",`translate(${o}, ${a+i/2})`)}if(t.startLabelLeft){const s=qe.get(t.id).startLeft;let o=t.x,a=t.y;if(r){const l=Hr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.startLabelRight){const s=qe.get(t.id).startRight;let o=t.x,a=t.y;if(r){const l=Hr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelLeft){const s=qe.get(t.id).endLeft;let o=t.x,a=t.y;if(r){const l=Hr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelRight){const s=qe.get(t.id).endRight;let o=t.x,a=t.y;if(r){const l=Hr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}},"positionEdgeLabel"),X8=v((t,e)=>{const r=t.x,n=t.y,i=Math.abs(e.x-r),s=Math.abs(e.y-n),o=t.width/2,a=t.height/2;return i>=o||s>=a},"outsideNode"),K8=v((t,e,r)=>{tt.debug(`intersection calc abc89:
|
|
636
|
-
outsidePoint: ${JSON.stringify(e)}
|
|
637
|
-
insidePoint : ${JSON.stringify(r)}
|
|
638
|
-
node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const n=t.x,i=t.y,s=Math.abs(n-r.x),o=t.width/2;let a=r.x<e.x?o-s:o+s;const l=t.height/2,c=Math.abs(e.y-r.y),u=Math.abs(e.x-r.x);if(Math.abs(i-e.y)*o>Math.abs(n-e.x)*l){let d=r.y<e.y?e.y-l-i:i-l-e.y;a=u*d/c;const p={x:r.x<e.x?r.x+a:r.x-u+a,y:r.y<e.y?r.y+c-d:r.y-c+d};return a===0&&(p.x=e.x,p.y=e.y),u===0&&(p.x=e.x),c===0&&(p.y=e.y),tt.debug(`abc89 top/bottom calc, Q ${c}, q ${d}, R ${u}, r ${a}`,p),p}else{r.x<e.x?a=e.x-o-n:a=n-o-e.x;let d=c*a/u,p=r.x<e.x?r.x+u-a:r.x-u+a,f=r.y<e.y?r.y+d:r.y-d;return tt.debug(`sides calc abc89, Q ${c}, q ${d}, R ${u}, r ${a}`,{_x:p,_y:f}),a===0&&(p=e.x,f=e.y),u===0&&(p=e.x),c===0&&(f=e.y),{x:p,y:f}}},"intersection"),e0=v((t,e)=>{tt.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(tt.info("abc88 checking point",s,e),!X8(e,s)&&!i){const o=K8(e,n,s);tt.debug("abc88 inside",s,n,o),tt.debug("abc88 intersection",o,e);let a=!1;r.forEach(l=>{a=a||l.x===o.x&&l.y===o.y}),r.some(l=>l.x===o.x&&l.y===o.y)?tt.warn("abc88 no intersect",o,r):r.push(o),i=!0}else tt.warn("abc88 outside",s,n),n=s,i||r.push(s)}),tt.debug("returning points",r),r},"cutPathAtIntersect");function q2(t){const e=[],r=[];for(let n=1;n<t.length-1;n++){const i=t[n-1],s=t[n],o=t[n+1];(i.x===s.x&&s.y===o.y&&Math.abs(s.x-o.x)>5&&Math.abs(s.y-i.y)>5||i.y===s.y&&s.x===o.x&&Math.abs(s.x-i.x)>5&&Math.abs(s.y-o.y)>5)&&(e.push(s),r.push(n))}return{cornerPoints:e,cornerPointPositions:r}}v(q2,"extractCornerPoints");var r0=v(function(t,e,r){const n=e.x-t.x,i=e.y-t.y,s=Math.sqrt(n*n+i*i),o=r/s;return{x:e.x-o*n,y:e.y-o*i}},"findAdjacentPoint"),Z8=v(function(t){const{cornerPointPositions:e}=q2(t),r=[];for(let n=0;n<t.length;n++)if(e.includes(n)){const i=t[n-1],s=t[n+1],o=t[n],a=r0(i,o,5),l=r0(s,o,5),c=l.x-a.x,u=l.y-a.y;r.push(a);const d=Math.sqrt(2)*2;let p={x:o.x,y:o.y};if(Math.abs(s.x-i.x)>10&&Math.abs(s.y-i.y)>=10){tt.debug("Corner point fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));const f=5;o.x===a.x?p={x:c<0?a.x-f+d:a.x+f-d,y:u<0?a.y-d:a.y+d}:p={x:c<0?a.x-d:a.x+d,y:u<0?a.y-f+d:a.y+f-d}}else tt.debug("Corner point skipping fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));r.push(p,l)}else r.push(t[n]);return r},"fixCorners"),Q8=v((t,e,r)=>{const n=t-e-r,i=2,s=2,o=i+s,a=Math.floor(n/o),l=Array(a).fill(`${i} ${s}`).join(" ");return`0 ${e} ${l} ${r}`},"generateDashArray"),J8=v(function(t,e,r,n,i,s,o,a=!1){var D;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:l}=re();let c=e.points,u=!1;const d=i;var p=s;const f=[];for(const O in e.cssCompiledStyles)zv(O)||f.push(e.cssCompiledStyles[O]);tt.debug("UIO intersect check",e.points,p.x,d.x),p.intersect&&d.intersect&&!a&&(c=c.slice(1,e.points.length-1),c.unshift(d.intersect(c[0])),tt.debug("Last point UIO",e.start,"-->",e.end,c[c.length-1],p,p.intersect(c[c.length-1])),c.push(p.intersect(c[c.length-1])));const m=btoa(JSON.stringify(c));e.toCluster&&(tt.info("to cluster abc88",r.get(e.toCluster)),c=e0(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(tt.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(c,null,2)),c=e0(c.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=c.filter(O=>!Number.isNaN(O.y));const g=G8(e.curve);g!=="rounded"&&(x=Z8(x));let y=Vo;switch(g){case"linear":y=Vo;break;case"basis":y=pd;break;case"cardinal":y=jC;break;case"bumpX":y=SC;break;case"bumpY":y=TC;break;case"catmullRom":y=BC;break;case"monotoneX":y=DC;break;case"monotoneY":y=OC;break;case"natural":y=$C;break;case"step":y=zC;break;case"stepAfter":y=qC;break;case"stepBefore":y=WC;break;case"rounded":y=Vo;break;default:y=pd}const{x:b,y:k}=G$(e),T=jR().x(b).y(k).curve(y);let _;switch(e.thickness){case"normal":_="edge-thickness-normal";break;case"thick":_="edge-thickness-thick";break;case"invisible":_="edge-thickness-invisible";break;default:_="edge-thickness-normal"}switch(e.pattern){case"solid":_+=" edge-pattern-solid";break;case"dotted":_+=" edge-pattern-dotted";break;case"dashed":_+=" edge-pattern-dashed";break;default:_+=" edge-pattern-solid"}let w,N=g==="rounded"?H2(U2(x,e),5):T(x);const B=Array.isArray(e.style)?e.style:[e.style];let I=B.find(O=>O==null?void 0:O.startsWith("stroke:")),E="";e.animate&&(E="edge-animation-fast"),e.animation&&(E="edge-animation-"+e.animation);let P=!1;if(e.look==="handDrawn"){const O=yt.svg(t);Object.assign([],x);const j=O.path(N,{roughness:.3,seed:l});_+=" transition",w=Yt(j).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(E?" "+E:"")).attr("style",B?B.reduce((G,Q)=>G+";"+Q,""):"");let S=w.attr("d");w.attr("d",S),t.node().appendChild(w.node())}else{const O=f.join(";"),j=B?B.reduce((ut,st)=>ut+st+";",""):"",S=(O?O+";"+j+";":j)+";"+(B?B.reduce((ut,st)=>ut+";"+st,""):"");w=t.append("path").attr("d",N).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(E?" "+E:"")).attr("style",S),I=(D=S.match(/stroke:([^;]+)/))==null?void 0:D[1],P=e.animate===!0||!!e.animation||O.includes("animation");const G=w.node(),Q=typeof G.getTotalLength=="function"?G.getTotalLength():0,A=gx[e.arrowTypeStart]||0,ct=gx[e.arrowTypeEnd]||0;if(e.look==="neo"&&!P){const st=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?Q8(Q,A,ct):`0 ${A} ${Q-A-ct} ${ct}`}; stroke-dashoffset: 0;`;w.attr("style",st+w.attr("style"))}}w.attr("data-edge",!0),w.attr("data-et","edge"),w.attr("data-id",e.id),w.attr("data-points",m),w.attr("data-look",Oe(e.look)),e.showPoints&&x.forEach(O=>{t.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",O.x).attr("cy",O.y)});let z="";(re().flowchart.arrowMarkerAbsolute||re().state.arrowMarkerAbsolute)&&(z=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,z=z.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),tt.info("arrowTypeStart",e.arrowTypeStart),tt.info("arrowTypeEnd",e.arrowTypeEnd);const q=!P&&(e==null?void 0:e.look)==="neo";q8(w,e,z,o,n,q,I);const R=Math.floor(c.length/2),F=c[R];Hr.isLabelCoordinateInPath(F,w.attr("d"))||(u=!0);let M={};return u&&(M.updatedPath=c),M.originalPath=e.points,M},"insertEdge");function H2(t,e){if(t.length<2)return"";let r="";const n=t.length,i=1e-5;for(let s=0;s<n;s++){const o=t[s],a=t[s-1],l=t[s+1];if(s===0)r+=`M${o.x},${o.y}`;else if(s===n-1)r+=`L${o.x},${o.y}`;else{const c=o.x-a.x,u=o.y-a.y,d=l.x-o.x,p=l.y-o.y,f=Math.hypot(c,u),m=Math.hypot(d,p);if(f<i||m<i){r+=`L${o.x},${o.y}`;continue}const x=c/f,g=u/f,y=d/m,b=p/m,k=x*y+g*b,T=Math.max(-1,Math.min(1,k)),_=Math.acos(T);if(_<i||Math.abs(Math.PI-_)<i){r+=`L${o.x},${o.y}`;continue}const w=Math.min(e/Math.sin(_/2),f/2,m/2),N=o.x-x*w,B=o.y-g*w,I=o.x+y*w,E=o.y+b*w;r+=`L${N},${B}`,r+=`Q${o.x},${o.y} ${I},${E}`}}return r}v(H2,"generateRoundedPath");function Hd(t,e){if(!t||!e)return{angle:0,deltaX:0,deltaY:0};const r=e.x-t.x,n=e.y-t.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}v(Hd,"calculateDeltaAndAngle");function U2(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&Ve[e.arrowTypeStart]){const i=Ve[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=Hd(s,o),l=i*Math.cos(a),c=i*Math.sin(a);r[0].x=s.x+l,r[0].y=s.y+c}const n=t.length;if(n>=2&&Ve[e.arrowTypeEnd]){const i=Ve[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=Hd(o,s),l=i*Math.cos(a),c=i*Math.sin(a);r[n-1].x=s.x-l,r[n-1].y=s.y-c}return r}v(U2,"applyMarkerOffsetsToPoints");var t9=v((t,e,r,n)=>{e.forEach(i=>{w9[i](t,r,n)})},"insertMarkers"),e9=v((t,e,r)=>{tt.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),t.append("marker").attr("id",r+"_"+e+"-extensionStart-margin").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd-margin").attr("class","marker extension "+e).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),r9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart-margin").attr("class","marker composition "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("viewBox","0 0 15 15").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd-margin").attr("class","marker composition "+e).attr("refX",3.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),n9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart-margin").attr("class","marker aggregation "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd-margin").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),i9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart-margin").attr("class","marker dependency "+e).attr("refX",4).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd-margin").attr("class","marker dependency "+e).attr("refX",16).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),s9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart-margin").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd-margin").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2)},"lollipop"),o9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",11.5).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",10.5).attr("markerHeight",14).attr("orient","auto").append("path").attr("d","M 0 0 L 11.5 7 L 0 14 z").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",1).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11.5).attr("markerHeight",14).attr("orient","auto").append("polygon").attr("points","0,7 11.5,14 11.5,0").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"point"),a9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refY",5).attr("refX",12.25).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-2).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"circle"),l9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossEnd-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",17.7).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5),t.append("marker").attr("id",r+"_"+e+"-crossStart-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",-3.5).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5).style("stroke-dasharray","1,0")},"cross"),c9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),h9=v((t,e,r)=>{const n=ye(),{themeVariables:i}=n,{transitionColor:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd-margin").attr("refX",17).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z").attr("fill",`${s}`)},"barbNeo"),u9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),d9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),f9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),p9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),m9=v((t,e,r)=>{const n=ye(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M9,0 L9,18 M15,0 L15,18").attr("stroke-width",`${s}`),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M3,0 L3,18 M9,0 L9,18").attr("stroke-width",`${s}`)},"only_one_neo"),g9=v((t,e,r)=>{const n=ye(),{themeVariables:i}=n,{strokeWidth:s,mainBkg:o}=i,a=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse");a.append("circle").attr("fill",o??"white").attr("cx",21).attr("cy",9).attr("stroke-width",`${s}`).attr("r",6),a.append("path").attr("d","M9,0 L9,18").attr("stroke-width",`${s}`);const l=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("markerUnits","userSpaceOnUse").attr("orient","auto");l.append("circle").attr("fill",o??"white").attr("cx",9).attr("cy",9).attr("stroke-width",`${s}`).attr("r",6),l.append("path").attr("d","M21,0 L21,18").attr("stroke-width",`${s}`)},"zero_or_one_neo"),x9=v((t,e,r)=>{const n=ye(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width",`${s}`),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width",`${s}`)},"one_or_more_neo"),y9=v((t,e,r)=>{const n=ye(),{themeVariables:i}=n,{strokeWidth:s,mainBkg:o}=i,a=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto");a.append("circle").attr("fill",o??"white").attr("cx",45.5).attr("cy",18).attr("r",6).attr("stroke-width",`${s}`),a.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width",`${s}`);const l=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse");l.append("circle").attr("fill",o??"white").attr("cx",11).attr("cy",18).attr("r",6).attr("stroke-width",`${s}`),l.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width",`${s}`)},"zero_or_more_neo"),b9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
639
|
-
L20,10
|
|
640
|
-
M20,10
|
|
641
|
-
L0,20`)},"requirement_arrow"),C9=v((t,e,r)=>{const n=ye(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${s}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
|
|
642
|
-
L20,10
|
|
643
|
-
M20,10
|
|
644
|
-
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),k9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),v9=v((t,e,r)=>{const n=ye(),{themeVariables:i}=n,{strokeWidth:s}=i,o=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),w9={extension:e9,composition:r9,aggregation:n9,dependency:i9,lollipop:s9,point:o9,circle:a9,cross:l9,barb:c9,barbNeo:h9,only_one:u9,zero_or_one:d9,one_or_more:f9,zero_or_more:p9,only_one_neo:m9,zero_or_one_neo:g9,one_or_more_neo:x9,zero_or_more_neo:y9,requirement_arrow:b9,requirement_contains:k9,requirement_arrow_neo:C9,requirement_contains_neo:v9},S9=t9,T9={common:wa,getConfig:ye,insertCluster:v8,insertEdge:J8,insertEdgeLabel:Y8,insertMarkers:S9,insertNode:W2,interpolateToCurve:Sp,labelHelper:Mt,log:tt,positionEdgeLabel:V8},da={},G2=v(t=>{for(const e of t)da[e.name]=e},"registerLayoutLoaders"),_9=v(()=>{G2([{name:"dagre",loader:v(async()=>await Jt(()=>import("./dagre-BM42HDAG-CO-3fQv_.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Jt(()=>import("./cose-bilkent-S5V4N54A-DPu8eCS8.js"),__vite__mapDeps([8,7,3,4,5,6])),"loader")}])},"registerDefaultLayoutLoaders");_9();var MZ=v(async(t,e)=>{if(!(t.layoutAlgorithm in da))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);if(t.diagramId)for(const u of t.nodes){const d=u.domId||u.id;u.domId=`${t.diagramId}-${d}`}const r=da[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:l}=s,c=e.attr("id");if(e.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),o){const u=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");u.append("svg:stop").attr("offset","0%").attr("stop-color",a).attr("stop-opacity",1),u.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return n.render(t,e,T9,{algorithm:r.algorithm})},"render"),IZ=v((t="",{fallback:e="dagre"}={})=>{if(t in da)return t;if(e in da)return tt.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),Up="comm",Y2="rule",V2="decl",E9="@media",N9="@import",j9="@supports",L9="@namespace",Ud="@keyframes",X2="@layer",B9="@scope",A9=Math.abs,Ko=String.fromCharCode;function K2(t){return t.trim()}function Gd(t,e,r){return t.replace(e,r)}function ys(t,e){return t.charCodeAt(e)|0}function Gs(t,e,r){return t.slice(e,r)}function on(t){return t.length}function Z2(t){return t.length}function al(t,e){return e.push(t),t}var ch=1,Ys=1,Q2=0,Fr=0,Le=0,to="";function Gp(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:ch,column:Ys,length:o,return:"",siblings:a}}function M9(){return Le}function I9(){return Le=Fr>0?ys(to,--Fr):0,Ys--,Le===10&&(Ys=1,ch--),Le}function Yr(){return Le=Fr<Q2?ys(to,Fr++):0,Ys++,Le===10&&(Ys=1,ch++),Le}function Un(){return ys(to,Fr)}function Fl(){return Fr}function hh(t,e){return Gs(to,t,e)}function fa(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function F9(t){return ch=Ys=1,Q2=on(to=t),Fr=0,[]}function P9(t){return to="",t}function mu(t){return K2(hh(Fr-1,Yd(t===91?t+2:t===40?t+1:t)))}function D9(t){for(;(Le=Un())&&Le<33;)Yr();return fa(t)>2||fa(Le)>3?"":" "}function O9(t,e){for(;--e&&Yr()&&!(Le<48||Le>102||Le>57&&Le<65||Le>70&&Le<97););return hh(t,Fl()+(e<6&&Un()==32&&Yr()==32))}function Yd(t){for(;Yr();)switch(Le){case t:return Fr;case 34:case 39:t!==34&&t!==39&&Yd(Le);break;case 40:t===41&&Yd(t);break;case 92:Yr();break}return Fr}function R9(t,e){for(;Yr()&&t+Le!==57;)if(t+Le===84&&Un()===47)break;return"/*"+hh(e,Fr-1)+"*"+Ko(t===47?t:Yr())}function $9(t){for(;!fa(Un());)Yr();return hh(t,Fr)}function z9(t){return P9(Pl("",null,null,null,[""],t=F9(t),0,[0],t))}function Pl(t,e,r,n,i,s,o,a,l){for(var c=0,u=0,d=o,p=0,f=0,m=0,x=1,g=1,y=1,b=0,k=0,T="",_=i,w=s,N=n,B=T;g;)switch(m=k,k=Yr()){case 40:m!=108&&ys(B,d-1)==58?(b++,B+="("):B+=mu(k);break;case 41:b--,B+=")";break;case 34:case 39:case 91:B+=mu(k);break;case 9:case 10:case 13:case 32:if(b>0){B+=Ko(k);break}B+=D9(m);break;case 92:B+=O9(Fl()-1,7);continue;case 47:switch(Un()){case 42:case 47:al(W9(R9(Yr(),Fl()),e,r,l),l),(fa(m||1)==5||fa(Un()||1)==5)&&on(B)&&Gs(B,-1,void 0)!==" "&&(B+=" ");break;default:B+="/"}break;case 123*x:a[c++]=on(B)*y;case 125*x:case 59:case 0:if(b>0&&k){B+=Ko(k);break}switch(k){case 0:case 125:g=0;case 59+u:y==-1&&(B=Gd(B,/\f/g,"")),f>0&&(on(B)-d||x===0)&&al(f>32?i0(B+";",n,r,d-1,l):i0(Gd(B," ","")+";",n,r,d-2,l),l);break;case 59:B+=";";default:if(al(N=n0(B,e,r,c,u,i,a,T,_=[],w=[],d,s),s),k===123)if(u===0)Pl(B,e,N,N,_,s,d,a,w);else{switch(p){case 99:if(ys(B,3)===110)break;case 108:if(ys(B,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Pl(t,N,N,n&&al(n0(t,N,N,0,0,i,a,T,i,_=[],d,w),w),i,w,d,a,n?_:w):Pl(B,N,N,N,[""],w,0,a,w)}}c=u=f=0,x=y=1,T=B="",d=o;break;case 58:d=1+on(B),f=m;default:if(x<1){if(k==123)--x;else if(k==125&&x++==0&&I9()==125)continue}switch(B+=Ko(k),k*x){case 38:y=u>0?1:(B+="\f",-1);break;case 44:if(b>0)break;a[c++]=(on(B)-1)*y,y=1;break;case 64:Un()===45&&(B+=mu(Yr())),p=Un(),u=d=on(T=B+=$9(Fl())),k++;break;case 45:m===45&&on(B)==2&&(x=0)}}return s}function n0(t,e,r,n,i,s,o,a,l,c,u,d){for(var p=i-1,f=i===0?s:[""],m=Z2(f),x=0,g=0,y=0;x<n;++x)for(var b=0,k=Gs(t,p+1,p=A9(g=o[x])),T=t;b<m;++b)(T=K2(g>0?f[b]+" "+k:Gd(k,/&\f/g,f[b])))&&(l[y++]=T);return Gp(t,e,r,i===0?Y2:a,l,c,u,d)}function W9(t,e,r,n){return Gp(t,e,r,Up,Ko(M9()),Gs(t,2,-2),0,n)}function i0(t,e,r,n,i){return Gp(t,e,r,V2,Gs(t,0,n),Gs(t,n+1,-1),n,i)}function Vd(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function q9(t,e,r,n){switch(t.type){case X2:if(t.children.length)break;case N9:case L9:case V2:return t.return=t.return||t.value;case Up:return"";case Ud:return t.return=t.value+"{"+Vd(t.children,n)+"}";case Y2:if(!on(t.value=t.props.join(",")))return""}return on(r=Vd(t.children,n))?t.return=t.value+"{"+r+"}":""}function H9(t){var e=Z2(t);return function(r,n,i,s){for(var o="",a=0;a<e;a++)o+=t[a](r,n,i,s)||"";return o}}var J2="c4",U9=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),G9=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./c4Diagram-AAUBKEIU-BKxSEqgT.js");return{diagram:e}},__vite__mapDeps([9,10,3,4,5,6,7]));return{id:J2,diagram:t}},"loader"),Y9={id:J2,detector:U9,loader:G9},V9=Y9,tS="flowchart",X9=v((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),K9=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-B2b-dSfR.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:tS,diagram:t}},"loader"),Z9={id:tS,detector:X9,loader:K9},Q9=Z9,eS="flowchart-v2",J9=v((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),t7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-B2b-dSfR.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:eS,diagram:t}},"loader"),e7={id:eS,detector:J9,loader:t7},r7=e7,rS="er",n7=v(t=>/^\s*erDiagram/.test(t),"detector"),i7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./erDiagram-TEJ5UH35-BqW54tXR.js");return{diagram:e}},__vite__mapDeps([16,13,14,15,3,4,5,6,7]));return{id:rS,diagram:t}},"loader"),s7={id:rS,detector:n7,loader:i7},o7=s7,nS="gitGraph",a7=v(t=>/^\s*gitGraph/.test(t),"detector"),l7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-PVQCEYII-BT8o_4m6.js");return{diagram:e}},__vite__mapDeps([17,18,19,20,5,3,4,6,7]));return{id:nS,diagram:t}},"loader"),c7={id:nS,detector:a7,loader:l7},h7=c7,iS="gantt",u7=v(t=>/^\s*gantt/.test(t),"detector"),d7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ganttDiagram-6RSMTGT7-CmJFWbDF.js");return{diagram:e}},__vite__mapDeps([21,3,4,22,23,24,5,6,7]));return{id:iS,diagram:t}},"loader"),f7={id:iS,detector:u7,loader:d7},p7=f7,sS="info",m7=v(t=>/^\s*info/.test(t),"detector"),g7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./infoDiagram-5YYISTIA-BqunByDN.js");return{diagram:e}},__vite__mapDeps([25,20,5,3,4,6,7]));return{id:sS,diagram:t}},"loader"),x7={id:sS,detector:m7,loader:g7},oS="pie",y7=v(t=>/^\s*pie/.test(t),"detector"),b7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./pieDiagram-4H26LBE5-DkZl7DXu.js");return{diagram:e}},__vite__mapDeps([26,18,20,5,3,4,6,27,28,23,7]));return{id:oS,diagram:t}},"loader"),C7={id:oS,detector:y7,loader:b7},aS="quadrantChart",k7=v(t=>/^\s*quadrantChart/.test(t),"detector"),v7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./quadrantDiagram-W4KKPZXB-2lwVSBWb.js");return{diagram:e}},__vite__mapDeps([29,22,23,24,3,4,5,6,7]));return{id:aS,diagram:t}},"loader"),w7={id:aS,detector:k7,loader:v7},S7=w7,lS="xychart",T7=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),_7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./xychartDiagram-2RQKCTM6-BmPqraoL.js");return{diagram:e}},__vite__mapDeps([30,23,28,22,24,3,4,5,6,7]));return{id:lS,diagram:t}},"loader"),E7={id:lS,detector:T7,loader:_7},N7=E7,cS="requirement",j7=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),L7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./requirementDiagram-4Y6WPE33-C0t5AupD.js");return{diagram:e}},__vite__mapDeps([31,13,14,3,4,5,6,7]));return{id:cS,diagram:t}},"loader"),B7={id:cS,detector:j7,loader:L7},A7=B7,hS="sequence",M7=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),I7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sequenceDiagram-3UESZ5HK-B3NY1tZo.js");return{diagram:e}},__vite__mapDeps([32,10,19,3,4,5,6,7]));return{id:hS,diagram:t}},"loader"),F7={id:hS,detector:M7,loader:I7},P7=F7,uS="class",D7=v((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),O7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-4FO5ZUOK-C_u9Angz.js");return{diagram:e}},__vite__mapDeps([33,34,12,10,13,14,3,4,5,6,7]));return{id:uS,diagram:t}},"loader"),R7={id:uS,detector:D7,loader:O7},$7=R7,dS="classDiagram",z7=v((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),W7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-v2-Q7XG4LA2-C_u9Angz.js");return{diagram:e}},__vite__mapDeps([35,34,12,10,13,14,3,4,5,6,7]));return{id:dS,diagram:t}},"loader"),q7={id:dS,detector:z7,loader:W7},H7=q7,fS="state",U7=v((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),G7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-AJRCARHV-DWmuapu-.js");return{diagram:e}},__vite__mapDeps([36,37,13,14,1,2,3,4,5,6,7]));return{id:fS,diagram:t}},"loader"),Y7={id:fS,detector:U7,loader:G7},V7=Y7,pS="stateDiagram",X7=v((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),K7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-BHNVJYJU-Dk4v8A5E.js");return{diagram:e}},__vite__mapDeps([38,37,13,14,3,4,5,6,7]));return{id:pS,diagram:t}},"loader"),Z7={id:pS,detector:X7,loader:K7},Q7=Z7,mS="journey",J7=v(t=>/^\s*journey/.test(t),"detector"),tW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./journeyDiagram-JHISSGLW-gEGcRX8K.js");return{diagram:e}},__vite__mapDeps([39,12,10,27,3,4,5,6,7]));return{id:mS,diagram:t}},"loader"),eW={id:mS,detector:J7,loader:tW},rW=eW,nW=v((t,e,r)=>{tt.debug(`rendering svg for syntax error
|
|
645
|
-
`);const n=OR(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),Y1(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),gS={draw:nW},iW=gS,sW={db:{},renderer:gS,parser:{parse:v(()=>{},"parse")}},oW=sW,xS="flowchart-elk",aW=v((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),lW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-B2b-dSfR.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:xS,diagram:t}},"loader"),cW={id:xS,detector:aW,loader:lW},hW=cW,yS="timeline",uW=v(t=>/^\s*timeline/.test(t),"detector"),dW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./timeline-definition-PNZ67QCA-BcThQznB.js");return{diagram:e}},__vite__mapDeps([40,27,3,4,5,6,7]));return{id:yS,diagram:t}},"loader"),fW={id:yS,detector:uW,loader:dW},pW=fW,bS="mindmap",mW=v(t=>/^\s*mindmap/.test(t),"detector"),gW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./mindmap-definition-RKZ34NQL-B5XNiIMw.js");return{diagram:e}},__vite__mapDeps([41,13,14,3,4,5,6,7]));return{id:bS,diagram:t}},"loader"),xW={id:bS,detector:mW,loader:gW},yW=xW,CS="kanban",bW=v(t=>/^\s*kanban/.test(t),"detector"),CW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./kanban-definition-UN3LZRKU-Ce6Ql7ld.js");return{diagram:e}},__vite__mapDeps([42,12,3,4,5,6,7]));return{id:CS,diagram:t}},"loader"),kW={id:CS,detector:bW,loader:CW},vW=kW,kS="sankey",wW=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),SW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sankeyDiagram-5OEKKPKP-CeXMM5uX.js");return{diagram:e}},__vite__mapDeps([43,28,23,3,4,5,6,7]));return{id:kS,diagram:t}},"loader"),TW={id:kS,detector:wW,loader:SW},_W=TW,vS="packet",EW=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),NW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-LMA3HP47-CKzGPl09.js");return{diagram:e}},__vite__mapDeps([44,18,20,5,3,4,6,7]));return{id:vS,diagram:t}},"loader"),jW={id:vS,detector:EW,loader:NW},wS="radar",LW=v(t=>/^\s*radar-beta/.test(t),"detector"),BW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-2AECGRRQ-ES8OaCtj.js");return{diagram:e}},__vite__mapDeps([45,18,20,5,3,4,6,7]));return{id:wS,diagram:t}},"loader"),AW={id:wS,detector:LW,loader:BW},SS="block",MW=v(t=>/^\s*block(-beta)?/.test(t),"detector"),IW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./blockDiagram-GPEHLZMM-BsKGohnn.js");return{diagram:e}},__vite__mapDeps([46,12,1,15,3,4,5,6,7]));return{id:SS,diagram:t}},"loader"),FW={id:SS,detector:MW,loader:IW},PW=FW,TS="treeView",DW=v(t=>/^\s*treeView-beta/.test(t),"detector"),OW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-5GNKFQAL-DAxAGwHz.js");return{diagram:e}},__vite__mapDeps([47,18,19,20,5,3,4,6,7]));return{id:TS,diagram:t}},"loader"),RW={id:TS,detector:DW,loader:OW},$W=RW,_S="architecture",zW=v(t=>/^\s*architecture/.test(t),"detector"),WW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./architectureDiagram-3BPJPVTR-HfQQjJmI.js");return{diagram:e}},__vite__mapDeps([48,18,20,5,3,4,6,7]));return{id:_S,diagram:t}},"loader"),qW={id:_S,detector:zW,loader:WW},HW=qW,ES="eventmodeling",UW=v(t=>/^\s*eventmodeling/.test(t),"detector"),GW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-KO2AKTUF-Ch8FzysS.js");return{diagram:e}},__vite__mapDeps([49,18,20,5,3,4,6,7]));return{id:ES,diagram:t}},"loader"),YW={id:ES,detector:UW,loader:GW},VW=YW,NS="ishikawa",XW=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),KW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-YF4QCWOH-B7d9fw7d.js");return{diagram:e}},__vite__mapDeps([50,3,4,5,6,7]));return{id:NS,diagram:t}},"loader"),ZW={id:NS,detector:XW,loader:KW},jS="venn",QW=v(t=>/^\s*venn-beta/.test(t),"detector"),JW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./vennDiagram-CIIHVFJN-dfCrxHjF.js");return{diagram:e}},__vite__mapDeps([51,3,4,5,6,7]));return{id:jS,diagram:t}},"loader"),tq={id:jS,detector:QW,loader:JW},eq=tq,LS="treemap",rq=v(t=>/^\s*treemap/.test(t),"detector"),nq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-OG6HWLK6-DO22Vj8Q.js");return{diagram:e}},__vite__mapDeps([52,14,18,20,5,3,4,6,24,28,23,7]));return{id:LS,diagram:t}},"loader"),iq={id:LS,detector:rq,loader:nq},BS="wardley-beta",sq=v(t=>/^\s*wardley-beta/i.test(t),"detector"),oq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./wardleyDiagram-YWT4CUSO-BaxHdcre.js");return{diagram:e}},__vite__mapDeps([53,18,20,5,3,4,6,7]));return{id:BS,diagram:t}},"loader"),aq={id:BS,detector:sq,loader:oq},lq=aq,s0=!1,uh=v(()=>{s0||(s0=!0,nc("error",oW,t=>t.toLowerCase().trim()==="error"),nc("---",{db:{clear:v(()=>{},"clear")},styles:{},renderer:{draw:v(()=>{},"draw")},parser:{parse:v(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:v(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),Ju(hW,yW,HW),Ju(V9,vW,H7,$7,o7,p7,x7,C7,A7,P7,r7,Q9,pW,h7,Q7,V7,rW,S7,_W,jW,N7,PW,VW,$W,AW,ZW,iq,eq,lq))},"addDiagrams"),cq=v(async()=>{tt.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(Ei).map(async([r,{detector:n,loader:i}])=>{if(i)try{id(r)}catch{try{const{diagram:s,id:o}=await i();nc(o,s,n)}catch(s){throw tt.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Ei[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){tt.error(`Failed to load ${e.length} external diagrams`);for(const r of e)tt.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),hq="graphics-document document";function AS(t,e){t.attr("role",hq),e!==""&&t.attr("aria-roledescription",e)}v(AS,"setA11yDiagramInfo");function MS(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}v(MS,"addSVGa11yTitleDescription");var Si,Xd=(Si=class{constructor(e,r,n,i,s){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=s}static async fromText(e,r={}){var c,u;const n=ye(),i=Vf(e,n);e=W6(e)+`
|
|
646
|
-
`;try{id(i)}catch{const d=i4(i);if(!d)throw new A1(`Diagram ${i} not found.`);const{id:p,diagram:f}=await d();nc(p,f)}const{db:s,parser:o,renderer:a,init:l}=id(i);return o.parser&&(o.parser.yy=s),(c=s.clear)==null||c.call(s),l==null||l(n),r.title&&((u=s.setDiagramTitle)==null||u.call(s,r.title)),await o.parse(e),new Si(i,e,s,o,a)}async render(e,r){await this.renderer.draw(this.text,e,r,this)}getParser(){return this.parser}getType(){return this.type}},v(Si,"Diagram"),Si),o0=[],uq=v(()=>{o0.forEach(t=>{t()}),o0=[]},"attachFunctions"),dq=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function IS(t){const e=t.match(B1);if(!e)return{text:t,metadata:{}};let r=U$(e[1],{schema:H$})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:t.slice(e[0].length),metadata:n}}v(IS,"extractFrontMatter");var fq=v(t=>t.replace(/\r\n?/g,`
|
|
647
|
-
`).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),pq=v(t=>{const{text:e,metadata:r}=IS(t),{displayMode:n,title:i,config:s={}}=r;return n&&(s.gantt||(s.gantt={}),s.gantt.displayMode=n),{title:i,config:s,text:e}},"processFrontmatter"),mq=v(t=>{const e=Hr.detectInit(t)??{},r=Hr.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:n})=>n==="wrap"):(r==null?void 0:r.type)==="wrap"&&(e.wrap=!0),{text:j6(t),directive:e}},"processDirectives");function Yp(t){const e=fq(t),r=pq(e),n=mq(r.text),i=jp(r.config,n.directive);return t=dq(n.text),{code:t,title:r.title,config:i}}v(Yp,"preprocessDiagram");function FS(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(FS,"toBase64");var gq=5e4,xq="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",yq="sandbox",bq="loose",Cq="http://www.w3.org/2000/svg",kq="http://www.w3.org/1999/xlink",vq="http://www.w3.org/1999/xhtml",wq="100%",Sq="100%",Tq="border:0;margin:0;",_q="margin:0",Eq="allow-top-navigation-by-user-activation allow-popups",Nq='The "iframe" tag is not supported by your browser.',jq=["foreignobject"],Lq=["dominant-baseline"];function Vp(t){const e=Yp(t);return ec(),B4(e.config??{}),e}v(Vp,"processAndSetConfigs");async function PS(t,e){uh();try{const{code:r,config:n}=Vp(t);return{diagramType:(await OS(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(PS,"parse");var a0=v((t,e,r=[])=>{const n=D1(`{ ${r.join(" !important; ")} !important; }`);return`.${t} ${e} ${n}`},"cssImportantStyles"),Bq=v((t,e=new Map)=>{const r=new CSSStyleSheet;if(t.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${t.fontFamily}}`,r.cssRules.length),t.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${t.altFontFamily}}`,r.cssRules.length),e instanceof Map){const a=hr(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(l=>{kx(l.styles)||a.forEach(c=>{r.insertRule(a0(l.id,c,l.styles),r.cssRules.length)}),kx(l.textStyles)||r.insertRule(a0(l.id,"tspan",((l==null?void 0:l.textStyles)||[]).map(c=>c.replace("color","fill"))),r.cssRules.length)})}let n="";if(t.themeCSS!==void 0)if(typeof r.replaceSync=="function"){const i=new CSSStyleSheet;i.replaceSync(t.themeCSS),n=nd(i)+`
|
|
648
|
-
`}else n+=`${t.themeCSS}
|
|
649
|
-
`;return n+nd(r)},"createCssStyles"),Aq=v((t,e)=>Vd(z9(`${t}{${e}}`),H9([v(function(n,i,s,o){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===Ud)return;n.props=n.props.map(a=>a.startsWith(t)?a:`${t} ${a}`)}else n.type.startsWith("@")&&([...[E9,j9,X2,B9,"@container","@starting-style"],Ud].includes(n.type)||(tt.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=Up))},"addNamespace"),q9])),"compileCSS"),Mq=v((t,e,r,n)=>{const i=Bq(t,r),s=K4(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return Aq(n,s)},"createUserStyles"),Iq=v((t="",e,r)=>{let n=t;return!r&&!e&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=Bi(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),Fq=v((t="",e)=>{var i,s;const r=(s=(i=e==null?void 0:e.viewBox)==null?void 0:i.baseVal)!=null&&s.height?e.viewBox.baseVal.height+"px":Sq,n=FS(`<body style="${_q}">${t}</body>`);return`<iframe style="width:${wq};height:${r};${Tq}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${Eq}">
|
|
650
|
-
${Nq}
|
|
651
|
-
</iframe>`},"putIntoIFrame"),l0=v((t,e,r,n,i)=>{const s=t.append("div");s.attr("id",r),n&&s.attr("style",n);const o=s.append("svg").attr("id",e).attr("width","100%").attr("xmlns",Cq);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function Kd(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(Kd,"sandboxedIframe");var Pq=v((t,e,r,n)=>{var i,s,o;(i=t.getElementById(e))==null||i.remove(),(s=t.getElementById(r))==null||s.remove(),(o=t.getElementById(n))==null||o.remove()},"removeExistingElements"),Dq=v(async function(t,e,r){var z,q,R,F,M,D;uh();const n=Vp(e);e=n.code;const i=ye();tt.debug(i),e.length>((i==null?void 0:i.maxTextSize)??gq)&&(e=xq);const s=`#${t}`,o="i"+t,a="#"+o,l="d"+t,c="#"+l,u=v(()=>{const j=Yt(p?a:c).node();j&&"remove"in j&&j.remove()},"removeTempElements");let d=Yt(document.body);const p=i.securityLevel===yq,f=i.securityLevel===bq,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),p){const O=Kd(Yt(r),o);d=Yt(O.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Yt(r);l0(d,t,l,`font-family: ${m}`,kq)}else{if(Pq(document,t,l,o),p){const O=Kd(Yt(document.body),o);d=Yt(O.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Yt("body");l0(d,t,l)}let x,g;try{x=await Xd.fromText(e,{title:n.title})}catch(O){if(i.suppressErrorRendering)throw u(),O;x=await Xd.fromText("error"),g=O}const y=d.select(c).node(),b=x.type,k=y.firstChild,T=k.firstChild,_=(q=(z=x.renderer).getClasses)==null?void 0:q.call(z,e,x),w=Mq(i,b,_,s),N=document.createElement("style");N.innerHTML=w,k.insertBefore(N,T);try{await x.renderer.draw(e,t,"11.15.0",x)}catch(O){throw i.suppressErrorRendering?u():iW.draw(e,t,"11.15.0"),O}const B=d.select(`${c} svg`),I=(F=(R=x.db).getAccTitle)==null?void 0:F.call(R),E=(D=(M=x.db).getAccDescription)==null?void 0:D.call(M);RS(b,B,I,E),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",vq);let P=d.select(c).node().innerHTML;if(tt.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),P=Iq(P,p,Ln(i.arrowMarkerAbsolute)),p){const O=d.select(c+" svg").node();P=Fq(P,O)}else f||(P=$s.sanitize(P,{ADD_TAGS:jq,ADD_ATTR:Lq,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(uq(),g)throw g;return u(),{diagramType:b,svg:P,bindFunctions:x.db.bindFunctions}},"render");function DS(t={}){var n;const e=Ie({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),j4(e),e!=null&&e.theme&&e.theme in Sn?e.themeVariables=Sn[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=Sn.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?N4(e):O1();Yf(r.logLevel),uh()}v(DS,"initialize");var OS=v((t,e={})=>{const{code:r}=Yp(t);return Xd.fromText(r,e)},"getDiagramFromText");function RS(t,e,r,n){AS(e,t),MS(e,r,n,e.attr("id"))}v(RS,"addA11yInfo");var Mi=Object.freeze({render:Dq,parse:PS,getDiagramFromText:OS,initialize:DS,getConfig:ye,setConfig:R1,getSiteConfig:O1,updateSiteConfig:L4,reset:v(()=>{ec()},"reset"),globalReset:v(()=>{ec(zs)},"globalReset"),defaultConfig:zs});Yf(ye().logLevel);ec(ye());var Oq=v((t,e,r)=>{tt.warn(t),Np(t)?(r&&r(t.str,t.hash),e.push({...t,message:t.str,error:t})):(r&&r(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),$S=v(async function(t={querySelector:".mermaid"}){try{await Rq(t)}catch(e){if(Np(e)&&tt.error(e.str),_r.parseError&&_r.parseError(e),!t.suppressErrors)throw tt.error("Use the suppressErrors option to suppress these errors"),e}},"run"),Rq=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=Mi.getConfig();tt.debug(`${t?"":"No "}Callback function found`);let i;if(r)i=r;else if(e)i=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");tt.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(tt.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),Mi.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new Hr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const l of Array.from(i)){if(tt.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${s.next()}`;o=l.innerHTML,o=tw(Hr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Hr.detectInit(o);u&&tt.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:p}=await HS(c,o,l);l.innerHTML=d,t&&await t(c),p&&p(l)}catch(d){Oq(d,a,_r.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),zS=v(function(t){Mi.initialize(t)},"initialize"),$q=v(async function(t,e,r){tt.warn("mermaid.init is deprecated. Please use run instead."),t&&zS(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await $S(n)},"init"),zq=v(async(t,{lazyLoad:e=!0}={})=>{uh(),Ju(...t),e===!1&&await cq()},"registerExternalDiagrams"),WS=v(function(){if(_r.startOnLoad){const{startOnLoad:t}=Mi.getConfig();t&&_r.run().catch(e=>tt.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",WS,!1);var Wq=v(function(t){_r.parseError=t},"setParseErrorHandler"),jc=[],gu=!1,qS=v(async()=>{if(!gu){for(gu=!0;jc.length>0;){const t=jc.shift();if(t)try{await t()}catch(e){tt.error("Error executing queue",e)}}gu=!1}},"executeQueue"),qq=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{Mi.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;tt.error("Error parsing",a),(l=_r.parseError)==null||l.call(_r,a),o(a),n(a)})}),"performCall");jc.push(i),qS().catch(n)}),"parse"),HS=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{Mi.render(t,e,r).then(l=>{o(l),n(l)},l=>{var c;tt.error("Error parsing",l),(c=_r.parseError)==null||c.call(_r,l),a(l),i(l)})}),"performCall");jc.push(s),qS().catch(i)}),"render"),Hq=v(()=>Object.keys(Ei).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),_r={startOnLoad:!0,mermaidAPI:Mi,parse:qq,render:HS,init:$q,run:$S,registerExternalDiagrams:zq,registerLayoutLoaders:G2,initialize:zS,parseError:void 0,contentLoaded:WS,setParseErrorHandler:Wq,detectType:Vf,registerIconPacks:Xz,getRegisteredDiagramsMetadata:Hq},US=_r;/*! Check if previously processed *//*!
|
|
652
|
-
* Wait for document loaded before starting the execution
|
|
653
|
-
*/US.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function Uq({code:t}){const e=C.useRef(null),r=C.useId(),[n,i]=C.useState(null),[s,o]=C.useState(null);return C.useEffect(()=>{let a=!1;const l=`mermaid-${r.replace(/:/g,"")}`;return US.render(l,t).then(({svg:c})=>{a||i(c)}).catch(c=>{a||o(c.message||"Invalid diagram")}),()=>{a=!0}},[t,r]),s?h.jsx("pre",{className:"text-[11px] text-destructive bg-destructive/10 border border-destructive/20 rounded p-3 overflow-x-auto",children:`Mermaid error: ${s}
|
|
654
|
-
|
|
655
|
-
${t}`}):n?h.jsx("div",{ref:e,className:"my-3 overflow-x-auto",dangerouslySetInnerHTML:{__html:n}}):h.jsx("div",{className:"text-[11px] text-muted-foreground py-2",children:"Rendering diagram..."})}function Gq({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?h.jsx(Uq,{code:String(e).trim()}):h.jsx("code",{className:t,...r,children:e})}function Yq(t){const e={name:"",children:new Map,files:[]};for(const r of t){const n=r.split("/");let i=e;for(let s=0;s<n.length-1;s++)i.children.has(n[s])||i.children.set(n[s],{name:n[s],children:new Map,files:[]}),i=i.children.get(n[s]);i.files.push({name:n[n.length-1],path:r})}return e}function GS(t,e){if(!e)return t;const r=e.toLowerCase(),n={name:t.name,children:new Map,files:t.files.filter(i=>i.name.toLowerCase().includes(r)||i.path.toLowerCase().includes(r))};for(const[i,s]of t.children){const o=GS(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function YS(t){let e=t.files.length;for(const r of t.children.values())e+=YS(r);return e}function VS({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=Vq(t,e),c=r.has(l)||!!a,u=YS(t);return h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>n(l),className:"flex items-center gap-1.5 w-full px-2 py-1 text-left hover:bg-muted/30 transition-colors rounded-sm",style:{paddingLeft:`${e*16+4}px`},children:[c?h.jsx(nM,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):h.jsx(If,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name}),h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto tabular-nums shrink-0",children:u})]}),c&&h.jsxs(h.Fragment,{children:[[...t.children.values()].sort((d,p)=>d.name.localeCompare(p.name)).map(d=>h.jsx(VS,{node:d,depth:e+1,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a},d.name)),t.files.sort((d,p)=>d.name.localeCompare(p.name)).map(d=>h.jsx(XS,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function XS({file:t,depth:e,isSelected:r,isTracked:n,onSelect:i}){return h.jsxs("button",{onClick:i,className:rt("flex items-center gap-1.5 w-full px-2 py-1 text-left transition-colors rounded-sm",r?"bg-accent/10 text-accent":"hover:bg-muted/30"),style:{paddingLeft:`${e*16+4}px`},children:[h.jsx(Pi,{className:"h-3 w-3 shrink-0",style:{color:n?"hsl(var(--primary))":void 0}}),h.jsx("span",{className:rt("text-xs truncate",r?"text-accent font-medium":"text-foreground"),children:t.name}),n&&h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 ml-auto",style:{background:"hsl(var(--primary))"}})]})}function Vq(t,e){return`dir-${e}-${t.name}`}function KS({items:t,selectedFile:e,onSelectedFileChange:r,previousView:n,onBack:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,c]=C.useState([]),[u,d]=C.useState(!0),[p,f]=C.useState(null),m=e||p,x=Y=>{f(Y),r&&r(Y)},[g,y]=C.useState(null),[b,k]=C.useState(!1),[T,_]=C.useState(!1),[w,N]=C.useState(""),[B,I]=C.useState(null),[E,P]=C.useState(!1),z=C.useRef(null),[q,R]=C.useState(""),[F,M]=C.useState(()=>new Set(["dir-0-docs"])),[D,O]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),j=C.useRef(!1),S=C.useRef(null),G=C.useCallback(Y=>{Y.preventDefault(),j.current=!0;const lt=Nt=>{if(!j.current||!S.current)return;const Dt=S.current.getBoundingClientRect(),le=Math.min(Math.max(Nt.clientX-Dt.left,160),500);O(le)},xt=()=>{j.current=!1,document.removeEventListener("mousemove",lt),document.removeEventListener("mouseup",xt),O(Nt=>(localStorage.setItem("compose:docsTreeWidth",Nt),Nt))};document.addEventListener("mousemove",lt),document.addEventListener("mouseup",xt)},[]),Q=T&&w!==B,A=C.useCallback(async()=>{if(!(!m||E)){P(!0);try{(await Rt("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:w})})).ok&&(I(w),y(w))}catch{}P(!1)}},[m,w,E]),ct=C.useCallback(()=>{_(Y=>(!Y&&g!==null&&(N(g),I(g)),!Y))},[g]);C.useEffect(()=>{if(!T)return;const Y=lt=>{(lt.metaKey||lt.ctrlKey)&<.key==="s"&&(lt.preventDefault(),A())};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[T,A]),C.useEffect(()=>{_(!1),N(""),I(null)},[m]),C.useEffect(()=>{Rt("/api/files").then(Y=>Y.json()).then(Y=>{c(Y.files||[]),d(!1);const lt=new Set(["dir-0-docs"]);for(const xt of Y.files||[]){const Nt=xt.split("/");Nt.length>1&<.add(`dir-1-${Nt[1]}`)}M(lt)}).catch(()=>d(!1))},[]),C.useEffect(()=>{if(!m){y(null);return}k(!0),Rt(`/api/file?path=${encodeURIComponent(m)}`).then(Y=>Y.json()).then(Y=>{y(Y.content??null),k(!1)}).catch(()=>{y(null),k(!1)})},[m]);const ut=C.useMemo(()=>!o||!s?l:l.filter(Y=>Y.includes(`features/${s}/`)),[l,o,s]),st=C.useMemo(()=>{const Y=new Set,lt=xt=>xt.split("/").pop();for(const xt of t){const Nt=`${xt.title||""} ${xt.description||""} ${xt.planLink||""}`.toLowerCase();for(const Dt of ut)(Nt.includes(Dt.toLowerCase())||Nt.includes(lt(Dt).replace(".md","").toLowerCase()))&&Y.add(Dt)}return Y},[t,ut]),It=C.useMemo(()=>Yq(ut),[ut]),ht=C.useMemo(()=>GS(It,q),[It,q]),ot=C.useCallback(Y=>{M(lt=>{const xt=new Set(lt);return xt.has(Y)?xt.delete(Y):xt.add(Y),xt})},[]);return u?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading docs..."})}):h.jsxs("div",{ref:S,className:"flex-1 flex min-h-0",children:[h.jsxs("div",{className:"shrink-0 flex flex-col min-h-0",style:{width:`${D}px`},children:[h.jsxs("div",{className:"px-2 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:h.jsx(ka,{featureCode:s,active:o,onToggle:a})}),h.jsxs("div",{className:"relative",children:[h.jsx(ni,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Hc,{placeholder:"Search files...",value:q,onChange:Y=>R(Y.target.value),className:"h-7 pl-7 pr-7 text-xs"}),q&&h.jsx("button",{onClick:()=>R(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h.jsx(dn,{className:"h-3 w-3"})})]}),h.jsxs("div",{className:"flex items-center justify-between mt-1.5 px-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ut.length," files"]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ut.length-st.size," untracked"]})]})]}),h.jsx(Kn,{className:"flex-1",children:h.jsxs("div",{className:"py-1",children:[[...ht.children.values()].sort((Y,lt)=>Y.name.localeCompare(lt.name)).map(Y=>h.jsx(VS,{node:Y,depth:0,expandedDirs:F,onToggleDir:ot,selectedFile:m,onSelectFile:x,trackedPaths:st,searchQuery:q},Y.name)),ht.files.sort((Y,lt)=>Y.name.localeCompare(lt.name)).map(Y=>h.jsx(XS,{file:Y,depth:0,isSelected:m===Y.path,isTracked:st.has(Y.path),onSelect:()=>x(Y.path)},Y.path))]})})]}),h.jsx("div",{onMouseDown:G,className:"w-1 shrink-0 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors",style:{background:"hsl(var(--border))"}}),h.jsx("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:m?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2",style:{borderBottom:"1px solid hsl(var(--border))"},children:[n&&i&&h.jsxs("button",{onClick:i,className:"flex items-center gap-1 text-xs text-accent hover:text-accent/80 transition-colors shrink-0",title:`Back to ${n}`,children:[h.jsx(MA,{className:"h-3 w-3"}),"Back to ",n.charAt(0).toUpperCase()+n.slice(1)]}),h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:m}),Q&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{color:"hsl(var(--accent))",background:"hsl(var(--accent) / 0.1)"},children:"modified"}),st.has(m)&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{color:"hsl(var(--primary))",background:"hsl(var(--primary) / 0.1)"},children:"tracked"}),T&&h.jsxs("button",{onClick:A,disabled:E||!Q,className:rt("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",Q?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[h.jsx(BM,{className:"h-3 w-3"}),E?"Saving...":"Save"]}),h.jsx("button",{onClick:ct,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors px-1.5 py-0.5 rounded hover:bg-muted/50",title:T?"Preview":"Edit",disabled:g===null,children:T?h.jsx(Bb,{className:"h-3.5 w-3.5"}):h.jsx(Ib,{className:"h-3.5 w-3.5"})})]}),b?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):g!==null&&T?h.jsx("textarea",{ref:z,value:w,onChange:Y=>N(Y.target.value),className:"flex-1 w-full resize-none border-0 outline-none px-4 py-3 text-sm",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',background:"hsl(var(--background))",color:"hsl(var(--foreground))",tabSize:2},spellCheck:!1}):g!==null?h.jsx(Kn,{className:"flex-1",children:h.jsx("div",{className:"px-6 py-4 max-w-3xl",children:h.jsx("article",{className:`prose prose-sm prose-invert max-w-none
|
|
656
|
-
prose-headings:text-foreground prose-p:text-muted-foreground
|
|
657
|
-
prose-a:text-accent prose-strong:text-foreground
|
|
658
|
-
prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
|
|
659
|
-
prose-pre:bg-muted prose-pre:border prose-pre:border-border
|
|
660
|
-
prose-li:text-muted-foreground prose-table:text-xs
|
|
661
|
-
prose-th:text-foreground prose-td:text-muted-foreground
|
|
662
|
-
prose-hr:border-border`,children:h.jsx(Ef,{remarkPlugins:[Bf],components:{code:Gq},children:g})})})}):h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Could not load file"})})]}):h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsxs("div",{className:"text-center",children:[h.jsx(Pi,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/30"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a file to preview"}),h.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Markdown files from the project docs/ directory"})]})})})]})}const Xq=Rb("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),zt=C.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},s)=>{const o=n?KI:"button";return h.jsx(o,{className:rt(Xq({variant:e,size:r,className:t})),ref:s,...i})});zt.displayName="Button";class Kq{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);const s=this.castInput(e,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,r,n,i){var s;const o=b=>{if(b=this.postProcess(b,n),i){setTimeout(function(){i(b)},0);return}else return b},a=r.length,l=e.length;let c=1,u=a+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));const d=(s=n.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+d,f=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(f[0],r,e,0,n);if(f[0].oldPos+1>=l&&m+1>=a)return o(this.buildValues(f[0].lastComponent,r,e));let x=-1/0,g=1/0;const y=()=>{for(let b=Math.max(x,-c);b<=Math.min(g,c);b+=2){let k;const T=f[b-1],_=f[b+1];T&&(f[b-1]=void 0);let w=!1;if(_){const B=_.oldPos-b;w=_&&0<=B&&B<a}const N=T&&T.oldPos+1<l;if(!w&&!N){f[b]=void 0;continue}if(!N||w&&T.oldPos<_.oldPos?k=this.addToPath(_,!0,!1,0,n):k=this.addToPath(T,!1,!0,1,n),m=this.extractCommon(k,r,e,b,n),k.oldPos+1>=l&&m+1>=a)return o(this.buildValues(k.lastComponent,r,e))||!0;f[b]=k,k.oldPos+1>=l&&(g=Math.min(g,b-1)),m+1>=a&&(x=Math.max(x,b+1))}c++};if(i)(function b(){setTimeout(function(){if(c>u||Date.now()>p)return i(void 0);y()||b()},0)})();else for(;c<=u&&Date.now()<=p;){const b=y();if(b)return b}}addToPath(e,r,n,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(e,r,n,i,s){const o=r.length,a=n.length;let l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(n[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(n.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let d=r.slice(l,l+u.count);d=d.map(function(p,f){const m=n[c+f];return m.length>p.length?m:p}),u.value=this.join(d)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}}class Zq extends Kq{constructor(){super(...arguments),this.tokenize=tH}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
663
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
|
|
664
|
-
`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
665
|
-
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
|
666
|
-
`)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const Qq=new Zq;function Jq(t,e,r){return Qq.diff(t,e,r)}function tH(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
|
667
|
-
`));const r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){const s=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}function Xp({oldText:t,newText:e}){const[r,n]=C.useState(!1),{parts:i,addCount:s,removeCount:o}=C.useMemo(()=>{if(!t||!e)return{parts:[],addCount:0,removeCount:0};const a=Jq(t,e);let l=0,c=0;for(const u of a){const d=u.value.split(`
|
|
668
|
-
`).filter(p=>p!=="").length;u.added&&(l+=d),u.removed&&(c+=d)}return{parts:a,addCount:l,removeCount:c}},[t,e]);return!t||!e?null:s===0&&o===0?h.jsx("span",{className:"text-[9px] text-muted-foreground/50 italic",children:"No changes"}):r?h.jsxs("div",{className:"mt-1.5",children:[h.jsx("button",{onClick:()=>n(!1),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors mb-1",children:"Hide changes"}),h.jsx("div",{className:"rounded border border-border bg-muted/30 overflow-x-auto max-h-[300px] overflow-y-auto",children:h.jsx("pre",{className:"text-[10px] font-mono leading-relaxed",children:i.map((a,l)=>{const c=a.value.split(`
|
|
669
|
-
`);return c[c.length-1]===""&&c.pop(),c.map((u,d)=>h.jsxs("div",{className:a.added?"bg-emerald-500/15 text-emerald-300":a.removed?"bg-red-500/15 text-red-300 line-through":"text-muted-foreground",style:{padding:"0 8px"},children:[h.jsx("span",{className:"inline-block w-3 text-muted-foreground/40 select-none mr-1",children:a.added?"+":a.removed?"-":" "}),u||" "]},`${l}-${d}`))})})})]}):h.jsxs("button",{onClick:()=>n(!0),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors",children:["Show changes (+",s," -",o,")"]})}function ZS(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function eH({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=fy[t.fromPhase];return e.exists?h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r&&h.jsx("span",{className:"font-mono",children:r}),r&&": ",Math.round(e.completeness*100),"% complete"," · ",e.wordCount," words",((i=(n=e.sections)==null?void 0:n.missing)==null?void 0:i.length)>0&&h.jsxs("span",{className:"text-amber-400",children:[" (missing: ",e.sections.missing.join(", "),")"]}),!e.meetsMinWordCount&&h.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}):h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r??"Artifact"," not found"]})}function rH(t){var f;const e=t.artifactAssessment,r=t.summary;if(r){const m=new RegExp("(?<!\\bno\\s)(?<!\\b0\\s)\\b(critical|error|fail|missing)\\b","i").test(r);return{sentence:r,outcome:m?"revise":"approve"}}if(!e)return null;if(e.exists===!1)return{sentence:"Required artifact is missing",outcome:"revise"};const{completeness:n,wordCount:i,sections:s,meetsMinWordCount:o,findings:a}=e,l=(a??[]).filter(m=>/critical|error|fatal/i.test(m.severity??m.level??"")).length,c=((f=s==null?void 0:s.missing)==null?void 0:f.length)??0;if(l>0)return{sentence:`${l} critical finding${l>1?"s":""}`,outcome:"revise"};if(!o&&i!==void 0)return{sentence:`Thin artifact (${i} words)`,outcome:"revise"};if(c>0)return{sentence:`Missing ${c} section${c>1?"s":""}`,outcome:"revise"};const u=n!==void 0?`${Math.round(n*100)}% complete`:null,d=i!==void 0?`${i}w`:null;return{sentence:[u,d].filter(Boolean).join(", ")||"Ready",outcome:"approve"}}function nH({gate:t}){const e=rH(t);if(!e)return null;const r=e.outcome==="approve";return h.jsxs("div",{className:`text-[10px] px-2 py-0.5 rounded font-medium ${r?"bg-success/10 text-success border border-success/20":"bg-amber-400/10 text-amber-400 border border-amber-400/20"}`,children:[r?"Recommended: approve":"Recommended: revise"," — ",e.sentence]})}function c0({title:t,count:e,color:r,children:n}){return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:r}}),h.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:t}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:e})]}),n]})}function iH({gate:t,item:e,priorRevision:r,isExpanded:n,expandedAction:i,onExpand:s,onResolve:o,onSelect:a}){const[l,c]=C.useState(""),u=()=>{o(t.id,"revised",l||void 0),s(null,null),c("")},d=()=>{l.trim()&&(o(t.id,"killed",l),s(null,null),c(""))};return h.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent hover:bg-muted/50 transition-colors",children:[h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[h.jsx("button",{onClick:()=>a(t.itemId),className:"text-sm text-foreground hover:text-accent transition-colors truncate block",children:(e==null?void 0:e.title)??"Unknown"}),h.jsx("p",{className:"text-[10px] text-muted-foreground",children:_n[t.stepId]??`${_e[t.fromPhase]??t.fromPhase} → ${_e[t.toPhase]??t.toPhase}`}),h.jsx(eH,{gate:t}),r?h.jsxs("div",{className:"space-y-1",children:[h.jsxs("div",{className:"text-[10px] px-2 py-1 rounded bg-amber-400/10 border border-amber-400/20 text-amber-400",children:["Prior revision: ",r.comment||"No comment"]}),r.priorSnapshot&&r.currentSnapshot&&h.jsx("div",{className:"px-2",children:h.jsx(Xp,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:ZS(t.createdAt)})]}),h.jsx("div",{className:"mt-1.5",children:h.jsx(nH,{gate:t})}),h.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[h.jsx(zt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>o(t.id,"approved"),children:"Approve"}),h.jsx(zt,{variant:"outline",size:"sm",className:rt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",n&&i==="revise"&&"bg-amber-400/10"),onClick:()=>{n&&i==="revise"?s(null,null):(s(t.id,"revise"),c(""))},children:"Revise"}),h.jsx(zt,{variant:"outline",size:"sm",className:rt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",n&&i==="kill"&&"bg-destructive/10"),onClick:()=>{n&&i==="kill"?s(null,null):(s(t.id,"kill"),c(""))},children:"Kill"})]}),n&&h.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[h.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none",placeholder:i==="revise"?"Feedback (optional)...":"Kill reason (required)...",value:l,onChange:p=>c(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(i==="revise"?u():i==="kill"&&d()),p.key==="Escape"&&s(null,null)},autoFocus:!0}),h.jsx(zt,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:i==="kill"&&!l.trim(),onClick:i==="revise"?u:d,children:i==="revise"?"Submit":"Confirm Kill"})]})]})}function sH(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function oH({gate:t,item:e}){const r={approved:{color:"text-success",border:"border-success/30"},approve:{color:"text-success",border:"border-success/30"},revised:{color:"text-amber-400",border:"border-amber-400/30"},revise:{color:"text-amber-400",border:"border-amber-400/30"},killed:{color:"text-destructive",border:"border-destructive/30"},kill:{color:"text-destructive",border:"border-destructive/30"}},n=r[t.outcome]||r.approved,i=sH(t);return h.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:(e==null?void 0:e.title)??"Unknown"}),h.jsx(ar,{variant:"outline",className:rt("text-[10px] px-1.5 py-0 h-4",n.color,n.border),children:t.outcome}),i!=="human"&&h.jsx("span",{className:"text-[9px] px-1 py-0 rounded bg-muted text-muted-foreground",children:i}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:ZS(t.resolvedAt)})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:_n[t.stepId]??`${_e[t.fromPhase]??t.fromPhase} → ${_e[t.toPhase]??t.toPhase}`}),t.comment&&h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function QS({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o}){const[a,l]=C.useState(null),[c,u]=C.useState(null),d=C.useMemo(()=>{if(!s||!i)return t;const k=new Set(e.filter(T=>{var _;return T.featureCode===i||((_=T.lifecycle)==null?void 0:_.featureCode)===i}).map(T=>T.id));return t.filter(T=>k.has(T.itemId))},[t,e,s,i]),p=(k,T)=>{l(k),u(T)},{pending:f,resolved:m,priorRevisions:x}=C.useMemo(()=>{const k=[],T=[];for(const w of d)w.status==="pending"?k.push(w):w.resolvedAt&&T.push(w);k.sort((w,N)=>new Date(w.createdAt)-new Date(N.createdAt)),T.sort((w,N)=>new Date(N.resolvedAt)-new Date(w.resolvedAt));const _=new Map;for(const w of k){const N=T.find(B=>B.stepId===w.stepId&&B.itemId===w.itemId&&(B.outcome==="revised"||B.outcome==="revise")&&B.comment);N&&_.set(w.id,{comment:N.comment,priorSnapshot:N.artifactSnapshot||null,currentSnapshot:w.artifactSnapshot||null})}return{pending:k,resolved:T,priorRevisions:_}},[d]),[g,y]=C.useState(!1),b=C.useMemo(()=>new Map(e.map(k=>[k.id,k])),[e]);return h.jsxs("div",{className:"flex-1 overflow-auto flex flex-col",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0",children:[h.jsx(ka,{featureCode:i,active:s,onToggle:o}),h.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),f.length>0?h.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:[f.length," pending"]}):h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),m.length>0&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",m.length," resolved"]})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[f.length>0&&h.jsx(c0,{title:"Pending",count:f.length,color:"#f59e0b",children:f.map(k=>h.jsx(iH,{gate:k,item:b.get(k.itemId),priorRevision:x.get(k.id),isExpanded:a===k.id,expandedAction:a===k.id?c:null,onExpand:p,onResolve:r,onSelect:n},k.id))}),m.length>0&&h.jsxs(c0,{title:"History",count:m.length,color:"#22c55e",children:[(g?m.slice(0,50):m.slice(0,10)).map(k=>h.jsx(oH,{gate:k,item:b.get(k.itemId)},k.id)),m.length>10&&!g&&h.jsxs("button",{className:"w-full px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>y(!0),children:["Show all ",m.length," resolved gates"]})]}),f.length===0&&m.length===0&&h.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function JS({event:t,items:e,onNavigate:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(null);if(C.useEffect(()=>{if(!t)return;o(t),i(!0);const u=setTimeout(()=>i(!1),5e3);return()=>clearTimeout(u)},[t]),!n||!s)return null;const a=e.find(u=>u.id===s.itemId),l=(a==null?void 0:a.title)??"Unknown",c=s.type==="pending"?`Gate pending: ${Jo(s,a)}`:`Gate ${s.outcome}: ${l}`;return h.jsx("button",{onClick:()=>{r(),i(!1)},className:"fixed bottom-4 right-4 z-50 max-w-sm px-4 py-3 rounded-lg border border-border bg-card shadow-lg text-sm text-foreground cursor-pointer hover:bg-muted/50 transition-all animate-in fade-in slide-in-from-bottom-2",children:c})}function aH({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=C.useContext(qc),i=r.has(t.id)?"vision-entering":n.has(t.id)?"vision-updated":"",[s,o]=C.useState(!1),[a,l]=C.useState(""),c=t.status==="complete"||t.status==="killed",{baseDesc:u,resolution:d}=C.useMemo(()=>{if(!t.description)return{baseDesc:"",resolution:""};const x=`
|
|
670
|
-
|
|
671
|
-
---
|
|
672
|
-
Resolution:`,g=t.description.indexOf(x);return g===-1?{baseDesc:t.description,resolution:""}:{baseDesc:t.description.slice(0,g).trim(),resolution:t.description.slice(g+x.length).trim()}},[t.description]),p=C.useCallback(async()=>{const g=`Be brief. Summarize, give your recommendation, refine the decision wording based on the resolution if needed: ${t.description||t.title}
|
|
673
|
-
`;try{await fetch("http://localhost:4002/api/terminal/inject",{method:"POST",headers:ps({"Content-Type":"application/json"}),body:JSON.stringify({text:g})});const y=document.querySelector(".xterm-helper-textarea");y&&y.focus()}catch(y){console.error("Failed to inject into terminal:",y)}},[t]),f=C.useCallback(()=>{const x=a.trim()?`${t.description||""}
|
|
674
|
-
|
|
675
|
-
---
|
|
676
|
-
Resolution: ${a.trim()}`:t.description;e(t.id,{status:"complete",description:x}),o(!1),l("")},[t.id,t.description,a,e]),m=C.useCallback(()=>{e(t.id,{status:"killed"})},[t.id,e]);return h.jsxs("div",{className:rt("rounded-lg border p-3 space-y-2 transition-all",c?"border-border/50 bg-muted/20 opacity-60":"border-border bg-muted/30",i),children:[h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{background:c?"hsl(var(--muted-foreground))":br.question}}),h.jsx("p",{className:rt("text-sm font-medium leading-snug flex-1",c?"text-muted-foreground line-through":"text-foreground"),children:t.title})]}),u&&h.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed pl-4",children:u}),d&&h.jsxs("div",{className:rt("ml-4 pl-3 border-l-2 border-success/40 py-1",n.has(t.id)&&"resolution-sparkle"),children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-0.5",children:"Resolution"}),h.jsx("p",{className:"text-xs text-foreground leading-relaxed",children:d})]}),s&&h.jsxs("div",{className:"ml-4 flex items-center gap-1.5",children:[h.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring",placeholder:"Resolution note (optional)...",value:a,onChange:x=>l(x.target.value),onKeyDown:x=>{x.key==="Enter"&&f(),x.key==="Escape"&&o(!1)},autoFocus:!0}),h.jsx(zt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:f,children:h.jsx(Ff,{className:"h-3 w-3"})}),h.jsx(zt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:h.jsx(dn,{className:"h-3 w-3"})})]}),!c&&!s&&h.jsxs("div",{className:"flex items-center gap-1.5 pl-4",children:[h.jsxs("button",{onClick:p,className:"text-[10px] px-2 py-0.5 rounded-md text-accent hover:bg-accent/10 flex items-center gap-1 transition-colors",children:[h.jsx(zc,{className:"h-2.5 w-2.5"})," Discuss"]}),h.jsxs("button",{onClick:()=>o(!0),className:"text-[10px] px-2 py-0.5 rounded-md text-success hover:bg-success/10 flex items-center gap-1 transition-colors",children:[h.jsx(ba,{className:"h-2.5 w-2.5"})," Resolve"]}),h.jsxs("button",{onClick:m,className:"text-[10px] px-2 py-0.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 flex items-center gap-1 transition-colors",children:[h.jsx(XA,{className:"h-2.5 w-2.5"})," Dismiss"]})]}),c&&h.jsx("div",{className:"pl-4",children:h.jsx("span",{className:rt("text-[10px] px-1.5 py-0.5 rounded-full",t.status==="complete"?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.status==="complete"?"Resolved":"Dismissed"})})]})}function tT({item:t,items:e,connections:r,onUpdate:n,onClose:i}){const[s,o]=C.useState(null),[a,l]=C.useState(null),[c,u]=C.useState(""),d=C.useRef(null),p=C.useMemo(()=>{const x=new Map(e.map(y=>[y.id,y])),g=[];for(const y of r)if(y.type==="contradicts"){if(y.toId===t.id){const b=x.get(y.fromId);b&&g.push(b)}if(y.fromId===t.id){const b=x.get(y.toId);b&&g.push(b)}}return g.sort((y,b)=>{const k=new Date(y.createdAt||0).getTime();return new Date(b.createdAt||0).getTime()-k}),g},[t.id,e,r]),f=p.filter(x=>x.status!=="complete"&&x.status!=="killed").length;C.useEffect(()=>{if(!(!s||a!=="running"))return d.current=setInterval(async()=>{try{const x=await Rt(`http://localhost:4001/api/agent/${s}`);if(!x.ok)return;const g=await x.json();g.status!=="running"&&(l(g.status),clearInterval(d.current))}catch{}},1500),()=>clearInterval(d.current)},[s,a]);const m=C.useCallback(async()=>{if(a==="running")return;const x=t.description?`
|
|
677
|
-
Description: ${t.description}`:"",g=["Challenge the assumptions of this item and create counter-questions.","",`Item: "${t.title}" (type: ${t.type}, status: ${t.status})${x}`,"","Create 2-3 challenging questions that probe weaknesses, missing considerations, or alternative approaches. For each question, run:",`node scripts/vision-track.mjs create "<your question>" --type question --phase ${t.phase||"vision"} --description "<why this matters>" --connects-to ${t.id}:contradicts`,"","Be specific and constructive. Challenge the idea, not the person.","Only run the vision-track.mjs commands above. Do not do anything else."].join(`
|
|
678
|
-
`);l("running");try{const y=await Rt("http://localhost:4001/api/agent/spawn",{method:"POST",headers:ps({"Content-Type":"application/json"}),body:JSON.stringify({prompt:g})});if(!y.ok){const k=await y.json().catch(()=>({}));l("failed"),u(k.error||"Failed to spawn agent");return}const b=await y.json();o(b.agentId)}catch(y){l("failed"),u(y.message)}},[t,a]);return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:i}),h.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-xl border border-border bg-card shadow-2xl mx-4",children:[h.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3 border-b border-border shrink-0",children:[h.jsx(Yl,{className:"h-5 w-5 text-amber-400 shrink-0 mt-0.5"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pressure Test"}),h.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t.title})]}),h.jsx(zt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:h.jsx(dn,{className:"h-3.5 w-3.5"})})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-3",children:[a==="running"&&h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[h.jsx(Mb,{className:"h-3.5 w-3.5 text-accent animate-spin"}),h.jsx("span",{className:"text-xs text-accent",children:"Generating challenges..."})]}),a==="failed"&&h.jsx("div",{className:"px-3 py-2 rounded-lg bg-destructive/10 border border-destructive/20",children:h.jsxs("span",{className:"text-xs text-destructive",children:["Failed: ",c]})}),p.length===0&&!a?h.jsxs("div",{className:"text-center py-8",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No challenges yet."}),h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Run a pressure test to generate counter-questions."})]}):p.map(x=>h.jsx(aH,{item:x,onUpdate:n},x.id))]}),h.jsxs("div",{className:"flex items-center justify-between p-4 pt-3 border-t border-border shrink-0",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:f>0?`${f} open / ${p.length} total`:p.length>0?`${p.length} resolved`:"No challenges"}),h.jsxs(zt,{size:"sm",className:rt("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[h.jsx(Yl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const lH=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],cH=["gate","flag","skip"],hH=["light","dark","system"],h0=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function _o({title:t,children:e}){return h.jsxs("div",{className:"mb-6",children:[h.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:t}),e]})}function Ji({label:t,children:e}){return h.jsxs("div",{className:"flex items-center justify-between py-1.5 px-1",children:[h.jsx("label",{className:"text-sm text-foreground",children:t}),e]})}function uH({value:t,className:e,onCommit:r}){const[n,i]=C.useState(t||"");return C.useEffect(()=>{i(t||"")},[t]),h.jsx("input",{type:"text",className:e,value:n,onChange:s=>i(s.target.value),onBlur:()=>{n.trim()&&n.trim()!==t&&r(n.trim())}})}function eT({settings:t,onSettingsChange:e,onReset:r}){var p,f,m,x,g,y;if(!t)return h.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."});const n=C.useCallback((b,k)=>{const T=k==="null"?null:k;e({policies:{[b]:T}})},[e]),i=C.useCallback((b,k)=>{const T=parseInt(k,10);T>=1&&T<=100&&e({iterations:{[b]:{maxIterations:T}}})},[e]),s=C.useCallback((b,k)=>{k.trim()&&e({models:{[b]:k.trim()}})},[e]),o=C.useCallback(b=>{if(e({ui:{theme:b}}),b==="system"){const k=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",k),localStorage.removeItem("compose:theme")}else document.documentElement.classList.toggle("dark",b==="dark"),localStorage.setItem("compose:theme",b)},[e]),a=C.useCallback(b=>{e({ui:{defaultView:b}})},[e]),l=C.useCallback(b=>{e({capabilities:{enforcement:b}})},[e]),c=C.useCallback(()=>{window.confirm("Reset all settings to defaults?")&&r()},[r]),u="h-7 text-xs rounded-md border border-input bg-background px-2 py-1",d="h-7 text-xs rounded-md border border-input bg-background px-2 py-1 w-24";return h.jsxs("div",{className:"flex-1 overflow-auto p-6 max-w-2xl",children:[h.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Settings"}),h.jsx(_o,{title:"Phase Policies",children:lH.map(b=>h.jsx(Ji,{label:_e[b]||b,children:h.jsxs("select",{className:u,value:t.policies[b]===null?"null":t.policies[b]||"skip",onChange:k=>n(b,k.target.value),children:[b==="explore_design"&&h.jsx("option",{value:"null",children:"—"}),cH.map(k=>h.jsx("option",{value:k,children:k},k))]})},b))}),h.jsxs(_o,{title:"Iteration Limits",children:[h.jsx(Ji,{label:"Review max iterations",children:h.jsx("input",{type:"number",className:d,min:1,max:100,value:((f=(p=t.iterations)==null?void 0:p.review)==null?void 0:f.maxIterations)??10,onChange:b=>i("review",b.target.value)})}),h.jsx(Ji,{label:"Coverage max iterations",children:h.jsx("input",{type:"number",className:d,min:1,max:100,value:((x=(m=t.iterations)==null?void 0:m.coverage)==null?void 0:x.maxIterations)??15,onChange:b=>i("coverage",b.target.value)})})]}),h.jsx(_o,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var k;return h.jsx(Ji,{label:b,children:h.jsx(uH,{className:d+" w-48",value:((k=t.models)==null?void 0:k[b])||"",onCommit:T=>s(b,T)},b)},b)})}),h.jsxs(_o,{title:"Appearance",children:[h.jsx(Ji,{label:"Theme",children:h.jsx("select",{className:u,value:((g=t.ui)==null?void 0:g.theme)||"system",onChange:b=>o(b.target.value),children:hH.map(b=>h.jsx("option",{value:b,children:b},b))})}),h.jsx(Ji,{label:"Default view",children:h.jsx("select",{className:u,value:h0.includes((y=t.ui)==null?void 0:y.defaultView)?t.ui.defaultView:"graph",onChange:b=>a(b.target.value),children:h0.map(b=>h.jsx("option",{value:b,children:b},b))})})]}),h.jsx(_o,{title:"Capability Enforcement",children:h.jsxs("div",{className:"space-y-2 px-1",children:[[{value:"log",label:"Log (default)"},{value:"block",label:"Block"}].map(({value:b,label:k})=>{var T;return h.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[h.jsx("input",{type:"radio",name:"enforcement",value:b,checked:(((T=t.capabilities)==null?void 0:T.enforcement)??"log")===b,onChange:()=>l(b),className:"accent-accent"}),h.jsx("span",{className:"text-sm text-foreground",children:k})]},b)}),h.jsx("p",{className:"text-[11px] text-muted-foreground pt-1",children:"Block stops the build on disallowed tool use; Log records but continues."})]})}),h.jsx("button",{onClick:c,className:"text-xs text-destructive hover:underline mt-2",children:"Reset to Defaults"})]})}function dH({icon:t=cM,title:e,description:r,action:n,onAction:i,className:s}){return h.jsxs("div",{className:rt("flex flex-col items-center justify-center gap-3 p-8 text-center",s),children:[h.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-muted/50",children:h.jsx(t,{className:"w-6 h-6 text-muted-foreground/60"})}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:e}),r&&h.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),n&&h.jsx(zt,{variant:"outline",size:"sm",onClick:i,children:n})]})}function fH(){const[t,e]=C.useState([]),[r,n]=C.useState(!0),[i,s]=C.useState(null);C.useEffect(()=>{Rt("/api/pipeline/templates").then(a=>a.json()).then(a=>{e(a.templates||[]),n(!1)}).catch(()=>n(!1))},[]);const o=async a=>{s(a);try{await Rt("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})})}catch(l){console.error("[TemplateSelector] Failed to create draft:",l)}s(null)};return r?h.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[h.jsx(Mb,{className:"w-4 h-4 animate-spin mr-2"}),"Loading templates..."]}):t.length===0?h.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"No pipeline templates found"}):h.jsxs("div",{className:"p-4 space-y-3",children:[h.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Choose a pipeline template"}),h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(a=>h.jsxs("button",{onClick:()=>o(a.id),disabled:i!==null,className:rt("flex flex-col gap-2 p-3 rounded-lg border text-left transition-all","hover:ring-1 hover:ring-accent/50",i===a.id&&"opacity-60",v_[a.category]||"border-border bg-card"),children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Pi,{className:"w-4 h-4 shrink-0"}),h.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.label})]}),h.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),h.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-auto",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(uM,{className:"w-3 h-3"})," ",a.steps," steps"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(Lb,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),h.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function rT({activeBuild:t,pipelineDraft:e,onSelectStep:r,onRefresh:n}){const[i,s]=C.useState(null),[o,a]=C.useState(!1),[l,c]=C.useState(!1),u=k=>{const T=i===k?null:k;s(T),r&&r(T)},d=()=>{n&&n()},p=async()=>{if(e!=null&&e.draftId){a(!0);try{await Rt("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})})}catch(k){console.error("[PipelineView] Approve failed:",k)}a(!1)}},f=async()=>{if(e!=null&&e.draftId){c(!0);try{await Rt("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})})}catch(k){console.error("[PipelineView] Reject failed:",k)}c(!1)}};if(!t&&!e)return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pipeline Templates"}),h.jsx("div",{className:"ml-auto",children:h.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border",children:[h.jsx(Gl,{className:"w-3 h-3"})," Refresh"]})})]}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(fH,{})})]});if(e){const k=e.steps||[],T=e.metadata||{};return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Draft Review"}),h.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[h.jsxs("button",{onClick:f,disabled:l||o,className:rt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-red-400 border-red-500/30 hover:bg-red-500/10",l&&"opacity-60"),children:[h.jsx(dn,{className:"w-3 h-3"})," Reject"]}),h.jsxs("button",{onClick:p,disabled:o||l,className:rt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/10",o&&"opacity-60"),children:[h.jsx(ba,{className:"w-3 h-3"})," Approve"]})]})]}),h.jsxs("div",{className:"mx-3 mt-3 px-3 py-2 rounded-lg border ring-1 ring-amber-500/30 border-amber-500/20 bg-amber-500/5 text-[11px]",children:[h.jsxs("span",{className:"text-amber-400 font-medium",children:["Draft: ",T.label||T.id||"Pipeline"]}),h.jsx("span",{className:"text-muted-foreground ml-2",children:T.description||""}),T.category&&h.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",T.category]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-3",children:h.jsx("div",{className:"space-y-1",children:k.map((_,w)=>h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-slate-800/40 bg-card",children:[h.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0 bg-slate-500/15 text-slate-400 text-[10px] font-mono",children:w+1}),h.jsx("span",{className:"text-xs text-foreground",children:_.id}),_.agent&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:_.agent}),_.function&&h.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",_.function]})]},_.id||w))})})]})}const m=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(k=>[k.id,k.status])):{},x=(t==null?void 0:t.currentStepId)??null,g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(k=>[k.id,k])):{},y=Ch.map(k=>{const T=g[k.id];return T?{...k,...T}:k});if(t!=null&&t.steps)for(const k of t.steps)Ch.find(T=>T.id===k.id)||y.push({id:k.id,name:k.id.replace(/_/g," "),agent:"claude",phase:"implementation",...k});const b=Object.keys(nm).map(k=>({phase:k,config:nm[k],steps:y.filter(T=>T.phase===k)}));return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ll,{icon:ms,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),h.jsx(ll,{icon:Mf,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),h.jsx(ll,{icon:Pf,color:"text-slate-300 bg-slate-500/10",label:"Human"}),h.jsx(ll,{icon:Ks,color:"text-amber-400 bg-amber-500/10",label:"Gate"})]}),h.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Live: ",h.jsx("span",{className:"text-blue-400 font-medium",children:t.featureCode})]}),h.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border",children:[h.jsx(Gl,{className:"w-3 h-3"})," Refresh"]})]})]}),t&&h.jsxs("div",{className:"mx-3 mt-3 px-3 py-2 rounded-lg border ring-1 ring-blue-500/30 border-blue-500/20 bg-blue-500/5 text-[11px]",children:[h.jsxs("span",{className:"text-blue-400 font-medium",children:["Active Build: ",t.featureCode]}),h.jsxs("span",{className:"text-muted-foreground ml-2",children:["status: ",t.status," · step ",t.stepNum??"?","/",t.totalSteps??Ch.length]}),x&&h.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",h.jsx("span",{className:"font-medium",children:x})]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:b.map(({phase:k,config:T,steps:_})=>h.jsxs("div",{className:rt("rounded-lg border p-3",T.color),children:[h.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:T.label}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:_.map((w,N)=>{const B=m[w.id]??null,I=w.id===x,E=w.id===i;return h.jsxs(Xt.Fragment,{children:[h.jsx(pH,{step:w,liveStatus:B,isCurrent:I,isSelected:E,onClick:()=>u(w.id)}),N<_.length-1&&h.jsx(_b,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},w.id)})})]},k))})]})}function pH({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?Ks:t.agent==="claude"?ms:t.agent==="codex"?Mf:Pf,o={active:"border-blue-500/80 bg-blue-500/10",done:"border-emerald-500/50 bg-emerald-500/5",failed:"border-red-500/60 bg-red-500/10",pending:"border-slate-800/60 bg-card"}[e]??"border-slate-800/40 bg-card";return h.jsxs("button",{onClick:i,className:rt("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border text-left transition-all min-w-[120px]",n?"border-accent/80 bg-accent/10":o,t.hasGate&&!e&&"border-amber-500/30 bg-amber-500/5",r&&"ring-1 ring-blue-400/40"),children:[h.jsx("div",{className:rt("w-5 h-5 rounded flex items-center justify-center shrink-0",t.hasGate?"bg-amber-500/15 text-amber-400":t.agent==="claude"?"bg-orange-500/15 text-orange-400":t.agent==="codex"?"bg-emerald-500/15 text-emerald-400":"bg-slate-500/15 text-slate-400"),children:h.jsx(s,{className:"w-3 h-3"})}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("p",{className:"text-[10px] font-medium text-foreground truncate leading-tight",children:t.name}),e&&h.jsx("p",{className:"text-[8px] text-muted-foreground capitalize",children:e})]})]})}function ll({icon:t,color:e,label:r}){return h.jsxs("div",{className:rt("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",e),children:[h.jsx(t,{className:"w-3 h-3"}),h.jsx("span",{children:r})]})}function mH(t,{search:e="",agentFilter:r="all",statusFilter:n="all"}={}){let i=t;if(e){const s=e.toLowerCase();i=i.filter(o=>{var a,l,c,u;return((a=o.featureCode)==null?void 0:a.toLowerCase().includes(s))||((l=o.feature_code)==null?void 0:l.toLowerCase().includes(s))||((c=o.summary)==null?void 0:c.toLowerCase().includes(s))||((u=o.agent)==null?void 0:u.toLowerCase().includes(s))})}return r!=="all"&&(i=i.filter(s=>s.agent===r)),n!=="all"&&(i=i.filter(s=>s.status===n)),[...i].sort((s,o)=>s.status==="active"&&o.status!=="active"?-1:o.status==="active"&&s.status!=="active"?1:new Date(o.startedAt||o.created_date||0)-new Date(s.startedAt||s.created_date||0))}const gH={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:ms},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:Mf},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:ms},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:Pf},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:ms}},xH={bg:"bg-slate-800",text:"text-slate-600",Icon:ms},u0={sm:{outer:"w-6 h-6",icon:"w-3 h-3"},md:{outer:"w-8 h-8",icon:"w-4 h-4"},lg:{outer:"w-10 h-10",icon:"w-5 h-5"}};function yH({agent:t,size:e="md",className:r}){const n=gH[t]||xH,i=u0[e]||u0.md,{Icon:s}=n;return h.jsx("span",{className:rt("inline-flex items-center justify-center rounded-full shrink-0",n.bg,n.text,i.outer,r),title:t||"unassigned",children:h.jsx(s,{className:i.icon})})}function he(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function ei(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const nT=6048e5,bH=864e5,cl=43200,d0=1440;let CH={};function Ba(){return CH}function pa(t,e){var a,l,c,u;const r=Ba(),n=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??r.weekStartsOn??((u=(c=r.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,i=he(t),s=i.getDay(),o=(s<n?7:0)+s-n;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Lc(t){return pa(t,{weekStartsOn:1})}function iT(t){const e=he(t),r=e.getFullYear(),n=ei(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=Lc(n),s=ei(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=Lc(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function f0(t){const e=he(t);return e.setHours(0,0,0,0),e}function Bc(t){const e=he(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function kH(t,e){const r=f0(t),n=f0(e),i=+r-Bc(r),s=+n-Bc(n);return Math.round((i-s)/bH)}function vH(t){const e=iT(t),r=ei(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Lc(r)}function Dl(t,e){const r=he(t),n=he(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function wH(t){return ei(t,Date.now())}function SH(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function TH(t){if(!SH(t)&&typeof t!="number")return!1;const e=he(t);return!isNaN(Number(e))}function _H(t,e){const r=he(t),n=he(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function EH(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function NH(t,e){return+he(t)-+he(e)}function jH(t){const e=he(t);return e.setHours(23,59,59,999),e}function LH(t){const e=he(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function BH(t){const e=he(t);return+jH(e)==+LH(e)}function AH(t,e){const r=he(t),n=he(e),i=Dl(r,n),s=Math.abs(_H(r,n));let o;if(s<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*s);let a=Dl(r,n)===-i;BH(he(t))&&s===1&&Dl(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function MH(t,e,r){const n=NH(t,e)/1e3;return EH(r==null?void 0:r.roundingMethod)(n)}function IH(t){const e=he(t),r=ei(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const FH={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},PH=(t,e,r)=>{let n;const i=FH[t];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function xu(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const DH={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},OH={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},RH={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$H={date:xu({formats:DH,defaultWidth:"full"}),time:xu({formats:OH,defaultWidth:"full"}),dateTime:xu({formats:RH,defaultWidth:"full"})},zH={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},WH=(t,e,r,n)=>zH[t];function Eo(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let i;if(n==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,a=r!=null&&r.width?String(r.width):o;i=t.formattingValues[a]||t.formattingValues[o]}else{const o=t.defaultWidth,a=r!=null&&r.width?String(r.width):t.defaultWidth;i=t.values[a]||t.values[o]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const qH={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},HH={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},UH={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},GH={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},YH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},VH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},XH=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},KH={ordinalNumber:XH,era:Eo({values:qH,defaultWidth:"wide"}),quarter:Eo({values:HH,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Eo({values:UH,defaultWidth:"wide"}),day:Eo({values:GH,defaultWidth:"wide"}),dayPeriod:Eo({values:YH,defaultWidth:"wide",formattingValues:VH,defaultFormattingWidth:"wide"})};function No(t){return(e,r={})=>{const n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const o=s[0],a=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?QH(a,d=>d.test(o)):ZH(a,d=>d.test(o));let c;c=t.valueCallback?t.valueCallback(l):l,c=r.valueCallback?r.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function ZH(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function QH(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function JH(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const i=n[0],s=e.match(t.parsePattern);if(!s)return null;let o=t.valueCallback?t.valueCallback(s[0]):s[0];o=r.valueCallback?r.valueCallback(o):o;const a=e.slice(i.length);return{value:o,rest:a}}}const tU=/^(\d+)(th|st|nd|rd)?/i,eU=/\d+/i,rU={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},nU={any:[/^b/i,/^(a|c)/i]},iU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},sU={any:[/1/i,/2/i,/3/i,/4/i]},oU={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},aU={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},lU={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},cU={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},hU={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},uU={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},dU={ordinalNumber:JH({matchPattern:tU,parsePattern:eU,valueCallback:t=>parseInt(t,10)}),era:No({matchPatterns:rU,defaultMatchWidth:"wide",parsePatterns:nU,defaultParseWidth:"any"}),quarter:No({matchPatterns:iU,defaultMatchWidth:"wide",parsePatterns:sU,defaultParseWidth:"any",valueCallback:t=>t+1}),month:No({matchPatterns:oU,defaultMatchWidth:"wide",parsePatterns:aU,defaultParseWidth:"any"}),day:No({matchPatterns:lU,defaultMatchWidth:"wide",parsePatterns:cU,defaultParseWidth:"any"}),dayPeriod:No({matchPatterns:hU,defaultMatchWidth:"any",parsePatterns:uU,defaultParseWidth:"any"})},sT={code:"en-US",formatDistance:PH,formatLong:$H,formatRelative:WH,localize:KH,match:dU,options:{weekStartsOn:0,firstWeekContainsDate:1}};function fU(t){const e=he(t);return kH(e,IH(e))+1}function pU(t){const e=he(t),r=+Lc(e)-+vH(e);return Math.round(r/nT)+1}function oT(t,e){var u,d,p,f;const r=he(t),n=r.getFullYear(),i=Ba(),s=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((f=(p=i.locale)==null?void 0:p.options)==null?void 0:f.firstWeekContainsDate)??1,o=ei(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=pa(o,e),l=ei(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const c=pa(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=c.getTime()?n:n-1}function mU(t,e){var a,l,c,u;const r=Ba(),n=(e==null?void 0:e.firstWeekContainsDate)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(c=r.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,i=oT(t,e),s=ei(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),pa(s,e)}function gU(t,e){const r=he(t),n=+pa(r,e)-+mU(r,e);return Math.round(n/nT)+1}function ae(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const Rn={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return ae(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):ae(r+1,2)},d(t,e){return ae(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return ae(t.getHours()%12||12,e.length)},H(t,e){return ae(t.getHours(),e.length)},m(t,e){return ae(t.getMinutes(),e.length)},s(t,e){return ae(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return ae(i,e.length)}},ts={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},p0={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return Rn.y(t,e)},Y:function(t,e,r,n){const i=oT(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return ae(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):ae(s,e.length)},R:function(t,e){const r=iT(t);return ae(r,e.length)},u:function(t,e){const r=t.getFullYear();return ae(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return ae(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return ae(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return Rn.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return ae(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const i=gU(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):ae(i,e.length)},I:function(t,e,r){const n=pU(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):ae(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Rn.d(t,e)},D:function(t,e,r){const n=fU(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):ae(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return ae(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return ae(s,e.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return ae(i,e.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let i;switch(n===12?i=ts.noon:n===0?i=ts.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let i;switch(n>=17?i=ts.evening:n>=12?i=ts.afternoon:n>=4?i=ts.morning:i=ts.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Rn.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Rn.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):ae(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):ae(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Rn.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Rn.s(t,e)},S:function(t,e){return Rn.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return g0(n);case"XXXX":case"XX":return xi(n);case"XXXXX":case"XXX":default:return xi(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return g0(n);case"xxxx":case"xx":return xi(n);case"xxxxx":case"xxx":default:return xi(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+m0(n,":");case"OOOO":default:return"GMT"+xi(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+m0(n,":");case"zzzz":default:return"GMT"+xi(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return ae(n,e.length)},T:function(t,e,r){const n=t.getTime();return ae(n,e.length)}};function m0(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),s=n%60;return s===0?r+String(i):r+String(i)+e+ae(s,2)}function g0(t,e){return t%60===0?(t>0?"-":"+")+ae(Math.abs(t)/60,2):xi(t,e)}function xi(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=ae(Math.trunc(n/60),2),s=ae(n%60,2);return r+i+e+s}const x0=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},aT=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},xU=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return x0(t,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",x0(n,e)).replace("{{time}}",aT(i,e))},yU={p:aT,P:xU},bU=/^D+$/,CU=/^Y+$/,kU=["D","DD","YY","YYYY"];function vU(t){return bU.test(t)}function wU(t){return CU.test(t)}function SU(t,e,r){const n=TU(t,e,r);if(console.warn(n),kU.includes(t))throw new RangeError(n)}function TU(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const _U=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,EU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,NU=/^'([^]*?)'?$/,jU=/''/g,LU=/[a-zA-Z]/;function BU(t,e,r){var u,d,p,f;const n=Ba(),i=n.locale??sT,s=n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=n.weekStartsOn??((f=(p=n.locale)==null?void 0:p.options)==null?void 0:f.weekStartsOn)??0,a=he(t);if(!TH(a))throw new RangeError("Invalid time value");let l=e.match(EU).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=yU[x];return g(m,i.formatLong)}return m}).join("").match(_U).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:AU(m)};if(p0[x])return{isToken:!0,value:m};if(x.match(LU))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(m=>{if(!m.isToken)return m.value;const x=m.value;(wU(x)||vU(x))&&SU(x,e,String(t));const g=p0[x[0]];return g(a,x,i.localize,c)}).join("")}function AU(t){const e=t.match(NU);return e?e[1].replace(jU,"'"):t}function MU(t,e,r){const n=Ba(),i=(r==null?void 0:r.locale)??n.locale??sT,s=2520,o=Dl(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o});let l,c;o>0?(l=he(e),c=he(t)):(l=he(t),c=he(e));const u=MH(c,l),d=(Bc(c)-Bc(l))/1e3,p=Math.round((u-d)/60);let f;if(p<2)return r!=null&&r.includeSeconds?u<5?i.formatDistance("lessThanXSeconds",5,a):u<10?i.formatDistance("lessThanXSeconds",10,a):u<20?i.formatDistance("lessThanXSeconds",20,a):u<40?i.formatDistance("halfAMinute",0,a):u<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):p===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",p,a);if(p<45)return i.formatDistance("xMinutes",p,a);if(p<90)return i.formatDistance("aboutXHours",1,a);if(p<d0){const m=Math.round(p/60);return i.formatDistance("aboutXHours",m,a)}else{if(p<s)return i.formatDistance("xDays",1,a);if(p<cl){const m=Math.round(p/d0);return i.formatDistance("xDays",m,a)}else if(p<cl*2)return f=Math.round(p/cl),i.formatDistance("aboutXMonths",f,a)}if(f=AH(c,l),f<12){const m=Math.round(p/cl);return i.formatDistance("xMonths",m,a)}else{const m=f%12,x=Math.trunc(f/12);return m<3?i.formatDistance("aboutXYears",x,a):m<9?i.formatDistance("overXYears",x,a):i.formatDistance("almostXYears",x+1,a)}}function IU(t,e){return MU(t,wH(t),e)}function FU({date:t,className:e}){if(!t)return h.jsx("span",{className:rt("text-muted-foreground",e),children:"—"});let r;try{if(r=typeof t=="string"?new Date(t):t,isNaN(r.getTime()))return h.jsx("span",{className:rt("text-muted-foreground",e),children:"—"})}catch{return h.jsx("span",{className:rt("text-muted-foreground",e),children:"—"})}const n=IU(r,{addSuffix:!0}),i=BU(r,"PPpp");return h.jsx("time",{dateTime:r.toISOString(),title:i,className:rt("text-muted-foreground tabular-nums",e),children:n})}function lT({sessions:t=[],items:e=[],onSelectItem:r,featureCode:n,focusActive:i,onToggleFocus:s}){const[o,a]=C.useState(""),[l,c]=C.useState("all"),[u,d]=C.useState("all"),p=C.useMemo(()=>t.filter(m=>m.status==="active").length,[t]),f=C.useMemo(()=>{let m=mH(t,{search:o,agentFilter:l,statusFilter:u});return i&&n&&(m=m.filter(x=>x.featureCode===n||x.feature_code===n)),m},[t,o,l,u,i,n]);return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[h.jsx(ka,{featureCode:n,active:i,onToggle:s}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[h.jsx("span",{className:rt("w-2 h-2 rounded-full",p>0?"bg-emerald-400":"bg-slate-600")}),h.jsxs("span",{className:"text-muted-foreground",children:[p," active"]})]}),h.jsx("div",{className:"h-4 w-px bg-border"}),h.jsxs("div",{className:"relative",children:[h.jsx(ni,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),h.jsx("input",{type:"text",placeholder:"Search…",value:o,onChange:m=>a(m.target.value),className:"text-xs pl-5 pr-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-32"})]}),h.jsxs("select",{value:l,onChange:m=>c(m.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[h.jsx("option",{value:"all",children:"All agents"}),py.filter(m=>m!=="unassigned").map(m=>h.jsx("option",{value:m,children:m},m))]}),h.jsxs("select",{value:u,onChange:m=>d(m.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[h.jsx("option",{value:"all",children:"All status"}),["active","completed","failed","paused"].map(m=>h.jsx("option",{value:m,children:m},m))]}),h.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[f.length,"/",t.length]})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[f.length===0&&h.jsx(dH,{icon:Af,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),f.map(m=>h.jsx(PU,{session:m,items:e,onSelectItem:r},m.id))]})]})}function PU({session:t,items:e,onSelectItem:r}){const n=t.workType||t.work_type,i=t.featureCode||t.feature_code,s=t.startedAt||t.created_date,o=rm[n]||rm.exploring,a=i?e.find(l=>{var c;return l.featureCode===i||l.feature_code===i||((c=l.lifecycle)==null?void 0:c.featureCode)===i}):null;return h.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2.5 border-b border-border/50 hover:bg-muted/30 transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(yH,{agent:t.agent,size:"sm",className:"shrink-0"}),h.jsx(Gf,{status:t.status,className:"shrink-0"}),n&&h.jsx("span",{className:rt("text-[10px] px-1.5 py-0.5 rounded",o),children:n}),i&&h.jsx("button",{onClick:()=>a&&(r==null?void 0:r(a.id)),className:rt("text-[10px] font-mono",a?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:i}),h.jsx(FU,{date:s,className:"ml-auto text-[10px] shrink-0"})]}),t.summary&&h.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:t.summary}),h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[h.jsxs("span",{children:["📄 ",t.reads??0]}),h.jsxs("span",{children:["📤 ",t.writes??0]}),h.jsxs("span",{className:(t.errors??0)>0?"text-red-400":void 0,children:["⚠ ",t.errors??0]})]})]})}const y0=t=>Symbol.iterator in t,b0=t=>"entries"in t,C0=(t,e)=>{const r=t instanceof Map?t:new Map(t.entries()),n=e instanceof Map?e:new Map(e.entries());if(r.size!==n.size)return!1;for(const[i,s]of r)if(!n.has(i)||!Object.is(s,n.get(i)))return!1;return!0},DU=(t,e)=>{const r=t[Symbol.iterator](),n=e[Symbol.iterator]();let i=r.next(),s=n.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=r.next(),s=n.next()}return!!i.done&&!!s.done};function OU(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:y0(t)&&y0(e)?b0(t)&&b0(e)?C0(t,e):DU(t,e):C0({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Ri(t){const e=Xt.useRef(void 0);return r=>{const n=t(r);return OU(e.current,n)?e.current:e.current=n}}function cT({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=yr(Ri(g=>({items:g.items,gates:g.gates,sessions:g.sessions}))),[a,l]=C.useState(""),[c,u]=C.useState(0),d=C.useRef(null);C.useEffect(()=>{t&&(l(""),u(0),setTimeout(()=>{var g;return(g=d.current)==null?void 0:g.focus()},0))},[t]);const p=C.useMemo(()=>{if(!t)return[];if(!a.trim()){const T=s.filter(w=>w.status==="pending").slice(0,3).map(w=>({type:"gate",id:w.id,label:Jo(w,i.find(N=>N.id===w.itemId)),sub:_n[w.stepId]?`${_e[w.fromPhase]??w.fromPhase} → ${_e[w.toPhase]??w.toPhase}`:null,status:"pending",gate:w})),_=i.filter(w=>w.status==="blocked").slice(0,3).map(w=>({type:"item",id:w.id,label:w.title,sub:w.type,status:w.status,item:w}));return[...T.length?[{type:"section",label:"Pending Gates"}]:[],...T,..._.length?[{type:"section",label:"Blocked Items"}]:[],..._]}const g=a.toLowerCase(),y=i.filter(T=>{var _,w;return((_=T.title)==null?void 0:_.toLowerCase().includes(g))||((w=T.featureCode)==null?void 0:w.toLowerCase().includes(g))||(T.description||"").toLowerCase().includes(g)}).slice(0,5).map(T=>({type:"item",id:T.id,label:T.title,sub:`${T.type} · ${T.phase??""}`,status:T.status,item:T})),b=s.filter(T=>{var _;return(T.fromPhase||"").toLowerCase().includes(g)||(T.toPhase||"").toLowerCase().includes(g)||(((_=i.find(w=>w.id===T.itemId))==null?void 0:_.title)??"").toLowerCase().includes(g)}).slice(0,3).map(T=>({type:"gate",id:T.id,label:Jo(T,i.find(_=>_.id===T.itemId)),sub:T.status,status:T.status,gate:T})),k=(o||[]).filter(T=>(T.featureCode||"").toLowerCase().includes(g)||(T.summary||"").toLowerCase().includes(g)).slice(0,2).map(T=>({type:"session",id:T.id,label:T.featureCode||T.id,sub:T.summary||T.agent||"",status:T.status,session:T}));return[...y.length?[{type:"section",label:"Items"}]:[],...y,...b.length?[{type:"section",label:"Gates"}]:[],...b,...k.length?[{type:"section",label:"Sessions"}]:[],...k]},[t,a,i,s,o]),f=p.filter(g=>g.type!=="section"),m=C.useCallback(g=>{if(g.key==="Escape"){e();return}if(g.key==="ArrowDown"){g.preventDefault(),u(y=>(y+1)%Math.max(1,f.length));return}if(g.key==="ArrowUp"){g.preventDefault(),u(y=>(y-1+Math.max(1,f.length))%Math.max(1,f.length));return}if(g.key==="Enter"){const y=f[c];if(!y)return;y.type==="gate"?n==null||n(y.id):y.type==="item"?r==null||r(y.id):e();return}if(g.key==="Backspace"&&a===""){e();return}},[f,c,a,e,n,r]);let x=0;return t?h.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh]",onClick:e,children:h.jsxs("div",{className:"w-full max-w-[640px] mx-4 rounded-xl border border-slate-700 bg-card shadow-2xl overflow-hidden",onClick:g=>g.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-slate-700/50",children:[h.jsx(ni,{className:"h-4 w-4 text-muted-foreground shrink-0"}),h.jsx("input",{ref:d,value:a,onChange:g=>{l(g.target.value),u(0)},onKeyDown:m,placeholder:"Search items, gates, sessions…",className:"flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none"}),h.jsx("kbd",{className:"text-[10px] text-muted-foreground border border-border rounded px-1 py-0.5",children:"esc"})]}),h.jsxs("div",{className:"max-h-80 overflow-y-auto py-1",children:[p.length===0&&h.jsx("div",{className:"py-8 text-center text-xs text-muted-foreground",children:a?"No results":"No pending gates or blocked items"}),p.map((g,y)=>{if(g.type==="section")return h.jsx("div",{className:"px-4 pt-2 pb-1",children:h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:g.label})},`section-${y}`);const b=x++,k=c===b;return h.jsxs("button",{className:rt("flex w-full items-center gap-3 px-4 py-2 text-left transition-colors",k?"bg-accent/10":"hover:bg-muted/50"),onMouseEnter:()=>u(b),onClick:()=>{g.type==="gate"?n==null||n(g.id):g.type==="item"?r==null||r(g.id):e()},children:[g.type==="gate"&&h.jsx(Ks,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&h.jsx(Wc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&h.jsx(Af,{className:"h-4 w-4 text-blue-400 shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-sm text-foreground truncate",children:g.label}),g.sub&&h.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:g.sub})]}),g.status&&h.jsx(Gf,{status:g.status})]},g.id)})]}),h.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/50 text-[10px] text-muted-foreground",children:[h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"↑↓"})," navigate"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"↵"})," select"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"esc"})," close"]})]})]})}):null}var RU=hf[" useId ".trim().toString()]||(()=>{}),$U=0;function yu(t){const[e,r]=C.useState(RU());return Ds(()=>{r(n=>n??String($U++))},[t]),t||(e?`radix-${e}`:"")}var zU=hf[" useInsertionEffect ".trim().toString()]||Ds;function WU({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[i,s,o]=qU({defaultProp:e,onChange:r}),a=t!==void 0,l=a?t:i;{const u=C.useRef(t!==void 0);C.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,n])}const c=C.useCallback(u=>{var d;if(a){const p=HU(u)?u(t):u;p!==t&&((d=o.current)==null||d.call(o,p))}else s(u)},[a,t,s,o]);return[l,c]}function qU({defaultProp:t,onChange:e}){const[r,n]=C.useState(t),i=C.useRef(r),s=C.useRef(e);return zU(()=>{s.current=e},[e]),C.useEffect(()=>{var o;i.current!==r&&((o=s.current)==null||o.call(s,r),i.current=r)},[r,i]),[r,n,s]}function HU(t){return typeof t=="function"}function UU(t,e=globalThis==null?void 0:globalThis.document){const r=Mr(t);C.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var GU="DismissableLayer",Zd="dismissableLayer.update",YU="dismissableLayer.pointerDownOutside",VU="dismissableLayer.focusOutside",k0,hT=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),uT=C.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=C.useContext(hT),[u,d]=C.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=C.useState({}),m=Nr(e,N=>d(N)),x=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=x.indexOf(g),b=u?x.indexOf(u):-1,k=c.layersWithOutsidePointerEventsDisabled.size>0,T=b>=y,_=ZU(N=>{const B=N.target,I=[...c.branches].some(E=>E.contains(B));!T||I||(i==null||i(N),o==null||o(N),N.defaultPrevented||a==null||a())},p),w=QU(N=>{const B=N.target;[...c.branches].some(E=>E.contains(B))||(s==null||s(N),o==null||o(N),N.defaultPrevented||a==null||a())},p);return UU(N=>{b===c.layers.size-1&&(n==null||n(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},p),C.useEffect(()=>{if(u)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(k0=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),v0(),()=>{r&&(c.layersWithOutsidePointerEventsDisabled.delete(u),c.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=k0))}},[u,p,r,c]),C.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),v0())},[u,c]),C.useEffect(()=>{const N=()=>f({});return document.addEventListener(Zd,N),()=>document.removeEventListener(Zd,N)},[]),h.jsx(ur.div,{...l,ref:m,style:{pointerEvents:k?T?"auto":"none":void 0,...t.style},onFocusCapture:lr(t.onFocusCapture,w.onFocusCapture),onBlurCapture:lr(t.onBlurCapture,w.onBlurCapture),onPointerDownCapture:lr(t.onPointerDownCapture,_.onPointerDownCapture)})});uT.displayName=GU;var XU="DismissableLayerBranch",KU=C.forwardRef((t,e)=>{const r=C.useContext(hT),n=C.useRef(null),i=Nr(e,n);return C.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),h.jsx(ur.div,{...t,ref:i})});KU.displayName=XU;function ZU(t,e=globalThis==null?void 0:globalThis.document){const r=Mr(t),n=C.useRef(!1),i=C.useRef(()=>{});return C.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){dT(YU,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function QU(t,e=globalThis==null?void 0:globalThis.document){const r=Mr(t),n=C.useRef(!1);return C.useEffect(()=>{const i=s=>{s.target&&!n.current&&dT(VU,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function v0(){const t=new CustomEvent(Zd);document.dispatchEvent(t)}function dT(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?a3(i,s):i.dispatchEvent(s)}var bu="focusScope.autoFocusOnMount",Cu="focusScope.autoFocusOnUnmount",w0={bubbles:!1,cancelable:!0},JU="FocusScope",fT=C.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=C.useState(null),c=Mr(i),u=Mr(s),d=C.useRef(null),p=Nr(e,x=>l(x)),f=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(n){let x=function(k){if(f.paused||!a)return;const T=k.target;a.contains(T)?d.current=T:Wn(d.current,{select:!0})},g=function(k){if(f.paused||!a)return;const T=k.relatedTarget;T!==null&&(a.contains(T)||Wn(d.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&Wn(a)};document.addEventListener("focusin",x),document.addEventListener("focusout",g);const b=new MutationObserver(y);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",g),b.disconnect()}}},[n,a,f.paused]),C.useEffect(()=>{if(a){T0.add(f);const x=document.activeElement;if(!a.contains(x)){const y=new CustomEvent(bu,w0);a.addEventListener(bu,c),a.dispatchEvent(y),y.defaultPrevented||(tG(sG(pT(a)),{select:!0}),document.activeElement===x&&Wn(a))}return()=>{a.removeEventListener(bu,c),setTimeout(()=>{const y=new CustomEvent(Cu,w0);a.addEventListener(Cu,u),a.dispatchEvent(y),y.defaultPrevented||Wn(x??document.body,{select:!0}),a.removeEventListener(Cu,u),T0.remove(f)},0)}}},[a,c,u,f]);const m=C.useCallback(x=>{if(!r&&!n||f.paused)return;const g=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,y=document.activeElement;if(g&&y){const b=x.currentTarget,[k,T]=eG(b);k&&T?!x.shiftKey&&y===T?(x.preventDefault(),r&&Wn(k,{select:!0})):x.shiftKey&&y===k&&(x.preventDefault(),r&&Wn(T,{select:!0})):y===b&&x.preventDefault()}},[r,n,f.paused]);return h.jsx(ur.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});fT.displayName=JU;function tG(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Wn(n,{select:e}),document.activeElement!==r)return}function eG(t){const e=pT(t),r=S0(e,t),n=S0(e.reverse(),t);return[r,n]}function pT(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function S0(t,e){for(const r of t)if(!rG(r,{upTo:e}))return r}function rG(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function nG(t){return t instanceof HTMLInputElement&&"select"in t}function Wn(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&nG(t)&&e&&t.select()}}var T0=iG();function iG(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=_0(t,e),t.unshift(e)},remove(e){var r;t=_0(t,e),(r=t[0])==null||r.resume()}}}function _0(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function sG(t){return t.filter(e=>e.tagName!=="A")}var oG="Portal",mT=C.forwardRef((t,e)=>{var a;const{container:r,...n}=t,[i,s]=C.useState(!1);Ds(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?$f.createPortal(h.jsx(ur.div,{...n,ref:e}),o):null});mT.displayName=oG;var hl=0,tn=null;function aG(){C.useEffect(()=>{tn||(tn={start:E0(),end:E0()});const{start:t,end:e}=tn;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),hl++,()=>{hl===1&&(tn==null||tn.start.remove(),tn==null||tn.end.remove(),tn=null),hl=Math.max(0,hl-1)}},[])}function E0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var an=function(){return an=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},an.apply(this,arguments)};function gT(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function lG(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var Ol="right-scroll-bar-position",Rl="width-before-scroll-bar",cG="with-scroll-bars-hidden",hG="--removed-body-scroll-bar-size";function ku(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function uG(t,e){var r=C.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=e,r.facade}var dG=typeof window<"u"?C.useLayoutEffect:C.useEffect,N0=new WeakMap;function fG(t,e){var r=uG(null,function(n){return t.forEach(function(i){return ku(i,n)})});return dG(function(){var n=N0.get(r);if(n){var i=new Set(n),s=new Set(t),o=r.current;i.forEach(function(a){s.has(a)||ku(a,null)}),s.forEach(function(a){i.has(a)||ku(a,o)})}N0.set(r,t)},[t]),r}function pG(t){return t}function mG(t,e){e===void 0&&(e=pG);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var o=e(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),r={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),r}}}};return i}function gG(t){t===void 0&&(t={});var e=mG(null);return e.options=an({async:!0,ssr:!1},t),e}var xT=function(t){var e=t.sideCar,r=gT(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return C.createElement(n,an({},r))};xT.isSideCarExport=!0;function xG(t,e){return t.useMedium(e),xT}var yT=gG(),vu=function(){},dh=C.forwardRef(function(t,e){var r=C.useRef(null),n=C.useState({onScrollCapture:vu,onWheelCapture:vu,onTouchMoveCapture:vu}),i=n[0],s=n[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,p=t.sideCar,f=t.noRelative,m=t.noIsolation,x=t.inert,g=t.allowPinchZoom,y=t.as,b=y===void 0?"div":y,k=t.gapMode,T=gT(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=p,w=fG([r,e]),N=an(an({},T),i);return C.createElement(C.Fragment,null,u&&C.createElement(_,{sideCar:yT,removeScrollBar:c,shards:d,noRelative:f,noIsolation:m,inert:x,setCallbacks:s,allowPinchZoom:!!g,lockRef:r,gapMode:k}),o?C.cloneElement(C.Children.only(a),an(an({},N),{ref:w})):C.createElement(b,an({},N,{className:l,ref:w}),a))});dh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dh.classNames={fullWidth:Rl,zeroRight:Ol};var yG=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function bG(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=yG();return e&&t.setAttribute("nonce",e),t}function CG(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function kG(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var vG=function(){var t=0,e=null;return{add:function(r){t==0&&(e=bG())&&(CG(e,r),kG(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},wG=function(){var t=vG();return function(e,r){C.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},bT=function(){var t=wG(),e=function(r){var n=r.styles,i=r.dynamic;return t(n,i),null};return e},SG={left:0,top:0,right:0,gap:0},wu=function(t){return parseInt(t||"",10)||0},TG=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[wu(r),wu(n),wu(i)]},_G=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return SG;var e=TG(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},EG=bT(),bs="data-scroll-locked",NG=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),`
|
|
679
|
-
.`.concat(cG,` {
|
|
680
|
-
overflow: hidden `).concat(n,`;
|
|
681
|
-
padding-right: `).concat(a,"px ").concat(n,`;
|
|
682
|
-
}
|
|
683
|
-
body[`).concat(bs,`] {
|
|
684
|
-
overflow: hidden `).concat(n,`;
|
|
685
|
-
overscroll-behavior: contain;
|
|
686
|
-
`).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
687
|
-
padding-left: `.concat(i,`px;
|
|
688
|
-
padding-top: `).concat(s,`px;
|
|
689
|
-
padding-right: `).concat(o,`px;
|
|
690
|
-
margin-left:0;
|
|
691
|
-
margin-top:0;
|
|
692
|
-
margin-right: `).concat(a,"px ").concat(n,`;
|
|
693
|
-
`),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
.`).concat(Ol,` {
|
|
697
|
-
right: `).concat(a,"px ").concat(n,`;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
.`).concat(Rl,` {
|
|
701
|
-
margin-right: `).concat(a,"px ").concat(n,`;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
.`).concat(Ol," .").concat(Ol,` {
|
|
705
|
-
right: 0 `).concat(n,`;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
.`).concat(Rl," .").concat(Rl,` {
|
|
709
|
-
margin-right: 0 `).concat(n,`;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
body[`).concat(bs,`] {
|
|
713
|
-
`).concat(hG,": ").concat(a,`px;
|
|
714
|
-
}
|
|
715
|
-
`)},j0=function(){var t=parseInt(document.body.getAttribute(bs)||"0",10);return isFinite(t)?t:0},jG=function(){C.useEffect(function(){return document.body.setAttribute(bs,(j0()+1).toString()),function(){var t=j0()-1;t<=0?document.body.removeAttribute(bs):document.body.setAttribute(bs,t.toString())}},[])},LG=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n;jG();var s=C.useMemo(function(){return _G(i)},[i]);return C.createElement(EG,{styles:NG(s,!e,i,r?"":"!important")})},Qd=!1;if(typeof window<"u")try{var ul=Object.defineProperty({},"passive",{get:function(){return Qd=!0,!0}});window.addEventListener("test",ul,ul),window.removeEventListener("test",ul,ul)}catch{Qd=!1}var es=Qd?{passive:!1}:!1,BG=function(t){return t.tagName==="TEXTAREA"},CT=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!BG(t)&&r[e]==="visible")},AG=function(t){return CT(t,"overflowY")},MG=function(t){return CT(t,"overflowX")},L0=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=kT(t,n);if(i){var s=vT(t,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},IG=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},FG=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},kT=function(t,e){return t==="v"?AG(e):MG(e)},vT=function(t,e){return t==="v"?IG(e):FG(e)},PG=function(t,e){return t==="h"&&e==="rtl"?-1:1},DG=function(t,e,r,n,i){var s=PG(t,window.getComputedStyle(e).direction),o=s*n,a=r.target,l=e.contains(a),c=!1,u=o>0,d=0,p=0;do{if(!a)break;var f=vT(t,a),m=f[0],x=f[1],g=f[2],y=x-g-s*m;(m||y)&&kT(t,a)&&(d+=y,p+=m);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(p)<1)&&(c=!0),c},dl=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},B0=function(t){return[t.deltaX,t.deltaY]},A0=function(t){return t&&"current"in t?t.current:t},OG=function(t,e){return t[0]===e[0]&&t[1]===e[1]},RG=function(t){return`
|
|
716
|
-
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
717
|
-
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
718
|
-
`)},$G=0,rs=[];function zG(t){var e=C.useRef([]),r=C.useRef([0,0]),n=C.useRef(),i=C.useState($G++)[0],s=C.useState(bT)[0],o=C.useRef(t);C.useEffect(function(){o.current=t},[t]),C.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var x=lG([t.lockRef.current],(t.shards||[]).map(A0),!0).filter(Boolean);return x.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=C.useCallback(function(x,g){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var y=dl(x),b=r.current,k="deltaX"in x?x.deltaX:b[0]-y[0],T="deltaY"in x?x.deltaY:b[1]-y[1],_,w=x.target,N=Math.abs(k)>Math.abs(T)?"h":"v";if("touches"in x&&N==="h"&&w.type==="range")return!1;var B=window.getSelection(),I=B&&B.anchorNode,E=I?I===w||I.contains(w):!1;if(E)return!1;var P=L0(N,w);if(!P)return!0;if(P?_=N:(_=N==="v"?"h":"v",P=L0(N,w)),!P)return!1;if(!n.current&&"changedTouches"in x&&(k||T)&&(n.current=_),!_)return!0;var z=n.current||_;return DG(z,g,x,z==="h"?k:T)},[]),l=C.useCallback(function(x){var g=x;if(!(!rs.length||rs[rs.length-1]!==s)){var y="deltaY"in g?B0(g):dl(g),b=e.current.filter(function(_){return _.name===g.type&&(_.target===g.target||g.target===_.shadowParent)&&OG(_.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var k=(o.current.shards||[]).map(A0).filter(Boolean).filter(function(_){return _.contains(g.target)}),T=k.length>0?a(g,k[0]):!o.current.noIsolation;T&&g.cancelable&&g.preventDefault()}}},[]),c=C.useCallback(function(x,g,y,b){var k={name:x,delta:g,target:y,should:b,shadowParent:WG(y)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(T){return T!==k})},1)},[]),u=C.useCallback(function(x){r.current=dl(x),n.current=void 0},[]),d=C.useCallback(function(x){c(x.type,B0(x),x.target,a(x,t.lockRef.current))},[]),p=C.useCallback(function(x){c(x.type,dl(x),x.target,a(x,t.lockRef.current))},[]);C.useEffect(function(){return rs.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,es),document.addEventListener("touchmove",l,es),document.addEventListener("touchstart",u,es),function(){rs=rs.filter(function(x){return x!==s}),document.removeEventListener("wheel",l,es),document.removeEventListener("touchmove",l,es),document.removeEventListener("touchstart",u,es)}},[]);var f=t.removeScrollBar,m=t.inert;return C.createElement(C.Fragment,null,m?C.createElement(s,{styles:RG(i)}):null,f?C.createElement(LG,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function WG(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const qG=xG(yT,zG);var wT=C.forwardRef(function(t,e){return C.createElement(dh,an({},t,{ref:e,sideCar:qG}))});wT.classNames=dh.classNames;var HG=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ns=new WeakMap,fl=new WeakMap,pl={},Su=0,ST=function(t){return t&&(t.host||ST(t.parentNode))},UG=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=ST(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},GG=function(t,e,r,n){var i=UG(e,Array.isArray(t)?t:[t]);pl[r]||(pl[r]=new WeakMap);var s=pl[r],o=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))u(p);else try{var f=p.getAttribute(n),m=f!==null&&f!=="false",x=(ns.get(p)||0)+1,g=(s.get(p)||0)+1;ns.set(p,x),s.set(p,g),o.push(p),x===1&&m&&fl.set(p,!0),g===1&&p.setAttribute(r,"true"),m||p.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return u(e),a.clear(),Su++,function(){o.forEach(function(d){var p=ns.get(d)-1,f=s.get(d)-1;ns.set(d,p),s.set(d,f),p||(fl.has(d)||d.removeAttribute(n),fl.delete(d)),f||d.removeAttribute(r)}),Su--,Su||(ns=new WeakMap,ns=new WeakMap,fl=new WeakMap,pl={})}},YG=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=HG(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),GG(n,i,r,"aria-hidden")):function(){return null}},fh="Dialog",[TT]=t1(fh),[VG,Zr]=TT(fh),_T=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=C.useRef(null),l=C.useRef(null),[c,u]=WU({prop:n,defaultProp:i??!1,onChange:s,caller:fh});return h.jsx(VG,{scope:e,triggerRef:a,contentRef:l,contentId:yu(),titleId:yu(),descriptionId:yu(),open:c,onOpenChange:u,onOpenToggle:C.useCallback(()=>u(d=>!d),[u]),modal:o,children:r})};_T.displayName=fh;var ET="DialogTrigger",XG=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Zr(ET,r),s=Nr(e,i.triggerRef);return h.jsx(ur.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Qp(i.open),...n,ref:s,onClick:lr(t.onClick,i.onOpenToggle)})});XG.displayName=ET;var Kp="DialogPortal",[KG,NT]=TT(Kp,{forceMount:void 0}),jT=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=Zr(Kp,e);return h.jsx(KG,{scope:e,forceMount:r,children:C.Children.map(n,o=>h.jsx(si,{present:r||s.open,children:h.jsx(mT,{asChild:!0,container:i,children:o})}))})};jT.displayName=Kp;var Ac="DialogOverlay",LT=C.forwardRef((t,e)=>{const r=NT(Ac,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Zr(Ac,t.__scopeDialog);return s.modal?h.jsx(si,{present:n||s.open,children:h.jsx(QG,{...i,ref:e})}):null});LT.displayName=Ac;var ZG=zf("DialogOverlay.RemoveScroll"),QG=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Zr(Ac,r);return h.jsx(wT,{as:ZG,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(ur.div,{"data-state":Qp(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Ii="DialogContent",BT=C.forwardRef((t,e)=>{const r=NT(Ii,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Zr(Ii,t.__scopeDialog);return h.jsx(si,{present:n||s.open,children:s.modal?h.jsx(JG,{...i,ref:e}):h.jsx(tY,{...i,ref:e})})});BT.displayName=Ii;var JG=C.forwardRef((t,e)=>{const r=Zr(Ii,t.__scopeDialog),n=C.useRef(null),i=Nr(e,r.contentRef,n);return C.useEffect(()=>{const s=n.current;if(s)return YG(s)},[]),h.jsx(AT,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:lr(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:lr(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:lr(t.onFocusOutside,s=>s.preventDefault())})}),tY=C.forwardRef((t,e)=>{const r=Zr(Ii,t.__scopeDialog),n=C.useRef(!1),i=C.useRef(!1);return h.jsx(AT,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=r.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),AT=C.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Zr(Ii,r),l=C.useRef(null),c=Nr(e,l);return aG(),h.jsxs(h.Fragment,{children:[h.jsx(fT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(uT,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Qp(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(eY,{titleId:a.titleId}),h.jsx(nY,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Zp="DialogTitle",MT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Zr(Zp,r);return h.jsx(ur.h2,{id:i.titleId,...n,ref:e})});MT.displayName=Zp;var IT="DialogDescription",FT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Zr(IT,r);return h.jsx(ur.p,{id:i.descriptionId,...n,ref:e})});FT.displayName=IT;var PT="DialogClose",DT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Zr(PT,r);return h.jsx(ur.button,{type:"button",...n,ref:e,onClick:lr(t.onClick,()=>i.onOpenChange(!1))})});DT.displayName=PT;function Qp(t){return t?"open":"closed"}var OT="DialogTitleWarning",[FZ,RT]=d3(OT,{contentName:Ii,titleName:Zp,docsSlug:"dialog"}),eY=({titleId:t})=>{const e=RT(OT),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
719
|
-
|
|
720
|
-
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
721
|
-
|
|
722
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return C.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},rY="DialogDescriptionWarning",nY=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${RT(rY).contentName}}.`;return C.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},iY=_T,sY=jT,$T=LT,zT=BT,WT=MT,qT=FT,oY=DT;const Jp=iY,aY=sY,HT=C.forwardRef(({className:t,...e},r)=>h.jsx($T,{ref:r,className:rt("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));HT.displayName=$T.displayName;const ph=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(aY,{children:[h.jsx(HT,{}),h.jsxs(zT,{ref:n,className:rt("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%]","w-full max-w-lg rounded-lg border border-slate-700 bg-card shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",t),...r,children:[e,h.jsxs(oY,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(dn,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ph.displayName=zT.displayName;const mh=({className:t,...e})=>h.jsx("div",{className:rt("flex flex-col space-y-1.5 p-6 pb-4",t),...e});mh.displayName="DialogHeader";const tm=({className:t,...e})=>h.jsx("div",{className:rt("flex items-center justify-end gap-2 p-6 pt-4",t),...e});tm.displayName="DialogFooter";const gh=C.forwardRef(({className:t,...e},r)=>h.jsx(WT,{ref:r,className:rt("text-sm font-semibold text-foreground leading-none tracking-tight",t),...e}));gh.displayName=WT.displayName;const lY=C.forwardRef(({className:t,...e},r)=>h.jsx(qT,{ref:r,className:rt("text-sm text-muted-foreground",t),...e}));lY.displayName=qT.displayName;const M0=[{id:"task",label:"Task",defaults:{type:"task",phase:"planning",priority:1,governance:"flag"}},{id:"decision",label:"Decision",defaults:{type:"decision",phase:"specification",priority:2,governance:"gate"}},{id:"question",label:"Question",defaults:{type:"question",phase:"specification",priority:1,governance:"flag"}},{id:"idea",label:"Idea",defaults:{type:"idea",phase:"vision",priority:0,governance:"skip"}},{id:"spec",label:"Spec",defaults:{type:"spec",phase:"specification",priority:2,governance:"gate"}}],cY=["gate","flag","skip"];function I0(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function UT({open:t,onClose:e,parentItem:r}){const n=yr(b=>b.createItem),[i,s]=C.useState(()=>I0(r)),[o,a]=C.useState("task"),[l,c]=C.useState(!1),[u,d]=C.useState(!1),[p,f]=C.useState(""),m=C.useRef(null);C.useEffect(()=>{if(t){const b=I0(r);s(b),a("task"),c(!1),f(""),setTimeout(()=>{var k;return(k=m.current)==null?void 0:k.focus()},50)}},[t,r]);const x=b=>{const k=M0.find(T=>T.id===b);k&&(a(b),s(T=>({...T,type:k.defaults.type,phase:(r==null?void 0:r.phase)??k.defaults.phase,priority:k.defaults.priority,governance:k.defaults.governance})))},g=async()=>{if(!i.title.trim()){f("Title is required");return}d(!0),f("");try{const b={type:i.type,title:i.title.trim(),description:i.description.trim()||void 0,phase:i.phase||void 0,status:"planned",confidence:0,priority:i.priority,assignedTo:i.assignedTo!=="unassigned"?i.assignedTo:void 0,governance:i.governance!=="flag"?i.governance:void 0,featureCode:i.featureCode.trim()||void 0};await n(b),e()}catch{f("Failed to create item")}finally{d(!1)}},y=b=>{b.key==="Enter"&&!b.shiftKey&&b.target.tagName!=="TEXTAREA"&&(b.preventDefault(),g())};return h.jsx(Jp,{open:t,onOpenChange:b=>!b&&e(),children:h.jsxs(ph,{className:"max-w-md",onKeyDown:y,children:[h.jsx(mh,{children:h.jsx(gh,{children:"New Item"})}),h.jsxs("div",{className:"px-6 pb-2 space-y-4",children:[h.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:M0.map(b=>h.jsx("button",{type:"button",onClick:()=>x(b.id),className:rt("rounded-md px-2 py-1.5 text-[11px] font-medium border transition-colors",o===b.id?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:b.label},b.id))}),h.jsx("input",{ref:m,type:"text",placeholder:"Item title…",value:i.title,onChange:b=>s(k=>({...k,title:b.target.value})),className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring"}),h.jsx("textarea",{placeholder:"Description (optional)…",value:i.description,onChange:b=>s(k=>({...k,description:b.target.value})),rows:2,className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring resize-none"}),h.jsxs("button",{type:"button",onClick:()=>c(b=>!b),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l?h.jsx(Nb,{className:"h-3 w-3"}):h.jsx(Ca,{className:"h-3 w-3"}),"Advanced"]}),l&&h.jsxs("div",{className:"space-y-3 border border-border/40 rounded-md p-3 bg-muted/20",children:[h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Feature Code"}),h.jsx("input",{type:"text",placeholder:"e.g. COMP-UI-5",value:i.featureCode,onChange:b=>s(k=>({...k,featureCode:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none"})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Phase"}),h.jsx("select",{value:i.phase,onChange:b=>s(k=>({...k,phase:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:dy.map(b=>h.jsx("option",{value:b,children:$l[b]??b},b))})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Priority"}),h.jsxs("select",{value:i.priority,onChange:b=>s(k=>({...k,priority:Number(b.target.value)})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:[h.jsx("option",{value:0,children:"Low (0)"}),h.jsx("option",{value:1,children:"Normal (1)"}),h.jsx("option",{value:2,children:"High (2)"}),h.jsx("option",{value:3,children:"Critical (3)"})]})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Assign to"}),h.jsx("select",{value:i.assignedTo,onChange:b=>s(k=>({...k,assignedTo:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:py.map(b=>h.jsx("option",{value:b,children:b},b))})]}),h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Governance"}),h.jsx("div",{className:"flex gap-1.5",children:cY.map(b=>h.jsx("button",{type:"button",onClick:()=>s(k=>({...k,governance:b})),className:rt("flex-1 text-[11px] px-2 py-1 rounded border transition-colors",i.governance===b?b==="gate"?"bg-amber-500/20 text-amber-300 border-amber-500/40":b==="flag"?"bg-blue-500/20 text-blue-300 border-blue-500/40":"bg-slate-700 text-slate-400 border-slate-600":"border-border/40 text-muted-foreground hover:border-border"),children:b},b))})]})]}),p&&h.jsx("p",{className:"text-xs text-destructive",children:p})]}),h.jsxs(tm,{children:[h.jsx(zt,{variant:"ghost",size:"sm",onClick:e,disabled:u,children:"Cancel"}),h.jsx(zt,{size:"sm",onClick:g,disabled:u||!i.title.trim(),children:u?"Creating…":"Create"})]})]})})}const hY=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],uY=[{id:"gate",Icon:Ks,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:Bb,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:Pb,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function dY(t,e){var r,n;return((n=(r=t==null?void 0:t.governance)==null?void 0:r.phases)==null?void 0:n[e])??"flag"}function GT({open:t,onClose:e,settings:r,onSettingsChange:n}){const[i,s]=C.useState(!1),o=C.useRef(null),a=C.useCallback((l,c)=>{n==null||n({governance:{phases:{[l]:c}}}),clearTimeout(o.current),s(!0),o.current=setTimeout(()=>s(!1),1500)},[n]);return h.jsx(Jp,{open:t,onOpenChange:l=>!l&&e(),children:h.jsxs(ph,{className:"max-w-sm",children:[h.jsx(mh,{children:h.jsxs("div",{className:"flex items-center justify-between pr-6",children:[h.jsx(gh,{children:"Governance Settings"}),i&&h.jsx("span",{className:"text-[11px] text-emerald-400 font-medium",children:"Saved ✓"})]})}),h.jsx("div",{className:"px-6 pb-6 space-y-1 max-h-96 overflow-y-auto",children:hY.map(l=>{const c=l==="explore_design",u=dY(r,l),d=_e[l]??l;return h.jsxs("div",{className:rt("flex items-center gap-3 rounded-md px-2 py-1.5",c&&"opacity-40"),children:[h.jsx("span",{className:rt("text-xs flex-1 min-w-0 truncate",c?"text-muted-foreground":"text-foreground"),children:d}),c?h.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"no policy"}):h.jsx("div",{className:"flex gap-1 shrink-0",children:uY.map(p=>{const f=u===p.id,{Icon:m}=p;return h.jsxs("button",{onClick:()=>a(l,p.id),title:p.label,className:rt("flex items-center gap-1 px-2 py-0.5 text-[10px] rounded border transition-colors",f?p.active:"border-border/30 text-muted-foreground hover:border-border hover:text-foreground"),children:[h.jsx(m,{className:"h-2.5 w-2.5"}),p.label]},p.id)})})]},l)})}),h.jsx("div",{className:"px-6 pb-4 text-[10px] text-muted-foreground border-t border-border/30 pt-3",children:"Agent config via Compose CLI"})]})})}function YT({onOpenGate:t}){const{gates:e,items:r}=yr(Ri(g=>({gates:g.gates,items:g.items}))),[n,i]=C.useState(new Set),[s,o]=C.useState(0),a=e.filter(g=>g.status==="pending"&&!n.has(g.id));if(a.length===0)return null;const l=Math.min(s,a.length-1),c=a[l],u=r.find(g=>g.id===c.itemId)||r.find(g=>{var y;return((y=g.lifecycle)==null?void 0:y.featureCode)&&c.featureCode&&g.lifecycle.featureCode===c.featureCode}),d=Jo(c,u),p=w_[c.fromPhase]??S_,f=()=>{i(g=>new Set([...g,c.id])),l>=a.length-1&&l>0&&o(l-1)},m=()=>o(Math.max(0,l-1)),x=()=>o(Math.min(a.length-1,l+1));return h.jsxs("div",{className:rt("shrink-0 h-10 border-t flex items-center gap-2 px-3",p.bg,p.border),children:[h.jsx(Ks,{className:rt("h-3.5 w-3.5 shrink-0",p.text)}),h.jsx("span",{className:rt("text-[11px] font-medium truncate flex-1 min-w-0",p.text),children:d}),a.length>1&&h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx("button",{onClick:m,disabled:l===0,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:h.jsx(Eb,{className:"h-3 w-3"})}),h.jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[l+1,"/",a.length]}),h.jsx("button",{onClick:x,disabled:l===a.length-1,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:h.jsx(Ps,{className:"h-3 w-3"})})]}),h.jsx("button",{onClick:()=>t==null?void 0:t(c.id),className:rt("shrink-0 text-[10px] px-2 py-0.5 rounded border transition-colors hover:opacity-80",p.border,p.text),children:"Review"}),h.jsx("button",{onClick:f,className:"shrink-0 p-0.5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Dismiss (page session only)",children:h.jsx(dn,{className:"h-3 w-3"})})]})}const fY="●",pY="text-zinc-400";function mY(t,e){if(!t)return"";const n=(e??Date.now())-new Date(t).getTime(),i=Math.floor(n/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const s=Math.floor(i/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function gY(t){var e;return((e=my[t])==null?void 0:e.icon)??fY}function xY(t){var e;return((e=my[t])==null?void 0:e.color)??pY}const yY={IMPLEMENTER:"bg-blue-500/15 text-blue-300 border border-blue-500/25",REVIEWER:"bg-emerald-500/15 text-emerald-300 border border-emerald-500/25",PRODUCER:"bg-purple-500/15 text-purple-300 border border-purple-500/25"};function bY(t){return yY[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function kY(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function vY(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function wY({event:t,now:e}){const r=gY(t.kind),n=xY(t.kind),i=mY(t.timestamp,e);return h.jsxs("div",{"data-decision-card":!0,className:"inline-flex flex-col gap-0.5 w-40 shrink-0 rounded border border-border/40 bg-muted/20 px-2 py-1.5 text-left",children:[h.jsxs("div",{className:"flex items-center justify-between gap-1",children:[h.jsx("span",{className:rt("text-[11px] shrink-0",n),children:r}),h.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:i||vY(t.timestamp)})]}),h.jsx("p",{className:"text-[11px] text-foreground/80 truncate leading-tight",children:t.title}),t.roles&&t.roles.length>0&&h.jsx("div",{className:"flex flex-wrap gap-0.5 mt-0.5",children:t.roles.map((s,o)=>h.jsx("span",{"data-role-chip":!0,className:rt("text-[9px] px-1 py-px rounded-full leading-tight",bY(s.name)),children:s.name},o))})]})}function VT({events:t=[],currentFeatureCode:e,now:r}){const n=kY(t,e);return n.length===0?null:h.jsx("div",{className:"w-full overflow-x-auto whitespace-nowrap border-b border-border/30 bg-background/95 backdrop-blur-sm",style:{height:72,minHeight:72,maxHeight:72,position:"sticky",top:32,zIndex:20},"data-decision-timeline-strip":!0,children:h.jsx("div",{className:"flex items-center gap-2 px-3 h-full",children:n.map(i=>h.jsx(wY,{event:i,now:r},i.id))})})}function SY(t){if(!t)return[];const e=[];t.active_phase!=null&&e.push({label:"Phase",value:t.active_phase});const r=t.pending_gates??[];e.push({label:"Pending gates",value:r.length===0?"none":r.join(", ")}),e.push({label:"Open loops",value:t.open_loops_count??0}),e.push({label:"Gate load (24h)",value:t.gate_load_24h??0});const n=t.drift_alerts??[];return n.length>0?e.push({label:"Drift alerts",value:n.map(i=>i.axis_id||i.name||"unknown").join(", ")}):e.push({label:"Drift alerts",value:"none"}),t.computed_at&&e.push({label:"Updated",value:t.computed_at}),e}const TY="Select a feature to see status.";function XT({featureCode:t,snapshot:e}){const[r,n]=C.useState(!1),i=C.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??TY,o=SY(e);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-status-band":!0,onClick:i,style:{position:"sticky",top:"0px",zIndex:30,height:"32px",minHeight:"32px",maxHeight:"32px",cursor:"pointer",display:"flex",alignItems:"center",paddingLeft:"12px",paddingRight:"12px",userSelect:"none",overflow:"hidden"},className:"w-full bg-background/95 backdrop-blur-sm border-b border-border/30 text-sm text-foreground/80",title:s,"aria-expanded":r,role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&i()},children:[h.jsx("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1},children:s}),h.jsx("span",{style:{marginLeft:8,opacity:.5,fontSize:10},"aria-hidden":"true",children:r?"▲":"▼"})]}),r&&h.jsx("div",{"data-status-band-expansion":!0,style:{position:"relative",width:"100%",zIndex:29,maxHeight:200,overflowY:"auto"},className:"bg-background/98 border-b border-border/50 text-xs text-foreground/70",children:h.jsx("div",{style:{padding:"8px 12px"},children:o.length===0?h.jsx("span",{className:"text-muted-foreground",children:"No details available."}):h.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:h.jsx("tbody",{children:o.map((a,l)=>h.jsxs("tr",{children:[h.jsx("td",{style:{paddingRight:16,paddingBottom:2,fontWeight:500,whiteSpace:"nowrap"},className:"text-foreground/60",children:a.label}),h.jsx("td",{style:{paddingBottom:2},children:String(a.value)})]},l))})})})})]})}function _Y({onContextSelect:t,sidebarOpen:e=!0,onToggleSidebar:r}){const{items:n,connections:i,connected:s,uiCommand:o,clearUICommand:a,recentChanges:l,createItem:c,updateItem:u,deleteItem:d,createConnection:p,deleteConnection:f,agentActivity:m,agentErrors:x,sessionState:g,registerSnapshotProvider:y,gates:b,gateEvent:k,resolveGate:T,settings:_,updateSettings:w,resetSettings:N,activeBuild:B,setActiveBuild:I,pipelineDraft:E,sessions:P,selectedPhase:z,setSelectedPhase:q,decisionEvents:R,statusSnapshots:F,setStatusSnapshot:M}=yr(),[D,O]=C.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),j=C.useRef(!!sessionStorage.getItem("vision-activeView")),[S,G]=C.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[Q,A]=C.useState(""),[ct,ut]=C.useState(null),[st,It]=C.useState(!1),[ht,ot]=C.useState(!1),[Y,lt]=C.useState(!1);C.useEffect(()=>{sessionStorage.setItem("vision-activeView",S)},[S]),C.useEffect(()=>{D?sessionStorage.setItem("vision-selectedItemId",D):sessionStorage.removeItem("vision-selectedItemId")},[D]);const xt=C.useRef(!1);C.useEffect(()=>{var et;(et=_==null?void 0:_.ui)!=null&&et.defaultView&&!xt.current&&!j.current&&(G(_.ui.defaultView),xt.current=!0)},[_]),C.useEffect(()=>{o&&(o.view&&G(o.view),o.phase!==void 0&&q(o.phase),o.select!==void 0&&O(o.select),a())},[o,a]),C.useEffect(()=>{const et=()=>{var U;return["INPUT","TEXTAREA","SELECT"].includes((U=document.activeElement)==null?void 0:U.tagName)},bt=U=>{(U.metaKey||U.ctrlKey)&&U.key==="k"&&(U.preventDefault(),It(nt=>!nt)),(U.metaKey||U.ctrlKey)&&U.key==="n"&&(U.preventDefault(),ot(!0)),U.key===","&&!U.metaKey&&!U.ctrlKey&&!et()&<(!0)};return window.addEventListener("keydown",bt),()=>window.removeEventListener("keydown",bt)},[]);const Nt=C.useMemo(()=>{let et=n;if(z&&(et=et.filter(bt=>bt.phase===z)),Q){const bt=Q.toLowerCase();et=et.filter(U=>U.title.toLowerCase().includes(bt)||(U.description||"").toLowerCase().includes(bt))}return et},[n,z,Q]),Dt=C.useMemo(()=>z?n.filter(et=>et.phase===z):n,[n,z]),le=C.useMemo(()=>new Set(Dt.map(et=>et.id)),[Dt]),be=C.useMemo(()=>z?b.filter(et=>le.has(et.itemId)):b,[b,le,z]),tr=C.useMemo(()=>{if(!z&&!Q)return i;const et=new Set(Nt.map(bt=>bt.id));return i.filter(bt=>et.has(bt.fromId)&&et.has(bt.toId))},[i,Nt,z,Q]);C.useEffect(()=>{y(()=>({activeView:S,selectedPhase:z,searchQuery:Q,selectedItemId:D,totalItems:n.length,filteredCount:Nt.length,connected:s}))},[y,S,z,Q,D,n.length,Nt.length,s]);const Kt=C.useCallback(et=>{O(et),t&&t({type:"item",id:et})},[t]),we=C.useCallback((et,bt)=>{u(et,bt)},[u]);C.useCallback(async()=>{const bt=await c({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:z||"vision"});bt&&bt.id&&O(bt.id)},[c,z]),C.useCallback(async et=>{await d(et),D===et&&(O(null),t&&t(null))},[d,D,t]);const V=C.useCallback(et=>{const bt=b.find(U=>U.id===et);bt&&(O(bt.itemId),t&&t({type:"item",id:bt.itemId}))},[b,t]);C.useCallback(async et=>p(et),[p]),C.useCallback(async et=>f(et),[f]);const it=C.useCallback(()=>{Rt("/api/build/state").then(et=>et.json()).then(et=>I(et.state??null)).catch(()=>{})},[I]),ft=C.useCallback(et=>{t&&t({type:"step",id:et})},[t]),_t=C.useMemo(()=>{var bt;if(!D)return null;const et=n.find(U=>U.id===D);return((bt=et==null?void 0:et.lifecycle)==null?void 0:bt.featureCode)||null},[D,n]);return C.useEffect(()=>{_t&&(F&&F[_t]||Rt(`/api/lifecycle/status?featureCode=${encodeURIComponent(_t)}`).then(et=>et.json()).then(et=>{et.snapshot&&M&&M(_t,et.snapshot)}).catch(()=>{}))},[_t]),h.jsx(qc.Provider,{value:l,children:h.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[h.jsx(XT,{featureCode:_t,snapshot:_t?(F==null?void 0:F[_t])??null:null}),_t&&h.jsx(VT,{events:R,currentFeatureCode:_t}),h.jsxs("div",{className:"flex-1 flex min-h-0",children:[h.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[r&&h.jsx("button",{className:"w-4 h-full flex items-center justify-center text-[10px] text-muted-foreground hover:text-foreground transition-colors select-none",onClick:r,title:e?"Collapse sidebar":"Expand sidebar","aria-expanded":e,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:e?"‹":"›"}),e&&h.jsx(C1,{items:n,gates:b,activeBuild:B,activeView:S,onViewChange:G,selectedPhase:z,onPhaseSelect:q,searchQuery:Q,onSearchChange:A,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Kt,onThemeChange:w,onNewItem:()=>ot(!0)})]}),h.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[!s&&h.jsx("div",{className:"text-center text-[10px] py-0.5 bg-destructive text-destructive-foreground",children:"Disconnected — reconnecting..."}),S==="tree"&&h.jsx(v1,{items:Nt,connections:tr,selectedItemId:D,onSelect:Kt}),S==="graph"&&h.jsx(S1,{items:Nt,connections:tr,selectedItemId:D,onSelect:Kt}),S==="pipeline"&&h.jsx(rT,{activeBuild:B,pipelineDraft:E,onSelectStep:ft,onRefresh:it}),S==="sessions"&&h.jsx(lT,{sessions:P,items:n,onSelectItem:Kt}),S==="docs"&&h.jsx(KS,{items:Dt}),S==="gates"&&h.jsx(QS,{gates:be,items:Dt,onResolve:T,onSelect:Kt}),S==="settings"&&h.jsx(eT,{settings:_,onSettingsChange:w,onReset:N})]}),h.jsx(YT,{onOpenGate:V}),ct&&(()=>{const et=n.find(bt=>bt.id===ct);return et?h.jsx(tT,{item:et,items:n,connections:i,onUpdate:we,onClose:()=>ut(null)}):null})(),h.jsx(JS,{event:k,items:n,onNavigate:()=>G("gates")}),h.jsx(cT,{open:st,onClose:()=>It(!1),onSelectItem:et=>{Kt(et),It(!1)},onSelectGate:et=>{V(et),It(!1)}}),h.jsx(UT,{open:ht,onClose:()=>ot(!1)}),h.jsx(GT,{open:Y,onClose:()=>lt(!1),settings:_,onSettingsChange:w})]})]})})}ma.use(uy);const EY={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},NY={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function jY(t){return[{selector:"node",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"11px","font-weight":600,"font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textPrimary,"text-wrap":"wrap","text-max-width":"110px","background-color":t.overlay,"border-width":1,"border-color":"data(color)","border-opacity":.5,width:140,height:52,shape:"round-rectangle","text-outline-width":0,"overlay-padding":4,"overlay-opacity":0}},{selector:'node[shape = "diamond"]',style:{shape:"diamond",width:160,height:80,"font-size":"10px"}},{selector:"node:selected",style:{"border-width":2,"border-opacity":1,"border-color":t.accent}},{selector:"edge",style:{width:1,"line-color":t.textMuted,"target-arrow-color":t.textMuted,"target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.7,opacity:.5}},{selector:"edge[label]",style:{label:"data(label)","font-size":"10px","font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textSecondary,"text-rotation":"autorotate","text-margin-y":-8,"text-outline-width":3,"text-outline-color":t.background}},{selector:"edge[color]",style:{"line-color":"data(color)","target-arrow-color":"data(color)"}},{selector:'edge[lineStyle = "dashed"]',style:{"line-style":"dashed"}},{selector:'edge[lineStyle = "dotted"]',style:{"line-style":"dotted"}},{selector:":parent",style:{"background-color":t.overlay,"background-opacity":.3,"border-width":1,"border-color":"data(color)","border-opacity":.3,"text-valign":"top","text-halign":"center","font-size":"10px",color:t.textTertiary,padding:"16px"}}]}function LY(){const[t,e]=C.useState(()=>document.documentElement.classList.contains("dark"));return C.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const BY={"dagre-tb":{name:"dagre",rankDir:"LR",rankSep:80,nodeSep:50,padding:40},"dagre-lr":{name:"dagre",rankDir:"TB",rankSep:100,nodeSep:40,padding:40},circle:{name:"circle",padding:40},grid:{name:"grid",padding:40,rows:3},concentric:{name:"concentric",padding:40,minNodeSpacing:60},breadthfirst:{name:"breadthfirst",padding:40,spacingFactor:1.2}},AY={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function MY(t,e){const r=[];for(const n of t)r.push({data:{id:n.id,label:n.label,sublabel:n.sublabel||void 0,color:n.color||CY.textMuted,parent:n.parent||void 0,shape:n.shape||void 0},...n.position?{position:n.position}:{}});for(const n of e)r.push({data:{id:n.id||`${n.from}-${n.to}-${n.label||""}`,source:n.from,target:n.to,label:n.label||void 0,color:n.color||void 0,lineStyle:n.style||"solid",edgeType:n.type||void 0}});return r}const Mc="compose:graph:";function IY(t){try{const e=localStorage.getItem(Mc+t);return e?JSON.parse(e):null}catch{return null}}function FY(t,e){try{localStorage.setItem(Mc+t,JSON.stringify(e))}catch{}}const PY=[{style:"solid",label:"Structural / hard",dash:null},{style:"dashed",label:"Informational / weak",dash:"4,3"},{style:"dotted",label:"Soft dependency",dash:"1.5,3"}];function fs({onClick:t,active:e,children:r,title:n}){return h.jsx("button",{onClick:t,title:n,className:"text-xs rounded cursor-pointer transition-colors font-semibold",style:{padding:"4px 8px",borderRadius:"0.375rem",border:"1px solid",borderColor:e?"hsl(var(--primary) / 0.1)":"hsl(var(--border))",background:e?"hsl(var(--primary) / 0.1)":"hsl(var(--accent))",color:e?"hsl(var(--primary))":"hsl(var(--muted-foreground))"},children:r})}function ml({mode:t,active:e,onClick:r}){return h.jsx("button",{onClick:r,className:"text-xs rounded cursor-pointer capitalize transition-colors font-semibold",style:{padding:"4px 8px",borderRadius:"0.375rem",border:"1px solid",borderColor:e?"hsl(var(--primary) / 0.1)":"hsl(var(--border))",background:e?"hsl(var(--primary) / 0.1)":"hsl(var(--accent))",color:e?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:t})}function Tu(){return h.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function F0({arrow:t,label:e,edgeStyle:r,color:n,targetLabel:i,targetColor:s,suffix:o}){return h.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:t}),h.jsx("span",{style:{color:n||"hsl(var(--muted-foreground))",fontStyle:r==="dashed"?"italic":"normal"},children:e||"connects"}),i?h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s||"hsl(var(--muted-foreground) / 0.6)"}}),h.jsx("span",{style:{color:"hsl(var(--foreground))"},children:i})]})]}):o?h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:o}):null,r&&r!=="solid"&&h.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",r,")"]})]})}function DY({nodes:t,edges:e,graphKey:r}){const[n,i]=C.useState(()=>{try{const l=localStorage.getItem(Mc+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});C.useEffect(()=>{try{localStorage.setItem(Mc+r+":tree-collapsed",JSON.stringify([...n]))}catch{}},[n,r]);const s=C.useMemo(()=>{const l={};for(const c of t)l[c.id]=c;return l},[t]),o=C.useMemo(()=>{var u,d;const l={},c={};for(const p of t)l[p.id]=[],c[p.id]=[];for(const p of e)(u=l[p.from])==null||u.push(p),(d=c[p.to])==null||d.push(p);return{out:l,inc:c}},[t,e]),a=l=>i(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return h.jsxs("div",{className:"w-full h-full overflow-y-auto",style:{background:"hsl(var(--background))",padding:"1rem"},children:[h.jsxs("div",{className:"flex items-center mb-4",style:{gap:"8px"},children:[h.jsx(fs,{onClick:()=>i(new Set),children:"Expand all"}),h.jsx(fs,{onClick:()=>i(new Set(t.map(l=>l.id))),children:"Collapse all"}),h.jsxs("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground))"},children:[t.length," entities · ",e.length," relations"]})]}),t.map(l=>{const c=n.has(l.id),u=o.out[l.id]||[],d=o.inc[l.id]||[],p=u.filter(g=>g.from===g.to),f=u.filter(g=>g.from!==g.to),m=d.filter(g=>g.from!==g.to),x=f.length+m.length+p.length;return h.jsxs("div",{className:"mb-0.5",children:[h.jsxs("button",{onClick:()=>a(l.id),className:"flex items-center w-full text-left bg-transparent border-none cursor-pointer rounded-md transition-colors hover:bg-[hsl(var(--accent))]",style:{gap:"8px",padding:"8px"},children:[h.jsx("span",{className:"text-xs w-4 text-center inline-block transition-transform",style:{color:"hsl(var(--muted-foreground))",transform:c?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),h.jsx("span",{className:"w-3 h-3 shrink-0",style:{borderRadius:l.shape==="diamond"?0:3,background:l.color,transform:l.shape==="diamond"?"rotate(45deg) scale(0.8)":"none"}}),h.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:l.label}),l.sublabel&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:["— ",l.sublabel]}),h.jsx("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:x})]}),!c&&h.jsxs("div",{style:{paddingLeft:"32px",paddingBottom:"4px"},children:[f.map((g,y)=>{var b,k;return h.jsx(F0,{arrow:"→",label:g.label,edgeStyle:g.style,color:g.color,targetLabel:((b=s[g.to])==null?void 0:b.label)||g.to,targetColor:(k=s[g.to])==null?void 0:k.color},`out-${y}`)}),p.map((g,y)=>h.jsx(F0,{arrow:"↻",label:g.label,edgeStyle:g.style,color:g.color,suffix:"(self)"},`self-${y}`)),m.map((g,y)=>{var b,k;return h.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:((b=s[g.from])==null?void 0:b.color)||"hsl(var(--muted-foreground) / 0.6)"}}),h.jsx("span",{style:{color:"hsl(var(--foreground))"},children:((k=s[g.from])==null?void 0:k.label)||g.from})]}),h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),h.jsx("span",{style:{color:g.color||"hsl(var(--muted-foreground))",fontStyle:g.style==="dashed"?"italic":"normal"},children:g.label||"connects"}),h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→ this"}),g.style&&g.style!=="solid"&&h.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",g.style,")"]})]},`in-${y}`)}),x===0&&h.jsx("div",{className:"text-xs italic",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground) / 0.6)"},children:"no relations"})]})]},l.id)})]})}function OY({elements:t,nodes:e,edges:r,layout:n,style:i,title:s,subtitle:o,graphKey:a="default",onNodeClick:l}){const c=C.useRef(null),u=C.useRef(null),[d,p]=C.useState(null),f=LY(),m=f?EY:NY,x=C.useMemo(()=>IY(a),[a]),[g,y]=C.useState((x==null?void 0:x.layoutKey)||"dagre-tb"),[b,k]=C.useState((x==null?void 0:x.showEdgeLabels)??!0),[T,_]=C.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[w,N]=C.useState((x==null?void 0:x.showLegend)??!0),[B,I]=C.useState((x==null?void 0:x.viewMode)||"graph");C.useEffect(()=>{FY(a,{layoutKey:g,showEdgeLabels:b,hiddenNodes:[...T],showLegend:w,viewMode:B})},[a,g,b,T,w,B]);const E=t||(e&&r?MY(e,r):[]),P=C.useMemo(()=>i||jY(m),[i,f]),z=n||BY[g],q=C.useMemo(()=>E.filter(S=>!S.data.source).map(S=>({id:S.data.id,label:S.data.label,color:S.data.color})),[JSON.stringify(E)]),R=C.useMemo(()=>T.size===0?E:E.filter(S=>S.data.source?!T.has(S.data.source)&&!T.has(S.data.target):!T.has(S.data.id)),[E,T]);C.useEffect(()=>{if(!c.current)return;const S=ma({container:c.current,elements:R,style:P,layout:z,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=S,S.on("mouseover","node",G=>{const Q=G.target;Q.style("border-width",2),Q.style("border-opacity",1);const A=Q.renderedPosition();p({x:A.x,y:A.y-Q.renderedHeight()/2-12,label:Q.data("label"),sublabel:Q.data("sublabel"),id:Q.id(),color:Q.data("color")})}),S.on("mouseout","node",G=>{G.target.style("border-width",1),G.target.style("border-opacity",.5),p(null)}),l&&S.on("tap","node",G=>l(G.target.id())),S.on("layoutstop",()=>S.fit(void 0,40)),()=>{S.destroy(),u.current=null}},[JSON.stringify(R),JSON.stringify(z),f,B]),C.useEffect(()=>{const S=u.current;S&&S.edges().forEach(G=>{G.data("label")&&G.style("label",b?G.data("label"):"")})},[b]);const F=C.useCallback(()=>{var S;return(S=u.current)==null?void 0:S.fit(void 0,40)},[]),M=C.useCallback(()=>{const S=u.current;S&&S.zoom({level:S.zoom()*1.3,renderedPosition:{x:S.width()/2,y:S.height()/2}})},[]),D=C.useCallback(()=>{const S=u.current;S&&S.zoom({level:S.zoom()/1.3,renderedPosition:{x:S.width()/2,y:S.height()/2}})},[]),O=C.useCallback(S=>{_(G=>{const Q=new Set(G);return Q.has(S)?Q.delete(S):Q.add(S),Q})},[]),j=C.useCallback(()=>_(new Set),[]);return B==="tree"?h.jsxs("div",{className:"w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[h.jsxs("div",{className:"flex items-center justify-between shrink-0",style:{padding:"8px 16px",borderBottom:"1px solid hsl(var(--border))"},children:[h.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[s&&h.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&h.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),h.jsxs("div",{className:"flex",style:{gap:"4px"},children:[h.jsx(ml,{mode:"graph",active:B==="graph",onClick:()=>I("graph")}),h.jsx(ml,{mode:"tree",active:B==="tree",onClick:()=>I("tree")})]})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(DY,{nodes:e||[],edges:r||[],graphKey:a})})]}):h.jsxs("div",{className:"w-full h-full relative",style:{background:"hsl(var(--background))"},children:[(s||o)&&h.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[2] pointer-events-none",style:{padding:"8px 16px",background:"linear-gradient(to bottom, hsl(var(--background)) 0%, transparent 100%)"},children:[s&&h.jsx("div",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&h.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),h.jsxs("div",{className:"absolute top-2 right-3 z-[2] flex items-center",style:{gap:"4px"},children:[h.jsx("select",{value:g,onChange:S=>y(S.target.value),className:"text-xs rounded cursor-pointer appearance-none",style:{padding:"4px 8px",borderRadius:"0.375rem",background:"hsl(var(--accent))",border:"1px solid hsl(var(--border))",color:"hsl(var(--muted-foreground))"},title:"Graph layout",children:Object.entries(AY).map(([S,G])=>h.jsx("option",{value:S,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:G},S))}),h.jsx(Tu,{}),h.jsx(fs,{onClick:D,title:"Zoom out",children:"−"}),h.jsx(fs,{onClick:F,title:"Fit to view",children:"Fit"}),h.jsx(fs,{onClick:M,title:"Zoom in",children:"+"}),h.jsx(Tu,{}),h.jsx(fs,{onClick:()=>N(!w),active:w,title:w?"Hide legend":"Show legend",children:"Legend"}),h.jsx(Tu,{}),h.jsx(ml,{mode:"graph",active:B==="graph",onClick:()=>I("graph")}),h.jsx(ml,{mode:"tree",active:B==="tree",onClick:()=>I("tree")})]}),w&&h.jsxs("div",{className:"absolute bottom-3 left-3 z-[2]",style:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"0.5rem",padding:"8px 16px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",minWidth:150,maxWidth:210},children:[h.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Entities"}),T.size>0&&h.jsx("button",{onClick:j,className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:"hsl(var(--primary))"},children:"Show all"})]}),h.jsx("div",{className:"flex flex-col gap-1",children:q.map(S=>{const G=T.has(S.id);return h.jsxs("button",{onClick:()=>O(S.id),className:"flex items-center gap-1.5 bg-transparent border-none py-0.5 cursor-pointer transition-opacity",style:{opacity:G?.35:1},title:G?`Show ${S.label}`:`Hide ${S.label}`,children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:G?"transparent":S.color,border:`1.5px solid ${S.color}`}}),h.jsx("span",{className:"text-xs",style:{color:G?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:G?"line-through":"none"},children:S.label})]},S.id)})}),h.jsxs("div",{className:"flex justify-between items-center mt-2.5 mb-1.5",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Edges"}),h.jsx("button",{onClick:()=>k(!b),className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:b?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:b?"Hide labels":"Show labels"})]}),h.jsx("div",{className:"flex flex-col gap-1",children:PY.map(S=>h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("svg",{width:"20",height:"6",className:"shrink-0",children:h.jsx("line",{x1:"0",y1:"3",x2:"20",y2:"3",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.5",strokeDasharray:S.dash||"none"})}),h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:S.label})]},S.style))})]}),d&&h.jsxs("div",{className:"absolute z-10 text-center pointer-events-none backdrop-blur-sm",style:{left:d.x,top:d.y,transform:"translate(-50%, -100%)",background:"hsl(var(--accent))",border:"1px solid hsl(var(--border))",borderRadius:"0.5rem",padding:"4px 8px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",minWidth:110,maxWidth:200},children:[h.jsx("div",{className:"text-sm font-semibold",style:{color:d.color||"hsl(var(--foreground))"},children:d.label}),d.sublabel&&h.jsx("div",{className:"text-xs mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:d.sublabel}),h.jsx("div",{className:"text-[10px] mt-1 font-mono",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:d.id})]}),h.jsx("div",{ref:c,className:"w-full h-full"})]})}const qt={discovery:"#a78bfa",feature:"#3b82f6",track:"#06b6d4",task:"#94a3b8",spec:"#a78bfa",idea:"#fbbf24",question:"#f472b6",evaluation:"#f59e0b",thread:"#64748b",decision:"#22c55e",artifact:"#a87cb8",informs:"#64748b",pipeline:"#6366f1"},RY=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:qt.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:qt.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:qt.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:qt.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:qt.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:qt.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:qt.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:qt.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:qt.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:qt.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:qt.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:qt.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:qt.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:qt.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:qt.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:qt.decision},{id:"question",label:"Question",sublabel:"may block progress",color:qt.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:qt.artifact}],$Y=[{from:"p-vision",to:"p-specification",color:qt.pipeline},{from:"p-specification",to:"p-planning",color:qt.pipeline},{from:"p-planning",to:"p-implementation",color:qt.pipeline},{from:"p-implementation",to:"p-verification",color:qt.pipeline},{from:"p-verification",to:"p-release",color:qt.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:qt.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:qt.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:qt.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:qt.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:qt.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:qt.track},{from:"task",to:"feature",label:"implements",color:qt.task},{from:"spec",to:"feature",label:"implements",color:qt.spec},{from:"feature",to:"feature",label:"blocks",color:qt.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:qt.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:qt.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:qt.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:qt.artifact},{from:"question",to:"decision",label:"contradicts",color:qt.question},{from:"feature",to:"p-vision",label:"enters",color:qt.feature,style:"dashed"}];function zY(){return h.jsx(OY,{graphKey:"product",nodes:RY,edges:$Y,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const WY="compose-popout";function KT(t){if(t==="vision://surface")return"Vision Tracker";if(t.startsWith("graph://")){const r=t.replace("graph://","");return r.charAt(0).toUpperCase()+r.slice(1)+" Graph"}const e=t.split("/");return e.length>1?e.slice(-2).join("/"):e[e.length-1]}function gl({path:t,onDock:e}){return h.jsxs("div",{className:"flex items-center justify-between px-3 shrink-0",style:{height:"28px",borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--background))"},children:[h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:KT(t)}),h.jsxs("button",{onClick:e,className:"flex items-center gap-1 px-2 py-0.5 rounded text-[10px] uppercase tracking-wider",style:{color:"hsl(var(--primary))",background:"none",border:"none",cursor:"pointer"},title:"Pop back into main window",children:[h.jsx(BA,{style:{width:11,height:11}}),"pop in"]})]})}function qY({path:t}){const[e,r]=C.useState(null),[n,i]=C.useState(!0),s=C.useRef(null),o=C.useRef(null),a=t.startsWith("vision://")?"vision":t.startsWith("graph://")?"graph":t.endsWith(".html")||t.endsWith(".htm")?"html":"markdown";C.useEffect(()=>{document.title=KT(t)+" — Compose"},[t]),C.useEffect(()=>{const c=new BroadcastChannel(WY);s.current=c,c.postMessage({type:"popout-mounted",path:t});const u=()=>{c.postMessage({type:"popout-closed",path:t})};return window.addEventListener("beforeunload",u),()=>{u(),c.close(),window.removeEventListener("beforeunload",u)}},[t]);const l=C.useCallback(()=>{var c;(c=s.current)==null||c.postMessage({type:"popout-dock",path:t}),window.close()},[t]);return C.useEffect(()=>{if(a==="vision"||a==="graph"){i(!1);return}Rt(`/api/file?path=${encodeURIComponent(t)}`).then(c=>c.json()).then(c=>{c.content!==void 0&&r(c.content),i(!1)}).catch(()=>i(!1))},[t,a]),C.useEffect(()=>{if(a==="vision"||a==="graph")return;const c=window.location.protocol==="https:"?"wss:":"ws:",u=new WebSocket(`${c}//${window.location.host}/ws/files`);return o.current=u,u.onmessage=d=>{try{const p=JSON.parse(d.data);p.type==="fileChanged"&&p.path===t&&r(p.content)}catch{}},()=>u.close()},[t,a]),n?h.jsx("div",{className:"h-screen w-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a==="vision"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(gl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(_Y,{})})]}):a==="graph"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(gl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(zY,{})})]}):a==="html"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(gl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx("iframe",{srcDoc:e,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin",title:t})})]}):h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(gl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 overflow-y-auto px-8 py-6",children:h.jsx("div",{className:"canvas-markdown max-w-4xl mx-auto",children:h.jsx(Ef,{remarkPlugins:[Bf],children:e||""})})})]})}const HY="/api/stratum";async function xh(t,e={}){return(await Rt(`${HY}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function UY(t,e){return xh(t,{method:"POST",body:JSON.stringify(e)})}function ZT({status:t}){const e={running:"hsl(var(--background))",awaiting_gate:"#7c3aed",complete:"#166534",killed:"#7f1d1d",blocked:"#7f1d1d"},r={running:"running",awaiting_gate:"gate pending",complete:"complete",killed:"killed",blocked:"blocked"};return h.jsx("span",{style:{fontSize:"0.72em",padding:"2px 6px",borderRadius:4,background:e[t]||"#333",color:"#e5e7eb",textTransform:"uppercase",letterSpacing:"0.05em"},children:r[t]||t})}function em(){return h.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function GY({onAction:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState({}),[a,l]=C.useState({}),c=C.useCallback(()=>{xh("/gates").then(d=>{r(Array.isArray(d)?d:[]),i(null)}).catch(d=>i(d.message))},[]);C.useEffect(()=>{c();const d=setInterval(c,1e4);return()=>clearInterval(d)},[c]);async function u(d,p,f){const m=`${d}/${p}/${f}`;o(g=>({...g,[m]:!0}));const x=a[`${d}/${p}`]||"";try{const g=await UY(`/gates/${d}/${p}/${f}`,{note:x});g.conflict?i(`Gate already resolved (${d}/${p})`):g.error?i(g.error.message):(t==null||t(),c())}catch(g){i(g.message)}finally{o(g=>({...g,[m]:!1}))}}return e===null&&!n?h.jsx(em,{}):h.jsxs("section",{children:[h.jsxs("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:["Pending Gates ",(e==null?void 0:e.length)>0&&h.jsxs("span",{style:{opacity:1,color:"#f59e0b"},children:["(",e.length,")"]})]}),n&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em",margin:"0 0 8px"},children:n}),(e==null?void 0:e.length)===0&&h.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No pending gates."}),e==null?void 0:e.map(d=>{const p=`${d.flow_id}/${d.step_id}`,f=m=>s[`${p}/${m}`];return h.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",marginBottom:8,background:"#18181b"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[h.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:d.flow_name||d.flow_id}),h.jsx("span",{style:{opacity:.4,fontSize:"0.8em"},children:"›"}),h.jsx("span",{style:{fontFamily:"monospace",fontSize:"0.82em",opacity:.7},children:d.step_id}),d.function&&h.jsxs("span",{style:{opacity:.4,fontSize:"0.78em"},children:["fn:",d.function]})]}),h.jsx("input",{type:"text",placeholder:"Note (optional)",value:a[p]||"",onChange:m=>l(x=>({...x,[p]:m.target.value})),style:{width:"100%",boxSizing:"border-box",marginBottom:8,background:"#27272a",border:"1px solid #3f3f46",borderRadius:4,color:"#e4e4e7",padding:"4px 8px",fontSize:"0.82em"}}),h.jsx("div",{style:{display:"flex",gap:6},children:[{a:"approve",label:"Approve",color:"#166534",hover:"#15803d"},{a:"reject",label:"Reject",color:"#7f1d1d",hover:"#b91c1c"},{a:"revise",label:"Revise",color:"#1e3a5f",hover:"#1d4ed8"}].map(({a:m,label:x,color:g})=>h.jsx("button",{disabled:f(m),onClick:()=>u(d.flow_id,d.step_id,m),style:{padding:"4px 12px",fontSize:"0.8em",borderRadius:4,border:"none",background:g,color:"#e5e7eb",cursor:f(m)?"not-allowed":"pointer",opacity:f(m)?.5:1},children:f(m)?"…":x},m))})]},p)})]})}function YY({flowId:t,onClose:e}){const[r,n]=C.useState(null),[i,s]=C.useState(null);return C.useEffect(()=>{xh(`/flows/${t}`).then(o=>{o.error?s(o.error.message):n(o)}).catch(o=>s(o.message))},[t]),h.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",background:"#18181b"},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[h.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:(r==null?void 0:r.flow_name)||t}),h.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"1.1em"},children:"✕"})]}),i&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:i}),!r&&!i&&h.jsx(em,{}),r&&h.jsx("div",{style:{fontSize:"0.82em",opacity:.8},children:(()=>{const o=new Set(Array.isArray(r.completed_steps)?r.completed_steps:[]),a=new Set(Array.isArray(r.active_steps)?r.active_steps:[]),l=o.size,c=r.step_count??"?";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:[h.jsx("span",{children:h.jsx(ZT,{status:r.status})}),h.jsxs("span",{children:["steps ",l,"/",c,a.size>0&&h.jsxs("span",{style:{marginLeft:6,color:"#34d399",fontSize:"0.85em"},children:["∥ ",a.size," running"]})]}),r.round>0&&h.jsxs("span",{children:["round ",r.round]})]}),Array.isArray(r.ordered_steps)&&r.ordered_steps.length>0&&h.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",lineHeight:1.7},children:r.ordered_steps.map(u=>h.jsxs("li",{style:{opacity:o.has(u.id)?.4:1,fontWeight:a.has(u.id)?700:"normal",color:a.has(u.id)?"#34d399":"inherit"},children:[h.jsx("span",{style:{fontFamily:"monospace"},children:u.id}),u.mode==="gate"&&h.jsx("span",{style:{marginLeft:6,color:"#f59e0b",fontSize:"0.9em"},children:"gate"}),a.has(u.id)&&h.jsx("span",{style:{marginLeft:6,fontSize:"0.85em"},children:"∥ running"})]},u.id))})]})})()})]})}function VY({activeBuild:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState(null),a=C.useCallback(()=>{xh("/flows").then(l=>{r(Array.isArray(l)?l:[]),i(null)}).catch(l=>i(l.message))},[]);return C.useEffect(()=>{a();const l=setInterval(a,15e3);return()=>clearInterval(l)},[a]),C.useEffect(()=>{t&&a()},[t,a]),e===null&&!n?h.jsx(em,{}):h.jsxs("section",{children:[h.jsx("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:"Flows"}),n&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:n}),(e==null?void 0:e.length)===0&&h.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No flows found."}),e==null?void 0:e.map(l=>h.jsx("div",{onClick:()=>o(s===l.flow_id?null:l.flow_id),style:{border:`1px solid ${s===l.flow_id?"#6366f1":"#3f3f46"}`,borderRadius:6,padding:"8px 12px",marginBottom:6,background:s===l.flow_id?"#1e1b4b":"#18181b",cursor:"pointer"},children:h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx("span",{style:{fontSize:"0.88em",fontWeight:500},children:l.flow_name||l.flow_id}),h.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[h.jsxs("span",{style:{fontSize:"0.78em",opacity:.5},children:[Array.isArray(l.completed_steps)?l.completed_steps.length:l.completed_steps??0,"/",l.step_count??"?"]}),h.jsx(ZT,{status:l.status})]})]})},l.flow_id)),s&&h.jsx("div",{style:{marginTop:8},children:h.jsx(YY,{flowId:s,onClose:()=>o(null)})})]})}const XY={display:"inline-block",width:8,height:8,borderRadius:"50%",background:"#22c55e",marginRight:8,animation:"pulse-dot 1.5s ease-in-out infinite"};if(typeof document<"u"&&!document.getElementById("pulse-dot-style")){const t=document.createElement("style");t.id="pulse-dot-style",t.textContent="@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }",document.head.appendChild(t)}function KY({build:t,onDismiss:e}){const r=t.status==="running",n=["complete","failed","aborted"].includes(t.status);C.useEffect(()=>{if(t.status==="complete"){const s=setTimeout(()=>e==null?void 0:e(),5e3);return()=>clearTimeout(s)}},[t.status,e]);const i={running:"#166534",complete:"#14532d",failed:"#7f1d1d",aborted:"#78350f"};return h.jsxs("div",{style:{border:`1px solid ${r?"#22c55e33":"#3f3f46"}`,borderRadius:6,padding:"10px 12px",marginBottom:12,background:i[t.status]||"#18181b"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[r&&h.jsx("span",{style:XY}),h.jsx("span",{style:{fontWeight:600,fontSize:"0.88em"},children:t.featureCode}),h.jsx("span",{style:{opacity:.5,fontSize:"0.78em"},children:r?"building":t.status})]}),n&&t.status!=="complete"&&h.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"0.9em"},children:"✕"})]}),h.jsxs("div",{style:{fontSize:"0.8em",opacity:.7,marginTop:4,fontFamily:"monospace"},children:[t.currentStepId,t.stepNum!=null&&t.totalSteps!=null&&h.jsxs("span",{style:{marginLeft:8,opacity:.5},children:["(",t.stepNum,"/",t.totalSteps,")"]}),t.retries>0&&h.jsxs("span",{style:{marginLeft:8,color:"#f59e0b"},children:["retry ",t.retries]})]})]})}function ZY(){const t=yr(s=>s.activeBuild),[e,r]=C.useState(null),n=C.useCallback(()=>{t&&r(`${t.flowId}:${t.completedAt}`)},[t]);C.useEffect(()=>{(t==null?void 0:t.status)==="running"&&r(null)},[t==null?void 0:t.status]);const i=t&&!(e&&e===`${t.flowId}:${t.completedAt}`);return h.jsxs("div",{style:{padding:"12px 14px",color:"#e4e4e7",fontSize:"0.9em",overflowY:"auto",height:"100%"},children:[i&&h.jsx(KY,{build:t,onDismiss:n}),h.jsx(GY,{}),h.jsx("div",{style:{marginTop:20},children:h.jsx(VY,{activeBuild:t})})]})}function QY({projectName:t,projectRoot:e,onSwitch:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(e||""),a=C.useRef(null);return C.useEffect(()=>{o(e||"")},[e]),C.useEffect(()=>{if(!n)return;const l=c=>{var u;(u=a.current)!=null&&u.contains(c.target)||i(!1)};return window.addEventListener("mousedown",l),()=>window.removeEventListener("mousedown",l)},[n]),C.useEffect(()=>{if(!n)return;const l=c=>{c.key==="Escape"&&i(!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]),h.jsxs("div",{ref:a,className:"flex items-center shrink-0 gap-2 relative",children:[h.jsx("span",{className:"text-xs font-semibold tracking-widest uppercase text-blue-600 dark:text-accent",children:"Compose"}),h.jsx("button",{"data-testid":"project-btn",className:"text-[10px] uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(l=>!l),title:e||"Switch project","aria-label":"Switch project","aria-haspopup":"dialog","aria-expanded":n,children:t||"no project"}),n&&h.jsxs("div",{"data-testid":"project-popover",role:"dialog","aria-label":"Switch project",className:"absolute top-full left-0 mt-1 z-50 p-2 rounded-md shadow-lg",style:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",minWidth:"280px"},children:[h.jsxs("div",{className:"text-[10px] text-muted-foreground mb-1 px-1",children:["Current: ",e]}),h.jsx("input",{autoFocus:!0,"data-testid":"project-input",className:"w-full px-2 py-1 text-xs rounded border bg-background text-foreground",style:{borderColor:"hsl(var(--border))"},placeholder:"Absolute path to project...",value:s,onChange:l=>o(l.target.value),onKeyDown:async l=>{l.key==="Enter"&&await r(s)&&i(!1),l.key==="Escape"&&i(!1)}})]})]})}const JY={dashboard:{label:"Dashboard",icon:fM,tip:"Overview of project status and activity"},tree:{label:"Items",icon:Ab,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:SM,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:XM,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:Af,tip:"Active and past agent sessions"},gates:{label:"Gates",icon:Ks,tip:"Quality gates and approval checkpoints"},docs:{label:"Docs",icon:Pi,tip:"Project documentation and specs"},design:{label:"Design",icon:zc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:_i,tip:"Captured ideas and suggestions"}};function tV({tabs:t=[],activeTab:e,onTabChange:r,onOpenPalette:n,badges:i={}}){return h.jsxs("div",{className:"flex items-center gap-0.5 h-full",role:"tablist","aria-label":"Main views",children:[t.map(s=>{const o=JY[s],a=s===e,l=o==null?void 0:o.icon,c=(o==null?void 0:o.label)||s,u=i[s];return h.jsxs("button",{role:"tab","aria-selected":a,title:o==null?void 0:o.tip,className:["flex items-center gap-1.5 px-3 h-full text-[11px] uppercase tracking-wider font-medium transition-colors","border-b-2 -mb-px",a?"border-blue-600 text-blue-600 dark:border-accent dark:text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>r==null?void 0:r(s),children:[l&&h.jsx(l,{style:{width:12,height:12}}),c,u>0&&h.jsx("span",{className:"text-[9px] min-w-[16px] h-4 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))"},children:u})]},s)}),h.jsx("div",{className:"flex-1"}),n&&h.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2.5 h-full text-[11px] text-muted-foreground hover:text-foreground transition-colors",title:"Search (⌘K)",children:[h.jsx(ni,{style:{width:12,height:12}}),h.jsx("kbd",{className:"text-[9px] font-mono opacity-50 bg-muted px-1 py-0.5 rounded",children:"⌘K"})]})]})}function eV(){const[t,e]=C.useState(xy);function r(){const n=!t;G_(n),e(n)}return h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:r,title:t?"Hide verbose events":"Show verbose events","aria-label":"Toggle verbose stream",style:t?{background:"hsl(210 60% 60% / 0.15)",color:"hsl(210 60% 60%)",borderRadius:"3px",padding:"1px 4px",fontSize:"10px"}:{fontSize:"10px"},children:"{ }"})}const Xe={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},rV={[Xe.COLLAPSED]:Xe.EXPANDED,[Xe.EXPANDED]:Xe.MAXIMIZED,[Xe.MAXIMIZED]:Xe.COLLAPSED};function nV(t){return rV[t]??Xe.COLLAPSED}function iV(t){return Xe.COLLAPSED}function sV(t){return Xe.MAXIMIZED}const oV=new Set(Object.values(Xe));function aV(t){return oV.has(t)}function lV(t){switch(t){case Xe.COLLAPSED:return"h-7";case Xe.EXPANDED:return"h-[40vh]";case Xe.MAXIMIZED:return"flex-1";default:return"h-7"}}const QT="compose:agentBarState";function cV(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(QT);return aV(e)?e:Xe.COLLAPSED}catch{return Xe.COLLAPSED}}function hV(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(QT,t)}catch{}}const P0="▾",uV="▴",dV="⤢";function fV({barState:t="collapsed",onStateChange:e}){const[r,n]=C.useState("ready"),[i,s]=C.useState(null);C.useEffect(()=>{function u(d){const{status:p,tool:f,category:m,parallelTasks:x}=d.detail??{};if(s(x??null),x){const{total:g,completed:y,failed:b,active:k}=x;n(`∥ ${y}/${g} tasks${b?` (${b} failed)`:""}${k?` • ${k} active`:""}`)}else n(p==="idle"?"ready":f?`${f} — ${m??p}`:m||(p==="idle"?"ready":p??"ready"))}return window.addEventListener("compose:agent-status",u),()=>window.removeEventListener("compose:agent-status",u)},[]);const o=C.useCallback(()=>{e==null||e(nV(t))},[t,e]),a=C.useCallback(()=>{e==null||e(iV())},[t,e]);C.useCallback(()=>{e==null||e(sV())},[t,e]);const l=t==="collapsed",c=t==="expanded";return h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{borderTop:"1px solid hsl(var(--border))"},"data-agent-bar-state":t,children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 h-7 shrink-0 select-none",style:{borderBottom:l?"none":"1px solid hsl(var(--border) / 0.5)"},children:[h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:o,title:l?"Expand agent bar":c?"Maximize agent bar":"Collapse agent bar","aria-label":"Toggle agent bar",children:l?uV:c?dV:P0}),h.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold shrink-0",style:{color:"hsl(var(--accent))"},children:"Agent"}),h.jsx("span",{className:"flex-1 min-w-0 truncate text-[11px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:r}),h.jsx(eV,{}),i&&i.total>0&&h.jsx("div",{className:"shrink-0 flex items-center gap-1",title:`${i.completed}/${i.total} tasks complete`,children:h.jsx("div",{style:{width:48,height:4,borderRadius:2,background:"hsl(var(--muted))",overflow:"hidden"},children:h.jsx("div",{style:{width:`${i.completed/i.total*100}%`,height:"100%",borderRadius:2,background:i.failed?"hsl(var(--destructive))":"hsl(var(--accent))",transition:"width 300ms ease"}})})}),!l&&h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:a,title:"Collapse agent bar","aria-label":"Collapse agent bar",children:P0})]}),!l&&h.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:h.jsx(Cy,{})})]})}const pV=280,mV=.6;function gV({isOpen:t=!1,onToggle:e,widthPx:r=380,onResizePx:n,children:i,activeBuild:s,gates:o=[],agentErrors:a=[],items:l=[]}){const c=C.useRef(!1),u=C.useCallback(p=>{p.preventDefault(),c.current=!0;const f=x=>{if(!c.current)return;const g=window.innerWidth-x.clientX,y=window.innerWidth*mV,b=Math.max(pV,Math.min(y,g));n==null||n(b)},m=()=>{c.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",m)},[n]),d=o.filter(p=>p.status==="pending"||p.status==="awaiting");return h.jsxs("div",{className:"flex shrink-0 h-full",style:{borderLeft:"1px solid hsl(var(--border))"},"data-context-panel-open":t,children:[t&&n&&h.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0",onMouseDown:u}),h.jsx("button",{className:["w-4 h-full flex items-center justify-center","text-[10px] text-muted-foreground hover:text-foreground","transition-colors select-none"].join(" "),onClick:e,title:t?"Close context panel":"Open context panel","aria-expanded":t,"aria-label":"Toggle context panel",style:{background:"hsl(var(--muted) / 0.3)"},children:t?"›":"‹"}),t&&h.jsx("div",{className:"flex flex-col h-full overflow-hidden",style:{width:`${r}px`},children:Xt.Children.toArray(i).length>0?h.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):h.jsx(yV,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const xV={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function D0(t){return xV[t]||"#6b7280"}function yV({activeBuild:t,pendingGates:e,agentErrors:r,items:n}){const i={};for(const a of n){const l=a.phase||"unknown";i[l]=(i[l]||0)+1}const s=n.length||1,o=r.slice(-5);return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"h-7 flex items-center px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:h.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-muted-foreground",children:"Project Overview"})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-3 space-y-4",children:[t?h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Active Build"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-xs text-accent font-mono",children:t.featureCode||"—"}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),h.jsx("span",{className:"text-[10px] text-foreground",children:t.currentStep||t.step||"—"})]})]}):h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Status"}),h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No active build"})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Pending Gates (",e.length,")"]}),e.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):h.jsx("div",{className:"space-y-0.5",children:e.slice(0,5).map((a,l)=>h.jsx("p",{className:"text-[10px] text-amber-400 truncate",children:Jo(a,n.find(c=>c.id===a.itemId))},l))})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Recent Errors (",o.length,")"]}),o.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):h.jsx("div",{className:"space-y-0.5",children:o.map((a,l)=>h.jsx("p",{className:"text-[10px] text-destructive truncate",children:a.message||a.error||"Error"},l))})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase Distribution"}),h.jsx("div",{className:"flex h-2 rounded overflow-hidden gap-px",children:Object.entries(i).map(([a,l])=>h.jsx("div",{className:"h-full",style:{width:`${l/s*100}%`,background:D0(a),opacity:.75,minWidth:"2px"},title:`${a}: ${l}`},a))}),h.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1",children:Object.entries(i).map(([a,l])=>h.jsxs("span",{className:"text-[9px] text-muted-foreground flex items-center gap-1",children:[h.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:D0(a)}}),a,": ",l]},a))})]})]})]})}const $n=60,Rr=24,xl=80,_u=28,Eu=48,O0=8,Cs=5,Ic=9;function bV(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function CV(t,e,r){const n=new Map(e.map(a=>[a.id,a])),i=[],s=[],o=new Map;for(const a of r){if(a.toId===t.id){const l=n.get(a.fromId);l&&i.push(l)}if(a.fromId===t.id){const l=n.get(a.toId);l&&s.push(l)}}for(const a of s){const l=[];for(const c of r)if(c.fromId===a.id&&c.toId!==t.id){const u=n.get(c.toId);u&&l.push(u)}l.length>0&&o.set(a.id,l)}return{parents:i,children:s,grandchildren:o}}function Nu(t,e,r,n,i){const s=Math.min(t,Cs),o=s*n+(s-1)*O0,a=(r-o)/2,l=[];for(let c=0;c<s;c++)l.push({x:a+c*(n+O0),y:e,w:n,h:i});return{positions:l,overflow:t>Cs?t-Cs+1:0}}function yl({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:c}){const u=br[t.type]||br.task,d=s?.2:.08;return h.jsxs("g",{style:{cursor:"pointer"},onClick:()=>a(t.id),onMouseEnter:p=>l(t,p),onMouseLeave:c,children:[h.jsx("rect",{x:e,y:r,width:n,height:i,rx:4,fill:u,fillOpacity:d,stroke:u,strokeWidth:s?2:1.5,strokeDasharray:o?"4 2":void 0}),h.jsx("text",{x:e+n/2,y:r+i/2,textAnchor:"middle",dominantBaseline:"central",fontSize:s?Ic+1:Ic,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:bV(t.title,s?10:8)})]})}function kV({item:t,pos:e}){if(!t||!e)return null;const r=br[t.type]||br.task,n=Xn[t.status]||Xn.planned;return h.jsxs("div",{className:"absolute z-50 pointer-events-none px-2 py-1.5 rounded bg-popover border border-border shadow-md",style:{left:e.x,top:e.y,transform:"translate(-50%, -100%)"},children:[h.jsx("p",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:t.title}),h.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[h.jsx("span",{className:"text-[10px]",style:{color:r},children:t.type}),h.jsxs("span",{className:"text-[10px] flex items-center gap-1",children:[h.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:n}}),t.status]}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:uf[t.confidence||0]})]})]})}function vV({item:t,items:e,connections:r,onSelect:n}){const[i,s]=C.useState(null),[o,a]=C.useState(null),{parents:l,children:c,grandchildren:u}=C.useMemo(()=>CV(t,e,r),[t,e,r]),d=C.useCallback((F,M)=>{const D=M.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),O=M.currentTarget.getBoundingClientRect();s(F),a({x:O.x+O.width/2-D.x,y:O.y-D.y-4})},[]),p=C.useCallback(()=>{s(null),a(null)},[]);if(!(l.length>0||c.length>0))return null;const m=288,x=[];let g=12,y=[],b=0;if(l.length>0){const F=Nu(l.length,g,m,$n,Rr);y=F.positions,b=F.overflow,g+=Rr+Eu}const k=(m-xl)/2,T=g;g+=_u+Eu;let _=[],w=0;if(c.length>0){const F=Nu(c.length,g,m,$n,Rr);_=F.positions,w=F.overflow,g+=Rr}let N=new Map,B=new Map;const I=[...u.entries()];let E=[];if(I.length>0){g+=Eu;for(const[D,O]of I)for(const j of O)E.push({...j,_parentChildId:D});const F=Nu(E.length,g,m,$n,Rr);let M=0;for(const[D,O]of I){const j=[];for(let S=0;S<O.length&&M<F.positions.length;S++,M++)j.push(F.positions[M]);N.set(D,j)}F.overflow>0&&B.set("all",F.overflow),g+=Rr}const P=g+12;for(let F=0;F<y.length;F++){const M=y[F];x.push({x1:M.x+M.w/2,y1:M.y+M.h,x2:k+xl/2,y2:T})}for(let F=0;F<_.length;F++){const M=_[F];x.push({x1:k+xl/2,y1:T+_u,x2:M.x+M.w/2,y2:M.y})}for(const[F,M]of N){const D=c.findIndex(O=>O.id===F);if(D>=0&&D<_.length){const O=_[D];for(const j of M)x.push({x1:O.x+O.w/2,y1:O.y+O.h,x2:j.x+j.w/2,y2:j.y})}}const z=l.slice(0,Cs-(b>0?1:0)),q=c.slice(0,Cs-(w>0?1:0)),R=E.slice(0,Cs-(B.size>0?1:0));return h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Graph"}),h.jsxs("div",{className:"relative connection-graph-wrap",children:[h.jsxs("svg",{width:m,height:P,className:"w-full",viewBox:`0 0 ${m} ${P}`,children:[x.map((F,M)=>h.jsx("line",{x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},M)),z.map((F,M)=>h.jsx(yl,{item:F,x:y[M].x,y:y[M].y,w:$n,h:Rr,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:p},F.id)),b>0&&h.jsxs("text",{x:y[y.length-1].x+$n/2,y:y[0].y+Rr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:Ic,fill:"hsl(var(--muted-foreground))",children:["+",b," more"]}),h.jsx(yl,{item:t,x:k,y:T,w:xl,h:_u,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:p}),q.map((F,M)=>h.jsx(yl,{item:F,x:_[M].x,y:_[M].y,w:$n,h:Rr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},F.id)),w>0&&h.jsxs("text",{x:_[_.length-1].x+$n/2,y:_[0].y+Rr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:Ic,fill:"hsl(var(--muted-foreground))",children:["+",w," more"]}),R.map((F,M)=>{const O=[...N.values()].flat()[M];return O?h.jsx(yl,{item:F,x:O.x,y:O.y,w:$n,h:Rr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},F.id):null})]}),h.jsx(kV,{item:i,pos:o})]})]})}const wV=["Untested","Low","Moderate","High","Crystallized"];function SV({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=wV[r]??"Untested",i=r===0?sm[0]:sm[r];return h.jsxs("span",{className:rt("inline-flex items-center gap-1",e),children:[h.jsx("span",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(s=>h.jsx("span",{className:rt("h-2.5 w-1.5 rounded-sm",s<=r?i:"bg-slate-600")},s))}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:n})]})}function TV(t,e=Date.now()){if(!t)return null;const r=Date.parse(t);if(Number.isNaN(r))return null;const n=e-r,i=Math.floor(n/36e5);return i<1?"<1h ago":i<48?`${i}h ago`:`${Math.floor(i/24)}d ago`}function R0(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function _V(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function EV(t){if(t==null)return"—";const e=Math.round(t/1e3);if(e<60)return`${e}s`;const r=Math.round(e/60);if(r<60)return`${r}m`;const n=Math.floor(r/60),i=r%60;return`${n}h${i?` ${i}m`:""}`}function NV(t,e=Date.now()){const r=(t||[]).filter(i=>i==null?void 0:i.started_at);if(!r.length)return null;let n=null;for(const i of r){const s=Date.parse(i.started_at);!Number.isNaN(s)&&(n==null||s>n)&&(n=s)}return n==null?null:TV(new Date(n).toISOString(),e)}function jV(t,e=Date.now()){const r=(t==null?void 0:t.branches)||[],n=r.filter(c=>c.state==="complete"),i=r.filter(c=>c.state==="running"),s=r.length,o=NV(r,e),a=n.length>=2;return{summary:i.length>0&&n.length<2?`${n.length} of ${s} branches ready`:`${s} branch${s===1?"":"es"}${o?` · last fork ${o}`:""}`,canCompare:a,completeBranches:n,runningCount:i.length,totalCount:s}}function LV(t,e=[]){const r=new Map(t.map(s=>[s.branch_id,s])),n=e[0]&&r.has(e[0])?r.get(e[0]):t[0]||null,i=e[1]&&r.has(e[1])?r.get(e[1]):t[1]||null;return[n,i]}function $0({branch:t,extraRows:e=[]}){var o;const r=t.files_touched||[],n=t.tests||{},i=t.cost||{},s=[{label:"Files touched",value:r.length},{label:"Tests",value:`${n.passed??0} / ${n.failed??0} / ${n.skipped??0}`},{label:"Tokens in / out",value:`${R0(i.tokens_in)} / ${R0(i.tokens_out)}`},{label:"USD",value:_V(i.usd)},{label:"Wall clock",value:EV(i.wall_clock_ms)},{label:"Final artifact",value:((o=t.final_artifact)==null?void 0:o.path)||"—"},...e];return h.jsx("div",{className:"space-y-1",children:s.map((a,l)=>h.jsxs("div",{className:"flex justify-between gap-2 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:a.label}),h.jsx("span",{className:"font-mono text-right truncate",title:typeof a.value=="string"?a.value:void 0,children:a.value})]},l))})}function BV({lineage:t,selectedPair:e=[],onSelectPair:r=()=>{},extraMetricsForBranch:n=()=>[],now:i=Date.now()}){var g,y;const[s,o]=C.useState(!1),{summary:a,canCompare:l,completeBranches:c}=jV(t,i),[u,d]=LV(c,e),p=()=>{l&&(o(b=>!b),!s&&u&&d&&r([u.branch_id,d.branch_id]))};if(!s)return h.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[h.jsx("span",{children:a}),h.jsx("button",{disabled:!l,onClick:p,className:"text-[10px] px-2 py-0.5 rounded border border-border "+(l?"hover:bg-muted/40 text-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),"data-testid":"branch-compare-toggle",children:"Compare"})]});const f=(g=u==null?void 0:u.final_artifact)==null?void 0:g.snapshot,m=(y=d==null?void 0:d.final_artifact)==null?void 0:y.snapshot,x=!!f&&!!m;return h.jsxs("div",{className:"space-y-2 rounded border border-border p-2 bg-muted/10",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:a}),h.jsx("button",{onClick:()=>o(!1),className:"text-[10px] text-muted-foreground hover:text-foreground",children:"Collapse"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-[10px] font-semibold mb-1 font-mono truncate",title:u==null?void 0:u.branch_id,children:u?`A: ${u.branch_id.slice(0,8)}…`:"A: (none)"}),u&&h.jsx($0,{branch:u,extraRows:n(u)})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-[10px] font-semibold mb-1 font-mono truncate",title:d==null?void 0:d.branch_id,children:d?`B: ${d.branch_id.slice(0,8)}…`:"B: (none)"}),d&&h.jsx($0,{branch:d,extraRows:n(d)})]})]}),h.jsx("div",{className:"col-span-2",children:x?h.jsx(Xp,{oldText:f,newText:m}):h.jsxs("div",{className:"text-[10px] italic text-muted-foreground",children:["No artifact produced on ",!f&&!m?"either branch":f?"branch B":"branch A","."]})})]})}const AV={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function MV(t){return AV[t]??t}function z0(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function IV(t){var r,n;return(((n=(r=t==null?void 0:t.lifecycle)==null?void 0:r.lifecycle_ext)==null?void 0:n.drift_axes)??[]).filter(i=>i.breached===!0)}function FV({item:t}){const[e,r]=C.useState(!1),n=IV(t);if(n.length===0)return null;const i=n.length;return h.jsxs("div",{className:"drift-ribbon",style:{background:"hsl(var(--destructive) / 0.12)",borderLeft:"3px solid hsl(var(--destructive))",minHeight:"28px",padding:e?"6px 10px 8px":"0 10px",display:"flex",flexDirection:"column",justifyContent:"center",gap:0,borderRadius:"4px",marginBottom:"4px"},children:[h.jsxs("button",{onClick:()=>r(s=>!s),style:{display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",cursor:"pointer",padding:"4px 0",color:"hsl(var(--destructive))",fontSize:"12px",fontWeight:600,width:"100%",textAlign:"left"},"aria-expanded":e,"data-testid":"drift-ribbon-toggle",children:[h.jsx(Wc,{size:13}),h.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?h.jsx(Nb,{size:13,style:{marginLeft:"auto"}}):h.jsx(Ca,{size:13,style:{marginLeft:"auto"}})]}),e&&h.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse",marginTop:"4px"},"data-testid":"drift-ribbon-table",children:[h.jsx("thead",{children:h.jsxs("tr",{style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Axis"}),h.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Ratio"}),h.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Threshold"}),h.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Explanation"})]})}),h.jsx("tbody",{children:n.map(s=>h.jsxs("tr",{"data-testid":`drift-axis-row-${s.axis_id}`,children:[h.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--foreground))",fontWeight:500},children:MV(s.axis_id)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:z0(s.ratio)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:z0(s.threshold)}),h.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--muted-foreground))",maxWidth:"200px",wordBreak:"break-word"},children:s.explanation??""})]},s.axis_id))})]})]})}function PV({item:t,onClose:e}){var m;const r=((m=t==null?void 0:t.lifecycle)==null?void 0:m.featureCode)||(t==null?void 0:t.featureCode)||(t==null?void 0:t.id)||"",[n,i]=C.useState(r),[s,o]=C.useState((t==null?void 0:t.type)==="bug"?"bug":"feature"),[a,l]=C.useState(""),[c,u]=C.useState(!1),[d,p]=C.useState(null);async function f(x){x==null||x.preventDefault();const g=n.trim();if(!g){p("Feature code is required");return}u(!0),p(null);try{const y=await Rt("/api/build/start",{method:"POST",headers:ps({"Content-Type":"application/json"}),body:JSON.stringify({featureCode:g,mode:s,description:a.trim()})});if(!y.ok){let b=null;try{b=await y.json()}catch{}throw new Error(b&&b.error||`Failed to start build (HTTP ${y.status})`)}e==null||e()}catch(y){p(y.message||"Failed to start build"),u(!1)}}return h.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50","data-testid":"start-build-popover",children:h.jsxs("form",{className:"p-2 space-y-2",onSubmit:f,children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-feature",children:"Feature code"}),h.jsx("input",{id:"start-build-feature",type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none",value:n,onChange:x=>i(x.target.value),"data-testid":"start-build-feature-input",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Mode"}),h.jsxs("div",{className:"flex items-center gap-1.5",role:"radiogroup","aria-label":"Build mode",children:[h.jsx("button",{type:"button",role:"radio","aria-checked":s==="feature",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${s==="feature"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"start-build-mode-feature",onClick:()=>o("feature"),children:"Feature"}),h.jsx("button",{type:"button",role:"radio","aria-checked":s==="bug",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${s==="bug"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"start-build-mode-bug",onClick:()=>o("bug"),children:"Bug"})]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-desc",children:"Description (optional)"}),h.jsx("textarea",{id:"start-build-desc",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none resize-none",rows:3,value:a,onChange:x=>l(x.target.value),"data-testid":"start-build-description"})]}),d?h.jsx("div",{className:"text-[10px] text-destructive",role:"alert",children:d}):null,h.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[h.jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded border border-border text-muted-foreground hover:bg-muted/50",onClick:()=>e==null?void 0:e(),disabled:c,"data-testid":"start-build-cancel",children:"Cancel"}),h.jsx("button",{type:"submit",className:"text-[10px] px-2 py-1 rounded border border-accent bg-accent/10 text-foreground disabled:opacity-50",disabled:c||!n.trim(),"data-testid":"start-build-submit",children:c?"Starting…":"Start"})]})]})})}function DV({level:t,onChange:e}){const r=["hsl(var(--muted-foreground))","hsl(var(--destructive))","hsl(var(--accent))","hsl(var(--success))","hsl(var(--success))"],n=r[t]||r[0];return h.jsxs("button",{onClick:()=>e((t+1)%5),className:"flex items-center gap-2 px-2 py-1 rounded-md bg-muted hover:bg-muted/80 transition-colors",title:"Click to cycle confidence",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:uf[t]}),h.jsx("div",{className:"flex items-center gap-0.5",children:[0,1,2,3].map(i=>h.jsx("div",{className:"rounded-full transition-all",style:{width:6,height:6,background:i<t?n:"transparent",border:`1.5px solid ${i<t?n:"hsl(var(--border))"}`}},i))})]})}function OV({item:t,connections:e,items:r,onSelect:n,onDeleteConnection:i}){const s=new Map(r.map(l=>[l.id,l])),o=[];for(const l of e)if(l.type!=="contradicts"){if(l.fromId===t.id){const c=s.get(l.toId);c&&o.push({item:c,type:l.type,direction:"outgoing",connId:l.id})}if(l.toId===t.id){const c=s.get(l.fromId);c&&o.push({item:c,type:l.type,direction:"incoming",connId:l.id})}}if(o.length===0)return null;const a={};for(const l of o){const c=`${l.type}-${l.direction}`;a[c]||(a[c]={type:l.type,direction:l.direction,items:[]}),a[c].items.push({item:l.item,connId:l.connId})}return h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Connections"}),Object.values(a).map(l=>h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] text-muted-foreground mb-1",children:l.direction==="incoming"?`${l.type} from`:`${l.type} to`}),h.jsx("div",{className:"space-y-0.5",children:l.items.map(({item:c,connId:u})=>h.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors group/conn",children:[h.jsxs("button",{onClick:()=>n(c.id),className:"flex flex-1 items-center gap-2 min-w-0",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Xn[c.status]||Xn.planned}}),h.jsx("span",{className:"text-xs text-foreground truncate",children:c.title}),h.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:br[c.type]},children:c.type})]}),i&&h.jsx("button",{onClick:()=>i(u),className:"opacity-0 group-hover/conn:opacity-100 p-0.5 rounded hover:bg-destructive/20 text-muted-foreground hover:text-destructive transition-all shrink-0",title:"Remove connection",children:h.jsx(dn,{className:"h-3 w-3"})})]},u))})]},`${l.type}-${l.direction}`))]})}function bl(t){if(!t)return"";const e=new Date(t);return e.toLocaleDateString("en-US",{month:"short",day:"numeric"})+" "+e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function RV({featureCode:t,lineage:e}){const r=yr(i=>i.selectedBranches),n=yr(i=>i.setSelectedBranches);return h.jsx(BV,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function $V({featureCode:t}){const[e,r]=C.useState([]),[n,i]=C.useState(!0);return C.useEffect(()=>{const s=new AbortController;return i(!0),Rt(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=10`,{signal:s.signal}).then(o=>o.json()).then(o=>{s.signal.aborted||r(o.sessions||[])}).catch(o=>{s.signal.aborted||r([])}).finally(()=>{s.signal.aborted||i(!1)}),()=>s.abort()},[t]),n||e.length===0?null:h.jsxs("div",{children:[h.jsxs("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Sessions (",e.length,")"]}),h.jsx("div",{className:"space-y-2",children:e.map(s=>{var o;return h.jsxs("div",{className:"text-xs text-muted-foreground border-l-2 border-border pl-2",children:[h.jsxs("div",{className:"font-medium text-foreground",children:[((o=s.phaseAtBind)==null?void 0:o.replace(/_/g," "))||"—",s.phaseAtEnd&&s.phaseAtEnd!==s.phaseAtBind&&` → ${s.phaseAtEnd.replace(/_/g," ")}`]}),h.jsxs("div",{children:[s.toolCount," tools · ",Math.round((new Date(s.endedAt)-new Date(s.startedAt))/6e4),"m"]})]},s.id)})})]})}const zV=["informs","supports","blocks","contradicts"];function WV({item:t,items:e,onCreateConnection:r,onDismiss:n}){const[i,s]=C.useState(""),[o,a]=C.useState("informs"),l=e.filter(u=>u.id===t.id?!1:i?u.title.toLowerCase().includes(i.toLowerCase()):!0).slice(0,8),c=C.useCallback(async u=>{await r({fromId:t.id,toId:u,type:o}),n()},[t.id,o,r,n]);return h.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50",children:h.jsxs("div",{className:"p-2 space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("select",{className:"text-[10px] px-1.5 py-1 rounded bg-muted text-foreground border border-border cursor-pointer",value:o,onChange:u=>a(u.target.value),children:zV.map(u=>h.jsx("option",{value:u,children:u},u))}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"to..."})]}),h.jsxs("div",{className:"relative",children:[h.jsx(ni,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),h.jsx("input",{className:"w-full text-xs bg-muted text-foreground pl-7 pr-2 py-1.5 rounded border border-border outline-none",placeholder:"Search items...",value:i,onChange:u=>s(u.target.value),autoFocus:!0})]}),h.jsx("div",{className:"max-h-40 overflow-auto space-y-0.5",children:l.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground text-center py-2",children:"No items found"}):l.map(u=>h.jsxs("button",{onClick:()=>c(u.id),className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Xn[u.status]||Xn.planned}}),h.jsx("span",{className:"text-xs text-foreground truncate",children:u.title}),h.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:br[u.type]},children:u.type})]},u.id))})]})})}function qV({gate:t,onResolveGate:e}){const[r,n]=C.useState(null),[i,s]=C.useState(""),o=()=>{e(t.id,"revised",i||void 0),n(null),s("")},a=()=>{i.trim()&&(e(t.id,"killed",i),n(null),s(""))};return h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(zt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>e(t.id,"approved"),children:"Approve"}),h.jsx(zt,{variant:"outline",size:"sm",className:rt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",r==="revise"&&"bg-amber-400/10"),onClick:()=>{n(r==="revise"?null:"revise"),s("")},children:"Revise"}),h.jsx(zt,{variant:"outline",size:"sm",className:rt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",r==="kill"&&"bg-destructive/10"),onClick:()=>{n(r==="kill"?null:"kill"),s("")},children:"Kill"})]}),r&&h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none",placeholder:r==="revise"?"Feedback (optional)...":"Kill reason (required)...",value:i,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(r==="revise"?o():a()),l.key==="Escape"&&n(null)},autoFocus:!0}),h.jsx(zt,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:r==="kill"&&!i.trim(),onClick:r==="revise"?o:a,children:r==="revise"?"Submit":"Confirm Kill"})]})]})}function HV({item:t,items:e,connections:r,gates:n,onUpdate:i,onDelete:s,onCreateConnection:o,onDeleteConnection:a,onSelect:l,onClose:c,onPressureTest:u,onResolveGate:d}){var D,O,j,S,G,Q;const[p,f]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[b,k]=C.useState(""),[T,_]=C.useState(!1),[w,N]=C.useState(!1),[B,I]=C.useState("");C.useEffect(()=>{I((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const E=C.useCallback(()=>{const A=B.trim(),ct=(t==null?void 0:t.group)||"";A!==ct&&i(t.id,{group:A||null})},[B,t==null?void 0:t.id,t==null?void 0:t.group,i]),P=C.useCallback(()=>{x(t.title),f(!0)},[t==null?void 0:t.title]),z=C.useCallback(()=>{m.trim()&&m!==t.title&&i(t.id,{title:m.trim()}),f(!1)},[m,t==null?void 0:t.id,t==null?void 0:t.title,i]),q=C.useCallback(()=>{k(t.description||""),y(!0)},[t==null?void 0:t.description]),R=C.useCallback(()=>{b!==(t.description||"")&&i(t.id,{description:b}),y(!1)},[b,t==null?void 0:t.id,t==null?void 0:t.description,i]),F=C.useMemo(()=>{if(!t)return 0;let A=0;for(const ct of r)ct.type==="contradicts"&&(ct.fromId===t.id||ct.toId===t.id)&&A++;return A},[t==null?void 0:t.id,r]);if(!t)return null;const M=br[t.type]||br.task;return h.jsxs("div",{className:"w-full bg-card flex flex-col h-full",children:[h.jsxs("div",{className:"p-3 pb-2 flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[h.jsx(ar,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:M,borderColor:M},children:t.type}),t.phase&&h.jsx(ar,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:$l[t.phase]||t.phase})]}),p?h.jsx("input",{className:"w-full text-sm font-semibold bg-muted text-foreground px-1.5 py-0.5 rounded border border-ring outline-none",value:m,onChange:A=>x(A.target.value),onBlur:z,onKeyDown:A=>{A.key==="Enter"&&z(),A.key==="Escape"&&f(!1)},autoFocus:!0}):h.jsx("h3",{className:"text-sm font-semibold text-foreground cursor-pointer hover:text-accent transition-colors",onDoubleClick:P,title:"Double-click to edit",children:t.title})]}),h.jsx(zt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:c,children:h.jsx(dn,{className:"h-3.5 w-3.5"})})]}),h.jsx(Zl,{}),h.jsx(Kn,{className:"flex-1",children:h.jsxs("div",{className:"p-3 space-y-4",children:[h.jsx(FV,{item:t}),((D=t.lifecycle)==null?void 0:D.featureCode)&&h.jsx(RV,{featureCode:t.lifecycle.featureCode,lineage:(O=t.lifecycle.lifecycle_ext)==null?void 0:O.branch_lineage}),h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("select",{className:"text-xs px-2 py-1 rounded-md bg-muted text-foreground border border-border cursor-pointer",value:t.status||"planned",onChange:A=>i(t.id,{status:A.target.value}),children:C_.map(A=>h.jsx("option",{value:A,children:A.replace("_"," ")},A))}),h.jsx(DV,{level:t.confidence||0,onChange:A=>i(t.id,{confidence:A})})]}),h.jsx(SV,{level:t.confidence||0}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase"}),h.jsxs("select",{className:"text-xs px-2 py-1 rounded-md bg-muted text-foreground border border-border cursor-pointer w-full",value:t.phase||"",onChange:A=>i(t.id,{phase:A.target.value||null}),children:[h.jsx("option",{value:"",children:"No phase"}),dy.map(A=>h.jsx("option",{value:A,children:$l[A]},A))]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Group"}),h.jsx("input",{type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1 rounded-md border border-border outline-none focus:border-ring",value:B,placeholder:"(none)",onChange:A=>I(A.target.value),onBlur:E,onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(I(t.group||""),A.currentTarget.blur())},"data-testid":"item-detail-group-input"})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),g?h.jsx("textarea",{className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-ring outline-none resize-none",rows:4,value:b,onChange:A=>k(A.target.value),onBlur:R,onKeyDown:A=>{A.key==="Escape"&&y(!1)},autoFocus:!0}):h.jsx("p",{className:rt("text-xs leading-relaxed cursor-pointer rounded px-2 py-1.5 hover:bg-muted/50 transition-colors",t.description?"text-muted-foreground":"text-muted-foreground/50 italic"),onClick:q,children:t.description||"Click to add description..."})]}),h.jsx(OV,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),h.jsx(vV,{item:t,items:e,connections:r,onSelect:l}),((j=t.lifecycle)==null?void 0:j.featureCode)&&h.jsx($V,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(A=>A.itemId===t.id))&&(()=>{var It;const A=t.lifecycle,ct=n?n.filter(ht=>ht.itemId===t.id):[],ut=ct.filter(ht=>ht.status==="pending"),st=ct.filter(ht=>ht.status!=="pending");return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Lifecycle"}),h.jsxs("div",{className:"space-y-1.5",children:[A&&h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Phase:"}),h.jsx("span",{className:"text-[10px] text-foreground font-medium",children:_e[A.currentPhase]??A.currentPhase}),A.featureCode&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:A.featureCode})]}),((It=A==null?void 0:A.phaseHistory)==null?void 0:It.length)>1&&h.jsxs("div",{className:"px-2 py-1 rounded bg-muted/30",children:[h.jsx("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"History"}),h.jsx("div",{className:"flex flex-wrap gap-x-1 gap-y-0.5",children:A.phaseHistory.map((ht,ot)=>h.jsxs("span",{className:rt("text-[10px]",ht.phase===A.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[_e[ht.phase]??ht.phase,ht.outcome&&ht.outcome!=="approved"&&h.jsxs("span",{className:"text-amber-400",children:[" (",ht.outcome,")"]}),ot<A.phaseHistory.length-1&&" → "]},ot))})]}),ut.map(ht=>{var lt,xt;const ot=ht.artifactAssessment,Y=fy[ht.fromPhase];return h.jsxs("div",{className:"rounded bg-amber-400/10 border border-amber-400/20 px-2 py-1.5",children:[h.jsxs("p",{className:"text-[10px] text-amber-400 font-medium mb-1",children:["Pending: ",_n[ht.stepId]??`${_e[ht.fromPhase]??ht.fromPhase} → ${_e[ht.toPhase]??ht.toPhase}`]}),ot&&ot.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[Y&&h.jsx("span",{className:"font-mono",children:Y}),Y&&": ",Math.round(ot.completeness*100),"% complete"," · ",ot.wordCount," words",((xt=(lt=ot.sections)==null?void 0:lt.missing)==null?void 0:xt.length)>0&&h.jsxs("span",{className:"text-amber-400",children:[" (missing: ",ot.sections.missing.join(", "),")"]}),!ot.meetsMinWordCount&&h.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),ot&&!ot.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[Y??"Artifact"," not found"]}),d&&h.jsx(qV,{gate:ht,onResolveGate:d})]},ht.id)}),st.map(ht=>{const ot={approved:"text-success",revised:"text-amber-400",killed:"text-destructive"};return h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:_n[ht.stepId]??`${_e[ht.fromPhase]??ht.fromPhase} → ${_e[ht.toPhase]??ht.toPhase}`}),h.jsx(ar,{variant:"outline",className:rt("text-[10px] px-1.5 py-0 h-4 ml-auto",ot[ht.outcome]||""),children:ht.outcome})]},ht.id)})]})]})})(),((G=(S=t.evidence)==null?void 0:S.stratumViolations)==null?void 0:G.length)>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1.5",children:["Blocked — Ensure Violations",t.evidence.violatedAt&&h.jsx("span",{className:"ml-2 font-normal normal-case text-muted-foreground",children:bl(t.evidence.violatedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((A,ct)=>h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:A})]},ct))})]}),((Q=t.evidence)==null?void 0:Q.stratumTrace)&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Stratum Trace",t.evidence.tracedAt&&h.jsx("span",{className:"ml-2 font-normal normal-case",children:bl(t.evidence.tracedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(A=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--success))"}}),h.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:A.step_id}),A.attempts>1&&h.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[A.attempts,"x"]}),A.duration_ms!=null&&h.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:A.duration_ms<1e3?`${A.duration_ms}ms`:`${(A.duration_ms/1e3).toFixed(1)}s`})]},A.step_id))})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",bl(t.createdAt)]}),h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",bl(t.updatedAt)]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[!t.lifecycle&&t.status!=="killed"&&t.type!=="question"&&h.jsxs("div",{className:"relative",children:[h.jsxs(zt,{variant:"outline",size:"sm",className:rt("h-7 text-xs gap-1",w&&"bg-accent/10 border-accent"),onClick:()=>N(!w),"data-testid":"item-start-build",title:"Start the build/bug-fix lifecycle for this item",children:[h.jsx(EM,{className:"h-3 w-3"})," Start"]}),w&&h.jsx(PV,{item:t,onClose:()=>N(!1)})]}),h.jsxs("div",{className:"relative",children:[h.jsxs(zt,{variant:"outline",size:"sm",className:rt("h-7 text-xs gap-1",T&&"bg-accent/10 border-accent"),onClick:()=>_(!T),children:[h.jsx(gM,{className:"h-3 w-3"})," Connect"]}),T&&h.jsx(WV,{item:t,items:e,onCreateConnection:o,onDismiss:()=>_(!1)})]}),h.jsxs(zt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:P,children:[h.jsx(Ib,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&h.jsxs(zt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[h.jsx(Yl,{className:"h-3 w-3"})," Pressure Test",F>0&&h.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:F})]}),t.status!=="killed"&&h.jsxs(zt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:async()=>{if(t.lifecycle)try{const A=await Rt(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!A.ok){const ct=await A.json();console.error("[vision] Lifecycle kill failed:",ct.error)}}catch(A){console.error("[vision] Lifecycle kill failed:",A.message)}else i(t.id,{status:"killed"})},children:[h.jsx(ng,{className:"h-3 w-3"})," Kill"]}),s&&h.jsxs(zt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>{window.confirm(`Delete "${t.title}" permanently? This cannot be undone.`)&&s(t.id)},title:"Permanently delete this item",children:[h.jsx(ng,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const JT=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];JT.map(t=>t.id);const UV={overview:Pi,pipeline:Ab,sessions:Lb,errors:Wc,files:If};function GV({activeTab:t="overview",onTabChange:e,errorCount:r=0}){return h.jsx("div",{className:"flex items-center gap-0 shrink-0",style:{height:"28px",borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--muted) / 0.3)"},role:"tablist","aria-label":"Detail sections",children:JT.map(({id:n,label:i})=>{const s=UV[n],o=n===t,a=n==="errors"?r:0;return h.jsxs("button",{role:"tab","aria-selected":o,className:["flex items-center gap-1 px-2 h-full text-[10px] uppercase tracking-wider font-medium transition-colors","border-b-2 -mb-px",o?"border-accent text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>e==null?void 0:e(n),children:[h.jsx(s,{style:{width:10,height:10}}),i,a>0&&h.jsx("span",{className:"text-[8px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-0.5 tabular-nums",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))"},children:a})]},n)})})}const W0=[{id:"design",label:"Design"},{id:"blueprint",label:"Blueprint"},{id:"execute",label:"Execute"},{id:"review",label:"Review"},{id:"coverage",label:"Coverage"},{id:"ship",label:"Ship"}];function Jd(t,e,r,n){if(r&&r.featureCode===n&&r.currentStep===t)return"active";if(e&&Array.isArray(e)){const i=e.find(s=>s.phase===t||s.step===t);if(i)return i.status==="failed"?"failed":"complete"}return"pending"}function YV({item:t,activeBuild:e}){const[r,n]=C.useState(null),i=(t==null?void 0:t.phaseHistory)||[],s=(t==null?void 0:t.featureCode)||(t==null?void 0:t.text)||"";return h.jsxs("div",{className:"p-3",children:[h.jsx("div",{className:"flex items-center gap-0 mb-3",children:W0.map((o,a)=>{const l=Jd(o.id,i,e,s),c=im[l],u=r===o.id;return h.jsxs(Xt.Fragment,{children:[a>0&&h.jsx("div",{className:"flex-1 h-px",style:{background:l==="pending"?"hsl(var(--muted-foreground) / 0.2)":c,minWidth:"8px"}}),h.jsxs("button",{onClick:()=>n(u?null:o.id),className:"relative flex flex-col items-center group",title:o.label,children:[h.jsx("div",{className:["w-3 h-3 rounded-full border-2 transition-all",l==="active"?"animate-pulse":"",u?"ring-2 ring-accent/30":""].join(" "),style:{borderColor:c,background:l==="complete"||l==="failed"?c:"transparent"}}),h.jsx("span",{className:"text-[8px] text-muted-foreground mt-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:o.label})]})]},o.id)})}),h.jsx("div",{className:"flex justify-between px-0.5",children:W0.map(o=>{const a=Jd(o.id,i,e,s);return h.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider",style:{color:a==="pending"?"hsl(var(--muted-foreground) / 0.4)":im[a]},children:o.label},o.id)})}),r&&h.jsx("div",{className:"mt-3 p-2 rounded border border-border/50 bg-muted/20",children:h.jsx(VV,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function VV({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=Jd(t,e,r,n),s=e==null?void 0:e.find(a=>a.phase===t||a.step===t),o={complete:"text-success",active:"text-accent",failed:"text-destructive",pending:"text-muted-foreground"};return h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs font-semibold text-foreground capitalize",children:t}),h.jsx("span",{className:`text-[10px] font-medium ${o[i]}`,children:i})]}),(s==null?void 0:s.summary)&&h.jsx("p",{className:"text-[10px] text-muted-foreground",children:s.summary}),(s==null?void 0:s.durationMs)!=null&&h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Duration: ",s.durationMs<1e3?`${s.durationMs}ms`:`${(s.durationMs/1e3).toFixed(1)}s`]}),(s==null?void 0:s.agent)&&h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Agent: ",s.agent]}),i==="active"&&r&&h.jsx("p",{className:"text-[10px] text-accent",children:"Running..."}),i==="pending"&&h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Not started"})]})}function XV(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function KV(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function ZV({featureCode:t,sessions:e=[],items:r=[]}){const[n,i]=C.useState(null),s=C.useMemo(()=>t?new Set(r.filter(a=>{var l;return((l=a.lifecycle)==null?void 0:l.featureCode)===t||a.featureCode===t||a.feature_code===t}).map(a=>a.id)):new Set,[t,r]),o=C.useMemo(()=>s.size===0?e.slice(0,20):e.filter(a=>!!(a.featureCode===t||a.itemsWorked&&a.itemsWorked.some(l=>s.has(l))||a.summary&&a.summary.includes(t))),[e,t,s]);return o.length===0?h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"No sessions for this feature."}):h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Sessions (",o.length,")"]}),o.map(a=>{const l=n===a.id;return h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>i(l?null:a.id),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left rounded hover:bg-muted/30 transition-colors",children:[h.jsx("span",{className:"text-[10px] font-mono text-accent shrink-0 w-12 truncate",children:a.source||"agent"}),h.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 w-16 truncate",children:a.classification||a.workType||"—"}),h.jsxs("span",{className:"text-[9px] text-muted-foreground tabular-nums flex gap-1.5 shrink-0",children:[h.jsxs("span",{title:"reads",children:[a.reads||0,"r"]}),h.jsxs("span",{title:"writes",children:[a.writes||0,"w"]}),h.jsxs("span",{title:"errors",style:a.errors>0?{color:"hsl(var(--destructive))"}:{},children:[a.errors||0,"e"]})]}),h.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:KV(a.durationMs)}),h.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:XV(a.startedAt||a.createdAt)})]}),l&&a.summary&&h.jsx("div",{className:"px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/10 rounded mx-1 mb-1",children:a.summary})]},a.id)})]})}function QV(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}const ju=10;function JV({featureCode:t,errors:e=[],items:r=[]}){const[n,i]=C.useState(null),[s,o]=C.useState(!1),a=C.useMemo(()=>t?new Set(r.filter(u=>{var d;return((d=u.lifecycle)==null?void 0:d.featureCode)===t||u.featureCode===t||u.feature_code===t}).map(u=>u.id)):new Set,[t,r]),l=C.useMemo(()=>!t&&a.size===0?[]:e.filter(u=>!!(t&&u.featureCode===t||u.itemId&&a.has(u.itemId)||t&&u.message&&u.message.includes(t))),[e,t,a]);if(l.length===0)return h.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[h.jsx(GA,{style:{width:20,height:20,color:"hsl(var(--success, 160 60% 45%))"}}),h.jsx("span",{className:"text-[11px] italic",children:"No errors for this feature."})]});const c=s?l:l.slice(0,ju);return h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Errors (",l.length,")"]}),c.map((u,d)=>{const p=n===d;return h.jsxs("button",{onClick:()=>i(p?null:d),className:"flex flex-col w-full px-2 py-1.5 text-left rounded hover:bg-destructive/5 transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-2 w-full",children:[h.jsx("span",{className:"text-[10px] text-destructive shrink-0",children:"✕"}),h.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0 w-16 truncate",children:u.tool||u.toolName||"unknown"}),h.jsx("span",{className:`text-[10px] text-foreground flex-1 ${p?"":"line-clamp-2"} truncate`,children:u.message||u.error||"Unknown error"}),h.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0 ml-auto",children:QV(u.timestamp||u.createdAt)})]}),p&&h.jsx("div",{className:"mt-1.5 px-5 py-1.5 text-[10px] text-foreground font-mono bg-muted/10 rounded whitespace-pre-wrap break-all",children:u.message||u.error||u.stack||"No additional details"})]},d)}),!s&&l.length>ju&&h.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-ju," more"]})]})}function tX(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function eX(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function rX({featureCode:t,onOpenFile:e}){const[r,n]=C.useState([]),[i,s]=C.useState(!0);C.useEffect(()=>{const l=new AbortController;return s(!0),Rt("/api/files",{signal:l.signal}).then(c=>c.json()).then(c=>{l.signal.aborted||(n(Array.isArray(c)?c:c.files||[]),s(!1))}).catch(c=>{l.signal.aborted||(n([]),s(!1))}),()=>l.abort()},[t]);const o=`docs/features/${t}/`,a=C.useMemo(()=>r.filter(l=>(typeof l=="string"?l:l.path||l.name||"").startsWith(o)),[r,o]);return i?h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Loading files..."}):a.length===0?h.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[h.jsx(If,{style:{width:20,height:20,opacity:.5}}),h.jsx("span",{className:"text-[11px] italic",children:"No files in feature folder."})]}):h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Files (",a.length,")"]}),a.map((l,c)=>{const u=typeof l=="string"?l:l.path||l.name||"",d=u.split("/").pop(),p=typeof l=="object"?l.size:null,f=typeof l=="object"?l.modified||l.mtime:null;return h.jsxs("button",{onClick:()=>e==null?void 0:e(u),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left rounded hover:bg-accent/10 transition-colors",children:[h.jsx(Pi,{className:"h-3 w-3 shrink-0 text-accent"}),h.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:d}),p!=null&&h.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:tX(p)}),f&&h.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:eX(f)})]},c)})]})}function nX({itemId:t,onSelect:e,onClose:r,onOpenFile:n,onViewInGraph:i,onViewInTree:s}){var w;const{items:o,connections:a,gates:l,updateItem:c,deleteItem:u,createConnection:d,deleteConnection:p,resolveGate:f,activeBuild:m,sessions:x,agentErrors:g}=yr(Ri(N=>({items:N.items,connections:N.connections,gates:N.gates,updateItem:N.updateItem,deleteItem:N.deleteItem,createConnection:N.createConnection,deleteConnection:N.deleteConnection,resolveGate:N.resolveGate,activeBuild:N.activeBuild,sessions:N.sessions,agentErrors:N.agentErrors}))),y=o.find(N=>N.id===t)||null,[b,k]=C.useState("overview"),T=((w=y==null?void 0:y.lifecycle)==null?void 0:w.featureCode)||(y==null?void 0:y.featureCode)||(y==null?void 0:y.feature_code)||"",_=C.useMemo(()=>T?g.filter(N=>N.featureCode===T||T&&N.message&&N.message.includes(T)):[],[g,T]);return y?h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsx(GV,{activeTab:b,onTabChange:k,errorCount:_.length}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[b==="overview"&&h.jsxs(h.Fragment,{children:[h.jsx(HV,{item:y,items:o,connections:a,gates:l,onUpdate:(N,B)=>c(N,B),onDelete:N=>{u(N),r()},onCreateConnection:d,onDeleteConnection:p,onSelect:e,onClose:r,onPressureTest:()=>{},onResolveGate:f}),h.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 mt-1",style:{borderTop:"1px solid hsl(var(--border))"},children:[i&&h.jsxs("button",{onClick:()=>i(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx("span",{style:{fontSize:10},children:"↑"})," View in Graph"]}),s&&h.jsxs("button",{onClick:()=>s(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx("span",{style:{fontSize:10},children:"↓"})," View in Tree"]})]})]}),b==="pipeline"&&h.jsx(YV,{item:y,activeBuild:m}),b==="sessions"&&h.jsx(ZV,{featureCode:T,sessions:x,items:o}),b==="errors"&&h.jsx(JV,{featureCode:T,errors:g,items:o}),b==="files"&&h.jsx(rX,{featureCode:T,onOpenFile:n})]})]}):h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function iX(t){if(!t)return null;const{retries:e}=t;return e==null?null:Array.isArray(e)?e.length===0?null:{count:e.length,isArray:!0,items:e}:typeof e=="number"&&e>0?{count:e,isArray:!1,items:[]}:null}function sX(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function oX(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function aX(t,e,r){var c;if(!t||t.status!=="running")return null;const n=t.startedAt?Date.parse(t.startedAt):r,i=r-n,s=t.wallClockTimeout!=null?t.wallClockTimeout*60*1e3:null,o=(c=e==null?void 0:e.per_loop_type)==null?void 0:c[t.loopType],a=(o==null?void 0:o.maxTotal)!=null?o.usedIterations:null,l=(o==null?void 0:o.maxTotal)??null;return{count:t.count??0,maxIterations:t.maxIterations??null,loopType:t.loopType,elapsedMs:i,timeoutMs:s,usedIterations:a,maxTotal:l}}function lX(t){if(!(t!=null&&t.per_loop_type))return"";const e={review:"r",coverage:"c"},r=[];for(const[n,i]of Object.entries(e)){const s=t.per_loop_type[n];!s||s.maxTotal==null||r.push(`${i} ${s.usedIterations}/${s.maxTotal}`)}return r.join(" · ")}function q0(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const H0=[{id:"T0",name:"schema",label:"T0"},{id:"T1",name:"lint",label:"T1"},{id:"T2",name:"tests",label:"T2"},{id:"T3",name:"review",label:"T3"},{id:"T4",name:"codex",label:"T4"}];function cX({tierMap:t,tierSummary:e}){const[r,n]=C.useState(null),i=s=>n(o=>o===s?null:s);return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Tier Pipeline"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[H0.map((s,o)=>{var d;const a=t[s.id],l=(d=e==null?void 0:e.tiersSkipped)==null?void 0:d.includes(s.id);let c,u;return l?(c="bg-muted-foreground/40",u=`${s.id} (${s.name}): skipped`):a===!0?(c="bg-success",u=`${s.id} (${s.name}): passed`):a===!1?(c="bg-destructive",u=`${s.id} (${s.name}): failed`):(c="bg-muted-foreground/20",u=`${s.id} (${s.name}): not run`),h.jsxs(Xt.Fragment,{children:[o>0&&h.jsx("div",{className:"h-px w-3 bg-muted-foreground/20 shrink-0"}),h.jsxs("button",{className:"flex flex-col items-center gap-0.5 group",onClick:()=>i(s.id),title:u,children:[h.jsx("div",{className:`w-2.5 h-2.5 rounded-full transition-all group-hover:scale-125 ${c} ${r===s.id?"ring-1 ring-foreground/40":""}`}),h.jsx("span",{className:"text-[8px] text-muted-foreground leading-none",children:s.label})]})]},s.id)}),(e==null?void 0:e.costSaved)>0&&h.jsxs("span",{className:"ml-2 text-[9px] text-success/80",children:["saved ~$",e.costSaved.toFixed(2)]})]}),r&&h.jsx("div",{className:"mt-1.5 px-2 py-1 rounded bg-muted/20 text-[9px] text-muted-foreground",children:(()=>{var l;const s=t[r],o=(l=e==null?void 0:e.tiersSkipped)==null?void 0:l.includes(r),a=H0.find(c=>c.id===r);return o?`${r} (${a==null?void 0:a.name}): skipped — short-circuited by earlier failure`:s===!0?`${r} (${a==null?void 0:a.name}): passed`:s===!1?`${r} (${a==null?void 0:a.name}): failed`:`${r} (${a==null?void 0:a.name}): not run this build`})()})]})}function Lu(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function hX(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const U0={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function G0(t){if(t==null)return"—";const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function uX({loopState:t,budget:e}){const[r,n]=C.useState(()=>Date.now());C.useEffect(()=>{if(!t||t.status!=="running")return;const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[t]);const i=aX(t,e,r);return i?h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Live Counters"}),h.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsxs("span",{className:"text-foreground font-mono font-medium",children:["attempt ",i.count,"/",i.maxIterations??"?"]}),h.jsx("span",{className:"text-muted-foreground",children:"·"}),h.jsxs("span",{className:"text-foreground font-mono",children:[G0(i.elapsedMs),i.timeoutMs!=null&&h.jsxs("span",{className:"text-muted-foreground",children:[" / ",G0(i.timeoutMs)]})]}),i.usedIterations!=null&&i.maxTotal!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground",children:"·"}),h.jsxs("span",{className:"text-foreground font-mono",children:["cumulative ",i.usedIterations,"/",i.maxTotal]})]})]}),h.jsxs("div",{className:"text-muted-foreground/70 text-[9px]",children:["loop: ",i.loopType]})]})]}):null}function dX({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=yr(Ri(I=>({activeBuild:I.activeBuild,iterationStates:I.iterationStates}))),[o,a]=C.useState(!1),[l,c]=C.useState(null),u=(i==null?void 0:i.featureCode)??null,d=C.useRef(null);C.useEffect(()=>{if(!u){c(null);return}u!==d.current&&(d.current=u,Rt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(I=>I.json()).then(I=>c(I)).catch(()=>{}))},[u]);const{step:p,allSteps:f}=C.useMemo(()=>i!=null&&i.steps?{step:i.steps.find(E=>E.id===t||E.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=C.useMemo(()=>{if(!r||r.length===0)return null;for(let I=r.length-1;I>=0;I--){const E=r[I];if(E.subtype==="health_score"&&typeof E.score=="number")return E}return null},[r]),{tierMap:x,tierSummary:g}=C.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const I={};let E=null;for(const P of e)P.subtype==="gate_tier_result"?I[P.tierId]=P.passed:P.subtype==="gate_tier_summary"&&(E=P);return{tierMap:I,tierSummary:E}},[e]),y=Object.keys(x).length>0||g!==null,b=C.useMemo(()=>{const I=f.filter(E=>E.cost_usd!=null);return I.length===0?[]:[...I].sort((E,P)=>o?(E.cost_usd??0)-(P.cost_usd??0):(P.cost_usd??0)-(E.cost_usd??0))},[f,o]),k=b.length>0?b[0].id:null,T=C.useMemo(()=>iX(p),[p]),_=C.useMemo(()=>sX(p),[p]),w=C.useMemo(()=>oX(s,t),[s,t]),N=C.useMemo(()=>{if(!n||n.length===0)return null;const I=n.filter(z=>z.stepId===t);if(I.length===0)return null;const E=I.filter(z=>z.severity==="violation").length,P=I.filter(z=>z.severity==="warning").length;return{total:I.length,hardViolations:E,warnings:P}},[n,t]);if(!p)return h.jsxs("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:["Step “",t,"” not found in active build."]});const B={done:"text-success",running:"text-accent",failed:"text-destructive",pending:"text-muted-foreground",skipped:"text-muted-foreground"};return h.jsxs("div",{className:"p-3 space-y-3",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Step"}),h.jsx("p",{className:"text-sm font-semibold text-foreground font-mono",children:p.id||p.step_id})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Status:"}),h.jsx("span",{className:`text-xs font-medium ${B[p.status]||"text-foreground"}`,children:p.status||"unknown"})]}),T&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Retries"}),h.jsxs("p",{className:"text-xs text-amber-400",children:["Retried ",T.count," ",T.count===1?"time":"times"]}),T.isArray&&T.items.length>0&&h.jsx("div",{className:"mt-1 space-y-0.5",children:T.items.map((I,E)=>h.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",E+1,I.reason?`: ${I.reason}`:""]},E))})]}),p.durationMs!=null&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Duration:"}),h.jsx("span",{className:"text-xs text-foreground",children:p.durationMs<1e3?`${p.durationMs}ms`:p.durationMs<6e4?`${(p.durationMs/1e3).toFixed(1)}s`:`${(p.durationMs/6e4).toFixed(1)}m`})]}),p.summary&&h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Summary:"}),h.jsx("p",{className:"text-xs text-foreground mt-0.5",children:p.summary})]}),p.artifact&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Artifact:"}),h.jsx("span",{className:"text-xs text-foreground font-mono truncate",children:p.artifact})]}),p.agent&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Agent:"}),h.jsx("span",{className:"text-xs text-foreground font-mono",children:p.agent})]}),p.filesChanged&&p.filesChanged.length>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Files Changed (",p.filesChanged.length,")"]}),h.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:p.filesChanged.map((I,E)=>h.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:I},E))})]}),(p.input_tokens>0||p.output_tokens>0||p.cost_usd>0)&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Tokens & Cost"}),h.jsxs("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:"Input"}),h.jsx("span",{className:"text-muted-foreground",children:"Output"}),h.jsx("span",{className:"text-muted-foreground",children:"Cost"}),h.jsx("span",{className:"text-foreground font-mono",children:(p.input_tokens??0).toLocaleString()}),h.jsx("span",{className:"text-foreground font-mono",children:(p.output_tokens??0).toLocaleString()}),h.jsx("span",{className:"text-foreground font-mono",children:q0(p.cost_usd)})]})]}),y&&h.jsx("div",{children:h.jsx(cX,{tierMap:x,tierSummary:g})}),_.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1",children:"Postcondition Violations"}),h.jsx("div",{className:"space-y-0.5",children:_.map((I,E)=>h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:typeof I=="string"?I:I.message||JSON.stringify(I)})]},E))})]}),N&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Capability Findings"}),h.jsxs("p",{className:"text-xs text-amber-400",children:[N.total," ",N.total===1?"finding":"findings"," ","(",N.hardViolations," ",N.hardViolations===1?"violation":"violations",","," ",N.warnings," ",N.warnings===1?"warning":"warnings",")"]})]}),(w==null?void 0:w.status)==="running"&&h.jsx(uX,{loopState:w,budget:l}),m!=null&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Health Score"}),h.jsxs("div",{className:"flex items-baseline gap-2 mb-2",children:[h.jsx("span",{className:`text-2xl font-bold font-mono tabular-nums ${Lu(m.score)}`,children:m.score}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"/100"}),m.trend&&h.jsxs("span",{className:`text-sm font-mono ${Lu(m.score)}`,children:[hX(m.trend.direction),m.trend.delta!=null&&h.jsxs("span",{className:"text-[10px] ml-0.5",children:[m.trend.delta>0?"+":"",Math.round(m.trend.delta)]})]})]}),m.breakdown&&Object.keys(m.breakdown).length>0&&h.jsxs("div",{className:"space-y-1",children:[Object.entries(m.breakdown).map(([I,E])=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:U0[I]??I}),h.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted-foreground/20 overflow-hidden",children:h.jsx("div",{className:`h-full rounded-full transition-all ${E>=80?"bg-success":E>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${E}%`}})}),h.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${Lu(E)}`,children:E})]},I)),m.missing&&m.missing.length>0&&h.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-0.5",children:["No data: ",m.missing.map(I=>U0[I]??I).join(", ")]})]})]}),b.length>1&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Build Cost Breakdown"}),h.jsx("button",{className:"text-[9px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>a(I=>!I),children:o?"cost asc":"cost desc"})]}),h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-[10px] border-collapse",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"text-muted-foreground",children:[h.jsx("th",{className:"text-left pr-2 pb-0.5 font-medium",children:"Step"}),h.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"In"}),h.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"Out"}),h.jsx("th",{className:"text-right pb-0.5 font-medium",children:"Cost"}),h.jsx("th",{className:"text-right pb-0.5 pl-2 font-medium",children:"Dur"})]})}),h.jsx("tbody",{children:b.map(I=>{const E=I.id===k,P=I.id===t,z=I.durationMs!=null?I.durationMs<1e3?`${I.durationMs}ms`:I.durationMs<6e4?`${(I.durationMs/1e3).toFixed(1)}s`:`${(I.durationMs/6e4).toFixed(1)}m`:"—";return h.jsxs("tr",{className:`${E?"text-amber-400":"text-foreground"} ${P?"font-semibold":""}`,children:[h.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:I.id}),h.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((I.input_tokens??0)/1e3).toFixed(1),"k"]}),h.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((I.output_tokens??0)/1e3).toFixed(1),"k"]}),h.jsx("td",{className:"text-right py-0.5 font-mono",children:q0(I.cost_usd)}),h.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:z})]},I.id)})})]})})]})]})}function t_(t){const e=[],r=/```decision\n([\s\S]*?)```/g;let n=0,i;for(;(i=r.exec(t))!==null;){i.index>n&&e.push({type:"text",content:t.slice(n,i.index)});const s=i[1].trim();try{e.push({type:"decision",content:JSON.parse(s)})}catch{e.push({type:"text",content:s})}n=i.index+i[0].length}return n<t.length&&e.push({type:"text",content:t.slice(n)}),e.length===0&&e.push({type:"text",content:t}),{parts:e}}function Y0(t,e){var l;const r=(e||[]).filter(c=>!c.superseded);if(r.length===0)return"";let n=`# Design Document
|
|
723
|
-
|
|
724
|
-
`;const i=(t||[]).filter(c=>c.role==="human"&&c.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
|
|
725
|
-
|
|
726
|
-
`,n+=i.map(c=>c.content).join(`
|
|
727
|
-
|
|
728
|
-
`),n+=`
|
|
729
|
-
|
|
730
|
-
`);for(const c of r){const u=c.selectedOption||{};n+=`## ${c.question}
|
|
731
|
-
|
|
732
|
-
`,n+=`**Decision:** ${u.title||u.id||"Selected option"}
|
|
733
|
-
|
|
734
|
-
`,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
|
|
735
|
-
`),n+=`
|
|
736
|
-
|
|
737
|
-
`),c.comment&&(n+=`*Note: ${c.comment}*
|
|
738
|
-
|
|
739
|
-
`)}const s=(l=r[r.length-1])==null?void 0:l.timestamp,o=s?(t||[]).filter(c=>c.role==="assistant"&&c.timestamp>s):[],a=[];for(const c of o){if(typeof c.content!="string")continue;const u=c.content.split(`
|
|
740
|
-
`);for(const d of u){const p=d.trim();p.endsWith("?")&&p.length>10&&p.length<200&&a.push(p)}}return n+=`## Open Threads
|
|
741
|
-
|
|
742
|
-
`,a.length>0?(n+=a.map(c=>`- ${c}`).join(`
|
|
743
|
-
`),n+=`
|
|
744
|
-
`):n+=`_No open threads._
|
|
745
|
-
`,n}function fX(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const jo={es:null},Vn=Df((t,e)=>({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:null,featureCode:null,designDocPath:null,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[],hydrate:async(r,n)=>{if(!r){const l=e().scope;if(l)r=l,n=e().featureCode||null;else try{const c=JSON.parse(localStorage.getItem("compose:designSession")||"{}");r=c.scope||"product",n=c.featureCode||null}catch{r="product"}}const i=e().docManuallyEdited,s=e().draftDoc,o=e().researchItems||[];t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,designDocPath:null,scope:r,featureCode:n,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]});const a=r==="feature"&&n?`?scope=feature&featureCode=${n}`:`?scope=${r}`;try{const l=await Rt(`/api/design/session${a}`),{session:c}=await l.json();if(c){const u=c.messages||[],d=c.decisions||[],p=Y0(u,d),f=fX(u,d);t({session:c,messages:u,decisions:d,status:c.status==="complete"?"complete":"active",scope:r,featureCode:n,draftDoc:i?s:p,docManuallyEdited:i,topicOutline:f,researchItems:o}),e().disconnectSSE(),e().connectSSE()}else t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:r,featureCode:n,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]}),e().disconnectSSE()}catch(l){t({error:l.message})}},startSession:async(r="product",n=null)=>{try{const i=await Rt("/api/design/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:r,featureCode:n})});if(!i.ok){const{error:o}=await i.json();t({error:o});return}const{session:s}=await i.json();try{localStorage.setItem("compose:designSession",JSON.stringify({scope:r,featureCode:n}))}catch{}t({session:s,messages:s.messages||[],decisions:s.decisions||[],status:"active",error:null,scope:r,featureCode:n}),e().connectSSE()}catch(i){t({error:i.message})}},sendMessage:async r=>{const{session:n,messages:i}=e();if(!n)return;const s=n.scope,o=n.featureCode,a={role:"human",type:"text",content:r,timestamp:new Date().toISOString()};t(l=>({messages:[...l.messages,a],status:"streaming"}));try{const l=await Rt("/api/design/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:s,featureCode:o,type:"text",content:r})});l.ok||t({messages:i,status:"active",error:`Failed to send message: ${l.status}`})}catch(l){t({messages:i,status:"active",error:l.message})}},selectCard:async(r,n=null,i=null)=>{const{session:s,messages:o}=e();if(!s)return;const a={role:"human",type:"card_select",content:{cardId:r,comment:n},timestamp:new Date().toISOString()};t(l=>({messages:[...l.messages,a],status:"streaming"}));try{const l=await Rt("/api/design/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:s.scope,featureCode:s.featureCode,type:"card_select",cardId:r,comment:n,messageIndex:i})});l.ok||t({messages:o,status:"active",error:`Failed to select card: ${l.status}`})}catch(l){t({messages:o,status:"active",error:l.message})}},reviseDecision:async r=>{const{session:n}=e();if(!n)return;const i=e().decisions[r];if(!(!i||i.superseded))try{const s=await Rt("/api/design/revise",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:n.scope,featureCode:n.featureCode,decisionIndex:r})});if(!s.ok){const{error:o}=await s.json().catch(()=>({error:"Revision failed"}));t({error:o});return}e().hydrate(n.scope,n.featureCode)}catch(s){t({error:s.message})}},completeDesign:async()=>{const{session:r,draftDoc:n}=e();if(r){t({status:"summarizing"});try{const i={scope:r.scope,featureCode:r.featureCode};n&&(i.draftDoc=n);const s=await Rt("/api/design/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const{error:l}=await s.json().catch(()=>({error:"Unknown error"}));t({error:l,status:"active"});return}const o=await s.json(),a={session:o.session,status:"complete",designDocPath:o.designDocPath||null};o.error&&(a.error=o.error),t(a)}catch(i){t({error:i.message,status:"active"})}}},connectSSE:()=>{if(jo.es)return;const{scope:r,featureCode:n}=e(),i=new URLSearchParams({scope:r||"product"});n&&i.set("featureCode",n);const s=new EventSource(`/api/design/stream?${i}`);jo.es=s,s.addEventListener("ack",()=>{t(o=>o.status!=="streaming"?{status:"streaming"}:{})}),s.addEventListener("text",o=>{const a=JSON.parse(o.data);t(l=>l.streamingMessage?{streamingMessage:{...l.streamingMessage,content:l.streamingMessage.content+a.content}}:{status:"streaming",streamingMessage:{role:"assistant",type:"text",content:a.content,timestamp:new Date().toISOString()}})}),s.addEventListener("decision",o=>{const a=JSON.parse(o.data);t(l=>({status:"streaming",streamingMessage:l.streamingMessage?{...l.streamingMessage,type:"decision",decisionData:a}:{role:"assistant",type:"decision",content:"",decisionData:a,timestamp:new Date().toISOString()}}))}),s.addEventListener("done",()=>{t(o=>({messages:o.streamingMessage?[...o.messages,o.streamingMessage]:o.messages,streamingMessage:null,status:"active"})),e().hydrate()}),s.addEventListener("research",o=>{const a=JSON.parse(o.data);t(l=>({researchItems:[...l.researchItems,{id:a.id,tool:a.tool,input:a.input,timestamp:a.timestamp,summary:null}]}))}),s.addEventListener("research_result",o=>{const a=JSON.parse(o.data);t(l=>{const c=[...l.researchItems],u=a.id?c.findIndex(d=>d.id===a.id):-1;return u!==-1&&(c[u]={...c[u],summary:a.summary}),{researchItems:c}})}),s.addEventListener("error",o=>{try{const a=JSON.parse(o.data);t(l=>({status:"active",streamingMessage:null,error:a.message||"Agent error",messages:l.messages}))}catch{t({status:"active",streamingMessage:null})}}),s.onerror=()=>{t({status:"active"})}},disconnectSSE:()=>{jo.es&&(jo.es.close(),jo.es=null)},reset:()=>{try{localStorage.removeItem("compose:designSession")}catch{}t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:null,featureCode:null,designDocPath:null,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]})},updateDraftDoc:r=>{t({draftDoc:r,docManuallyEdited:!0})},resetDocEdited:()=>{const{messages:r,decisions:n}=e(),i=Y0(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function pX(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=Vn(Ri(c=>({draftDoc:c.draftDoc,docManuallyEdited:c.docManuallyEdited,updateDraftDoc:c.updateDraftDoc,resetDocEdited:c.resetDocEdited}))),[i,s]=C.useState(!1),o=!t;let a="empty",l={color:"hsl(var(--muted-foreground))"};return e?(a="edited",l={color:"hsl(var(--primary))"}):o||(a="draft",l={color:"hsl(var(--muted-foreground))"}),h.jsxs("div",{className:"h-full flex flex-col",style:{fontFamily:"inherit"},children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[12px] font-semibold",style:{color:"hsl(var(--foreground))"},children:"Design Document"}),h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{...l,background:"hsl(var(--muted))"},children:a})]}),!o&&h.jsx("button",{onClick:()=>s(c=>!c),className:"text-[11px] px-2 py-1 rounded transition-colors",style:{color:"hsl(var(--muted-foreground))",background:i?"hsl(var(--accent))":"transparent"},onMouseEnter:c=>{c.currentTarget.style.color="hsl(var(--foreground))"},onMouseLeave:c=>{c.currentTarget.style.color="hsl(var(--muted-foreground))"},children:i?"Preview":"Edit"})]}),h.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o?h.jsx("div",{className:"p-4 text-[12px] italic",style:{color:"hsl(var(--muted-foreground))"},children:"Start the design conversation to see the document build here."}):i?h.jsxs("div",{className:"h-full flex flex-col p-2 gap-2",children:[h.jsx("textarea",{className:"flex-1 min-h-0 w-full resize-none rounded p-2 text-[12px]",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",background:"hsl(var(--background))",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",outline:"none"},value:t,onChange:c=>r(c.target.value),spellCheck:!1}),h.jsx("button",{onClick:()=>{n(),s(!1)},className:"shrink-0 text-[11px] px-3 py-1.5 rounded transition-colors self-start",style:{color:"hsl(var(--muted-foreground))",border:"1px solid hsl(var(--border))",background:"transparent"},onMouseEnter:c=>{c.currentTarget.style.color="hsl(var(--foreground))",c.currentTarget.style.borderColor="hsl(var(--foreground))"},onMouseLeave:c=>{c.currentTarget.style.color="hsl(var(--muted-foreground))",c.currentTarget.style.borderColor="hsl(var(--border))"},children:"Reset to auto-generated"})]}):h.jsx("div",{className:"p-4 prose prose-sm max-w-none",style:{color:"hsl(var(--foreground))","--tw-prose-body":"hsl(var(--foreground))","--tw-prose-headings":"hsl(var(--foreground))","--tw-prose-code":"hsl(var(--foreground))","--tw-prose-bold":"hsl(var(--foreground))","--tw-prose-links":"hsl(var(--primary))",fontSize:"12px"},children:h.jsx(Ef,{remarkPlugins:[Bf],children:t})})})]})}const mX=4e3,V0={info:{color:"hsl(var(--foreground))",bg:"hsl(var(--muted))"},warn:{color:"hsl(var(--warning, 32 95% 52%))",bg:"hsl(var(--muted))"},error:{color:"hsl(var(--destructive))",bg:"hsl(var(--destructive) / 0.08)"}};function gX(){const[t,e]=C.useState(null),r=C.useRef(null);if(C.useEffect(()=>{function i(s){const{message:o,level:a="info",ttl:l=mX}=s.detail??{};o&&(clearTimeout(r.current),e({message:o,level:a}),l>0&&(r.current=setTimeout(()=>e(null),l)))}return window.addEventListener("compose:notify",i),()=>{window.removeEventListener("compose:notify",i),clearTimeout(r.current)}},[]),!t)return null;const n=V0[t.level]??V0.info;return h.jsxs("div",{className:"h-6 flex items-center justify-between px-3 gap-2 shrink-0 text-[11px] font-mono",style:{background:n.bg,color:n.color,borderTop:"1px solid hsl(var(--border))"},role:"status","aria-live":"polite",children:[h.jsx("span",{className:"flex-1 min-w-0 truncate",children:t.message}),h.jsx("button",{className:"shrink-0 opacity-60 hover:opacity-100 text-[10px]",onClick:()=>{clearTimeout(r.current),e(null)},"aria-label":"Dismiss notification",children:"✕"})]})}const Bu={build:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(217 91% 60%)"},gate:{background:"hsl(38 92% 50% / 0.12)",borderColor:"hsl(38 92% 50% / 0.3)",color:"hsl(38 92% 50%)"},error:{background:"hsl(0 72% 51% / 0.12)",borderColor:"hsl(0 72% 51% / 0.3)",color:"hsl(0 72% 51%)"},done:{background:"hsl(160 60% 45% / 0.12)",borderColor:"hsl(160 60% 45% / 0.3)",color:"hsl(160 60% 45%)"},iteration:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(210 100% 66%)"}},X0={enter:{transform:"translateX(20px)",opacity:0},steady:{transform:"translateX(0)",opacity:1},flash:{transform:"translateX(0)",opacity:1},exit:{transform:"translateX(0)",opacity:0}};function xX({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?Bu.done:Bu[t])||Bu.build,l=X0[o]||X0.steady,c=o==="exit"?"200ms":o==="flash"?"300ms":"200ms";return h.jsxs("div",{className:"ops-strip-entry",style:{display:"inline-flex",alignItems:"center",gap:"4px",height:"24px",padding:"0 10px",borderRadius:"12px",border:`1px solid ${a.borderColor}`,background:a.background,color:a.color,fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",cursor:n?"pointer":"default",whiteSpace:"nowrap",transition:`transform ${c} ease, opacity ${c} ease, background 300ms ease, border-color 300ms ease, color 300ms ease`,...l},onClick:n,role:"button",tabIndex:0,onKeyDown:u=>{u.key==="Enter"&&n&&n()},children:[h.jsxs("span",{style:{fontSize:"12px",lineHeight:1},children:[t==="build"&&"▶",t==="gate"&&"⚠",t==="error"&&"✕",t==="done"&&"✓",t==="iteration"&&"↻"]}),h.jsx("span",{children:e}),r>0&&h.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:r}),t==="gate"&&i&&h.jsx("button",{className:"ops-strip-approve",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"9px",border:`1px solid ${a.borderColor}`,background:"transparent",color:a.color,fontSize:"11px",cursor:"pointer",padding:0,marginLeft:"2px",lineHeight:1},onClick:u=>{u.stopPropagation(),i()},title:"Approve gate",children:"✓"}),t==="error"&&s&&h.jsx("button",{className:"ops-strip-dismiss",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"9px",border:"none",background:"transparent",color:a.color,fontSize:"10px",cursor:"pointer",padding:0,marginLeft:"2px",opacity:.6,lineHeight:1},onClick:u=>{u.stopPropagation(),s()},title:"Dismiss error",children:"✕"})]})}function yX(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function bX(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function CX(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function kX({activeBuild:t,gates:e,items:r,recentErrors:n,iterationStates:i,now:s=Date.now()}){const o=[];if(t&&t.featureCode){const a=t.currentStep?`${t.currentStep}`:"building",l=t.totalSteps?` · step ${t.currentStepIndex??"?"}/${t.totalSteps}`:"",c=yX(t.cumulative_cost_usd),u=c?` · ${c}`:"",d=t.flowId||t.startedAt||t.featureCode;o.push({key:`build-${t.featureCode}-${d}`,type:t.status==="complete"?"done":"build",label:`${t.featureCode} · ${a}${l}${u}`,featureCode:t.featureCode,retries:t.retries??0})}if(Array.isArray(e)){for(const a of e)if(a.status==="pending"){const l=_n[a.stepId]??(a.fromPhase||a.toPhase||"Gate"),c=Array.isArray(r)?r.find(d=>d.id===a.itemId):null,u=(c==null?void 0:c.title)||a.featureCode||"";o.push({key:`gate-${a.id}`,type:"gate",label:u?`${l} — ${u}`:l,featureCode:a.featureCode||"",gateId:a.id})}}if(i){for(const[a,l]of i)if(l.status==="running"){const c=l.loopType==="review"?"review":"coverage",u=`${l.count}/${l.maxIterations}`;let d="";if(l.wallClockTimeout!=null&&l.startedAt){const p=s-new Date(l.startedAt).getTime();d=`, ${bX(p)}/${CX(l.wallClockTimeout)}`}o.push({key:`iter-${a}`,type:"iteration",label:`${c} ${u}${d}`})}}if(Array.isArray(n))for(const a of n){const l=a.featureCode||"system",c=(a.message||a.errorType||"error").substring(0,60);o.push({key:`error-${a.timestamp}-${c.substring(0,10)}`,type:"error",label:`${l} · ${c}`,featureCode:l,timestamp:a.timestamp})}return o}function vX({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=yr(Ri(R=>({activeBuild:R.activeBuild,gates:R.gates,items:R.items,recentErrors:R.recentErrors,resolveGate:R.resolveGate,iterationStates:R.iterationStates}))),[l,c]=C.useState(new Map),u=C.useRef([]),d=C.useRef(new Set),p=C.useRef(new Set),[f,m]=C.useState(null),x=C.useRef(null),g=(r==null?void 0:r.featureCode)??null;C.useEffect(()=>{if(!g){m(null),x.current=null;return}g!==x.current&&(x.current=g,Rt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(R=>R.json()).then(R=>m(R)).catch(()=>{}))},[g]);const y=C.useRef(0);C.useEffect(()=>{if(!g)return;const R=a?[...a.values()].reduce((F,M)=>F+(M.count??0),0):0;R!==y.current&&(y.current=R,Rt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(F=>F.json()).then(F=>m(F)).catch(()=>{}))},[a,g]);const b=C.useRef(r),[k,T]=C.useState(null);C.useEffect(()=>{const R=b.current;if(R&&R.featureCode&&!r){T({...R,status:"complete"});const F=setTimeout(()=>T(null),3e3);return b.current=r,()=>clearTimeout(F)}b.current=r},[r]);const _=r||k,[w,N]=C.useState(()=>Date.now()),B=a&&[...a.values()].some(R=>R.status==="running");C.useEffect(()=>{if(!B)return;const R=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(R)},[B]);const I=C.useMemo(()=>kX({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:w}),[_,n,i,s,a,w]),E=C.useMemo(()=>I.filter(R=>!d.current.has(R.key)),[I]);C.useEffect(()=>{const R=new Set(u.current.map(M=>M.key)),F=E.filter(M=>!R.has(M.key)).map(M=>M.key);F.length>0&&(c(M=>{const D=new Map(M);for(const O of F)D.set(O,"enter");return D}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{c(M=>{const D=new Map(M);for(const O of F)D.get(O)==="enter"&&D.set(O,"steady");return D})})}));for(const M of E)M.type==="done"&&!p.current.has(M.key)&&(p.current.add(M.key),c(D=>{const O=new Map(D);return O.set(M.key,"flash"),O}),setTimeout(()=>{c(D=>{const O=new Map(D);return O.set(M.key,"exit"),O}),setTimeout(()=>{d.current.add(M.key),c(D=>{const O=new Map(D);return O.delete(M.key),O})},500)},2e3));u.current=E},[E]);const P=C.useCallback(R=>{c(F=>{const M=new Map(F);return M.set(R,"exit"),M}),setTimeout(()=>{d.current.add(R),c(F=>{const M=new Map(F);return M.delete(R),M})},200)},[]),z=C.useCallback(R=>{o&&o(R,"approve","Approved from ops strip")},[o]);if(t==="docs"||E.length===0)return null;const q=lX(f);return h.jsxs("div",{className:"ops-strip",style:{height:"36px",display:"flex",alignItems:"center",gap:"6px",padding:"0 12px",overflowX:"auto",overflowY:"hidden",borderTop:"1px solid hsl(var(--border))",background:"hsl(var(--background))",flexShrink:0},children:[E.map(R=>h.jsx(xX,{type:R.type,label:R.label,retries:R.retries,animationState:l.get(R.key)||"steady",onClick:e?()=>e(R.featureCode):void 0,onApprove:R.type==="gate"&&R.gateId?()=>z(R.gateId):void 0,onDismiss:R.type==="error"?()=>P(R.key):void 0},R.key)),q&&h.jsx("span",{className:"ml-auto text-[9px] text-muted-foreground font-mono shrink-0 opacity-70",title:"Cumulative budget usage: review / coverage",children:q})]})}const Au=["dashboard","graph","tree","docs","design","gates","pipeline","sessions","ideabox"];function wX(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function SX(t){return(t==null?void 0:t[0])??null}const TX="compose:mainTabs",e_="compose:activeTab";function _X(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(TX);if(!e)return[...Au];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of Au)if(!n.includes(i)){const s=n.indexOf("docs");s>=0?n=[...n.slice(0,s+1),i,...n.slice(s+1)]:n=[...n,i]}return n}}catch{}return[...Au]}function EX(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(e_);if(r&&wX(t,r))return r}catch{}return SX(t)}function K0(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(e_,t)}catch{}}function r_(t,e){var r;try{const n=(r=globalThis.localStorage)==null?void 0:r.getItem(t);return n==null?e:n!=="false"}catch{return e}}function n_(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const i_="compose:sidebarOpen",s_="compose:contextPanelOpen";function NX(){return r_(i_,!0)}function jX(t){return n_(i_,t)}function LX(){return r_(s_,!1)}function Z0(t){return n_(s_,t)}const tf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));tf.displayName="Card";const ef=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("flex flex-col space-y-1.5 p-6",t),...e}));ef.displayName="CardHeader";const rf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("font-semibold leading-none tracking-tight",t),...e}));rf.displayName="CardTitle";const BX=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("text-sm text-muted-foreground",t),...e}));BX.displayName="CardDescription";const nf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("p-6 pt-0",t),...e}));nf.displayName="CardContent";const AX=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("flex items-center p-6 pt-0",t),...e}));AX.displayName="CardFooter";function MX(t){const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60);return r<60?`${r}m ${e%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function Q0({agent:t,toolCount:e,errorCount:r,currentTool:n,currentCategory:i,onStop:s}){const o=t.status==="running",a=t.status==="killed",l=t.status==="failed"||t.status==="error"||a,c=!o&&!l,u=t.silent,[d,p]=C.useState(()=>{const m=t.startedAt?new Date(t.startedAt).getTime():Date.now();return(t.completedAt?new Date(t.completedAt).getTime():Date.now())-m});C.useEffect(()=>{if(!o)return;const m=t.startedAt?new Date(t.startedAt).getTime():Date.now(),x=()=>p(Date.now()-m);x();const g=setInterval(x,1e3);return()=>clearInterval(g)},[o,t.startedAt]);const f=t.agentType||t.type||t.agent||"agent";return h.jsxs("div",{className:"px-3 py-2 rounded border border-border bg-muted/20",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"text-[11px] text-foreground font-medium truncate",children:f}),h.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[h.jsx("span",{className:rt("w-1.5 h-1.5 rounded-full inline-block",o&&!u&&"bg-green-400",o&&u&&"bg-yellow-400",c&&"bg-emerald-400",l&&"bg-red-400"),style:o&&!u?{animation:"phase-active-pulse 2s ease-in-out infinite"}:void 0}),h.jsx("span",{className:rt("text-[10px]",o&&!u&&"text-green-400",o&&u&&"text-yellow-400",c&&"text-emerald-400",l&&"text-red-400"),children:u?"silent":t.status}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:MX(d)}),o&&s&&h.jsx("button",{onClick:m=>{m.stopPropagation(),s(t.agentId||t.id)},className:"text-[10px] text-muted-foreground hover:text-destructive cursor-pointer ml-0.5",title:"Stop agent",children:"x"})]})]}),h.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:e!=null&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:[e," tools"]}),h.jsx("span",{className:"mx-1",children:"·"}),h.jsxs("span",{className:rt(r>0&&"text-red-400"),children:[r??0," err"]}),o&&n&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"mx-1",children:"·"}),h.jsxs("span",{children:[i||"working"," (",n,")"]})]})]})})]})}function IX(t,e,r){const n=new Array(t);return new Proxy(n,{get(i,s,o){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=57){const l=+s;if(Number.isInteger(l)&&l>=0&&l<t){let c=i[l];if(!c){const u=e[l*2];c=i[l]={index:l,key:r(l),start:u,size:e[l*2+1],end:u+e[l*2+1],lane:0}}return c}}if(s==="length")return t}return Reflect.get(i,s,o)}})}function is(t,e,r){let n=r.initialDeps??[],i,s=!0;function o(){const a=t();return(a.length!==n.length||a.some((c,u)=>n[u]!==c))&&(n=a,i=e(...a),r!=null&&r.onChange&&!(s&&r.skipInitialOnChange)&&r.onChange(i),s=!1),i}return o.updateDeps=a=>{n=a},o}function J0(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const FX=(t,e)=>Math.abs(t-e)<1.01,PX=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}};let Lo;const Mu=()=>{if(Lo!==void 0)return Lo;if(typeof navigator>"u")return Lo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Lo=!0;const t=navigator.maxTouchPoints;return Lo=navigator.platform==="MacIntel"&&t!==void 0&&t>0},ty=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},DX=t=>t,OX=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,i=new Array(n);for(let s=0;s<n;s++)i[s]=e+s;return i},RX=(t,e)=>{const r=t.scrollElement;if(!r)return;const n=t.targetWindow;if(!n)return;const i=o=>{const{width:a,height:l}=o;e({width:Math.round(a),height:Math.round(l)})};if(i(ty(r)),!n.ResizeObserver)return()=>{};const s=new n.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(ty(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},Fc={passive:!0},$X=typeof window>"u"?!0:"onscrollend"in window,zX=(t,e,r)=>{const n=t.scrollElement;if(!n)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&$X;let o=0;const a=s?null:PX(i,()=>e(o,!1),t.options.isScrollingResetDelay),l=d=>()=>{o=r(n),a==null||a(),e(o,d)},c=l(!0),u=l(!1);return n.addEventListener("scroll",c,Fc),s&&n.addEventListener("scrollend",u,Fc),()=>{n.removeEventListener("scroll",c),s&&n.removeEventListener("scrollend",u)}},WX=(t,e)=>zX(t,e,r=>{const{horizontal:n,isRtl:i}=t.options;return n?r.scrollLeft*(i&&-1||1):r.scrollTop}),qX=(t,e,r)=>{if(r.options.useCachedMeasurements){const n=r.indexFromElement(t),i=r.options.getItemKey(n);return r.itemSizeCache.get(i)??r.options.estimateSize(n)}if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}if(!e){const n=r.indexFromElement(t),i=r.options.getItemKey(n),s=r.itemSizeCache.get(i);if(s!==void 0)return s}return t[r.options.horizontal?"offsetWidth":"offsetHeight"]},HX=(t,{adjustments:e=0,behavior:r},n)=>{var i,s;(s=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[n.options.horizontal?"left":"top"]:t+e,behavior:r})},UX=HX;class GX{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,n,i;return((i=(n=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let r=null;const n=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const o=()=>{const a=s.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,u]of this.elementsCache)if(u===a){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(a,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),r=null},observe:i=>{var s;return(s=n())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=n())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=r=>{var n,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:DX,rangeExtractor:OX,onChange:()=>{},measureElement:qX,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const p in r){const f=r[p];f!==void 0&&(s[p]=f)}const o=this.options;let a=null,l=null,c=!1;if(o!==void 0&&o.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const p=o.count,f=s.count,m=this.getMeasurements(),x=p>0?((n=m[0])==null?void 0:n.key)??o.getItemKey(0):null,g=p>0?((i=m[p-1])==null?void 0:i.key)??o.getItemKey(p-1):null;if(f!==p||p>0&&f>0&&(s.getItemKey(0)!==x||s.getItemKey(f-1)!==g)){c=!0;const k=p>0?this.getVirtualItemForOffset(this.getScrollOffset())??m[0]:null;k&&(a=[k.key,this.getScrollOffset()-k.start]);const T=s.followOnAppend===!0?"auto":s.followOnAppend||null;T&&f>p&&this.isAtEnd(o.scrollEndThreshold)&&(p===0||s.getItemKey(f-1)!==g)&&(l=T)}}this.options=s,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(a&&this.scrollOffset!==null){const[p,f]=a,m=this.getMeasurements(),{count:x,getItemKey:g}=this.options;let y=0;for(;y<x&&g(y)!==p;)y++;if(y<x){const b=m[y];if(b){const k=b.start+f;k!==this.scrollOffset&&(d=k-this.scrollOffset,this.scrollOffset=k,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?a[0]:null,u?a[1]:0,l,d])},this.notify=r=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,r)},this.maybeNotify=is(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}if(this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!Mu()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,Fc),s.addEventListener("touchend",a,Fc),this.unsubs.push(()=>{s.removeEventListener("touchstart",o),s.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,o,a,l]=i;s!==null&&!a&&(Mu()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),n=this.getMaxScrollOffset();if(r<0||r>n)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,n)=>{const i=new Map,s=new Map;for(let o=n-1;o>=0;o--){const a=r[o];if(i.has(a.lane))continue;const l=s.get(a.lane);if(l==null||a.end>l.end?s.set(a.lane,a):a.end<l.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=is(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,n,i,s,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=is(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{const u=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const m of this.laneAssignments.keys())m>=r&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),a===1){const m=this.options.gap,x=r*2;let g=this._flatMeasurements;if(!g||g.length<x){const k=new Float64Array(x);g&&d>0&&k.set(g.subarray(0,d*2)),g=k,this._flatMeasurements=g}let y;if(d===0)y=n+i;else{const k=d-1;y=g[k*2]+g[k*2+1]+m}for(let k=d;k<r;k++){const T=s(k),_=u.get(T),w=typeof _=="number"?_:this.options.estimateSize(k);g[k*2]=y,g[k*2+1]=w,y+=w+m}const b=IX(r,g,s);return this.measurementsCache=b,b}const p=this.measurementsCache.slice(0,d),f=new Array(a).fill(void 0);for(let m=0;m<d;m++){const x=p[m];x&&(f[x.lane]=m)}for(let m=d;m<r;m++){const x=s(m),g=this.laneAssignments.get(m);let y,b;const k=l==="estimate"||u.has(x);if(g!==void 0&&this.options.lanes>1){y=g;const N=f[y],B=N!==void 0?p[N]:void 0;b=B?B.end+this.options.gap:n+i}else{const N=this.options.lanes===1?p[m-1]:this.getFurthestMeasurement(p,m);b=N?N.end+this.options.gap:n+i,y=N?N.lane:m%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(m,y)}const T=u.get(x),_=typeof T=="number"?T:this.options.estimateSize(m),w=b+_;p[m]={index:m,start:b,size:_,end:w,key:x,lane:y},f[y]=m}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=is(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?YX({measurements:r,outerSize:n,scrollOffset:i,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=is(()=>{let r=null,n=null;const i=this.calculateRange();return i&&(r=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,n]},(r,n,i,s,o)=>s===null||o===null?[]:r({startIndex:s,endIndex:o,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const n=this.options.indexAttribute,i=r.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-s),a=Math.min(this.options.count-1,i+s);return r>=o&&r<=a}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const n=this.indexFromElement(r),i=this.options.getItemKey(n),s=this.elementsCache.get(i);s!==r&&(s&&this.observer.unobserve(s),this.observer.observe(r),this.elementsCache.set(i,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,n)=>{var i,s;if(r<0||r>=this.options.count)return;let o,a,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(r),a=c[r*2],o=c[r*2+1];else{const p=this.measurementsCache[r];if(!p)return;l=p.key,a=p.start,o=p.size}const u=this.itemSizeCache.get(l)??o,d=n-u;if(d!==0){const p=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,f=p?this.getTotalSize():0,m=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:l,start:a,size:o,end:a+o,lane:0},d,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||r<this.pendingMin)&&(this.pendingMin=r),this.itemSizeCache.set(l,n),this.itemSizeCacheVersion++,p?this.applyScrollAdjustment(this.getTotalSize()-f):m&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=is(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,n)=>{const i=[];for(let s=0,o=r.length;s<o;s++){const a=r[s],l=n[a];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const n=this.getMeasurements();if(n.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,o=o_(0,n.length-1,s?a=>i[a*2]:a=>J0(n[a]).start,r);return J0(n[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,n,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=r>=o+s?"end":"start"),n==="center"?r+=(i-s)/2:n==="end"&&(r-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,r),0)},this.getOffsetForIndex=(r,n="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),o=this.measurementsCache[r];if(!o)return;if(n==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.scrollToOffset=(r,{align:n="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(r,n),o=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:n="auto",behavior:i="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const s=this.getOffsetForIndex(r,n);if(!s)return;const[o,a]=s,l=this.now();this.scrollState={index:r,align:a,behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:n="auto"}={})=>{const i=this.getScrollOffset()+r,s=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=n.length-1,o=this._flatMeasurements;o!=null?i=o[s*2]+o[s*2+1]:i=((r=n[s])==null?void 0:r.end)??0}else{const s=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&s.some(a=>a===null);){const a=n[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const n=this.getMeasurements();for(const i of n)i&&this.itemSizeCache.has(i.key)&&r.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return r},this._scrollToOffset=(r,{adjustments:n,behavior:i})=>{this._intendedScrollOffset=r+(n??0),this.options.scrollToFn(r,{behavior:i,adjustments:n},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,r){e!==0&&(Mu()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,s=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&FX(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(i-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=i,c||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const o_=(t,e,r,n)=>{for(;t<=e;){const i=(t+e)/2|0,s=r(i);if(s<n)t=i+1;else if(s>n)e=i-1;else return i}return t>0?t-1:0};function YX({measurements:t,outerSize:e,scrollOffset:r,lanes:n,flat:i}){const s=t.length-1,o=i?u=>i[u*2]:u=>t[u].start,a=i?u=>i[u*2]+i[u*2+1]:u=>t[u].end;if(t.length<=n)return{startIndex:0,endIndex:s};let l=o_(0,s,o,r),c=l;if(n===1)for(;c<s&&a(c)<r+e;)c++;else if(n>1){const u=Array(n).fill(0);for(;c<s&&u.some(p=>p<r+e);){const p=t[c];u[p.lane]=p.end,c++}const d=Array(n).fill(r+e);for(;l>=0&&d.some(p=>p>=r);){const p=t[l];d[p.lane]=p.start,l--}l=Math.max(0,l-l%n),c=Math.min(s,c+(n-1-c%n))}return{startIndex:l,endIndex:c}}const Iu=typeof document<"u"?C.useLayoutEffect:C.useEffect;function VX({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:r="transform",...n}){const i=C.useReducer(c=>c+1,0)[1],s=C.useRef({enabled:e,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=e,s.current.mode=r;const o=c=>{const u=s.current;if(!u.enabled)return;const d=c.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const y=c.options.horizontal?"width":"height";u.container.style[y]=`${d}px`}const p=!!c.options.horizontal,f=u.mode==="transform",m=p?"left":"top",x=c.options.scrollMargin,g=c.getVirtualItems();for(const y of g){const b=y.start-x,k=c.elementsCache.get(y.key);k&&u.lastPositions.get(k)!==b&&(u.lastPositions.set(k,b),f?k.style.transform=p?`translate3d(${b}px, 0, 0)`:`translate3d(0, ${b}px, 0)`:k.style[m]=`${b}px`)}},a={...n,onChange:(c,u)=>{var d;const p=s.current;let f=!0;if(p.enabled){o(c);const m=c.range,x=p.prevRange;f=!x||x.isScrolling!==c.isScrolling||x.startIndex!==(m==null?void 0:m.startIndex)||x.endIndex!==(m==null?void 0:m.endIndex),f&&(p.prevRange=m?{startIndex:m.startIndex,endIndex:m.endIndex,isScrolling:c.isScrolling}:null)}f&&(t&&u?$f.flushSync(i):i()),(d=n.onChange)==null||d.call(n,c,u)}},[l]=C.useState(()=>{const c=new GX(a);return Object.assign(c,{containerRef:u=>{const d=s.current;if(d.container=u,d.lastSize=null,u&&d.enabled){const p=c.getTotalSize();d.lastSize=p;const f=c.options.horizontal?"width":"height";u.style[f]=`${p}px`}}})});return l.setOptions(a),Iu(()=>l._didMount(),[]),Iu(()=>l._willUpdate()),Iu(()=>{o(l)}),l}function XX(t){return VX({observeElementRect:RX,observeElementOffset:WX,scrollToFn:UX,...t})}function KX(t,e,r){var a,l;const n=[],i=(r==null?void 0:r.id)??null;if(Array.isArray(t))for(const c of t){if(n.push({id:`session-start-${c.id}`,timestamp:c.startedAt,category:"session",title:"Session started",detail:c.source?`Source: ${c.source}`:null,severity:"info",sessionId:c.id,meta:{toolCount:c.toolCount,source:c.source}}),c.endedAt&&n.push({id:`session-end-${c.id}`,timestamp:c.endedAt,category:"session",title:`Session ended (${c.toolCount??0} tools${(a=c.errors)!=null&&a.length?`, ${c.errors.length} error${c.errors.length>1?"s":""}`:""})`,detail:null,severity:"info",sessionId:c.id,meta:{toolCount:c.toolCount,errorCount:((l=c.errors)==null?void 0:l.length)??0}}),Array.isArray(c.errors))for(let u=0;u<c.errors.length;u++){const d=c.errors[u];n.push({id:`error-${c.id}-${u}`,timestamp:d.timestamp||c.startedAt,category:"error",title:d.message||`${d.type} error`,detail:d.tool?`Tool: ${d.tool}`:null,severity:d.severity==="error"?"error":"warning",sessionId:c.id,meta:{type:d.type,tool:d.tool}})}if(c.phaseAtBind&&c.phaseAtEnd&&c.phaseAtBind!==c.phaseAtEnd){const u=new Date(c.startedAt).getTime(),d=c.endedAt?new Date(c.endedAt).getTime():u,p=new Date(u+(d-u)*.8).toISOString();n.push({id:`phase-${c.id}`,timestamp:p,category:"phase",title:`Phase: ${c.phaseAtBind} → ${c.phaseAtEnd}`,detail:null,severity:"success",sessionId:c.id,meta:{from:c.phaseAtBind,to:c.phaseAtEnd}})}}if(Array.isArray(e)){const c=i?e.filter(u=>u.itemId===i):e;for(const u of c){if(u.createdAt){const d=_n[u.stepId]??(u.fromPhase&&u.toPhase?`${_e[u.fromPhase]??u.fromPhase} → ${_e[u.toPhase]??u.toPhase}`:"Gate created");n.push({id:`gate-created-${u.id}`,timestamp:u.createdAt,category:"gate",title:d,detail:null,severity:"info",sessionId:null,meta:{gateId:u.id,fromPhase:u.fromPhase,toPhase:u.toPhase}})}if(u.resolvedAt&&u.outcome){const p={approve:"approve",approved:"approve",revise:"revise",revised:"revise",kill:"kill",killed:"kill"}[u.outcome]||u.outcome,f={approve:"success",revise:"warning",kill:"error"},m={approve:"approved",revise:"revised",kill:"killed"};n.push({id:`gate-resolved-${u.id}`,timestamp:u.resolvedAt,category:"gate",title:`Gate ${m[p]||u.outcome}`,detail:u.comment||null,severity:f[p]||"info",sessionId:null,meta:{gateId:u.id,outcome:u.outcome,comment:u.comment}})}}}const s=new Set,o=[];for(const c of n)s.has(c.id)||(s.add(c.id),o.push(c));return o.sort((c,u)=>c.timestamp.localeCompare(u.timestamp)),o}const ZX={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function QX(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"now";if(r<60)return`${r}m`;const n=Math.floor(r/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function JX({event:t,onSelectItem:e,style:r}){const n=ZX[t.category]||"●",i=__[t.category]||"text-zinc-400",s=T_[t.severity]||"text-zinc-400";return h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded",style:r,children:[h.jsx("span",{className:rt("text-[11px] shrink-0 w-4 text-center leading-4",i),children:n}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:rt("text-[11px] truncate",s),children:t.title}),t.detail&&h.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.detail})]}),h.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0 leading-4",children:QX(t.timestamp)})]})}const tK=["all","phase","gate","session","iteration","error"],ey={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function eK({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=C.useState("all"),[s,o]=C.useState([]),a=C.useRef(null),l=yr(m=>m.gates),c=yr(m=>m.featureTimeline),u=yr(m=>m.setFeatureTimeline);C.useEffect(()=>{if(!t)return;let m=!1;return Rt(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=50`).then(x=>x.json()).then(x=>{if(m)return;const g=e?(l||[]).filter(b=>b.itemId===e):l||[],y=KX(x.sessions||[],g,{id:e});o(y)}).catch(()=>{m||o([])}),()=>{m=!0}},[t,e]);const d=C.useMemo(()=>{var g,y;const m=new Map;for(const b of s)m.set(b.id,b);for(const b of c){const k=(g=b.meta)==null?void 0:g.itemId,T=(y=b.meta)==null?void 0:y.featureCode;(!k&&!T||k===e||T===t)&&m.set(b.id,b)}const x=[...m.values()];return x.sort((b,k)=>b.timestamp.localeCompare(k.timestamp)),x},[s,c,e,t]),p=C.useMemo(()=>n==="all"?d:d.filter(m=>m.category===n),[d,n]),f=XX({count:p.length,getScrollElement:()=>a.current,estimateSize:()=>48,overscan:5});return C.useEffect(()=>{u&&u([])},[t]),t?h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsx("div",{className:"flex flex-wrap gap-1 px-2 py-2 border-b border-border",children:tK.map(m=>h.jsxs("button",{className:rt("px-2 py-0.5 rounded text-[10px] font-medium transition-colors",n===m?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:()=>i(m),children:[ey[m],m!=="all"&&h.jsx("span",{className:"ml-1 text-[9px] opacity-60",children:d.filter(x=>x.category===m).length})]},m))}),h.jsx("div",{className:"px-2 py-1",children:h.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[p.length," event",p.length!==1?"s":""]})}),h.jsx("div",{ref:a,className:"flex-1 overflow-auto",children:p.length===0?h.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2 py-4 text-center",children:["No events",n!=="all"?` in "${ey[n]}"`:"","."]}):h.jsx("div",{style:{height:`${f.getTotalSize()}px`,width:"100%",position:"relative"},children:f.getVirtualItems().map(m=>h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${m.size}px`,transform:`translateY(${m.start}px)`},children:h.jsx(JX,{event:p[m.index],onSelectItem:r})},m.key))})})]}):h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"Select a feature to see its timeline."})})}const Zo=["explore_design","prd","architecture","blueprint","plan","execute","report"];function rK(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function nK({currentPhase:t}){const e=Zo.indexOf(t);return h.jsx("div",{className:"space-y-1.5",children:Zo.map((r,n)=>{const i=e>n,s=e===n,o=_e[r]??r;return h.jsxs("div",{className:"flex items-center gap-2",style:{animation:`phase-slide-in 300ms ease-out ${n*50}ms both`},children:[i?h.jsx(jb,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?h.jsx(_b,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):h.jsx(ZA,{className:"w-3.5 h-3.5 text-muted-foreground/40 shrink-0"}),h.jsx("span",{className:rt("text-[11px] transition-colors duration-500",i&&"text-emerald-400",s&&"text-blue-400 font-medium",!i&&!s&&"text-muted-foreground/50"),children:o})]},r)})})}function iK({spawnedAgents:t,activeBuild:e,sessionState:r,agentActivity:n}){const i=(t||[]).filter(a=>a.status==="running"),s=(t||[]).filter(a=>a.status!=="running").slice(-3).reverse(),o=C.useMemo(()=>{const a=["design.md","blueprint.md","plan.md","prd.md","architecture.md"],l=new Set(((e==null?void 0:e.steps)||[]).filter(c=>c.status==="done"||c.status==="completed").map(c=>c.id||c.name));return a.map(c=>({name:c,done:l.has(c)||((e==null?void 0:e.steps)||[]).some(u=>{var d,p;return(u.status==="done"||u.status==="completed")&&(((d=u.id)==null?void 0:d.includes(c.replace(".md","")))||((p=u.name)==null?void 0:p.includes(c.replace(".md",""))))})}))},[e]);return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents"}),i.length===0&&s.length===0&&h.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-1",children:"No agents active"}),h.jsxs("div",{className:"mt-1 space-y-1.5",children:[i.map((a,l)=>h.jsx(Q0,{agent:a,toolCount:(r==null?void 0:r.toolCount)||0,errorCount:(r==null?void 0:r.errorCount)||0,currentTool:n==null?void 0:n.tool,currentCategory:n==null?void 0:n.category},a.agentId||l)),s.map((a,l)=>h.jsx(Q0,{agent:a},a.agentId||`r-${l}`))]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Artifacts"}),h.jsx("div",{className:"mt-1 space-y-1",children:o.map(a=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Pi,{className:rt("w-3 h-3",a.done?"text-emerald-400":"text-muted-foreground/40")}),h.jsx("span",{className:rt("text-[11px] font-mono",a.done?"text-foreground":"text-muted-foreground/50"),children:a.name})]},a.name))})]})]})}function sK({gates:t,allGates:e,items:r,onResolveGate:n}){const i=C.useMemo(()=>{const s=new Map,o=(e||[]).filter(a=>a.resolvedAt&&(a.outcome==="revised"||a.outcome==="revise")).sort((a,l)=>new Date(l.resolvedAt)-new Date(a.resolvedAt));for(const a of t||[]){const l=o.find(c=>c.stepId===a.stepId&&c.itemId===a.itemId);l!=null&&l.artifactSnapshot&&a.artifactSnapshot&&s.set(a.id,{priorSnapshot:l.artifactSnapshot,currentSnapshot:a.artifactSnapshot})}return s},[t,e]);return!t||t.length===0?h.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No gates pending."}):h.jsx("div",{className:"space-y-2",children:t.map(s=>{var l;const o=r.find(c=>c.id===s.itemId),a=(l=s.artifactAssessment)==null?void 0:l.completeness;return h.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/30",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-[11px] text-foreground truncate",children:(o==null?void 0:o.title)??"Unknown"}),h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[_n[s.stepId]??_e[s.fromPhase]??s.fromPhase??"Gate",a!=null&&` · ${Math.round(a*100)}% complete`]}),i.has(s.id)&&h.jsx("div",{className:"mt-1",children:h.jsx(Xp,{oldText:i.get(s.id).priorSnapshot,newText:i.get(s.id).currentSnapshot})})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(zt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>n(s.id,"approved"),children:"Approve"}),h.jsx(zt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",onClick:()=>n(s.id,"revised"),children:"Revise"}),h.jsx(zt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>n(s.id,"killed"),children:"Kill"})]})]})},s.id)})})}function oK({sessions:t,items:e,onSelect:r}){const n=(t||[]).slice(-5).reverse();return n.length===0?h.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No sessions yet."}):h.jsx("div",{className:"space-y-1",children:n.map(i=>{const s=i.featureCode||i.feature_code,o=s?e.find(l=>{var c;return l.featureCode===s||l.feature_code===s||((c=l.lifecycle)==null?void 0:c.featureCode)===s}):null,a=i.startedAt||i.created_date;return h.jsxs("div",{className:rt("flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 transition-colors",o&&"cursor-pointer"),onClick:()=>o&&r(o.id),children:[h.jsx(HM,{className:"w-3 h-3 text-muted-foreground shrink-0"}),h.jsx("span",{className:"text-[11px] text-foreground",children:i.agent||"agent"}),s&&h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:s}),h.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:rK(a)}),h.jsx("span",{className:rt("w-1.5 h-1.5 rounded-full shrink-0",i.status==="active"?"bg-emerald-400":"bg-slate-600")})]},i.id)})})}function aK({items:t=[],gates:e=[],sessions:r=[],activeBuild:n,spawnedAgents:i=[],featureCode:s,sessionState:o,agentActivity:a,iterationStates:l,onSelect:c,onResolveGate:u,onOpenGate:d}){var T;const p=C.useMemo(()=>t.find(_=>{var w;return _.featureCode===s||((w=_.lifecycle)==null?void 0:w.featureCode)===s}),[t,s]),[f,m]=C.useState(()=>{try{return localStorage.getItem("compose:timeline-open")==="true"}catch{return!1}}),x=C.useCallback(()=>{m(_=>{const w=!_;try{localStorage.setItem("compose:timeline-open",String(w))}catch{}return w})},[]),g=((T=p==null?void 0:p.lifecycle)==null?void 0:T.currentPhase)||(p==null?void 0:p.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,y=Zo.indexOf(g),b=g?Math.max(0,(y+1)/Zo.length):0,k=C.useMemo(()=>{let _=e.filter(w=>w.status==="pending"||!w.resolvedAt);if(s){const w=new Set(t.filter(N=>{var B;return N.featureCode===s||((B=N.lifecycle)==null?void 0:B.featureCode)===s}).map(N=>N.id));_=_.filter(N=>w.has(N.itemId))}return _},[e,t,s]);if(!s){const _=t.filter(w=>w.type==="feature"&&(w.status==="complete"||w.status==="done")).slice(-5);return h.jsx("div",{className:"flex-1 overflow-auto p-4",children:h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No feature in progress."}),h.jsx("p",{className:"text-[11px] text-muted-foreground/70 font-mono",children:"Run /compose <feature-code> in the terminal to start."}),_.length>0&&h.jsxs("div",{className:"mt-6 w-full max-w-sm",children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recently completed"}),h.jsx("div",{className:"mt-2 space-y-1",children:_.map(w=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>c(w.id),children:[h.jsx(jb,{className:"w-3 h-3 text-emerald-400 shrink-0"}),h.jsx("span",{className:"text-[11px] text-foreground truncate",children:w.title}),w.featureCode&&h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:w.featureCode})]},w.id))})]})]})})}return h.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[h.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4 min-w-0",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-sm font-semibold text-foreground truncate",children:(p==null?void 0:p.title)??s}),h.jsx(ar,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),g&&h.jsx(ar,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:_e[g]??g}),h.jsxs("button",{className:rt("ml-auto flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition-colors shrink-0",f?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:x,children:[h.jsx(yM,{className:"w-3 h-3"}),"Timeline"]})]}),h.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-muted overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full bg-blue-500",style:{width:`${Math.round(b*100)}%`,transition:"width 800ms cubic-bezier(0.4, 0, 0.2, 1)"}})}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:y>=0?`${y+1} of ${Zo.length} phases`:"Phase unknown"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs(tf,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[h.jsx(ef,{className:"p-3 pb-2",children:h.jsx(rf,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),h.jsx(nf,{className:"p-3 pt-0",children:h.jsx(nK,{currentPhase:g})})]}),h.jsxs(tf,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[h.jsx(ef,{className:"p-3 pb-2",children:h.jsx(rf,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),h.jsx(nf,{className:"p-3 pt-0",children:h.jsx(iK,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),l&&l.size>0&&h.jsx("div",{className:"space-y-2",children:[...l.values()].map(_=>h.jsxs("div",{className:"px-3 py-2.5 rounded border border-blue-500/30 bg-blue-500/10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[h.jsxs("span",{className:"text-[11px] text-blue-400 font-medium",children:[_.status==="running"?"↻":_.outcome==="clean"?"✓":"✗"," ",_.loopType==="review"?"Review Loop":"Coverage Sweep"]}),h.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[_.count," of ",_.maxIterations]})]}),h.jsx("div",{className:"h-1.5 rounded-full bg-blue-500/20 overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.round(_.count/_.maxIterations*100)}%`,transition:"width 600ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:_.outcome==="clean"?"#22c55e":_.outcome==="max_reached"?"#ef4444":"#3b82f6"}})}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:_.status==="running"?_.loopType==="review"?"Waiting for clean review...":"Waiting for tests passing...":_.outcome==="clean"?"Clean!":_.outcome==="max_reached"?"Max iterations reached":"Aborted"})]},_.loopId))}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Pending Gates"}),k.length>0&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:k.length})]}),h.jsx(sK,{gates:k,allGates:e,items:t,onResolveGate:u})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recent Sessions"}),h.jsx("div",{className:"mt-2",children:h.jsx(oK,{sessions:r,items:t,onSelect:c})})]})]}),f&&h.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0",children:[h.jsx("div",{className:"px-3 py-2 border-b border-border",children:h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Event Timeline"})}),h.jsx(eK,{featureCode:s,itemId:p==null?void 0:p.id,onSelectItem:c})]})]})}function lK(t,e){var i,s;if(!((i=t.tags)!=null&&i.length)||!((s=e.tags)!=null&&s.length))return 0;const r=new Set(t.tags);return e.tags.filter(o=>r.has(o)).length/Math.max(t.tags.length,e.tags.length)}function cK(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:lK(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function hK({results:t,onClose:e}){const r=C.useMemo(()=>{const i={P0:0,P1:0,P2:0,killed:0,promoted:0,skipped:0};for(const s of t)s.action==="skip"?i.skipped++:s.action==="kill"?i.killed++:s.action==="promote"?i.promoted++:s.priority==="P0"?i.P0++:s.priority==="P1"?i.P1++:s.priority==="P2"&&i.P2++;return i},[t]),n=t.filter(i=>i.action!=="skip").length;return h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 text-center",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:h.jsx(_i,{className:"w-5 h-5 text-emerald-400"})}),h.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Triage complete"}),h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Triaged ",n," of ",t.length," ideas"]}),h.jsxs("div",{className:"flex gap-3 text-[11px]",children:[r.P0>0&&h.jsxs("span",{className:"text-red-400",children:[r.P0," P0"]}),r.P1>0&&h.jsxs("span",{className:"text-amber-400",children:[r.P1," P1"]}),r.P2>0&&h.jsxs("span",{className:"text-blue-400",children:[r.P2," P2"]}),r.promoted>0&&h.jsxs("span",{className:"text-emerald-400",children:[r.promoted," promoted"]}),r.killed>0&&h.jsxs("span",{className:"text-muted-foreground",children:[r.killed," killed"]}),r.skipped>0&&h.jsxs("span",{className:"text-muted-foreground/60",children:[r.skipped," skipped"]})]}),h.jsx(zt,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function uK({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=Rs(),[o,a]=C.useState(()=>[...t]),[l,c]=C.useState(0),[u,d]=C.useState([]),[p,f]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[b,k]=C.useState(!1),T=o[l]??null;o.length-l;const _=C.useMemo(()=>T?cK(T,s.filter(P=>P.id!==T.id)):[],[T,s]),w=C.useCallback(()=>{const P=l+1;P>=o.length?f(!0):(c(P),y(!1),x(""))},[l,o.length]),N=C.useCallback(async P=>{if(!(!T||b)){k(!0);try{await r(T.id,P),d(z=>[...z,{id:T.id,action:"priority",priority:P}]),w()}finally{k(!1)}}},[T,b,r,w]),B=C.useCallback(async()=>{if(!(!T||b)){k(!0);try{await n(T.id,m),d(P=>[...P,{id:T.id,action:"kill"}]),y(!1),x(""),w()}finally{k(!1)}}},[T,b,n,m,w]),I=C.useCallback(()=>{T&&(d(P=>[...P,{id:T.id,action:"skip"}]),w())},[T,w]),E=C.useCallback(async()=>{if(!(!T||b)){k(!0);try{await i(T.id),d(P=>[...P,{id:T.id,action:"promote"}]),w()}finally{k(!1)}}},[T,b,i,w]);return C.useEffect(()=>{const P=z=>{if(z.key==="Escape"){e();return}g||(z.key==="0"&&N("P0"),z.key==="1"&&N("P1"),z.key==="2"&&N("P2"),(z.key==="s"||z.key==="ArrowRight")&&I(),z.key==="k"&&y(!0))};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[g,N,I,e]),h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"hsl(var(--background) / 0.8)",backdropFilter:"blur(4px)"},children:h.jsxs("div",{className:"w-full max-w-lg mx-4 rounded-xl border border-border bg-card shadow-2xl flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[h.jsx(_i,{className:"w-4 h-4 text-amber-400 shrink-0"}),h.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Triage"}),!p&&h.jsxs("span",{className:"text-[11px] text-muted-foreground ml-1",children:[l+1," of ",o.length," untriaged"]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:h.jsx(dn,{className:"w-4 h-4"})})]}),!p&&h.jsx("div",{className:"h-1 bg-muted",children:h.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${Math.round(l/o.length*100)}%`}})}),h.jsx("div",{className:"flex-1 p-4",children:p?h.jsx(hK,{results:u,onClose:e}):T?h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:T.id}),T.cluster&&h.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:T.cluster})]}),h.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:T.title}),T.description&&h.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:T.description}),h.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(T.tags||[]).map(P=>h.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:P},P))}),T.source&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",T.source]})]}),_.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Similar to:"}),h.jsx("div",{className:"space-y-1",children:_.map(P=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-muted/30 border border-border/40",children:[h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:P.id}),h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:P.title})]},P.id))})]}),g&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing (optional)…",value:m,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&B(),P.key==="Escape"&&y(!1)},className:"w-full text-[12px] bg-muted text-foreground px-3 py-2 rounded border border-border outline-none focus:border-ring"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(zt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),h.jsx(zt,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:B,disabled:b,children:"Confirm Kill"})]})]})]}):h.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-8",children:"No more untriaged ideas."})}),!p&&T&&!g&&h.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsxs(zt,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>N("P0"),disabled:b,title:"Press 0",children:["P0 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),h.jsxs(zt,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>N("P1"),disabled:b,title:"Press 1",children:["P1 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),h.jsxs(zt,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>N("P2"),disabled:b,title:"Press 2",children:["P2 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"2"})]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsx(zt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:E,disabled:b,children:"Promote"}),h.jsxs(zt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>y(!0),title:"Press k",children:["Kill ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"k"})]}),h.jsxs(zt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:I,title:"Press s or →",children:[h.jsx(Pb,{className:"w-3 h-3"}),"Skip ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function ry(t){var n;if(!t)return"";const r=(t.cluster||"").toUpperCase().replace(/[^A-Z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,8);if(!r){const i=(((n=t.tags)==null?void 0:n[0])||"").replace("#","").toUpperCase().slice(0,6);return i?`${i}-1`:"FEAT-1"}return`${r}-1`}function dK(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
|
|
746
|
-
|
|
747
|
-
**Date:** ${r}
|
|
748
|
-
**Promoted from:** ${t.id}
|
|
749
|
-
**Priority:** ${t.priority||"TBD"}
|
|
750
|
-
**Tags:** ${n}
|
|
751
|
-
|
|
752
|
-
## Context
|
|
753
|
-
|
|
754
|
-
${t.description||t.title}
|
|
755
|
-
|
|
756
|
-
## Source
|
|
757
|
-
|
|
758
|
-
${t.source||"Internal idea"}
|
|
759
|
-
|
|
760
|
-
## Goals
|
|
761
|
-
|
|
762
|
-
- [ ] Define acceptance criteria
|
|
763
|
-
- [ ] Identify affected components
|
|
764
|
-
- [ ] Estimate effort
|
|
765
|
-
|
|
766
|
-
## Related
|
|
767
|
-
|
|
768
|
-
${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
|
|
769
|
-
`.trimStart()}function fK({step:t,current:e}){const r=e>t,n=e===t;return h.jsx("div",{className:"flex items-center gap-1.5",children:h.jsx("div",{className:rt("w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-semibold border transition-colors",r?"bg-emerald-400/20 border-emerald-400/60 text-emerald-400":n?"bg-accent/20 border-accent/60 text-accent":"bg-muted border-border/40 text-muted-foreground/40"),children:r?h.jsx(ba,{className:"w-3 h-3"}):t})})}function pK({idea:t,onClose:e}){var _;const{promoteIdea:r}=Rs(),[n,i]=C.useState(1),[s,o]=C.useState(()=>ry(t)),[a,l]=C.useState(""),[c,u]=C.useState(""),[d,p]=C.useState(!1),[f,m]=C.useState(null),x=C.useRef(null);C.useEffect(()=>{u(dK(t,s||"FEAT-?"))},[t,s]),C.useEffect(()=>{n===1&&setTimeout(()=>{var w;return(w=x.current)==null?void 0:w.focus()},50)},[n]);const g=()=>s.trim()?/^[A-Z0-9][A-Z0-9-]*[A-Z0-9]$/i.test(s.trim())?(l(""),!0):(l("Use format like FEAT-1 or COMP-UI-5"),!1):(l("Feature code is required"),!1),y=()=>{n===1&&!g()||i(w=>w+1)},b=()=>i(w=>w-1),k=async()=>{if(!d){p(!0);try{await r(t.id,s.trim().toUpperCase()),m({featureCode:s.trim().toUpperCase()}),i(4)}catch(w){l(w.message||"Failed to promote"),i(1)}finally{p(!1)}}},T=["Feature ID","Preview","Confirm"];return h.jsx(Jp,{open:!0,onOpenChange:w=>!w&&e(),children:h.jsxs(ph,{className:"max-w-lg",children:[h.jsx(mh,{children:h.jsxs(gh,{className:"flex items-center gap-2",children:[h.jsx(_i,{className:"w-4 h-4 text-amber-400"}),"Promote to Feature"]})}),n<4&&h.jsx("div",{className:"px-6 -mt-1 mb-1",children:h.jsx("div",{className:"flex items-center gap-2",children:[1,2,3].map((w,N)=>h.jsxs(Xt.Fragment,{children:[h.jsx(fK,{step:w,current:n}),h.jsx("span",{className:rt("text-[10px] transition-colors",n===w?"text-foreground font-medium":"text-muted-foreground/60"),children:T[N]}),N<2&&h.jsx(Ps,{className:"w-3 h-3 text-muted-foreground/30 mx-0.5"})]},w))})}),h.jsxs("div",{className:"px-6 pb-2",children:[n<4&&h.jsxs("div",{className:"mb-4 px-3 py-2 rounded border border-border/50 bg-muted/20",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:t.id}),t.priority&&t.priority!=="—"&&h.jsx("span",{className:rt("text-[9px] px-1 py-0.5 rounded font-mono font-semibold",t.priority==="P0"?"text-red-400":t.priority==="P1"?"text-amber-400":"text-blue-400"),children:t.priority})]}),h.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug",children:t.title})]}),n===1&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Feature Code"}),h.jsx("input",{ref:x,type:"text",value:s,onChange:w=>{o(w.target.value.toUpperCase()),l("")},onKeyDown:w=>{w.key==="Enter"&&y()},placeholder:"e.g. COMP-UI-5",className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring font-mono"}),a&&h.jsx("p",{className:"text-[11px] text-destructive mt-1",children:a})]}),t.cluster&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Suggested from cluster: ",h.jsx("span",{className:"text-muted-foreground",children:t.cluster})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Suggestions"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:[ry(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((w,N,B)=>B.indexOf(w)===N).map(w=>h.jsx("button",{onClick:()=>{o(w),l("")},className:rt("text-[10px] px-2 py-1 rounded border font-mono transition-colors",s===w?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:w},w))})]})]}),n===2&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Generated plan.md stub"}),h.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground bg-muted/40 border border-border/40 rounded p-3 overflow-auto max-h-48 whitespace-pre-wrap leading-relaxed",children:c}),h.jsx("p",{className:"text-[10px] text-muted-foreground/60",children:"This stub will be created when you run the promote workflow from the CLI."})]}),n===3&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Promote ",h.jsx("span",{className:"text-foreground font-medium",children:t.id})," to feature"," ",h.jsx("span",{className:"font-mono text-accent font-semibold",children:s}),"?"]}),h.jsxs("p",{className:"text-[11px] text-muted-foreground/70",children:["The idea will be marked ",h.jsxs("span",{className:"font-mono",children:["PROMOTED (",s,")"]})," in the ideabox."]})]}),n===4&&f&&h.jsxs("div",{className:"flex flex-col items-center gap-3 py-4 text-center",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:h.jsx(ba,{className:"w-5 h-5 text-emerald-400"})}),h.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Promoted!"}),h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t.id," is now linked to feature"," ",h.jsx("span",{className:"font-mono text-accent font-semibold",children:f.featureCode})]}),h.jsx(zt,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&h.jsxs(tm,{children:[n>1&&h.jsxs(zt,{variant:"ghost",size:"sm",onClick:b,disabled:d,children:[h.jsx(Eb,{className:"w-3 h-3 mr-1"}),"Back"]}),h.jsx(zt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?h.jsxs(zt,{size:"sm",onClick:y,children:["Next",h.jsx(Ps,{className:"w-3 h-3 ml-1"})]}):h.jsx(zt,{size:"sm",onClick:k,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const sf=["S","M","L"],mK=["high","medium","low"],gK={"high-S":"Quick Wins","high-M":"Quick Wins","high-L":"Big Bets","medium-S":"Fill-ins","medium-M":"Fill-ins","medium-L":"Money Pits","low-S":"Fill-ins","low-M":"Fill-ins","low-L":"Money Pits"},ny={"Quick Wins":"bg-emerald-400/8 border-emerald-400/20","Big Bets":"bg-blue-400/8 border-blue-400/20","Fill-ins":"bg-amber-400/8 border-amber-400/20","Money Pits":"bg-red-400/8 border-red-400/20"},iy=["bg-blue-400","bg-violet-400","bg-emerald-400","bg-amber-400","bg-rose-400","bg-cyan-400","bg-orange-400","bg-pink-400"];function xK({idea:t,onSubmit:e,onCancel:r}){const[n,i]=C.useState(t.effort||""),[s,o]=C.useState(t.impact||"");return h.jsxs("div",{className:"p-2 bg-card border border-border rounded-lg shadow-md w-52",children:[h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-2 truncate font-medium",children:[t.id,": ",t.title]}),h.jsxs("div",{className:"mb-2",children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Effort"}),h.jsx("div",{className:"flex gap-1",children:sf.map(a=>h.jsx("button",{onClick:()=>i(a),className:rt("flex-1 text-[10px] py-0.5 rounded border transition-colors",n===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),h.jsxs("div",{className:"mb-2.5",children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Impact"}),h.jsx("div",{className:"flex gap-1",children:["high","medium","low"].map(a=>h.jsx("button",{onClick:()=>o(a),className:rt("flex-1 text-[9px] py-0.5 rounded border transition-colors capitalize",s===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),h.jsxs("div",{className:"flex gap-1",children:[h.jsx("button",{onClick:r,className:"flex-1 text-[10px] py-1 rounded border border-border/40 text-muted-foreground hover:border-border transition-colors",children:"Cancel"}),h.jsx("button",{onClick:()=>n&&s&&e(t.id,{effort:n,impact:s}),disabled:!n||!s,className:"flex-1 text-[10px] py-1 rounded border border-primary/50 bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-40 transition-colors",children:"Save"})]})]})}function yK({ideas:t,selectedIdeaId:e,onSelectIdea:r,onUpdateIdea:n}){const[i,s]=C.useState(null),o=C.useMemo(()=>{const u=[...new Set(t.map(p=>p.cluster||"__none__"))],d={};return u.forEach((p,f)=>{d[p]=iy[f%iy.length]}),d},[t]),a=C.useMemo(()=>t.filter(u=>u.effort&&u.impact),[t]),l=C.useMemo(()=>t.filter(u=>!u.effort||!u.impact),[t]),c=C.useCallback(async(u,d)=>{await n(u,d),s(null)},[n]);return h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{children:[h.jsx("div",{className:"flex mb-1 ml-12",children:sf.map(u=>h.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),mK.map(u=>h.jsxs("div",{className:"flex mb-1",children:[h.jsx("div",{className:"w-12 shrink-0 flex items-center justify-end pr-2",children:h.jsx("span",{className:"text-[9px] text-muted-foreground capitalize",children:u})}),sf.map(d=>{const p=`${u}-${d}`,f=gK[p],m=a.filter(x=>x.impact===u&&x.effort===d);return h.jsxs("div",{className:rt("flex-1 min-h-[90px] rounded border p-1.5 mr-1 relative transition-colors",ny[f]||"border-border/30"),children:[h.jsx("span",{className:"absolute top-1 right-1 text-[8px] text-muted-foreground/50 italic",children:f}),h.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:m.map(x=>{const g=o[x.cluster||"__none__"]||"bg-muted-foreground",y=x.id===e;return h.jsx("button",{onClick:()=>r==null?void 0:r(x.id),title:`${x.id}: ${x.title}`,className:rt("w-5 h-5 rounded-full border-2 transition-all hover:scale-110 flex items-center justify-center",g,y?"border-foreground ring-1 ring-foreground":"border-transparent")},x.id)})})]},d)})]},u)),h.jsx("div",{className:"flex ml-12",children:h.jsx("div",{className:"flex-1 text-center text-[9px] text-muted-foreground/60 mt-0.5",children:"Effort (S = small, M = medium, L = large)"})})]}),h.jsx("div",{className:"flex flex-wrap gap-3 text-[10px]",children:Object.entries(ny).map(([u,d])=>h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:rt("w-2.5 h-2.5 rounded-sm border",d)}),h.jsx("span",{className:"text-muted-foreground",children:u})]},u))}),l.length>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-2",children:["Unassigned (",l.length,") — click to assign effort/impact"]}),h.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(u=>h.jsxs("div",{className:"relative",children:[h.jsxs("button",{onClick:()=>s((i==null?void 0:i.id)===u.id?null:u),className:rt("text-[10px] px-2 py-1 rounded border transition-colors",(i==null?void 0:i.id)===u.id?"border-accent bg-accent/10 text-foreground":"border-border/50 text-muted-foreground hover:border-border hover:text-foreground"),children:[h.jsx("span",{className:"font-mono text-[9px] mr-1 opacity-60",children:u.id}),u.title.slice(0,30),u.title.length>30?"…":""]}),(i==null?void 0:i.id)===u.id&&h.jsx("div",{className:"absolute left-0 top-full mt-1 z-10",children:h.jsx(xK,{idea:u,onSubmit:c,onCancel:()=>s(null)})})]},u.id))})]})]})}function Fu({value:t,max:e,color:r="bg-primary/60"}){const n=e>0?Math.round(t/e*100):0;return h.jsx("div",{className:"flex-1 h-1.5 bg-muted/50 rounded-full overflow-hidden",children:h.jsx("div",{className:rt("h-full rounded-full transition-all",r),style:{width:`${n}%`}})})}function bK({ideas:t,killed:e}){const[r,n]=C.useState(!1),i=C.useMemo(()=>{var b,k,T,_;const s=[...t,...e||[]],o={};for(const w of s){const N=((b=w.source)==null?void 0:b.trim())||"(no source)",B=N.length>30?N.slice(0,30)+"…":N;o[B]=(o[B]||0)+1}const a=Object.entries(o).sort((w,N)=>N[1]-w[1]).slice(0,6),l=((k=a[0])==null?void 0:k[1])||1,c=s.filter(w=>w.status==="NEW").length,u=s.filter(w=>w.status==="DISCUSSING").length,d=s.filter(w=>{var N;return(N=w.status)==null?void 0:N.startsWith("PROMOTED")}).length,p=(e||[]).length,f=t.length,m=s.length>0?Math.round(p/s.length*100):0,x={};for(const w of s){const N=w.cluster||"(unclustered)";x[N]||(x[N]={total:0,promoted:0}),x[N].total+=1,(T=w.status)!=null&&T.startsWith("PROMOTED")&&(x[N].promoted+=1)}const g=Object.entries(x).sort((w,N)=>N[1].total-w[1].total).slice(0,5),y=((_=g[0])==null?void 0:_[1].total)||1;return{sourceEntries:a,maxSourceCount:l,newCount:c,discussingCount:u,promotedCount:d,killedCount:p,killRate:m,totalActive:f,clusterEntries:g,maxClusterTotal:y}},[t,e]);return t.length===0&&(!e||e.length===0)?null:h.jsxs("div",{className:"mt-1.5",children:[h.jsxs("button",{onClick:()=>n(s=>!s),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/70 hover:text-muted-foreground transition-colors",children:[r?h.jsx(Ca,{className:"w-3 h-3"}):h.jsx(Ps,{className:"w-3 h-3"}),h.jsx(RA,{className:"w-3 h-3"}),h.jsx("span",{children:"Analytics"})]}),r&&h.jsxs("div",{className:"mt-2 space-y-3 border border-border/30 rounded-lg p-3 bg-muted/10",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Status Funnel"}),h.jsx("div",{className:"space-y-1",children:[{label:"NEW",count:i.newCount,color:"bg-emerald-400/60"},{label:"DISCUSSING",count:i.discussingCount,color:"bg-amber-400/60"},{label:"PROMOTED",count:i.promotedCount,color:"bg-blue-400/60"},{label:"KILLED",count:i.killedCount,color:"bg-muted-foreground/40"}].map(({label:s,count:o,color:a})=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-16 text-[9px] text-muted-foreground shrink-0",children:s}),h.jsx(Fu,{value:o,max:Math.max(i.newCount,i.discussingCount,i.promotedCount,i.killedCount,1),color:a}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))}),i.killRate>0&&h.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-1",children:["Kill rate: ",i.killRate,"%"]})]}),i.sourceEntries.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"By Source"}),h.jsx("div",{className:"space-y-1",children:i.sourceEntries.map(([s,o])=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),h.jsx(Fu,{value:o,max:i.maxSourceCount,color:"bg-violet-400/50"}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))})]}),i.clusterEntries.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Cluster Health"}),h.jsx("div",{className:"space-y-1",children:i.clusterEntries.map(([s,{total:o,promoted:a}])=>{const l=o>0?Math.round(a/o*100):0;return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),h.jsx(Fu,{value:o,max:i.maxClusterTotal,color:"bg-cyan-400/50"}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o}),l>0&&h.jsxs("span",{className:"text-[9px] text-blue-400 shrink-0",children:[l,"%"]})]},s)})})]})]})]})}const CK=[{key:"—",label:"Untriaged",color:"text-muted-foreground",bg:"bg-muted/20",border:"border-border/50"},{key:"P0",label:"P0",color:"text-red-400",bg:"bg-red-400/10",border:"border-red-400/30"},{key:"P1",label:"P1",color:"text-amber-400",bg:"bg-amber-400/10",border:"border-amber-400/30"},{key:"P2",label:"P2",color:"text-blue-400",bg:"bg-blue-400/10",border:"border-blue-400/30"}];function sy(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function a_({status:t}){const e=t==="NEW"?"bg-emerald-400":t==="DISCUSSING"?"bg-amber-400":t!=null&&t.startsWith("PROMOTED")?"bg-blue-400":"bg-muted-foreground/40";return h.jsx("span",{className:rt("inline-block w-2 h-2 rounded-full shrink-0",e),title:t})}function kK({priority:t}){if(!t||t==="—")return h.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded border border-border/40 text-muted-foreground/60",children:"untriaged"});const e={P0:"bg-red-400/15 text-red-400 border-red-400/30",P1:"bg-amber-400/15 text-amber-400 border-amber-400/30",P2:"bg-blue-400/15 text-blue-400 border-blue-400/30"};return h.jsx("span",{className:rt("text-[9px] px-1.5 py-0.5 rounded border font-mono font-semibold",e[t]||"border-border/40 text-muted-foreground"),children:t})}function vK({idea:t,selected:e,onClick:r,onDragStart:n,onDragEnd:i}){var s;return h.jsxs("div",{draggable:!0,onDragStart:o=>n==null?void 0:n(o,t.id),onDragEnd:i,onClick:()=>r==null?void 0:r(t.id),className:rt("group px-3 py-2.5 rounded border cursor-pointer transition-colors select-none","hover:border-accent/50",e?"border-accent/60 bg-accent/5":"border-border/50 bg-card/60"),children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),h.jsx(a_,{status:t.status}),h.jsx("div",{className:"flex-1"}),h.jsx(kK,{priority:t.priority})]}),h.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug mb-1 line-clamp-2",children:t.title}),((s=t.tags)==null?void 0:s.length)>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[t.tags.slice(0,4).map(o=>h.jsx("span",{className:"text-[9px] text-muted-foreground/70 font-mono",children:o},o)),t.tags.length>4&&h.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["+",t.tags.length-4]})]}),t.source&&h.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.source})]})}function wK({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,b,k,T;const[o,a]=C.useState(""),[l,c]=C.useState(!1),[u,d]=C.useState(!1),[p,f]=C.useState(""),[m,x]=C.useState(!1);if(!t)return null;const g=async()=>{const _=p.trim();if(_){x(!0);try{await s(t.id,"human",_),f("")}finally{x(!1)}}};return h.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0 overflow-hidden",children:[h.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),h.jsx(a_,{status:t.status}),h.jsx("span",{className:"text-[11px] text-muted-foreground flex-1 truncate",children:t.status}),h.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground text-xs px-1",children:"x"})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Title"}),h.jsx("p",{className:"text-[13px] text-foreground font-medium leading-snug",children:t.title})]}),t.description&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),h.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:t.description})]}),t.source&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Source"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.source})]}),t.cluster&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Cluster"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.cluster})]}),((y=t.tags)==null?void 0:y.length)>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Tags"}),h.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(_=>h.jsx("span",{className:"text-[10px] bg-muted/50 px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:_},_))})]}),t.mapsTo&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Maps To"}),h.jsx("p",{className:"text-[11px] text-muted-foreground font-mono",children:t.mapsTo})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5 flex items-center gap-1",children:[h.jsx(zc,{className:"w-3 h-3"}),"Discussion",((b=t.discussion)==null?void 0:b.length)>0&&h.jsxs("span",{className:"text-muted-foreground/50",children:["(",t.discussion.length,")"]})]}),((k=t.discussion)==null?void 0:k.length)>0&&h.jsx("div",{className:"space-y-1.5 mb-2",children:t.discussion.map((_,w)=>h.jsxs("div",{className:"px-2 py-1.5 rounded bg-muted/30 border border-border/30",children:[h.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[h.jsx("span",{className:rt("text-[9px] font-mono font-semibold",_.author==="agent"?"text-blue-400":"text-emerald-400"),children:_.author}),h.jsx("span",{className:"text-[9px] text-muted-foreground/50",children:_.date})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground leading-relaxed",children:_.text})]},w))}),h.jsxs("div",{className:"flex gap-1.5 items-end",children:[h.jsx("input",{type:"text",placeholder:"Add comment…",value:p,onChange:_=>f(_.target.value),onKeyDown:_=>_.key==="Enter"&&!_.shiftKey&&g(),className:"flex-1 text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring",disabled:m}),h.jsx("button",{onClick:g,disabled:!p.trim()||m,className:"shrink-0 p-1.5 rounded border border-border/50 text-muted-foreground hover:text-foreground disabled:opacity-40 transition-colors",children:h.jsx(Ff,{className:"w-3 h-3"})})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Priority"}),h.jsx("div",{className:"flex gap-1.5",children:["P0","P1","P2","—"].map(_=>h.jsx("button",{onClick:()=>i(t.id,_),className:rt("flex-1 text-[10px] px-1.5 py-1 rounded border transition-colors",t.priority===_?_==="P0"?"bg-red-400/20 text-red-400 border-red-400/50":_==="P1"?"bg-amber-400/20 text-amber-400 border-amber-400/50":_==="P2"?"bg-blue-400/20 text-blue-400 border-blue-400/50":"bg-muted text-muted-foreground border-border":"border-border/40 text-muted-foreground hover:border-border"),children:_==="—"?"none":_},_))})]})]}),!((T=t.status)!=null&&T.startsWith("PROMOTED"))&&t.status!=="KILLED"&&h.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[h.jsx(zt,{size:"sm",className:"w-full h-7 text-[11px]",onClick:()=>r(t),children:"Promote to Feature"}),l?h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing…",value:o,onChange:_=>a(_.target.value),className:"w-full text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsx(zt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{c(!1),a("")},children:"Cancel"}),h.jsx(zt,{size:"sm",className:"flex-1 h-7 text-[10px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:()=>{n(t.id,o),c(!1),a("")},children:"Confirm Kill"})]})]}):h.jsx(zt,{size:"sm",variant:"outline",className:"w-full h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>c(!0),children:"Kill"})]})]})}function SK({killed:t,onResurrect:e}){const[r,n]=C.useState(!1);return t.length===0?null:h.jsxs("div",{className:"mt-4 border border-border/40 rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>n(i=>!i),className:"w-full flex items-center gap-2 px-4 py-2.5 bg-muted/30 hover:bg-muted/50 transition-colors text-left",children:[r?h.jsx(Ca,{className:"w-3 h-3 text-muted-foreground"}):h.jsx(Ps,{className:"w-3 h-3 text-muted-foreground"}),h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Graveyard"}),h.jsxs("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:["(",t.length,")"]})]}),r&&h.jsx("div",{className:"p-3 grid grid-cols-1 gap-2 bg-muted/10",children:t.map(i=>h.jsx("div",{className:"px-3 py-2 rounded border border-border/40 bg-card/40",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[h.jsx(ar,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0 opacity-60",children:i.id}),h.jsx("p",{className:"text-[11px] text-muted-foreground/70 line-clamp-1 font-medium",children:i.title})]}),i.killedDate&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Killed ",i.killedDate,i.killedReason?` — ${i.killedReason}`:""]})]}),h.jsx("button",{onClick:()=>e(i.id),className:"shrink-0 text-[10px] text-muted-foreground/60 hover:text-foreground border border-border/40 px-1.5 py-0.5 rounded transition-colors",title:"Resurrect",children:"Resurrect"})]})},i.id))})]})}function TK(){const{ideas:t,killed:e,loading:r,error:n,selectedIdeaId:i,filters:s,hydrate:o,setPriority:a,killIdea:l,resurrectIdea:c,setSelectedIdea:u,updateFilters:d,addDiscussion:p,updateIdea:f}=Rs(),[m,x]=C.useState(!1),[g,y]=C.useState(null),[b,k]=C.useState(null),[T,_]=C.useState(null),[w,N]=C.useState("cards"),B=C.useMemo(()=>{var Q;const D=t.filter(A=>A.status==="NEW").length,O=t.filter(A=>!A.priority||A.priority==="—").length,j=t.filter(A=>A.priority==="P0").length,S={};t.filter(A=>A.priority==="P0"&&A.cluster).forEach(A=>{S[A.cluster]=(S[A.cluster]||0)+1});const G=((Q=Object.entries(S).sort((A,ct)=>ct[1]-A[1])[0])==null?void 0:Q[0])??null;return{newCount:D,untriaged:O,p0Count:j,topCluster:G}},[t]),I=C.useMemo(()=>{const D=new Set;return t.forEach(O=>(O.tags||[]).forEach(j=>D.add(j))),[...D].sort()},[t]),E=C.useMemo(()=>t.filter(D=>{var O;if(s.tag&&!((O=D.tags)!=null&&O.includes(s.tag))||s.status&&(D.status||"").split(/\s+/)[0]!==s.status||s.priority&&D.priority!==s.priority)return!1;if(s.search){const j=s.search.toLowerCase();if(!`${D.title} ${D.description} ${D.id} ${(D.tags||[]).join(" ")}`.toLowerCase().includes(j))return!1}return!0}),[t,s]),P=C.useMemo(()=>{const D=new Map,O=[];E.forEach(G=>{G.cluster?(D.has(G.cluster)||D.set(G.cluster,[]),D.get(G.cluster).push(G)):O.push(G)});const j=G=>[...G].sort((Q,A)=>sy(Q.priority)-sy(A.priority)),S=[];for(const[G,Q]of D)S.push({cluster:G,ideas:j(Q)});return O.length>0&&S.push({cluster:null,ideas:j(O)}),S},[E]),z=C.useMemo(()=>t.find(D=>D.id===i)||e.find(D=>D.id===i)||null,[t,e,i]),q=C.useCallback((D,O)=>{k(O),D.dataTransfer.effectAllowed="move"},[]),R=C.useCallback(()=>{k(null),_(null)},[]),F=C.useCallback((D,O)=>{D.preventDefault(),D.dataTransfer.dropEffect="move",_(O)},[]),M=C.useCallback(async(D,O)=>{D.preventDefault(),b&&await a(b,O),k(null),_(null)},[b,a]);return h.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[h.jsxs("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx(_i,{className:"w-4 h-4 text-amber-400 shrink-0"}),h.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Ideabox"}),r&&h.jsx(Gl,{className:"w-3 h-3 text-muted-foreground animate-spin"}),h.jsx("div",{className:"flex-1"}),h.jsxs("div",{className:"flex items-center gap-0.5 border border-border/50 rounded-md p-0.5",children:[h.jsx("button",{onClick:()=>N("cards"),className:rt("text-[10px] px-2 py-0.5 rounded transition-colors",w==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Cards"}),h.jsx("button",{onClick:()=>N("matrix"),className:rt("text-[10px] px-2 py-0.5 rounded transition-colors",w==="matrix"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Matrix"})]}),h.jsx("button",{onClick:()=>o(),className:"text-[10px] text-muted-foreground/60 hover:text-muted-foreground transition-colors",title:"Refresh",children:h.jsx(Gl,{className:"w-3 h-3"})}),h.jsxs(zt,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:B.untriaged===0,children:["Triage (",B.untriaged,")"]})]}),h.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[B.newCount>0&&h.jsxs("span",{className:"text-emerald-400",children:[B.newCount," new"]}),h.jsxs("span",{children:[B.untriaged," untriaged"]}),B.p0Count>0&&h.jsxs("span",{className:"text-red-400",children:[B.p0Count," P0"]}),B.topCluster&&h.jsxs("span",{children:["top cluster: ",h.jsx("span",{className:"text-foreground",children:B.topCluster})]}),h.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),h.jsx(bK,{ideas:t,killed:e})]}),h.jsxs("div",{className:"px-4 py-2 border-b border-border shrink-0 flex items-center gap-2 flex-wrap",children:[h.jsx(oM,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsxs("select",{value:s.tag,onChange:D=>d({tag:D.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All tags"}),I.map(D=>h.jsx("option",{value:D,children:D},D))]}),h.jsxs("select",{value:s.status,onChange:D=>d({status:D.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All statuses"}),h.jsx("option",{value:"NEW",children:"New"}),h.jsx("option",{value:"DISCUSSING",children:"Discussing"}),h.jsx("option",{value:"PROMOTED",children:"Promoted"})]}),h.jsxs("select",{value:s.priority,onChange:D=>d({priority:D.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All priorities"}),h.jsx("option",{value:"P0",children:"P0"}),h.jsx("option",{value:"P1",children:"P1"}),h.jsx("option",{value:"P2",children:"P2"}),h.jsx("option",{value:"—",children:"Untriaged"})]}),h.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[120px]",children:[h.jsx(ni,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:D=>d({search:D.target.value}),className:"flex-1 text-[11px] bg-transparent text-foreground outline-none placeholder:text-muted-foreground/40 min-w-0"})]}),(s.tag||s.status||s.priority||s.search)&&h.jsx("button",{onClick:()=>Rs.getState().clearFilters(),className:"text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors",children:"Clear"})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&h.jsx("div",{className:"mb-4 px-3 py-2 rounded border border-destructive/30 bg-destructive/10",children:h.jsx("p",{className:"text-[11px] text-destructive",children:n})}),w==="matrix"&&h.jsx(yK,{ideas:E,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:f}),w==="cards"&&E.length===0&&!r&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-2",children:[h.jsx(_i,{className:"w-8 h-8 text-muted-foreground/30"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"No ideas yet."}),h.jsxs("p",{className:"text-[11px] text-muted-foreground/60",children:["Use the CLI: ",h.jsx("span",{className:"font-mono",children:'compose idea "Your idea title"'})]})]}),w==="cards"&&P.map(({cluster:D,ideas:O})=>h.jsxs("div",{className:"mb-6",children:[D&&h.jsxs("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold mb-3 flex items-center gap-2",children:[h.jsx("span",{children:D}),h.jsxs("span",{className:"text-muted-foreground/40 normal-case tracking-normal font-normal",children:["(",O.length,")"]})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3",children:CK.map(j=>{const S=O.filter(Q=>Q.priority===j.key),G=T===j.key&&b;return h.jsxs("div",{className:rt("rounded-lg border p-2 min-h-[80px] transition-colors",j.bg,j.border,G&&"ring-1 ring-accent"),onDragOver:Q=>F(Q,j.key),onDrop:Q=>M(Q,j.key),children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[h.jsx("span",{className:rt("text-[10px] font-semibold uppercase tracking-wider",j.color),children:j.label}),h.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["(",S.length,")"]})]}),h.jsxs("div",{className:"space-y-1.5",children:[S.map(Q=>h.jsx(vK,{idea:Q,selected:i===Q.id,onClick:u,onDragStart:q,onDragEnd:R},Q.id)),S.length===0&&h.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},j.key)})})]},D||"__unclustered__")),w==="cards"&&h.jsx(SK,{killed:e,onResurrect:c})]})]}),z&&h.jsx(wK,{idea:z,onClose:()=>u(null),onPromote:D=>y(D),onKill:l,onSetPriority:a,onAddDiscussion:p}),m&&h.jsx(uK,{ideas:t.filter(D=>!D.priority||D.priority==="—"),onClose:()=>x(!1)}),g&&h.jsx(pK,{idea:g,onClose:()=>y(null)})]})}const _K=["A","B","C","D","E","F","G","H"];function EK({card:t,recommended:e=!1,selected:r=!1,disabled:n=!1,onSelect:i}){var a;const s=parseInt(t.id,10),o=Number.isFinite(s)?_K[s]??t.id:t.id;return h.jsxs("button",{type:"button",disabled:n,onClick:()=>i==null?void 0:i(t.id),className:["relative w-full text-left rounded-lg border p-3 transition-colors cursor-pointer","bg-card",r?"border-accent":"border-border hover:border-foreground",n&&"opacity-50 pointer-events-none"].filter(Boolean).join(" "),children:[(r||e)&&h.jsx("span",{className:"absolute top-2 right-2 text-accent",children:r?h.jsx(ba,{style:{width:14,height:14}}):h.jsx($M,{style:{width:14,height:14}})}),h.jsxs("span",{className:"block text-[12px] font-bold text-foreground",children:[o,". ",t.title]}),((a=t.bullets)==null?void 0:a.length)>0&&h.jsx("ul",{className:"mt-1.5 space-y-0.5 list-none pl-0",children:t.bullets.map((l,c)=>h.jsxs("li",{className:"text-[11px] text-muted-foreground leading-snug",children:[h.jsx("span",{className:"mr-1",children:"•"}),l]},c))})]})}function NK(){var P;const{session:t,messages:e,decisions:r,status:n,error:i,streamingMessage:s,designDocPath:o,hydrate:a,startSession:l,sendMessage:c,selectCard:u,completeDesign:d,connectSSE:p,disconnectSSE:f,reset:m}=Vn(),[x,g]=C.useState(""),[y,b]=C.useState(null),[k,T]=C.useState(""),_=C.useRef(null);C.useEffect(()=>(Vn.setState({scope:null,featureCode:null}),a(),()=>f()),[]),C.useEffect(()=>{var z;(z=_.current)==null||z.scrollIntoView({behavior:"smooth"})},[e,s]);const w=C.useCallback(()=>{x.trim()&&(c(x.trim()),g(""))},[x,c]),N=C.useCallback((z,q)=>{b({messageIndex:q,cardId:z})},[]),B=C.useCallback(()=>{y&&(u(y.cardId,k||null,y.messageIndex),b(null),T(""))},[y,k,u]),I=n==="streaming"||n==="summarizing",E=e.reduce((z,q,R)=>q.role==="assistant"&&q.content&&t_(q.content).parts.some(F=>F.type==="decision")?R:z,-1);return t?h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[i&&h.jsx("div",{className:"px-3 py-1.5 text-[11px] text-red-400 bg-red-500/10 border-b border-red-500/20 shrink-0",children:i}),n==="complete"&&h.jsxs("div",{className:"px-3 py-2 text-[11px] bg-green-500/10 border-b border-green-500/20 shrink-0 flex items-center gap-2",children:[h.jsx(rg,{style:{width:12,height:12},className:"text-green-400"}),h.jsx("span",{className:"text-green-400 font-medium",children:"Design complete."}),o&&h.jsxs("span",{className:"text-muted-foreground",children:["Document written to ",h.jsx("code",{className:"text-foreground",children:o})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:()=>{m()},className:"px-2 py-1 text-[10px] font-medium rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors",children:"New Session"})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.map((z,q)=>h.jsx(oy,{messageIndex:q,message:z,onCardSelect:N,selectedCard:y,isStreaming:I,cardsDisabled:I||q!==E},q)),s&&h.jsx(oy,{message:s,onCardSelect:N,selectedCard:y,isStreaming:I}),!i&&(n==="active"||n==="streaming")&&!s&&e.length>0&&((P=e[e.length-1])==null?void 0:P.role)==="human"&&h.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:h.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[h.jsx("div",{className:"w-3 h-3 rounded-full animate-spin",style:{border:"2px solid hsl(var(--muted-foreground) / 0.2)",borderTopColor:"hsl(var(--muted-foreground))"}}),h.jsx("span",{children:"Agent thinking..."})]})}),n==="summarizing"&&h.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:h.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[h.jsx("div",{className:"w-3 h-3 rounded-full animate-spin",style:{border:"2px solid hsl(var(--muted-foreground) / 0.2)",borderTopColor:"hsl(var(--muted-foreground))"}}),h.jsx("span",{children:"Generating design document..."})]})}),h.jsx("div",{ref:_})]}),n!=="complete"&&h.jsxs("div",{className:"border-t border-border p-3 shrink-0",children:[y?h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Selected: ",h.jsx("span",{className:"font-semibold text-foreground",children:y.cardId})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:k,onChange:z=>T(z.target.value),onKeyDown:z=>z.key==="Enter"&&B(),placeholder:"Add a comment (optional)...",className:"flex-1 bg-muted border border-border rounded px-3 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent"}),h.jsx("button",{onClick:B,disabled:I,className:"px-3 py-1.5 text-[11px] font-medium rounded bg-accent text-accent-foreground hover:opacity-90 transition-opacity disabled:opacity-50",children:"Send"}),h.jsx("button",{onClick:()=>{b(null),T("")},className:"px-3 py-1.5 text-[11px] rounded border border-border text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}):h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:x,onChange:z=>g(z.target.value),onKeyDown:z=>z.key==="Enter"&&!z.shiftKey&&w(),placeholder:I?"Waiting for response...":"Type a response...",disabled:I,className:"flex-1 bg-muted border border-border rounded px-3 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent disabled:opacity-50"}),h.jsx("button",{onClick:w,disabled:I||!x.trim(),className:"px-3 py-1.5 rounded bg-accent text-accent-foreground disabled:opacity-50 transition-opacity",children:h.jsx(Ff,{style:{width:14,height:14}})})]}),n==="active"&&r.length>=2&&h.jsxs("button",{onClick:d,className:"mt-2 w-full py-1.5 text-[11px] font-medium rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors flex items-center justify-center gap-1.5",children:[h.jsx(rg,{style:{width:12,height:12}}),"Complete Design"]})]})]}):h.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8",children:[h.jsx(zc,{className:"text-muted-foreground",style:{width:48,height:48}}),h.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:"Start a Design Conversation"}),h.jsx("p",{className:"text-[12px] text-muted-foreground text-center max-w-md",children:"Have an interactive design conversation with the AI. It will ask questions, present options with trade-offs, and build a design document from your decisions."}),i&&h.jsx("p",{className:"text-[11px] text-red-400 text-center max-w-md",children:i}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>l("product"),className:"px-4 py-2 text-[11px] font-medium rounded bg-accent text-accent-foreground hover:opacity-90 transition-opacity",children:"Product Design"}),h.jsx("button",{onClick:()=>{const z=prompt("Feature code:");z&&l("feature",z)},className:"px-4 py-2 text-[11px] font-medium rounded border border-border text-foreground hover:bg-muted transition-colors",children:"Feature Design"})]})]})}function oy({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,c;const o=t.role==="human",a=!o&&t.content?t_(t.content):null;return h.jsx("div",{className:rt("flex",o?"justify-end":"justify-start"),children:h.jsx("div",{className:rt("max-w-[85%] rounded-lg px-3 py-2 text-[12px]",o?"bg-accent/20 text-foreground":"bg-muted text-foreground"),children:o?h.jsx("div",{children:t.type==="card_select"?h.jsxs("span",{children:["Selected ",h.jsx("strong",{children:(l=t.content)==null?void 0:l.cardId}),(c=t.content)!=null&&c.comment?`: ${t.content.comment}`:""]}):h.jsx("span",{children:t.content})}):a?h.jsx("div",{className:"space-y-3",children:a.parts.map((u,d)=>{var p,f;return u.type==="text"?h.jsx("div",{className:"whitespace-pre-wrap",children:u.content},d):h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"flex flex-col gap-2 mt-2",children:(p=u.content.options)==null?void 0:p.map(m=>{var x;return h.jsx(EK,{card:m,recommended:((x=u.content.recommendation)==null?void 0:x.id)===m.id,selected:(n==null?void 0:n.messageIndex)===e&&(n==null?void 0:n.cardId)===m.id,disabled:s,onSelect:g=>r(g,e)},m.id)})}),((f=u.content.recommendation)==null?void 0:f.rationale)&&h.jsx("div",{className:"text-[11px] text-muted-foreground italic mt-1",children:u.content.recommendation.rationale})]},d)})}):h.jsx("div",{className:"whitespace-pre-wrap",children:t.content})})})}const jK=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),LK=new Set(["WebSearch","web_search"]);function BK({expanded:t}){return h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 150ms ease",flexShrink:0},children:h.jsx("path",{d:"M3 2L7 5L3 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function AK(){return h.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:[h.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--accent))",strokeWidth:"1.2"}),h.jsx("path",{d:"M3 5l1.5 1.5L7 3.5",stroke:"hsl(var(--accent))",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function MK(){return h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:h.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.2"})})}function Pu({title:t,count:e,defaultExpanded:r,children:n}){const[i,s]=C.useState(r);return h.jsxs("div",{className:"border-b",style:{borderColor:"hsl(var(--sidebar-border))"},children:[h.jsxs("button",{onClick:()=>s(o=>!o),className:"flex items-center gap-1.5 w-full px-3 py-2 text-left transition-colors hover:bg-sidebar-accent/30",children:[h.jsx(BK,{expanded:i}),h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider flex-1",style:{color:"hsl(var(--muted-foreground))"},children:t}),e>0&&h.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.12)",color:"hsl(var(--accent))"},children:e})]}),i&&h.jsx("div",{className:"pb-1",children:n})]})}function Cl(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function ay(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function IK({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>jK.has(o.tool)),n=t.filter(o=>LK.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return h.jsx(Kn,{className:"flex-1",children:h.jsxs("div",{children:[h.jsx(Pu,{title:"Topic Outline",count:e.length,defaultExpanded:e.length>0,children:e.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No topics yet"}):h.jsx("ul",{className:"px-3 space-y-1 pt-0.5",children:e.map((o,a)=>h.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[h.jsx("span",{className:"mt-0.5",children:o.decided?h.jsx(AK,{}):h.jsx(MK,{})}),h.jsx("span",{className:"text-[11px] leading-snug",style:{color:o.decided?"hsl(var(--foreground))":"hsl(var(--muted-foreground))"},children:o.title})]},a))})}),h.jsx(Pu,{title:"Codebase Refs",count:r.length,defaultExpanded:r.length>0,children:r.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No file references yet"}):h.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:i.map((o,a)=>h.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider px-1 rounded",style:{background:"hsl(var(--accent) / 0.12)",color:"hsl(var(--accent))"},children:o.tool}),h.jsx("span",{className:"text-[10px] font-mono leading-tight truncate flex-1",style:{color:"hsl(var(--foreground))"},title:typeof o.input=="string"?o.input:JSON.stringify(o.input),children:Cl(ay(o.tool,o.input),50)})]}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Cl(o.summary,100)})]},a))})}),h.jsx(Pu,{title:"Web Searches",count:n.length,defaultExpanded:n.length>0,children:n.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No web searches yet"}):h.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:s.map((o,a)=>h.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[h.jsx("p",{className:"text-[10px] font-medium leading-snug",style:{color:"hsl(var(--foreground))"},children:Cl(ay(o.tool,o.input),80)}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Cl(o.summary,100)})]},a))})})]})})}function FK({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=C.useState("decisions"),o=t.filter(c=>!c.superseded).length,a=Vn(c=>c.researchItems)||[],l=Vn(c=>c.topicOutline)||[];return h.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:n??208},children:[h.jsx("div",{className:"p-3 pb-0",children:h.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--foreground))"},children:"Design"})}),h.jsxs("div",{className:"flex px-2 pt-2 gap-1",style:{borderBottom:"1px solid hsl(var(--sidebar-border))"},children:[h.jsxs("button",{onClick:()=>s("decisions"),className:"flex items-center gap-1 px-2 py-1.5 text-[11px] font-medium transition-colors",style:{color:i==="decisions"?"hsl(var(--foreground))":"hsl(var(--muted-foreground))",borderBottom:i==="decisions"?"2px solid hsl(var(--accent))":"2px solid transparent",marginBottom:"-1px"},children:["Decisions",o>0&&h.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))"},children:o})]}),h.jsxs("button",{onClick:()=>s("research"),className:"flex items-center gap-1 px-2 py-1.5 text-[11px] font-medium transition-colors",style:{color:i==="research"?"hsl(var(--foreground))":"hsl(var(--muted-foreground))",borderBottom:i==="research"?"2px solid hsl(var(--accent))":"2px solid transparent",marginBottom:"-1px"},children:["Research",a.length>0&&h.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))"},children:a.length})]})]}),i==="decisions"&&h.jsx(Kn,{className:"flex-1",children:t.length===0?h.jsx("div",{className:"px-3 py-6 text-center text-[11px]",style:{color:"hsl(var(--muted-foreground))"},children:"No decisions yet"}):h.jsx("div",{className:"px-2 pb-2 pt-1",children:t.map((c,u)=>{var d;return h.jsxs("button",{disabled:c.superseded||r,onClick:()=>!c.superseded&&!r&&(e==null?void 0:e(u)),className:`flex flex-col w-full text-left rounded-md px-2 py-1.5 transition-colors ${c.superseded||r?"cursor-not-allowed opacity-40":"cursor-pointer hover:bg-sidebar-accent/50"}`,children:[h.jsx("span",{className:"text-[11px] font-medium leading-tight",style:{color:"hsl(var(--foreground))",textDecoration:c.superseded?"line-through":void 0},children:((d=c.selectedOption)==null?void 0:d.title)||c.question}),c.comment&&h.jsx("span",{className:"text-[10px] leading-snug mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:c.comment}),c.superseded&&h.jsx("span",{className:"text-[9px] mt-0.5 uppercase tracking-wider font-medium",style:{color:"hsl(var(--muted-foreground))"},children:"superseded"})]},u)})})}),i==="research"&&h.jsx(IK,{researchItems:a,topicOutline:l})]})}function PK(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function DK(t,e){const r=(e??Date.now())-Date.parse(t);if(r<0)return"0m";const n=Math.floor(r/6e4);if(n<60)return`${n}m`;const i=Math.floor(r/36e5);return i<24?`${i}h`:`${Math.floor(r/864e5)}d`}function OK(t,e){if(t.resolution)return!1;const r=t.ttl_days??90;return(e??Date.now())-Date.parse(t.created_at)>r*24*60*60*1e3}const RK=320,$K=40,zK={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function l_(t){return t?`compose:${t}:openLoopsCollapsed`:null}function ly(t){const e=l_(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function WK(t,e){const r=l_(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function qK({onConfirm:t,onCancel:e}){const[r,n]=C.useState("deferred"),[i,s]=C.useState(""),[o,a]=C.useState(""),l=c=>{c.preventDefault(),i.trim()&&t({kind:r,summary:i.trim(),ttl_days:o?parseInt(o,10):void 0})};return h.jsx("div",{"data-testid":"add-loop-modal",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:c=>{c.target===c.currentTarget&&e()},children:h.jsxs("form",{onSubmit:l,style:{background:"#1e1e2e",borderRadius:8,padding:24,width:360,display:"flex",flexDirection:"column",gap:12},children:[h.jsx("h3",{style:{margin:0,color:"#cdd6f4",fontSize:14},children:"Add Open Loop"}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Kind",h.jsxs("select",{value:r,onChange:c=>n(c.target.value),style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px"},children:[h.jsx("option",{value:"deferred",children:"Deferred"}),h.jsx("option",{value:"blocked",children:"Blocked"}),h.jsx("option",{value:"open_question",children:"Open Question"})]})]}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Summary (max 280 chars)",h.jsx("textarea",{"data-testid":"add-loop-summary",value:i,onChange:c=>s(c.target.value),maxLength:280,rows:3,required:!0,style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",resize:"vertical",boxSizing:"border-box"}})]}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["TTL days (optional, default 90)",h.jsx("input",{type:"number",value:o,onChange:c=>a(c.target.value),min:1,style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",boxSizing:"border-box"}})]}),h.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[h.jsx("button",{type:"button",onClick:e,style:{padding:"6px 16px",background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,cursor:"pointer"},children:"Cancel"}),h.jsx("button",{type:"submit","data-testid":"add-loop-submit",style:{padding:"6px 16px",background:"#89b4fa",color:"#1e1e2e",border:"none",borderRadius:4,cursor:"pointer",fontWeight:600},children:"Add"})]})]})})}function HK({loop:t,onResolve:e,nowMs:r}){const n=OK(t,r),i=!!t.resolution;return h.jsxs("div",{"data-testid":`loop-row-${t.id}`,style:{padding:"8px 12px",borderBottom:"1px solid #313244",opacity:i?.5:1},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx("span",{style:{fontSize:10,color:"#6c7086",background:"#313244",borderRadius:3,padding:"1px 5px"},children:zK[t.kind]||t.kind}),n&&!i&&h.jsx("span",{"data-testid":`stale-badge-${t.id}`,style:{fontSize:10,color:"#f38ba8",background:"#3e1111",borderRadius:3,padding:"1px 5px"},children:">TTL"}),h.jsx("span",{style:{fontSize:10,color:"#6c7086",marginLeft:"auto"},children:DK(t.created_at,r)})]}),h.jsx("p",{style:{margin:"4px 0 6px",fontSize:12,color:n&&!i?"#f38ba8":"#cdd6f4",lineHeight:1.4},children:t.summary}),!i&&h.jsx("button",{"data-testid":`resolve-btn-${t.id}`,onClick:()=>e(t.id),style:{fontSize:11,padding:"3px 10px",background:"#313244",color:"#a6e3a1",border:"1px solid #a6e3a1",borderRadius:3,cursor:"pointer"},children:"Resolve"}),i&&h.jsx("span",{style:{fontSize:11,color:"#a6e3a1"},children:"Resolved"})]})}function UK({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var g,y;const[i,s]=C.useState(()=>ly(t)),[o,a]=C.useState(!1),[l,c]=C.useState(()=>Date.now());C.useEffect(()=>{const b=setInterval(()=>c(Date.now()),6e4);return()=>clearInterval(b)},[]),C.useEffect(()=>{s(ly(t))},[t]);const u=C.useCallback(()=>{s(b=>{const k=!b;return WK(t,k),k})},[t]),d=C.useMemo(()=>!t||!e?null:e.find(b=>{var k;return((k=b.lifecycle)==null?void 0:k.featureCode)===t})??null,[t,e]),p=((y=(g=d==null?void 0:d.lifecycle)==null?void 0:g.lifecycle_ext)==null?void 0:y.open_loops)??[],f=C.useMemo(()=>PK(p.filter(b=>b.resolution==null)),[p]),m=C.useCallback(async b=>{if(a(!1),r)try{await r(t,b)}catch(k){console.error("[OpenLoopsPanel] addLoop failed:",k.message)}},[t,r]),x=C.useCallback(async b=>{if(n){const k=window.prompt("Resolve note (optional):")||"";try{await n(t,b,{note:k})}catch(T){console.error("[OpenLoopsPanel] resolveLoop failed:",T.message)}}},[t,n]);return t?i?h.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:$K,background:"#181825",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:12,borderLeft:"1px solid #313244",flexShrink:0},children:[h.jsx("button",{"data-testid":"open-loops-expand-btn",onClick:u,title:`Open loops (${f.length})`,style:{background:"none",border:"none",cursor:"pointer",color:"#a6adc8",fontSize:18},children:"↺"}),f.length>0&&h.jsx("span",{style:{fontSize:10,color:"#f5c2e7",marginTop:4},children:f.length})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"open-loops-panel",style:{width:RK,background:"#181825",display:"flex",flexDirection:"column",borderLeft:"1px solid #313244",flexShrink:0,overflow:"hidden"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid #313244",gap:8},children:[h.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#cdd6f4",flex:1},children:["Open Loops ",f.length>0&&h.jsxs("span",{style:{color:"#a6adc8"},children:["(",f.length,")"]})]}),h.jsx("button",{"data-testid":"add-loop-btn",onClick:()=>a(!0),title:"Add open loop",style:{background:"none",border:"1px solid #45475a",color:"#a6e3a1",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12},children:"+"}),h.jsx("button",{"data-testid":"open-loops-collapse-btn",onClick:u,title:"Collapse",style:{background:"none",border:"none",cursor:"pointer",color:"#6c7086",fontSize:16},children:"›"})]}),h.jsx("div",{style:{flex:1,overflowY:"auto"},children:f.length===0?h.jsxs("div",{"data-testid":"open-loops-empty",style:{padding:"16px 12px",color:"#6c7086",fontSize:12,textAlign:"center"},children:["No open loops for this feature",h.jsx("br",{}),h.jsx("button",{onClick:()=>a(!0),style:{marginTop:8,background:"none",border:"1px solid #45475a",color:"#a6adc8",borderRadius:4,padding:"3px 10px",cursor:"pointer",fontSize:11},children:"+ Add loop"})]}):f.map(b=>h.jsx(HK,{loop:b,onResolve:x,nowMs:l},b.id))})]}),o&&h.jsx(qK,{onConfirm:m,onCancel:()=>a(!1)})]}):null}const ss={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},GK=new Set(["blocks","informs"]);function cy(t,e){return t.find(r=>r.featureCode===e)||t.find(r=>r.title===e)||t.find(r=>r.title&&r.title.startsWith(e+":"))}function YK(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function VK(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=ss.error;else if(o==="running"){const c=a&&a.endsWith("_gate"),u=cy(e,s);c&&u&&n.some(p=>p.itemId===u.id&&!p.resolvedAt)?i[s]=ss.gate_pending:i[s]=ss.building}const l=cy(e,s);if(l&&(i[s]===ss.building||i[s]===ss.gate_pending)){const c=new Set([l.id]),u=XK(c,r),d=new Map(e.map(p=>[p.id,YK(p)]));for(const p of u){const f=d.get(p);f&&!i[f]&&(i[f]=ss.blocked_downstream)}}return i}function XK(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)GK.has(o.type)&&(r.has(o.fromId)||r.set(o.fromId,[]),r.get(o.fromId).push(o.toId));const n=new Set(t),i=[...t],s=new Set;for(;i.length>0;){const o=i.shift(),a=r.get(o)||[];for(const l of a)n.has(l)||(n.add(l),s.add(l),i.push(l))}return s}function KK(t,e){if(!t||!t.length)return{nodes:[],edges:[],activeEdgeIds:new Set};const r=[],n=new Map;r.push({data:{id:"agent-topology",label:"Agent Topology",isAgentGroup:!0}}),r.push({data:{id:"agent-session",label:"Session",isAgentNode:!0,agentType:"session",agentStatus:"running",agentColor:"#64748b",parent:"agent-topology"}});const i=new Set(t.map(l=>l.agentId));for(const l of t){const c=l.agentType||"claude",u=E_[c]||"#3b82f6";r.push({data:{id:`agent-${l.agentId}`,label:`${c}
|
|
770
|
-
${l.agentId.slice(0,6)}`,isAgentNode:!0,agentType:c,agentStatus:l.status||"running",agentColor:u,parent:"agent-topology"}});const p=l.parentSessionId&&i.has(l.parentSessionId)?`agent-${l.parentSessionId}`:"agent-session",f=`relay-${p}-agent-${l.agentId}`;n.has(f)||n.set(f,{data:{id:f,source:p,target:`agent-${l.agentId}`,isRelayEdge:!0}})}const s=Date.now()-3e4,o=new Set,a=l=>l==="session"?"agent-session":i.has(l)?`agent-${l}`:"agent-session";for(const l of e||[]){if(new Date(l.timestamp).getTime()<s)continue;const c=a(l.fromAgentId),u=a(l.toAgentId),d=l.direction==="dispatch"?`relay-${c}-${u}`:`relay-${u}-${c}`;o.add(d)}return{nodes:r,edges:[...n.values()],activeEdgeIds:o}}class wr extends Xt.Component{constructor(){super(...arguments);ie(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?h.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 p-4",style:{background:"hsl(var(--background))",color:"hsl(var(--muted-foreground))"},children:[h.jsx("div",{className:"text-xs uppercase tracking-wider font-semibold",style:{color:"hsl(var(--destructive))"},children:this.props.zone?`${this.props.zone} crashed`:"panel crashed"}),h.jsx("div",{className:"text-[11px] max-w-[300px] text-center opacity-70 font-mono",children:(n=(r=this.state.error)==null?void 0:r.message)==null?void 0:n.substring(0,120)}),h.jsx("button",{className:"mt-2 px-3 py-1 text-xs rounded border",style:{borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},onClick:()=>this.setState({error:null}),children:"retry"})]}):this.props.children}}class ZK extends Xt.Component{constructor(){super(...arguments);ie(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsxs("div",{className:"h-8 flex items-center justify-between px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--destructive) / 0.1)"},children:[h.jsxs("span",{className:"text-[10px] uppercase tracking-wider font-semibold",style:{color:"hsl(var(--destructive))"},children:["safe mode — UI crashed: ",(n=(r=this.state.error)==null?void 0:r.message)==null?void 0:n.substring(0,80)]}),h.jsx("button",{className:"px-2 py-0.5 text-[10px] rounded border",style:{borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},onClick:()=>this.setState({error:null}),children:"retry"})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(Cy,{})})]}):this.props.children}}const of="compose:fontSize",QK="compose:theme",Qo=13,af=10,lf=20;function JK(){try{const t=parseInt(localStorage.getItem(of),10);return t>=af&&t<=lf?t:Qo}catch{return Qo}}const hy=new URLSearchParams(window.location.search).get("popout");function tZ(){return hy?h.jsx(qY,{path:hy}):h.jsx(ZK,{children:h.jsx(rZ,{})})}function eZ({activeView:t,items:e,filteredItems:r,phaseFilteredItems:n,phaseFilteredGates:i,connections:s,filteredConnections:o,sessions:a,activeBuild:l,pipelineDraft:c,gates:u,settings:d,selectedPhase:p,selectedItemId:f,buildStateMap:m,agentOverlay:x,spawnedAgents:g,agentRelays:y,docsSelectedFile:b,onDocsSelectedFileChange:k,docsPreviousView:T,onDocsBack:_,visibleTracks:w,hiddenGroups:N,onSelect:B,onUpdate:I,onCreate:E,onDelete:P,onOpenGate:z,onCreateConnection:q,onDeleteConnection:R,onRefreshBuild:F,onSelectStep:M,onResolveGate:D,onUpdateSettings:O,onResetSettings:j,projectRoot:S,featureCode:G,focusActive:Q,onToggleFocus:A,sessionState:ct,agentActivity:ut,iterationStates:st}){switch(t){case"dashboard":return h.jsx(aK,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:g,featureCode:G,sessionState:ct,agentActivity:ut,iterationStates:st,onSelect:B,onResolveGate:D,onOpenGate:z});case"tree":return h.jsx(v1,{items:r,connections:o,selectedItemId:f,onSelect:B,onCreate:E,featureCode:G,focusActive:Q,onToggleFocus:A});case"graph":return h.jsx(S1,{items:e,connections:s,selectedItemId:f,onSelect:B,visibleTracks:w,hiddenGroups:N,buildStateMap:m,resolveGate:D,gates:u,spawnedAgents:g,agentRelays:y,agentOverlay:x,featureCode:G,focusActive:Q,onToggleFocus:A});case"pipeline":return h.jsx(rT,{activeBuild:l,pipelineDraft:c,onSelectStep:M,onRefresh:F});case"sessions":return h.jsx(lT,{sessions:a,items:e,onSelectItem:B,featureCode:G,focusActive:Q,onToggleFocus:A});case"gates":return h.jsx(QS,{gates:i,items:n,onResolve:D,onSelect:B,featureCode:G,focusActive:Q,onToggleFocus:A});case"docs":return h.jsx(KS,{items:n,selectedFile:b,onSelectedFileChange:k,previousView:T,onBack:_,featureCode:G,focusActive:Q,onToggleFocus:A});case"design":return h.jsx(NK,{},S);case"ideabox":return h.jsx(TK,{});case"settings":return h.jsx(eT,{settings:d,onSettingsChange:O,onReset:j});case"stratum":return h.jsx(ZY,{});default:return h.jsxs("div",{className:"flex-1 flex items-center justify-center text-[12px] text-muted-foreground italic",children:["View “",t,"” not found."]})}}function rZ(){const{refresh:t}=y_(),e=Vn(W=>W.decisions),r=Vn(W=>W.status),[n,i]=C.useState(JK),[s,o]=C.useState(()=>document.documentElement.classList.contains("dark")),[a]=C.useState(_X),[l,c]=C.useState(()=>EX(a)),[u,d]=C.useState(cV),[p,f]=C.useState(NX),[m,x]=C.useState(LX),[g,y]=C.useState(null),[b,k]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[T,_]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:w,connections:N,connected:B,uiCommand:I,clearUICommand:E,recentChanges:P,createItem:z,updateItem:q,deleteItem:R,createConnection:F,deleteConnection:M,agentActivity:D,agentErrors:O,spawnedAgents:j,agentRelays:S,sessionState:G,registerSnapshotProvider:Q,gates:A,gateEvent:ct,resolveGate:ut,settings:st,updateSettings:It,resetSettings:ht,activeBuild:ot,setActiveBuild:Y,pipelineDraft:lt,sessions:xt,iterationStates:Nt,selectedPhase:Dt,setSelectedPhase:le,statusSnapshots:be,setStatusSnapshot:tr}=yr(Ri(W=>({items:W.items,connections:W.connections,connected:W.connected,uiCommand:W.uiCommand,clearUICommand:W.clearUICommand,recentChanges:W.recentChanges,createItem:W.createItem,updateItem:W.updateItem,deleteItem:W.deleteItem,createConnection:W.createConnection,deleteConnection:W.deleteConnection,agentActivity:W.agentActivity,agentErrors:W.agentErrors,spawnedAgents:W.spawnedAgents,agentRelays:W.agentRelays,sessionState:W.sessionState,registerSnapshotProvider:W.registerSnapshotProvider,gates:W.gates,gateEvent:W.gateEvent,resolveGate:W.resolveGate,settings:W.settings,updateSettings:W.updateSettings,resetSettings:W.resetSettings,activeBuild:W.activeBuild,setActiveBuild:W.setActiveBuild,pipelineDraft:W.pipelineDraft,sessions:W.sessions,iterationStates:W.iterationStates,selectedPhase:W.selectedPhase,setSelectedPhase:W.setSelectedPhase,statusSnapshots:W.statusSnapshots,setStatusSnapshot:W.setStatusSnapshot}))),Kt=(G==null?void 0:G.featureCode)||null;C.useEffect(()=>{Kt&&(be&&be[Kt]||Rt(`/api/lifecycle/status?featureCode=${encodeURIComponent(Kt)}`).then(W=>W.json()).then(W=>{W!=null&&W.snapshot&&tr&&tr(Kt,W.snapshot)}).catch(()=>{}))},[Kt,be,tr]);const[we,V]=C.useState(null),it=C.useRef(!!localStorage.getItem("compose:activeView")),[ft,_t]=C.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[et,bt]=C.useState(""),U=C.useCallback(W=>{k(W),localStorage.setItem("compose:contextWidthPx",String(Math.round(W)))},[]),nt=C.useRef(!1),jt=C.useCallback(W=>{W.preventDefault(),nt.current=!0;const Tt=me=>{if(!nt.current)return;const dr=me.clientX-16,co=Math.max(160,Math.min(window.innerWidth*.4,dr));_(co),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(co)))},St=()=>{nt.current=!1,document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",St)};document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",St)},[]),[Wt,Ut]=C.useState(null),[fe,Ce]=C.useState(null),[de,Dr]=C.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[Re,Se]=C.useState(()=>{try{const W=localStorage.getItem("compose:visibleTracks");if(W){const Tt=JSON.parse(W);return new Set(Tt)}}catch{}return null}),[jr,He]=C.useState(new Set),[$i,Lr]=C.useState(!1),Mn=C.useCallback(W=>{He(Tt=>{const St=new Set(Tt);return St.has(W)?St.delete(W):St.add(W),St})},[]),[zi,eo]=C.useState(null),[yh,xn]=C.useState(!1),[ro,no]=C.useState(!1),[ai,Aa]=C.useState(!1),[bh,pe]=C.useState(""),[yn,Ma]=C.useState("");C.useEffect(()=>{Rt("/api/project").then(W=>W.json()).then(W=>{pe(W.name||""),Ma(W.targetRoot||"")}).catch(()=>{})},[]);const Ia=C.useCallback(async W=>{try{const St=await(await Rt("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:W})})).json();return St.ok?(await t(),pe(St.name),Ma(St.targetRoot),!0):!1}catch{return!1}},[t]),Wi=u===Xe.MAXIMIZED,Fa=C.useCallback(W=>{c(W),K0(W),_t(W)},[]),er=C.useCallback(W=>{_t(W),c(W),K0(W)},[]);C.useEffect(()=>{localStorage.setItem("compose:activeView",ft),ft!=="docs"&&(Ce(null),Ut(null))},[ft]),C.useEffect(()=>{de?localStorage.setItem("compose:selectedTrack",de):localStorage.removeItem("compose:selectedTrack")},[de]),C.useEffect(()=>{we?sessionStorage.setItem("vision-selectedItemId",we):sessionStorage.removeItem("vision-selectedItemId")},[we]),C.useEffect(()=>{try{Re?localStorage.setItem("compose:visibleTracks",JSON.stringify([...Re])):localStorage.removeItem("compose:visibleTracks")}catch{}},[Re]);const Pa=C.useRef(!1);C.useEffect(()=>{var W;Pa.current||it.current||(W=st==null?void 0:st.ui)!=null&&W.defaultView&&(er(st.ui.defaultView),Pa.current=!0)},[st]),C.useEffect(()=>{I&&(I.view&&er(I.view),I.phase!==void 0&&le(I.phase),I.select!==void 0&&De(I.select),E())},[I,E]),C.useEffect(()=>{const W=()=>{var St;return["INPUT","TEXTAREA","SELECT"].includes((St=document.activeElement)==null?void 0:St.tagName)},Tt=St=>{(St.metaKey||St.ctrlKey)&&St.key==="k"&&(St.preventDefault(),xn(me=>!me)),(St.metaKey||St.ctrlKey)&&St.key==="n"&&(St.preventDefault(),no(!0)),St.key===","&&!St.metaKey&&!St.ctrlKey&&!W()&&Aa(!0)};return window.addEventListener("keydown",Tt),()=>window.removeEventListener("keydown",Tt)},[]);const $e=C.useMemo(()=>{let W=w;if(Dt&&(W=W.filter(Tt=>Tt.phase===Dt)),de&&(W=W.filter(Tt=>{const St=(Tt.description||"").match(/Track:\s*(\w+)/i);return St&&St[1].toLowerCase()===de})),et){const Tt=et.toLowerCase();W=W.filter(St=>St.title.toLowerCase().includes(Tt)||(St.description||"").toLowerCase().includes(Tt))}return W},[w,Dt,de,et]),Or=C.useMemo(()=>Dt?w.filter(W=>W.phase===Dt):w,[w,Dt]),io=C.useMemo(()=>new Set(Or.map(W=>W.id)),[Or]),Da=C.useMemo(()=>Dt?A.filter(W=>io.has(W.itemId)):A,[A,io,Dt]),so=C.useMemo(()=>{if(!Dt&&!de&&!et)return N;const W=new Set($e.map(Tt=>Tt.id));return N.filter(Tt=>W.has(Tt.fromId)&&W.has(Tt.toId))},[N,$e,Dt,de,et]),qi=C.useMemo(()=>VK(ot,w,N,A),[ot,w,N,A]),In=C.useMemo(()=>KK(j,S),[j,S]),Pe=C.useCallback(W=>{y(W)},[]),De=C.useCallback(W=>{V(Tt=>Tt===W?(Pe(null),null):(Pe({type:"item",id:W}),W))},[Pe]),Oa=C.useCallback(async W=>{try{await Rt(`/api/agent/${W}/stop`,{method:"POST",headers:ps({"Content-Type":"application/json"})})}catch(Tt){console.error(`[App] Failed to stop agent ${W}:`,Tt.message)}},[]),oo=C.useRef(ot);C.useEffect(()=>{!oo.current&&ot&&ot.featureItemId&&De(ot.featureItemId),oo.current=ot},[ot]);const ao=C.useCallback(W=>{if(!W)return;const Tt=w.find(St=>{var me,dr;return((me=St.lifecycle)==null?void 0:me.featureCode)===W||St.featureCode===W||St.feature_code===W||((dr=St.title)==null?void 0:dr.includes(W))});Tt&&De(Tt.id)},[w,De]);C.useEffect(()=>{const W=Tt=>{const{featureCode:St}=Tt.detail||{};St&&ao(St)};return window.addEventListener("compose:select-feature",W),()=>window.removeEventListener("compose:select-feature",W)},[ao]);const li=C.useCallback(W=>w.find(Tt=>{var St;return((St=Tt.lifecycle)==null?void 0:St.featureCode)===W})||null,[w]),Ra=C.useCallback(async(W,Tt)=>{const St=li(W);if(!St)throw new Error(`No item found for feature ${W}`);const me=await Rt(`/api/vision/items/${St.id}/loops`,{method:"POST",headers:ps({"Content-Type":"application/json"}),body:JSON.stringify(Tt)});if(!me.ok)throw new Error(`Add loop failed: ${me.status}`)},[li]),Hi=C.useCallback(async(W,Tt,{note:St})=>{const me=li(W);if(!me)throw new Error(`No item found for feature ${W}`);const dr=await Rt(`/api/vision/items/${me.id}/loops/${Tt}/resolve`,{method:"POST",headers:ps({"Content-Type":"application/json"}),body:JSON.stringify({note:St})});if(!dr.ok)throw new Error(`Resolve loop failed: ${dr.status}`)},[li]);C.useEffect(()=>{Q(()=>({activeView:ft,selectedPhase:Dt,searchQuery:et,selectedItemId:we,totalItems:w.length,filteredCount:$e.length,connected:B}))},[Q,ft,Dt,et,we,w.length,$e.length,B]),C.useEffect(()=>{const W=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return W.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>W.disconnect()},[]),C.useEffect(()=>{g&&!m&&(x(!0),Z0(!0))},[g]),C.useEffect(()=>{ft==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[ft]);const Fn=C.useCallback(()=>{const W=s?"light":"dark";document.documentElement.classList.toggle("dark",W==="dark"),localStorage.setItem(QK,W),Rt("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:W}})}).catch(()=>{})},[s]),Ct=C.useCallback(W=>{i(Tt=>{const St=Math.min(Math.max(Tt+W,af),lf);return localStorage.setItem(of,St),St})},[]),$=C.useCallback(()=>{i(Qo),localStorage.setItem(of,Qo)},[]),J=C.useCallback(W=>{d(W),hV(W)},[]),dt=C.useCallback(()=>{f(W=>(jX(!W),!W))},[]),ee=C.useCallback(()=>{x(W=>(Z0(!W),!W))},[]),Ht=C.useCallback((W,Tt)=>{q(W,Tt)},[q]),oe=C.useCallback(async()=>{const Tt=await z({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Dt||"vision"});Tt&&Tt.id&&De(Tt.id)},[z,Dt]),Te=C.useCallback(async W=>{await R(W),we===W&&(V(null),Pe(null))},[R,we,Pe]),Ue=C.useCallback(W=>{const Tt=A.find(St=>St.id===W);Tt&&(V(Tt.itemId),Pe({type:"item",id:Tt.itemId}))},[A,Pe]),kr=C.useCallback(async W=>F(W),[F]),lo=C.useCallback(async W=>M(W),[M]),Ne=C.useCallback(()=>{Rt("/api/build/state").then(W=>W.json()).then(W=>Y(W.state??null)).catch(()=>{})},[Y]),$a=C.useCallback(W=>{Pe({type:"step",id:W})},[Pe]),ci=C.useCallback(W=>{const Tt=w.find(dr=>dr.id===W);if(!Tt)return;const St=(Tt.description||"").match(/Track:\s*(\w+)/i),me=St?St[1].toLowerCase():null;de&&me&&de!==me&&Dr(null),me&&Re&&!Re.has(me)&&Se(dr=>{const co=new Set(dr);return co.add(me),co})},[w,de,Re]),c_=C.useCallback(W=>{ci(W),V(W),Pe({type:"item",id:W}),er("graph")},[er,Pe,ci]),h_=C.useCallback(W=>{ci(W),V(W),Pe({type:"item",id:W}),er("tree")},[er,Pe,ci]),u_=C.useCallback(W=>{Ce(ft),Ut(W),er("docs")},[ft,er]),d_=C.useCallback(()=>{fe&&(er(fe),Ce(null),Ut(null))},[fe,er]);return h.jsx(qc.Provider,{value:P,children:h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[h.jsx(wr,{zone:"header",children:h.jsxs("header",{className:"h-9 flex items-center px-3 gap-3 shrink-0 justify-between",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsx(QY,{projectName:bh,projectRoot:yn,onSwitch:Ia}),h.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:h.jsx(tV,{tabs:a,activeTab:l,onTabChange:Fa,onOpenPalette:()=>xn(W=>!W),badges:{gates:A.filter(W=>!W.resolvedAt).length}})}),h.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!B&&h.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),h.jsx("button",{className:"compose-btn-icon",onClick:Fn,title:s?"Switch to light mode":"Switch to dark mode",children:s?"☀":"☾"}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{className:"compose-btn-icon",onClick:()=>Ct(-1),disabled:n<=af,title:"Decrease font size",children:"A−"}),h.jsx("span",{className:"text-[10px] tabular-nums min-w-[20px] text-center text-muted-foreground",children:n}),h.jsx("button",{className:"compose-btn-icon",onClick:()=>Ct(1),disabled:n>=lf,title:"Increase font size",children:"A+"})]}),h.jsx("button",{className:"compose-btn-icon",onClick:$,disabled:n===Qo,title:"Reset to default size",children:"100%"})]})]})}),h.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!Wi&&h.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[h.jsx(wr,{zone:"sidebar",children:h.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[h.jsx("button",{className:"w-4 h-full flex items-center justify-center text-[10px] text-muted-foreground hover:text-foreground transition-colors select-none",onClick:dt,title:p?"Collapse sidebar":"Expand sidebar","aria-expanded":p,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:p?"‹":"›"}),p&&h.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0 order-last",onMouseDown:jt}),p&&(ft==="design"?h.jsx(FK,{decisions:e,sessionComplete:r==="complete",onReviseDecision:W=>Vn.getState().reviseDecision(W),widthPx:T}):h.jsx(C1,{items:w,gates:A,activeBuild:ot,onViewChange:er,selectedPhase:Dt,onPhaseSelect:le,selectedTrack:de,onTrackSelect:Dr,visibleTracks:Re,onToggleVisibleTrack:(W,Tt)=>Se(St=>{if(!St){const dr=new Set(Tt);return dr.delete(W),dr}const me=new Set(St);return me.has(W)?me.delete(W):me.add(W),Tt&&me.size>=Tt.length?null:me}),onShowAllTracks:()=>Se(null),hiddenGroups:jr,onToggleGroup:Mn,searchQuery:et,onSearchChange:bt,connected:B,agentActivity:D,agentErrors:O,spawnedAgents:j,agentRelays:S,sessionState:G,onSelectItem:De,onStopAgent:Oa,onThemeChange:It,onNewItem:()=>no(!0),widthPx:T}))]})}),h.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[h.jsx(XT,{featureCode:Kt,snapshot:Kt?(be==null?void 0:be[Kt])??null:null}),Kt&&h.jsx(VT,{currentFeatureCode:Kt}),h.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:h.jsx(wr,{children:h.jsx(eZ,{activeView:ft,items:w,filteredItems:$e,phaseFilteredItems:Or,phaseFilteredGates:Da,connections:N,filteredConnections:so,sessions:xt,activeBuild:ot,pipelineDraft:lt,gates:A,settings:st,selectedPhase:Dt,selectedItemId:we,onSelect:De,onUpdate:Ht,onCreate:oe,onDelete:Te,onOpenGate:Ue,onCreateConnection:kr,onDeleteConnection:lo,onRefreshBuild:Ne,onSelectStep:$a,onResolveGate:ut,onUpdateSettings:It,onResetSettings:ht,visibleTracks:Re,hiddenGroups:jr,buildStateMap:qi,agentOverlay:In,spawnedAgents:j,agentRelays:S,docsSelectedFile:Wt,onDocsSelectedFileChange:Ut,docsPreviousView:fe,onDocsBack:d_,projectRoot:yn,featureCode:Kt,focusActive:$i,onToggleFocus:()=>Lr(W=>!W),sessionState:G,agentActivity:D,iterationStates:Nt})})})]}),ft!=="docs"&&h.jsx(wr,{children:h.jsxs(gV,{isOpen:m,onToggle:ee,widthPx:b,onResizePx:U,activeBuild:ot,gates:A,agentErrors:O,items:w,children:[(g==null?void 0:g.type)==="item"&&h.jsx(nX,{itemId:g.id,onSelect:W=>{y({type:"item",id:W}),V(W)},onClose:()=>{y(null),V(null)},onOpenFile:u_,onViewInGraph:c_,onViewInTree:h_}),(g==null?void 0:g.type)==="step"&&h.jsx(dX,{stepId:g.id,tierEvents:ot==null?void 0:ot.tierEvents,healthEvents:(ot==null?void 0:ot.health_score)!=null?[{score:ot.health_score,breakdown:ot.health_breakdown,missing:ot.health_missing}]:void 0,capabilityEvents:ot==null?void 0:ot.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&h.jsx(pX,{})]})}),Kt&&ft!=="docs"&&h.jsx(wr,{zone:"open loops panel",children:h.jsx(UK,{featureCode:Kt,items:w,onAddLoop:Ra,onResolveLoop:Hi})})]}),h.jsx(wr,{zone:"ops strip",children:h.jsx(vX,{activeView:ft,onSelectFeature:ao})}),h.jsx(wr,{zone:"agent bar",children:h.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",Wi?"flex-1 min-h-0":lV(u)].join(" "),children:h.jsx(fV,{barState:u,onStateChange:J})})})]}),h.jsx(wr,{zone:"notifications",children:h.jsx(gX,{})}),h.jsx(wr,{zone:"gate notifications",children:h.jsx(YT,{onOpenGate:Ue})}),h.jsx(wr,{zone:"challenge modal",children:zi&&(()=>{const W=w.find(Tt=>Tt.id===zi);return W?h.jsx(tT,{item:W,items:w,connections:N,onUpdate:Ht,onClose:()=>eo(null)}):null})()}),h.jsx(JS,{event:ct,items:w,onNavigate:()=>er("gates")}),h.jsx(wr,{zone:"command palette",children:h.jsx(cT,{open:yh,onClose:()=>xn(!1),onSelectItem:W=>{De(W),xn(!1)},onSelectGate:W=>{Ue(W),xn(!1)}})}),h.jsx(wr,{zone:"item form",children:h.jsx(UT,{open:ro,onClose:()=>no(!1)})}),h.jsx(wr,{zone:"settings",children:h.jsx(GT,{open:ai,onClose:()=>Aa(!1),settings:st,onSettingsChange:It})})]})})}const PZ=Object.freeze(Object.defineProperty({__proto__:null,default:tZ},Symbol.toStringTag,{value:"Module"}));export{V1 as $,hZ as A,Gn as B,bF as C,ye as D,sP as E,jp as F,P1 as G,I6 as H,OR as I,H$ as J,h4 as K,ra as L,lZ as M,rh as N,R4 as O,G1 as P,qg as Q,jR as R,pd as S,M6 as T,va as U,Xr as V,X as W,K as X,Y4 as Y,T6 as Z,v as _,J4 as a,NZ as a$,TR as a0,ap as a1,pZ as a2,xZ as a3,Ki as a4,cx as a5,lx as a6,bZ as a7,yZ as a8,gZ as a9,e6 as aA,Z$ as aB,i6 as aC,Ev as aD,t6 as aE,d6 as aF,u6 as aG,h6 as aH,p6 as aI,f6 as aJ,J$ as aK,Nv as aL,s6 as aM,n6 as aN,r6 as aO,jv as aP,G$ as aQ,hr as aR,Co as aS,Lp as aT,Pv as aU,Bi as aV,$v as aW,E1 as aX,S9 as aY,LZ as aZ,AZ as a_,dZ as aa,fZ as ab,mZ as ac,kZ as ad,CZ as ae,v8 as af,W2 as ag,BZ as ah,Ot as ai,cn as aj,Bn as ak,ja as al,Xz as am,Vz as an,Ep as ao,yt as ap,Zz as aq,vp as ar,Cp as as,Bl as at,c6 as au,l6 as av,a6 as aw,o6 as ax,Q$ as ay,_v as az,Q4 as b,wt as b0,jZ as b1,J8 as b2,V8 as b3,Y8 as b4,_R as b5,aZ as b6,np as b7,qn as b8,sa as b9,rx as ba,sO as bb,vt as bc,zv as bd,xr as be,QD as bf,rp as bg,lC as bh,Ta as bi,uC as bj,uZ as bk,yF as bl,PZ as bm,re as c,Yt as d,Y1 as e,Ie as f,eP as g,Nn as h,Vr as i,X$ as j,wa as k,tt as l,Ov as m,cZ as n,IZ as o,rP as p,nP as q,MZ as r,tP as s,U$ as t,Hr as u,W8 as v,D6 as w,vZ as x,$s as y,Z4 as z};
|