skill-creator 2.0.0 → 2.0.2

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +2 -2
  3. package/dist/cli.js +107 -27
  4. package/dist/cli.js.map +3 -3
  5. package/dist/daemon.js +106 -26
  6. package/dist/daemon.js.map +3 -3
  7. package/dist/package.json +1 -1
  8. package/dist/webui/_app/immutable/chunks/{CEpOi93z.js → BFnZD865.js} +1 -1
  9. package/dist/webui/_app/immutable/chunks/{D-ecV3TD.js → BNZqT8Gb.js} +1 -1
  10. package/dist/webui/_app/immutable/chunks/{IYkYSIV6.js → C36hgawG.js} +1 -1
  11. package/dist/webui/_app/immutable/chunks/{D0xHg31U.js → CLM6PwBO.js} +1 -1
  12. package/dist/webui/_app/immutable/chunks/CLVPf5uP.js +1 -0
  13. package/dist/webui/_app/immutable/chunks/{DEtYLPO4.js → CQhmWGDZ.js} +1 -1
  14. package/dist/webui/_app/immutable/chunks/Ce6RiTD3.js +2 -0
  15. package/dist/webui/_app/immutable/chunks/{BySEbwqx.js → Ce_bE79q.js} +1 -1
  16. package/dist/webui/_app/immutable/chunks/{B2zyE4XX.js → CnsFCObb.js} +1 -1
  17. package/dist/webui/_app/immutable/chunks/{D25cXQtk.js → CryWMAmp.js} +1 -1
  18. package/dist/webui/_app/immutable/chunks/{DJNLWtK-.js → D68T6slS.js} +1 -1
  19. package/dist/webui/_app/immutable/chunks/{DWcQbrnv.js → DFx4VmvA.js} +1 -1
  20. package/dist/webui/_app/immutable/chunks/{BD9g8Udg.js → DUYTokm-.js} +1 -1
  21. package/dist/webui/_app/immutable/chunks/{BrDKAjtR.js → DbA0Nfjq.js} +1 -1
  22. package/dist/webui/_app/immutable/chunks/{iicbWqXp.js → DkjKuLZP.js} +1 -1
  23. package/dist/webui/_app/immutable/chunks/DrGEPnFY.js +1 -0
  24. package/dist/webui/_app/immutable/entry/{app.CbFi8HIH.js → app.CEIXmsDN.js} +2 -2
  25. package/dist/webui/_app/immutable/entry/start.A-8tRY5f.js +1 -0
  26. package/dist/webui/_app/immutable/nodes/{0.C7-AKGsj.js → 0.DtX11nez.js} +28 -28
  27. package/dist/webui/_app/immutable/nodes/{1.raBmjc20.js → 1.sVOukQaO.js} +1 -1
  28. package/dist/webui/_app/immutable/nodes/{2.ewWz-Ki-.js → 2.Cpm2DXYr.js} +1 -1
  29. package/dist/webui/_app/version.json +1 -1
  30. package/dist/webui/index.html +14 -14
  31. package/package.json +1 -1
  32. package/dist/webui/_app/immutable/chunks/B_YFzSAv.js +0 -2
  33. package/dist/webui/_app/immutable/chunks/BaH4uqzh.js +0 -1
  34. package/dist/webui/_app/immutable/chunks/DLuJKUyD.js +0 -1
  35. package/dist/webui/_app/immutable/entry/start.C3bV1TCO.js +0 -1
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/B_YFzSAv.js","../chunks/CmCJ0SKP.js","../chunks/BaH4uqzh.js","../chunks/xihTtKlq.js","../chunks/DLuJKUyD.js","../chunks/BkEnd9_Z.js","../chunks/BrDKAjtR.js","../chunks/DWcQbrnv.js","../chunks/CNPsST_i.js","../chunks/D25cXQtk.js","../chunks/BD9g8Udg.js","../chunks/Dl8eQ129.js","../chunks/BEPs9Z9s.js","../chunks/Bs27XW8_.js","../chunks/BIfnT_mK.js","../chunks/D-V0xBeS.js","../chunks/BySEbwqx.js","../chunks/D-ecV3TD.js","../chunks/D0xHg31U.js","../assets/shell.U4CQV8re.css","../chunks/Ckw1quWt.js","../chunks/CIFG41pU.js","../chunks/s48N5eaK.js","../chunks/D8Der6oM.js","../assets/ProviderView.DEH95hqa.css","../chunks/DEtYLPO4.js","../chunks/UeEccMjN.js","../chunks/CeR4do8T.js","../chunks/IYkYSIV6.js","../chunks/0umLG1IN.js","../chunks/BYNWtKcf.js","../chunks/iicbWqXp.js","../chunks/CQD9uzpA.js","../chunks/B2zyE4XX.js","../chunks/DJNLWtK-.js","../chunks/CEpOi93z.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,A as t,At as n,B as r,Ct as i,D as a,Dt as o,E as s,F as c,G as l,H as u,J as d,K as f,M as p,Mt as m,N as h,Nt as g,O as _,Q as v,R as y,S as b,St as x,T as S,U as C,V as w,W as T,X as E,_ as D,_t as O,a as k,at as A,b as j,bt as ee,c as te,ct as M,d as N,f as P,ft as F,gt as I,h as L,ht as ne,it as re,j as ie,jt as R,k as ae,kt as oe,l as se,lt as z,m as B,mt as V,n as ce,nt as H,o as U,ot as W,p as le,q as G,r as ue,rt as de,s as K,st as q,ut as fe,v as pe,w as me,wt as he,x as J,y as ge,z as Y}from"../chunks/CmCJ0SKP.js";import{t as _e}from"../chunks/BaH4uqzh.js";import{t as ve}from"../chunks/HclGiUj8.js";import"../chunks/xihTtKlq.js";import{t as ye}from"../chunks/D0xHg31U.js";import"../chunks/DLuJKUyD.js";import{t as be}from"../chunks/BkEnd9_Z.js";import{A as xe,C as Se,D as Ce,E as X,F as we,M as Te,N as Ee,O as De,P as Oe,S as ke,T as Ae,_ as je,a as Me,c as Ne,d as Pe,f as Fe,g as Ie,h as Le,i as Re,j as ze,k as Be,l as Ve,m as He,n as Ue,o as We,p as Ge,r as Z,s as Ke,t as qe,u as Je,v as Ye,w as Xe,x as Ze,y as Qe}from"../chunks/BrDKAjtR.js";import{c as $e,d as et,l as tt,n as nt,o as rt,s as it,t as at,u as ot}from"../chunks/D-ecV3TD.js";import{A as st,C as ct,D as lt,E as ut,O as dt,S as ft,T as pt,a as mt,b as ht,c as gt,f as _t,g as vt,i as yt,k as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,t as Et,v as Dt,w as Ot,x as kt}from"../chunks/DWcQbrnv.js";import{r as At}from"../chunks/D25cXQtk.js";import{i as jt,n as Mt,o as Nt,t as Pt}from"../chunks/BD9g8Udg.js";import{A as Ft,B as It,C as Lt,D as Rt,E as zt,F as Bt,G as Vt,H as Ht,I as Ut,J as Q,K as Wt,L as Gt,M as Kt,N as qt,O as Jt,P as Yt,R as Xt,S as Zt,T as Qt,U as $t,V as en,W as tn,Y as nn,_ as rn,a as an,b as on,c as sn,d as cn,f as ln,g as un,h as dn,i as fn,j as pn,k as mn,l as hn,m as gn,n as _n,o as vn,p as yn,q as bn,r as xn,s as Sn,t as Cn,u as wn,v as Tn,w as En,x as Dn,y as On,z as kn}from"../chunks/Dl8eQ129.js";import"../chunks/DZ_Kltd5.js";import{a as An,i as jn,n as Mn,o as Nn,r as Pn,s as Fn,t as In}from"../chunks/CNPsST_i.js";import{t as Ln}from"../chunks/BEPs9Z9s.js";import{n as Rn,r as zn,t as Bn}from"../chunks/Ckw1quWt.js";import{n as Vn,t as Hn}from"../chunks/0umLG1IN.js";import{t as Un}from"../chunks/CIFG41pU.js";import{t as Wn}from"../chunks/BIfnT_mK.js";import{t as Gn}from"../chunks/UeEccMjN.js";import{n as Kn,r as qn,t as Jn}from"../chunks/CQD9uzpA.js";var Yn=g({prerender:()=>!1,ssr:()=>!1,trailingSlash:()=>Xn}),Xn=`ignore`;it({id:`workspaces`,name:`Workspaces`,icon:we,activities:[$e({pattern:`/workspaces`,entry:!0,root:tt({id:`workspaces.home`,component:()=>ve(()=>import(`../chunks/B_YFzSAv.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url)})}),$e({pattern:`/workspaces`,root:ot({id:`workspaces.provider`,pattern:`:wsId/:providerId`,params:ut({wsId:kt,providerId:ht}),search:ut({q:dt().optional(),skill:dt().optional(),view:ft([`list`,`detail`]).optional()}),component:()=>ve(()=>import(`../chunks/BySEbwqx.js`),__vite__mapDeps([16,1,3,5,17,2,18,4,7,19,9,10,8,12,20,21,22,15,23,24]),import.meta.url)})}),$e({pattern:`/workspaces`,root:ot({id:`workspaces.intelligence`,pattern:`intelligence/:wsId/:providerId`,params:ut({wsId:kt,providerId:ht}),search:ut({severity:ft([`all`,`error`,`warning`,`info`]).optional()}),component:()=>ve(()=>import(`../chunks/DEtYLPO4.js`),__vite__mapDeps([25,1,3,5,17,2,18,4,7,19,9,10,8,14,26,13,27,15,23]),import.meta.url)})})]});var Zn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qn(e,t){let n=U(t,Zn),r=[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`}],[`path`,{d:`M8 18h1`}]];be(e,K({name:`file-pen-line`},()=>n,{get iconNode(){return r}}))}it({id:`creator`,name:`Creator`,icon:Qn,activities:[$e({pattern:`/creator`,entry:!0,root:tt({id:`creator.home`,component:()=>ve(()=>import(`../chunks/IYkYSIV6.js`),__vite__mapDeps([28,1,2,3,4,5,9,7,10,29,30]),import.meta.url)})}),$e({pattern:`/creator`,root:ot({id:`creator.workspace`,pattern:`:mode/:wsId/:providerId`,params:ut({mode:ft([`edit`,`new`]),wsId:kt,providerId:ht}),search:ut({subview:ft([`file`,`log`,`preview`,`validate`,`test`]).optional(),template:dt().optional()}),component:()=>ve(()=>import(`../chunks/iicbWqXp.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,9,10,11,8,12,13,20,32,30,22,27]),import.meta.url),children:[ot({id:`creator.workspace.skill`,pattern:`:skillId`,params:ut({skillId:Dt}),component:()=>ve(()=>import(`../chunks/iicbWqXp.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,9,10,11,8,12,13,20,32,30,22,27]),import.meta.url)})]})})]});var $n=new Set([`$$slots`,`$$events`,`$$legacy`]);function er(e,t){let n=U(t,$n),r=[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}]];be(e,K({name:`git-branch`},()=>n,{get iconNode(){return r}}))}it({id:`repository`,name:`Repository`,icon:er,activities:[$e({pattern:`/repository`,entry:!0,root:ot({id:`repository.home`,pattern:``,search:ut({q:dt().optional()}),component:()=>ve(()=>import(`../chunks/B2zyE4XX.js`),__vite__mapDeps([33,1,2,3,4,5,17,18,7,19,11,8,12,13,34]),import.meta.url),children:[ot({id:`repository.scan`,pattern:`scan/:sourceId`,params:ut({sourceId:dt().min(1).max(128).regex(/^[a-z0-9_-]+$/i)}),search:ut({selected:dt().optional(),targets:dt().optional(),skill:dt().optional()}),component:()=>ve(()=>import(`../chunks/CEpOi93z.js`),__vite__mapDeps([35,1,2,3,18,4,17,7,19,10,34]),import.meta.url)})]})})]});var tr=r(`<div class="drag-strip no-drag shrink-0 svelte-11tvdi8" role="banner" aria-label="window titlebar"><!> <div class="flex-1"></div> <!></div>`);function nr(e,t){i(t,!0);let r=k(t,`variant`,3,`main`),a=k(t,`left`,3,null),o=k(t,`right`,3,null),s=V(8),c=V(8),u=()=>navigator.opentrayWindow??navigator.opentray?.window??void 0;function d(e){let t=u();try{t?.startAppRegionDrag?.({x:e.clientX,y:e.clientY,pointerId:e.pointerId})?.catch?.(()=>{})}catch{}}function f(e){let t=globalThis.innerWidth,n=Math.max(0,Math.round(e.x)),r=Math.max(0,Math.round(t-e.x-e.width));F(s,n+(n>0?4:0)),F(c,r+(r>0?4:0))}ue(()=>{let e=u()?.overlay;if(!e)return;let t=null;return(async()=>{try{if(f(await e.getTitlebarAreaRect()),e.listen)t=await e.listen(`geometrychange`,e=>f(e.titlebarAreaRect));else if(e.addEventListener){let n=e=>f(e.titlebarAreaRect);e.addEventListener(`geometrychange`,n),t=()=>e.removeEventListener?.(`geometrychange`,n)}}catch{}})(),()=>{t?.()}});var p=tr(),m=W(p),g=e=>{var t=Y(),n=q(t);_(n,a),y(e,t)};h(m,e=>{r()===`main`&&a()&&e(g)});var v=z(m,4),b=e=>{var t=Y(),n=q(t);_(n,o),y(e,t)};h(v,e=>{r()===`main`&&o()&&e(b)}),n(p),H(()=>j(p,`padding-left: ${E(s)??``}px; padding-right: ${E(c)??``}px`)),l(`pointerdown`,p,d),y(e,p),x()}T([`pointerdown`]);var rr={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,transform:`translateX(-100%)`};Vt(rr);function ir(t){de(()=>e(()=>t()))}var ar=[`top`,`right`,`bottom`,`left`],or=Math.min,sr=Math.max,cr=Math.round,lr=Math.floor,ur=e=>({x:e,y:e}),dr={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function fr(e,t,n){return sr(e,or(t,n))}function pr(e,t){return typeof e==`function`?e(t):e}function mr(e){return e.split(`-`)[0]}function hr(e){return e.split(`-`)[1]}function gr(e){return e===`x`?`y`:`x`}function _r(e){return e===`y`?`height`:`width`}function vr(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function yr(e){return gr(vr(e))}function br(e,t,n){n===void 0&&(n=!1);let r=hr(e),i=yr(e),a=_r(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=kr(o)),[o,kr(o)]}function xr(e){let t=kr(e);return[Sr(e),t,Sr(t)]}function Sr(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Cr=[`left`,`right`],wr=[`right`,`left`],Tr=[`top`,`bottom`],Er=[`bottom`,`top`];function Dr(e,t,n){switch(e){case`top`:case`bottom`:return n?t?wr:Cr:t?Cr:wr;case`left`:case`right`:return t?Tr:Er;default:return[]}}function Or(e,t,n,r){let i=hr(e),a=Dr(mr(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Sr)))),a}function kr(e){let t=mr(e);return dr[t]+e.slice(t.length)}function Ar(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function jr(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ar(e)}function Mr(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Nr(e,t,n){let{reference:r,floating:i}=e,a=vr(t),o=yr(t),s=_r(o),c=mr(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=hr(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Pr(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=pr(t,e),p=jr(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Mr(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Mr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Fr=50,Ir=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Pr},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Nr(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Fr&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Nr(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Lr=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=pr(e,t)||{};if(l==null)return{};let d=jr(u),f={x:n,y:r},p=yr(i),m=_r(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=or(d[_],T),D=or(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=fr(E,k,O),j=!c.arrow&&hr(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),Rr=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=pr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=mr(r),_=vr(o),v=mr(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[kr(o)]:xr(o)),x=p!==`none`;!d&&x&&b.push(...Or(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=br(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===vr(t)||T.every(e=>vr(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vr(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function zr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Br(e){return ar.some(t=>e[t]>=0)}var Vr=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=pr(e,t);switch(i){case`referenceHidden`:{let e=zr(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Br(e)}}}case`escaped`:{let e=zr(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Br(e)}}}default:return{}}}}},Hr=new Set([`left`,`top`]);async function Ur(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=mr(n),s=hr(n),c=vr(n)===`y`,l=Hr.has(o)?-1:1,u=a&&c?-1:1,d=pr(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Wr=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ur(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Gr=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=pr(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=vr(i),p=gr(f),m=u[p],h=u[f],g=(e,t)=>fr(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Kr=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=pr(e,t),u={x:n,y:r},d=vr(i),f=gr(d),p=u[f],m=u[d],h=pr(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Hr.has(mr(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},qr=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=pr(e,t),c=await i.detectOverflow(t,s),l=mr(n),u=hr(n),d=vr(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=or(p-c[m],g),y=or(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*sr(c.left,c.right):S=p-2*sr(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Jr(){return typeof window<`u`}function Yr(e){return Qr(e)?(e.nodeName||``).toLowerCase():`#document`}function Xr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zr(e){return((Qr(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Qr(e){return Jr()?e instanceof Node||e instanceof Xr(e).Node:!1}function $r(e){return Jr()?e instanceof Element||e instanceof Xr(e).Element:!1}function ei(e){return Jr()?e instanceof HTMLElement||e instanceof Xr(e).HTMLElement:!1}function ti(e){return!Jr()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Xr(e).ShadowRoot}function ni(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=pi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ri(e){return/^(table|td|th)$/.test(Yr(e))}function ii(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ai=/transform|translate|scale|rotate|perspective|filter/,oi=/paint|layout|strict|content/,si=e=>!!e&&e!==`none`,ci;function li(e){let t=$r(e)?pi(e):e;return si(t.transform)||si(t.translate)||si(t.scale)||si(t.rotate)||si(t.perspective)||!di()&&(si(t.backdropFilter)||si(t.filter))||ai.test(t.willChange||``)||oi.test(t.contain||``)}function ui(e){let t=hi(e);for(;ei(t)&&!fi(t);){if(li(t))return t;if(ii(t))return null;t=hi(t)}return null}function di(){return ci??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ci}function fi(e){return/^(html|body|#document)$/.test(Yr(e))}function pi(e){return Xr(e).getComputedStyle(e)}function mi(e){return $r(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hi(e){if(Yr(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ti(e)&&e.host||Zr(e);return ti(t)?t.host:t}function gi(e){let t=hi(e);return fi(t)?(e.ownerDocument||e).body:ei(t)&&ni(t)?t:gi(t)}function _i(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=gi(e),i=r===e.ownerDocument?.body,a=Xr(r);if(i){let e=vi(a);return t.concat(a,a.visualViewport||[],ni(r)?r:[],e&&n?_i(e):[])}return t.concat(r,_i(r,[],n))}function vi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yi(e){let t=pi(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ei(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=cr(n)!==a||cr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function bi(e){return $r(e)?e:e.contextElement}function xi(e){let t=bi(e);if(!ei(t))return ur(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=yi(t),o=(a?cr(n.width):n.width)/r,s=(a?cr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Si=ur(0);function Ci(e){let t=Xr(e);return!di()||!t.visualViewport?Si:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wi(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Xr(e)}function Ti(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=bi(e),o=ur(1);t&&(r?$r(r)&&(o=xi(r)):o=xi(e));let s=wi(a,n,r)?Ci(a):ur(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Xr(a),t=$r(r)?Xr(r):r,n=e,i=vi(n);for(;i&&t!==n;){let e=xi(i),t=i.getBoundingClientRect(),r=pi(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Xr(i),i=vi(n)}}return Mr({width:u,height:d,x:c,y:l})}function Ei(e,t){let n=mi(e).scrollLeft;return t?t.left+n:Ti(Zr(e)).left+n}function Di(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ei(e,n),y:n.top+t.scrollTop}}function Oi(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Zr(r),s=t?ii(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ur(1),u=ur(0),d=ei(r);if((d||!a)&&((Yr(r)!==`body`||ni(o))&&(c=mi(r)),d)){let e=Ti(r);l=xi(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Di(o,c):ur(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ki(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ai(e){let t=mi(e),n=e.ownerDocument.body,r=sr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=sr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ei(e),o=-t.scrollTop;return pi(n).direction===`rtl`&&(a+=sr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ji=25;function Mi(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Xr(e),a=Zr(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!di()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ei(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ji&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ni(e,t){let n=Ti(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=xi(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Pi(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Mi(e,n,t);else if(t===`document`)r=Ai(Zr(e));else if($r(t))r=Ni(t,n);else{let n=Ci(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Mr(r)}function Fi(e,t){let n=t.get(e);if(n)return n;let r=_i(e,[],!1).filter(e=>$r(e)&&Yr(e)!==`body`),i=null,a=pi(e).position===`fixed`,o=a?hi(e):e;for(;$r(o)&&!fi(o);){let e=pi(o),t=li(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=hi(o)}return t.set(e,r),r}function Ii(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ii(t)?[]:Fi(t,this._c):[].concat(n),r],o=Pi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Pi(t,a[e],i);s=sr(n.top,s),c=or(n.right,c),l=or(n.bottom,l),u=sr(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Li(e){let{width:t,height:n}=yi(e);return{width:t,height:n}}function Ri(e,t,n){let r=ei(t),i=Zr(t),a=n===`fixed`,o=Ti(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ur(0);if((r||!a)&&((Yr(t)!==`body`||ni(i))&&(s=mi(t)),r)){let e=Ti(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ei(i));let l=i&&!r&&!a?Di(i,s):ur(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function zi(e){return pi(e).position===`static`}function Bi(e,t){if(!ei(e)||pi(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Zr(e)===n&&(n=n.ownerDocument.body),n}function Vi(e,t){let n=Xr(e);if(ii(e))return n;if(!ei(e)){let t=hi(e);for(;t&&!fi(t);){if($r(t)&&!zi(t))return t;t=hi(t)}return n}let r=Bi(e,t);for(;r&&ri(r)&&zi(r);)r=Bi(r,t);return r&&fi(r)&&zi(r)&&!li(r)?n:r||ui(e)||n}var Hi=async function(e){let t=this.getOffsetParent||Vi,n=this.getDimensions,r=await n(e.floating);return{reference:Ri(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ui(e){return pi(e).direction===`rtl`}var Wi={convertOffsetParentRelativeRectToViewportRelativeRect:Oi,getDocumentElement:Zr,getClippingRect:Ii,getOffsetParent:Vi,getElementRects:Hi,getClientRects:ki,getDimensions:Li,getScale:xi,isElement:$r,isRTL:Ui};function Gi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ki(e,t,n){let r=null,i,a=Zr(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=lr(d),h=lr(a.clientWidth-(u+f)),g=lr(a.clientHeight-(d+p)),_=lr(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:sr(0,or(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Gi(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Xr(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function qi(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=bi(e),u=i||a?[...l?_i(l):[],...t?_i(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ki(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ti(e):null;c&&g();function g(){let t=Ti(e);h&&!Gi(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ji=Wr,Yi=Gr,Xi=Rr,Zi=qr,Qi=Vr,$i=Lr,ea=Kr,ta=(e,t,n)=>{let r=new Map,i=n??{},a={...Wi,...i.platform,_c:r};return Ir(e,t,{...i,platform:a})};function na(e){return typeof e==`function`?e():e}function ra(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ia(e,t){let n=ra(e);return Math.round(t*n)/n}function aa(e){return{[`--bits-${e}-content-transform-origin`]:`var(--bits-floating-transform-origin)`,[`--bits-${e}-content-available-width`]:`var(--bits-floating-available-width)`,[`--bits-${e}-content-available-height`]:`var(--bits-floating-available-height)`,[`--bits-${e}-anchor-width`]:`var(--bits-floating-anchor-width)`,[`--bits-${e}-anchor-height`]:`var(--bits-floating-anchor-height)`}}function oa(e){let t=e.whileElementsMounted,n=I(()=>na(e.open)??!0),r=I(()=>na(e.middleware)),i=I(()=>na(e.transform)??!0),a=I(()=>na(e.placement)??`bottom`),o=I(()=>na(e.strategy)??`absolute`),s=I(()=>na(e.sideOffset)??0),c=I(()=>na(e.alignOffset)??0),l=e.reference,u=V(0),d=V(0),f=nn(null),p=V(fe(E(o))),m=V(fe(E(a))),h=V(fe({})),g=V(!1),_=!1,v=0,y=I(()=>{let e=f.current?ia(f.current,E(u)):E(u),t=f.current?ia(f.current,E(d)):E(d);return E(i)?{position:E(p),left:`0`,top:`0`,transform:`translate(${e}px, ${t}px)`,...f.current&&ra(f.current)>=1.5&&{willChange:`transform`}}:{position:E(p),left:`${e}px`,top:`${t}px`}}),b;function x(){if(l.current===null||f.current===null)return;let e=l.current,t=f.current,i=++v;ta(e,t,{middleware:E(r),placement:E(a),strategy:E(o)}).then(r=>{if(i===v&&l.current===e&&f.current===t){if(sa(e)){F(h,{...E(h),hide:{...E(h).hide,referenceHidden:!0}},!0);return}if(!E(n)&&E(u)!==0&&E(d)!==0){let e=Math.max(Math.abs(E(s)),Math.abs(E(c)),15);if(r.x<=e&&r.y<=e)return}F(u,r.x,!0),F(d,r.y,!0),F(p,r.strategy,!0),F(m,r.placement,!0),F(h,r.middlewareData,!0),F(g,!0)}})}function S(){typeof b==`function`&&(b(),b=void 0),v++}function C(){if(S(),t===void 0){x();return}E(n)&&l.current!==null&&f.current!==null&&(b=t(l.current,f.current,x))}function w(){!E(n)&&f.current===null&&F(g,!1)}function T(){return[E(r),E(a),E(o),E(s),E(c),E(n)]}return de(()=>{t===void 0&&E(n)&&x()}),de(C),de(()=>{if(t!==void 0){if(T(),!E(n)){_=!1;return}if(!E(g)){_=!1;return}if(!_){_=!0;return}x()}}),de(w),de(()=>S),{floating:f,reference:l,get strategy(){return E(p)},get placement(){return E(m)},get middlewareData(){return E(h)},get isPositioned(){return E(g)},get floatingStyles(){return E(y)},get update(){return x}}}function sa(e){return e instanceof Element?!e.isConnected||e instanceof HTMLElement&&e.hidden?!0:e.getClientRects().length===0:!1}var ca={top:`bottom`,right:`left`,bottom:`top`,left:`right`},la=new $t(`Floating.Root`),ua=new $t(`Floating.Content`),da=new $t(`Floating.Root`),fa=class e{static create(t=!1){return t?da.set(new e):la.set(new e)}anchorNode=nn(null);customAnchorNode=nn(null);triggerNode=nn(null);constructor(){de(()=>{this.customAnchorNode.current?typeof this.customAnchorNode.current==`string`?this.anchorNode.current=document.querySelector(this.customAnchorNode.current):this.anchorNode.current=this.customAnchorNode.current:this.anchorNode.current=this.triggerNode.current})}},pa=class e{static create(t,n=!1){return n?ua.set(new e(t,da.get())):ua.set(new e(t,la.get()))}opts;root;contentRef=nn(null);wrapperRef=nn(null);arrowRef=nn(null);contentAttachment=Ut(this.contentRef);wrapperAttachment=Ut(this.wrapperRef);arrowAttachment=Ut(this.arrowRef);arrowId=nn(hn());#e=I(()=>{if(typeof this.opts.style==`string`)return Wt(this.opts.style);if(!this.opts.style)return{}});#t=void 0;#n=new en(()=>this.arrowRef.current??void 0);#r=I(()=>this.#n?.width??0);#i=I(()=>this.#n?.height??0);#a=I(()=>this.opts.side?.current+(this.opts.align.current===`center`?``:`-${this.opts.align.current}`));#o=I(()=>Array.isArray(this.opts.collisionBoundary.current)?this.opts.collisionBoundary.current:[this.opts.collisionBoundary.current]);#s=I(()=>E(this.#o).length>0);get hasExplicitBoundaries(){return E(this.#s)}set hasExplicitBoundaries(e){F(this.#s,e)}#c=I(()=>({padding:this.opts.collisionPadding.current,boundary:E(this.#o).filter(zt),altBoundary:this.hasExplicitBoundaries}));get detectOverflowOptions(){return E(this.#c)}set detectOverflowOptions(e){F(this.#c,e)}#l=V(void 0);#u=V(void 0);#d=V(void 0);#f=V(void 0);#p=I(()=>[Ji({mainAxis:this.opts.sideOffset.current+E(this.#i),alignmentAxis:this.opts.alignOffset.current}),this.opts.avoidCollisions.current&&Yi({mainAxis:!0,crossAxis:!1,limiter:this.opts.sticky.current===`partial`?ea():void 0,...this.detectOverflowOptions}),this.opts.avoidCollisions.current&&Xi({...this.detectOverflowOptions}),Zi({...this.detectOverflowOptions,apply:({rects:e,availableWidth:t,availableHeight:n})=>{let{width:r,height:i}=e.reference;F(this.#l,t,!0),F(this.#u,n,!0),F(this.#d,r,!0),F(this.#f,i,!0)}}),this.arrowRef.current&&$i({element:this.arrowRef.current,padding:this.opts.arrowPadding.current}),ha({arrowWidth:E(this.#r),arrowHeight:E(this.#i)}),this.opts.hideWhenDetached.current&&Qi({strategy:`referenceHidden`,...this.detectOverflowOptions})].filter(Boolean));get middleware(){return E(this.#p)}set middleware(e){F(this.#p,e)}floating;#m=I(()=>_a(this.floating.placement));get placedSide(){return E(this.#m)}set placedSide(e){F(this.#m,e)}#h=I(()=>va(this.floating.placement));get placedAlign(){return E(this.#h)}set placedAlign(e){F(this.#h,e)}#g=I(()=>this.floating.middlewareData.arrow?.x??0);get arrowX(){return E(this.#g)}set arrowX(e){F(this.#g,e)}#_=I(()=>this.floating.middlewareData.arrow?.y??0);get arrowY(){return E(this.#_)}set arrowY(e){F(this.#_,e)}#v=I(()=>this.floating.middlewareData.arrow?.centerOffset!==0);get cannotCenterArrow(){return E(this.#v)}set cannotCenterArrow(e){F(this.#v,e)}#y=V();get contentZIndex(){return E(this.#y)}set contentZIndex(e){F(this.#y,e,!0)}#b=I(()=>ca[this.placedSide]);get arrowBaseSide(){return E(this.#b)}set arrowBaseSide(e){F(this.#b,e)}#x=I(()=>({id:this.opts.wrapperId.current,"data-bits-floating-content-wrapper":``,style:{...this.floating.floatingStyles,transform:this.floating.isPositioned?this.floating.floatingStyles.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:this.contentZIndex,"--bits-floating-transform-origin":`${this.floating.middlewareData.transformOrigin?.x} ${this.floating.middlewareData.transformOrigin?.y}`,"--bits-floating-available-width":`${E(this.#l)}px`,"--bits-floating-available-height":`${E(this.#u)}px`,"--bits-floating-anchor-width":`${E(this.#d)}px`,"--bits-floating-anchor-height":`${E(this.#f)}px`,...this.floating.middlewareData.hide?.referenceHidden&&{visibility:`hidden`,"pointer-events":`none`},...E(this.#e)},dir:this.opts.dir.current,...this.wrapperAttachment}));get wrapperProps(){return E(this.#x)}set wrapperProps(e){F(this.#x,e)}#S=I(()=>({"data-side":this.placedSide,"data-align":this.placedAlign,style:Vt({...E(this.#e)}),...this.contentAttachment}));get props(){return E(this.#S)}set props(e){F(this.#S,e)}#C=I(()=>({position:`absolute`,left:this.arrowX?`${this.arrowX}px`:void 0,top:this.arrowY?`${this.arrowY}px`:void 0,[this.arrowBaseSide]:0,"transform-origin":{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[this.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[this.placedSide],visibility:this.cannotCenterArrow?`hidden`:void 0}));get arrowStyle(){return E(this.#C)}set arrowStyle(e){F(this.#C,e)}constructor(e,t){this.opts=e,this.root=t,this.#t=e.updatePositionStrategy,e.customAnchor&&(this.root.customAnchorNode.current=e.customAnchor.current),Ht(()=>e.customAnchor.current,e=>{this.root.customAnchorNode.current=e}),this.floating=oa({strategy:()=>this.opts.strategy.current,placement:()=>E(this.#a),middleware:()=>this.middleware,reference:this.root.anchorNode,whileElementsMounted:(...e)=>qi(...e,{animationFrame:this.#t?.current===`always`}),open:()=>this.opts.enabled.current,sideOffset:()=>this.opts.sideOffset.current,alignOffset:()=>this.opts.alignOffset.current}),de(()=>{this.floating.isPositioned&&this.opts.onPlaced?.current()}),Ht(()=>this.contentRef.current,e=>{if(!e||!this.opts.enabled.current)return;let t=Gt(e),n=t.requestAnimationFrame(()=>{if(this.contentRef.current!==e||!this.opts.enabled.current)return;let n=t.getComputedStyle(e).zIndex;n!==this.contentZIndex&&(this.contentZIndex=n)});return()=>{t.cancelAnimationFrame(n)}}),de(()=>{this.floating.floating.current=this.wrapperRef.current})}},ma=class e{static create(t,n=!1){return n?new e(t,da.get()):new e(t,la.get())}opts;root;constructor(e,t){this.opts=e,this.root=t,t.triggerNode=e.virtualEl&&e.virtualEl.current?bn(e.virtualEl.current):e.ref}};function ha(e){return{name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ga(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}}function ga(e){let[t,n=`center`]=e.split(`-`);return[t,n]}function _a(e){return ga(e)[0]}function va(e){return ga(e)[1]}function ya(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);fa.create(n());var r=Y(),a=q(r);_(a,()=>t.children??R),y(e,r),x()}function ba(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);ma.create({id:Q(()=>t.id),virtualEl:Q(()=>t.virtualEl),ref:t.ref},n());var r=Y(),a=q(r);_(a,()=>t.children??R),y(e,r),x()}function xa(e,t){i(t,!0);let n=k(t,`side`,3,`bottom`),r=k(t,`sideOffset`,3,0),a=k(t,`align`,3,`center`),o=k(t,`alignOffset`,3,0),s=k(t,`arrowPadding`,3,0),c=k(t,`avoidCollisions`,3,!0),l=k(t,`collisionBoundary`,19,()=>[]),u=k(t,`collisionPadding`,3,0),d=k(t,`hideWhenDetached`,3,!1),f=k(t,`onPlaced`,3,()=>{}),p=k(t,`sticky`,3,`partial`),m=k(t,`updatePositionStrategy`,3,`optimized`),h=k(t,`strategy`,3,`fixed`),g=k(t,`dir`,3,`ltr`),v=k(t,`style`,19,()=>({})),b=k(t,`wrapperId`,19,hn),S=k(t,`customAnchor`,3,null),C=k(t,`tooltip`,3,!1),w=pa.create({side:Q(()=>n()),sideOffset:Q(()=>r()),align:Q(()=>a()),alignOffset:Q(()=>o()),id:Q(()=>t.id),arrowPadding:Q(()=>s()),avoidCollisions:Q(()=>c()),collisionBoundary:Q(()=>l()),collisionPadding:Q(()=>u()),hideWhenDetached:Q(()=>d()),onPlaced:Q(()=>f()),sticky:Q(()=>p()),updatePositionStrategy:Q(()=>m()),strategy:Q(()=>h()),dir:Q(()=>g()),style:Q(()=>v()),enabled:Q(()=>t.enabled),wrapperId:Q(()=>b()),customAnchor:Q(()=>S())},C()),T=I(()=>tn(w.wrapperProps,{style:{pointerEvents:`auto`}}));var D=Y(),O=q(D);_(O,()=>t.content??R,()=>({props:w.props,wrapperProps:E(T)})),y(e,D),x()}function Sa(e,t){i(t,!0),ue(()=>{t.onPlaced?.()});var n=Y(),r=q(n);_(r,()=>t.content??R,()=>({props:{},wrapperProps:{}})),y(e,n),x()}var Ca=new Set([`$$slots`,`$$events`,`$$legacy`,`content`,`isStatic`,`onPlaced`]);function wa(e,t){let n=k(t,`isStatic`,3,!1),r=U(t,Ca);var i=Y(),a=q(i),o=e=>{Sa(e,{get content(){return t.content},get onPlaced(){return t.onPlaced}})},s=e=>{xa(e,K({get content(){return t.content},get onPlaced(){return t.onPlaced}},()=>r))};h(a,e=>{n()?e(o):e(s,-1)}),y(e,i)}var Ta=new Set(`$$slots.$$events.$$legacy.popper.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.enabled.ref.tooltip.contentPointerEvents`.split(`.`)),Ea=r(`<!> <!>`,1);function Da(e,t){i(t,!0);let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),a=k(t,`isValidEvent`,3,()=>!1),o=k(t,`customAnchor`,3,null),s=k(t,`isStatic`,3,!1),c=k(t,`tooltip`,3,!1),l=k(t,`contentPointerEvents`,3,`auto`),u=U(t,Ta),d=I(()=>t.preventScroll??!0),f=I(()=>t.strategy??(E(d)?`fixed`:`absolute`));wa(e,{get isStatic(){return s()},get id(){return t.id},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return E(f)},get dir(){return t.dir},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return o()},get enabled(){return t.enabled},get tooltip(){return c()},content:(e,i)=>{let o=()=>(i?.()).props,s=()=>(i?.()).wrapperProps;var c=Ea(),f=q(c),p=e=>{sn(e,{get preventScroll(){return E(d)}})},m=e=>{sn(e,{get preventScroll(){return E(d)}})};h(f,e=>{t.forceMount&&t.enabled?e(p):t.forceMount||e(m,1)});var g=z(f,2);cn(g,{get onOpenAutoFocus(){return t.onOpenAutoFocus},get onCloseAutoFocus(){return t.onCloseAutoFocus},get loop(){return t.loop},get enabled(){return t.enabled},get trapFocus(){return r()},get forceMount(){return t.forceMount},get ref(){return t.ref},focusScope:(e,r)=>{let i=()=>(r?.()).props;ln(e,{get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,r)=>{yn(e,{get id(){return t.id},get onInteractOutside(){return t.onInteractOutside},get onFocusOutside(){return t.onFocusOutside},get interactOutsideBehavior(){return n()},get isValidEvent(){return a()},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,n)=>{let r=()=>(n?.()).props;wn(e,{get id(){return t.id},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,n)=>{var a=Y(),c=q(a);{let e=I(()=>({props:tn(u,o(),r(),i(),{style:{pointerEvents:l()}}),wrapperProps:s()}));_(c,()=>t.popper??R,()=>E(e))}y(e,a)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),y(e,c)},$$slots:{content:!0}}),x()}var Oa=new Set(`$$slots.$$events.$$legacy.popper.open.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.ref.shouldRender`.split(`.`));function ka(e,t){let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),i=k(t,`isValidEvent`,3,()=>!1),a=k(t,`customAnchor`,3,null),o=k(t,`isStatic`,3,!1),s=U(t,Oa);var c=Y(),l=q(c),u=e=>{Da(e,K({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return a()},get isStatic(){return o()},get enabled(){return t.open},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside},forceMount:!1,get ref(){return t.ref}},()=>s))};h(l,e=>{t.shouldRender&&e(u)}),y(e,c)}var Aa=new Set(`$$slots.$$events.$$legacy.popper.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.enabled`.split(`.`));function ja(e,t){let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),i=k(t,`isValidEvent`,3,()=>!1),a=k(t,`customAnchor`,3,null),o=k(t,`isStatic`,3,!1),s=U(t,Aa);Da(e,K({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return a()},get isStatic(){return o()},get enabled(){return t.enabled},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside}},()=>s,{forceMount:!0}))}function Ma(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Na(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Pa(e){if(typeof CSS<`u`&&typeof CSS.escape==`function`)return CSS.escape(e);let t=e.length,n=-1,r,i=``,a=e.charCodeAt(0);if(t===1&&a===45)return`\\`+e;for(;++n<t;){if(r=e.charCodeAt(n),r===0){i+=`�`;continue}if(r>=1&&r<=31||r===127||n===0&&r>=48&&r<=57||n===1&&r>=48&&r<=57&&a===45){i+=`\\`+r.toString(16)+` `;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){i+=e.charAt(n);continue}i+=`\\`+e.charAt(n)}return i}var Fa=`data-value`,Ia=Bt({component:`command`,parts:[`root`,`list`,`input`,`separator`,`loading`,`empty`,`group`,`group-items`,`group-heading`,`item`,`viewport`,`input-label`]}),La=Ia.selector(`group`),Ra=Ia.selector(`group-items`),za=Ia.selector(`group-heading`),Ba=Ia.selector(`item`),Va=`${Ia.selector(`item`)}:not([aria-disabled="true"])`,Ha=new $t(`Command.Root`),Ua=new $t(`Command.List`),Wa=new $t(`Command.Group`),Ga={search:``,value:``,filtered:{count:0,items:new Map,groups:new Set}},Ka=class e{static create(t){return Ha.set(new e(t))}opts;attachment;#e=!1;#t=!0;sortAfterTick=!1;sortAndFilterAfterTick=!1;allItems=new Set;allGroups=new Map;allIds=new Map;#n=V(0);get key(){return E(this.#n)}set key(e){F(this.#n,e,!0)}#r=V(null);get viewportNode(){return E(this.#r)}set viewportNode(e){F(this.#r,e,!0)}#i=V(null);get inputNode(){return E(this.#i)}set inputNode(e){F(this.#i,e,!0)}#a=V(null);get labelNode(){return E(this.#a)}set labelNode(e){F(this.#a,e,!0)}#o=V(Ga);get commandState(){return E(this.#o)}set commandState(e){F(this.#o,e)}#s=V(fe(Ga));get _commandState(){return E(this.#s)}set _commandState(e){F(this.#s,e,!0)}#c(){return o(this._commandState)}#l(){this.#e||(this.#e=!0,Xt(()=>{this.#e=!1;let e=this.#c();Object.is(this.commandState,e)||(this.commandState=e,this.opts.onStateChange?.current?.(e))}))}setState(e,t,n){Object.is(this._commandState[e],t)||(this._commandState[e]=t,e===`search`?(this.#m(),this.#d()):e===`value`&&(n||this.#g()),this.#l())}constructor(e){this.opts=e,this.attachment=Ut(this.opts.ref);let t={...this._commandState,value:this.opts.value.current??``};this._commandState=t,this.commandState=t,this.onkeydown=this.onkeydown.bind(this)}#u(e,t){let n=this.opts.filter.current??qo;return e?n(e,this._commandState.search,t):0}#d(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){!this._commandState.value||!this.#t?this.#f():this.#t&&this._commandState.value&&this.#p();return}let e=this._commandState.filtered.items,t=[];for(let n of this._commandState.filtered.groups){let r=this.allGroups.get(n),i=0;if(!r){t.push([n,i]);continue}for(let t of r){let n=e.get(t);i=Math.max(n??0,i)}t.push([n,i])}let n=this.viewportNode,r=this.getValidItems().sort((t,n)=>{let r=t.getAttribute(`data-value`),i=n.getAttribute(`data-value`),a=e.get(r)??0;return(e.get(i)??0)-a});for(let e of r){let t=e.closest(Ra);if(t){let n=e.parentElement===t?e:e.closest(`${Ra} > *`);n&&t.appendChild(n)}else{let t=e.parentElement===n?e:e.closest(`${Ra} > *`);t&&n?.appendChild(t)}}let i=t.sort((e,t)=>t[1]-e[1]);for(let e of i){let t=n?.querySelector(`${La}[${Fa}="${Pa(e[0])}"]`);t?.parentElement?.appendChild(t)}this.#f()}setValue(e,t){e!==this.opts.value.current&&e===``&&Xt(()=>{this.key++}),this.setState(`value`,e,t),this.opts.value.current=e}#f(){Xt(()=>{let e=this.getValidItems().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Fa),t=this.#t&&this.opts.disableInitialScroll.current;this.setValue(e??``,t),this.#t=!1})}#p(){Xt(()=>{this.opts.disableInitialScroll.current||this.#g(),this.#t=!1})}#m(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){this._commandState.filtered.count=this.allItems.size;return}this._commandState.filtered.groups=new Set;let e=0;for(let t of this.allItems){let n=this.allIds.get(t)?.value??``,r=this.allIds.get(t)?.keywords??[],i=this.#u(n,r);this._commandState.filtered.items.set(t,i),i>0&&e++}for(let[e,t]of this.allGroups)for(let n of t){let t=this._commandState.filtered.items.get(n);if(t&&t>0){this._commandState.filtered.groups.add(e);break}}this._commandState.filtered.count=e}getValidItems(){let e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Va)).filter(e=>!!e):[]}getVisibleItems(){let e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Ba)).filter(e=>!!e):[]}get itemsGrid(){if(!this.isGrid)return[];let e=this.opts.columns.current??1,t=this.getVisibleItems(),n=[[]],r=t[0]?.getAttribute(`data-group`),i=0,a=0;for(let o=0;o<t.length;o++){let s=t[o],c=s?.getAttribute(`data-group`);r===c?(i++,i>e&&(a++,i=1,n.push([])),n[a]?.push({index:o,firstRowOfGroup:n[a]?.[0]?.firstRowOfGroup??o===0,ref:s})):(r=c,i=1,a++,n.push([{index:o,firstRowOfGroup:!0,ref:s}]))}return n}#h(){let e=this.opts.ref.current;if(!e)return;let t=e.querySelector(`${Va}[data-selected]`);if(t)return t}#g(){Xt(()=>{let e=this.#h();if(!e)return;let t=e.parentElement?.parentElement;if(t){if(this.isGrid){let t=this.#_(e);if(e.scrollIntoView({block:`nearest`}),t){(e?.closest(La)?.querySelector(za))?.scrollIntoView({block:`nearest`});return}}else{let n=Zt(t);if(n&&n.dataset?.value===e.dataset?.value){(e?.closest(La)?.querySelector(za))?.scrollIntoView({block:`nearest`});return}}e.scrollIntoView({block:`nearest`})}})}#_(e){let t=this.itemsGrid;if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t[n];if(r!==void 0)for(let t=0;t<r.length;t++){let n=r[t];if(n!==void 0&&n.ref===e)return n.firstRowOfGroup}}return!1}updateSelectedToIndex(e){let t=this.getValidItems()[e];t&&this.setValue(t.getAttribute(Fa)??``)}updateSelectedByItem(e){let t=this.#h(),n=this.getValidItems(),r=n.findIndex(e=>e===t),i=n[r+e];this.opts.loop.current&&(i=r+e<0?n[n.length-1]:r+e===n.length?n[0]:n[r+e]),i&&this.setValue(i.getAttribute(Fa)??``)}updateSelectedByGroup(e){let t=this.#h()?.closest(La),n;for(;t&&!n;)t=e>0?Ma(t,La):Na(t,La),n=t?.querySelector(Va);n?this.setValue(n.getAttribute(Fa)??``):this.updateSelectedByItem(e)}registerValue(e,t){return e&&e===this.allIds.get(e)?.value||this.allIds.set(e,{value:e,keywords:t}),this._commandState.filtered.items.set(e,this.#u(e,t)),this.sortAfterTick||(this.sortAfterTick=!0,Xt(()=>{this.#d(),this.sortAfterTick=!1})),()=>{this.allIds.delete(e)}}registerItem(e,t){return this.allItems.add(e),t&&(this.allGroups.has(t)?this.allGroups.get(t).add(e):this.allGroups.set(t,new Set([e]))),this.sortAndFilterAfterTick||(this.sortAndFilterAfterTick=!0,Xt(()=>{this.#m(),this.#d(),this.sortAndFilterAfterTick=!1})),this.#l(),()=>{let t=this.#h();this.allItems.delete(e),this.commandState.filtered.items.delete(e),this.#m(),t?.getAttribute(`id`)===e&&this.#f(),this.#l()}}registerGroup(e){return this.allGroups.has(e)||this.allGroups.set(e,new Set),()=>{this.allIds.delete(e),this.allGroups.delete(e)}}get isGrid(){return this.opts.columns.current!==null}#v(){return this.updateSelectedToIndex(this.getValidItems().length-1)}#y(e){e.preventDefault(),e.metaKey?this.#v():e.altKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(1)}#b(e){this.opts.columns.current!==null&&(e.preventDefault(),e.metaKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(this.#S(e)))}#x(e,t){if(t.length===0)return null;for(let n=0;n<t.length;n++){let r=t[n];if(r!==void 0)for(let t=0;t<r.length;t++){let i=r[t];if(i!==void 0&&i.ref===e)return{columnIndex:t,rowIndex:n}}}return null}#S(e){let t=this.itemsGrid,n=this.#h();if(!n)return 0;let r=this.#x(n,t);if(!r)return 0;let i=null,a=+!!e.altKey;if(e.altKey&&r.rowIndex===t.length-2&&!this.opts.loop.current)i=this.#C({start:t.length-1,end:t.length,expectedColumnIndex:r.columnIndex,grid:t});else if(r.rowIndex===t.length-1){if(!this.opts.loop.current)return 0;i=this.#C({start:0+a,end:r.rowIndex,expectedColumnIndex:r.columnIndex,grid:t})}else i=this.#C({start:r.rowIndex+1+a,end:t.length,expectedColumnIndex:r.columnIndex,grid:t}),i===null&&this.opts.loop.current&&(i=this.#C({start:0,end:r.rowIndex,expectedColumnIndex:r.columnIndex,grid:t}));return this.#w(n,i)}#C({start:e,end:t,grid:n,expectedColumnIndex:r}){let i=null;for(let a=e;a<t;a++){let e=n[a];if(i=e[r]?.ref??null,i!==null&&qa(i)){i=null;continue}if(i===null)for(let t=e.length-1;t>=0;t--){let t=e[e.length-1];if(!(t===void 0||qa(t.ref))){i=t.ref;break}}break}return i}#w(e,t){if(t===null)return 0;let n=this.getValidItems(),r=n.findIndex(t=>t===e);return n.findIndex(e=>e===t)-r}#T(e){this.opts.columns.current!==null&&(e.preventDefault(),e.metaKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(this.#E(e)))}#E(e){let t=this.itemsGrid,n=this.#h();if(n===void 0)return 0;let r=this.#x(n,t);if(r===null)return 0;let i=null,a=+!!e.altKey;if(e.altKey&&r.rowIndex===1&&this.opts.loop.current===!1)i=this.#D({start:0,end:0,expectedColumnIndex:r.columnIndex,grid:t});else if(r.rowIndex===0){if(this.opts.loop.current===!1)return 0;i=this.#D({start:t.length-1-a,end:r.rowIndex+1,expectedColumnIndex:r.columnIndex,grid:t})}else i=this.#D({start:r.rowIndex-1-a,end:0,expectedColumnIndex:r.columnIndex,grid:t}),i===null&&this.opts.loop.current&&(i=this.#D({start:t.length-1,end:r.rowIndex+1,expectedColumnIndex:r.columnIndex,grid:t}));return this.#w(n,i)}#D({start:e,end:t,grid:n,expectedColumnIndex:r}){let i=null;for(let a=e;a>=t;a--){let e=n[a];if(e!==void 0){if(i=e[r]?.ref??null,i!==null&&qa(i)){i=null;continue}if(i===null)for(let t=e.length-1;t>=0;t--){let t=e[e.length-1];if(!(t===void 0||qa(t.ref))){i=t.ref;break}}break}}return i}#O(e){e.preventDefault(),e.metaKey?this.updateSelectedToIndex(0):e.altKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(-1)}onkeydown(e){let t=this.opts.vimBindings.current&&e.ctrlKey;switch(e.key){case`n`:case`j`:t&&(this.isGrid?this.#b(e):this.#y(e));break;case`l`:t&&this.isGrid&&this.#y(e);break;case Rt:this.isGrid?this.#b(e):this.#y(e);break;case mn:if(!this.isGrid)break;this.#y(e);break;case`p`:case`k`:t&&(this.isGrid?this.#T(e):this.#O(e));break;case`h`:t&&this.isGrid&&this.#O(e);break;case Ft:this.isGrid?this.#T(e):this.#O(e);break;case Jt:if(!this.isGrid)break;this.#O(e);break;case Kt:e.preventDefault(),this.updateSelectedToIndex(0);break;case`End`:e.preventDefault(),this.#v();break;case pn:if(!e.isComposing&&e.keyCode!==229){e.preventDefault();let t=this.#h();t&&t?.click()}}}#k=I(()=>({id:this.opts.id.current,role:`application`,[Ia.root]:``,tabindex:-1,onkeydown:this.onkeydown,...this.attachment}));get props(){return E(this.#k)}set props(e){F(this.#k,e)}};function qa(e){return e.getAttribute(`aria-disabled`)===`true`}var Ja=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;#e=I(()=>this.root._commandState.filtered.count===0&&this.#t===!1||this.opts.forceMount.current);get shouldRender(){return E(this.#e)}set shouldRender(e){F(this.#e,e)}#t=!0;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref),re(()=>{this.#t=!1})}#n=I(()=>({id:this.opts.id.current,role:`presentation`,[Ia.empty]:``,...this.attachment}));get props(){return E(this.#n)}set props(e){F(this.#n,e)}},Ya=class e{static create(t){return Wa.set(new e(t,Ha.get()))}opts;root;attachment;#e=I(()=>this.opts.forceMount.current||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search?!0:this.root._commandState.filtered.groups.has(this.trueValue));get shouldRender(){return E(this.#e)}set shouldRender(e){F(this.#e,e)}#t=V(null);get headingNode(){return E(this.#t)}set headingNode(e){F(this.#t,e,!0)}#n=V(``);get trueValue(){return E(this.#n)}set trueValue(e){F(this.#n,e,!0)}constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref),this.trueValue=e.value.current??e.id.current,Ht(()=>this.trueValue,()=>this.root.registerGroup(this.trueValue)),de(()=>this.opts.value.current?(this.trueValue=this.opts.value.current,this.root.registerValue(this.opts.value.current)):this.headingNode&&this.headingNode.textContent?(this.trueValue=this.headingNode.textContent.trim().toLowerCase(),this.root.registerValue(this.trueValue)):(this.trueValue=`-----${this.opts.id.current}`,this.root.registerValue(this.trueValue)))}#r=I(()=>({id:this.opts.id.current,role:`presentation`,hidden:!this.shouldRender||void 0,"data-value":this.trueValue,[Ia.group]:``,...this.attachment}));get props(){return E(this.#r)}set props(e){F(this.#r,e)}},Xa=class e{static create(t){return new e(t,Wa.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Ut(this.opts.ref,e=>this.group.headingNode=e)}#e=I(()=>({id:this.opts.id.current,[Ia[`group-heading`]]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Za=class e{static create(t){return new e(t,Wa.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Ut(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`group`,[Ia[`group-items`]]:``,"aria-labelledby":this.group.headingNode?.id??void 0,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Qa=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;#e=I(()=>{let e=this.root.viewportNode?.querySelector(`${Ba}[${Fa}="${Pa(this.root.opts.value.current)}"]`);if(e!=null)return e.getAttribute(`id`)??void 0});constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref,e=>this.root.inputNode=e),Ht(()=>this.opts.ref.current,()=>{let e=this.opts.ref.current;e&&this.opts.autofocus.current&&kn(10,()=>e.focus())}),Ht(()=>this.opts.value.current,()=>{this.root.commandState.search!==this.opts.value.current&&this.root.setState(`search`,this.opts.value.current)})}#t=I(()=>({id:this.opts.id.current,type:`text`,[Ia.input]:``,autocomplete:`off`,autocorrect:`off`,spellcheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":Yt(!0),"aria-controls":this.root.viewportNode?.id??void 0,"aria-labelledby":this.root.labelNode?.id??void 0,"aria-activedescendant":E(this.#e),...this.attachment}));get props(){return E(this.#t)}set props(e){F(this.#t,e)}},$a=class e{static create(t){let n=Wa.getOr(null);return new e({...t,group:n},Ha.get())}opts;root;attachment;#e=null;#t=I(()=>this.opts.forceMount.current||this.#e?.opts.forceMount.current===!0);#n=I(()=>{if(this.opts.ref.current,E(this.#t)||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search)return!0;let e=this.root.commandState.filtered.items.get(this.trueValue);return e!==void 0&&e>0});get shouldRender(){return E(this.#n)}set shouldRender(e){F(this.#n,e)}#r=I(()=>this.root.opts.value.current===this.trueValue&&this.trueValue!==``);get isSelected(){return E(this.#r)}set isSelected(e){F(this.#r,e)}#i=V(``);get trueValue(){return E(this.#i)}set trueValue(e){F(this.#i,e,!0)}constructor(e,t){this.opts=e,this.root=t,this.#e=Wa.getOr(null),this.trueValue=e.value.current,this.attachment=Ut(this.opts.ref),Ht([()=>this.trueValue,()=>this.#e?.trueValue,()=>this.opts.forceMount.current],()=>{if(!this.opts.forceMount.current&&this.trueValue)return this.root.registerItem(this.trueValue,this.#e?.trueValue)}),Ht([()=>this.opts.value.current,()=>this.opts.ref.current],()=>{this.opts.value.current?this.trueValue=this.opts.value.current:this.opts.ref.current?.textContent&&(this.trueValue=this.opts.ref.current.textContent.trim()),this.trueValue&&(this.root.registerValue(this.trueValue,e.keywords.current.map(e=>e.trim())),this.opts.ref.current?.setAttribute(Fa,this.trueValue))}),this.onclick=this.onclick.bind(this),this.onpointermove=this.onpointermove.bind(this)}#a(){this.opts.disabled.current||(this.#o(),this.opts.onSelect?.current())}#o(){this.opts.disabled.current||this.root.setValue(this.trueValue,!0)}onpointermove(e){this.opts.disabled.current||this.root.opts.disablePointerSelection.current||this.#o()}onclick(e){this.opts.disabled.current||this.#a()}#s=I(()=>({id:this.opts.id.current,"aria-disabled":Yt(this.opts.disabled.current),"aria-selected":Yt(this.isSelected),"data-disabled":qt(this.opts.disabled.current),"data-selected":qt(this.isSelected),"data-value":this.trueValue,"data-group":this.#e?.trueValue,[Ia.item]:``,role:`option`,onpointermove:this.onpointermove,onclick:this.onclick,...this.attachment}));get props(){return E(this.#s)}set props(e){F(this.#s,e)}},eo=class e{static create(t){return Ua.set(new e(t,Ha.get()))}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`listbox`,"aria-label":this.opts.ariaLabel.current,[Ia.list]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},to=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref,e=>this.root.labelNode=e)}#e=I(()=>({id:this.opts.id.current,[Ia[`input-label`]]:``,for:this.opts.for?.current,style:rr,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},no=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`]),ro=r(`<label><!></label>`);function io(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,no),c=to.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=ro();P(d,()=>({...E(l)}));var f=W(d);_(f,()=>t.children??R),n(d),y(e,d),x()}var ao=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`onValueChange`,`onStateChange`,`loop`,`shouldFilter`,`filter`,`label`,`vimBindings`,`disablePointerSelection`,`disableInitialScroll`,`columns`,`children`,`child`]),oo=r(`<!> <!>`,1),so=r(`<div><!> <!></div>`);function co(e,t){let r=u();i(t,!0);let a=e=>{io(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,v())),y(e,n)},$$slots:{default:!0}})},o=k(t,`id`,19,()=>En(r)),s=k(t,`ref`,15,null),l=k(t,`value`,15,``),d=k(t,`onValueChange`,3,Qt),f=k(t,`onStateChange`,3,Qt),p=k(t,`loop`,3,!1),m=k(t,`shouldFilter`,3,!0),g=k(t,`filter`,3,qo),v=k(t,`label`,3,``),b=k(t,`vimBindings`,3,!0),S=k(t,`disablePointerSelection`,3,!1),w=k(t,`disableInitialScroll`,3,!1),T=k(t,`columns`,3,null),D=U(t,ao),O=Ka.create({id:Q(()=>o()),ref:Q(()=>s(),e=>s(e)),filter:Q(()=>g()),shouldFilter:Q(()=>m()),loop:Q(()=>p()),value:Q(()=>l(),e=>{l()!==e&&(l(e),d()(e))}),vimBindings:Q(()=>b()),disablePointerSelection:Q(()=>S()),disableInitialScroll:Q(()=>w()),onStateChange:Q(()=>f()),columns:Q(()=>T())}),A=e=>O.updateSelectedToIndex(e),j=e=>O.updateSelectedByGroup(e),ee=e=>O.updateSelectedByItem(e),te=()=>O.getValidItems(),M=I(()=>tn(D,O.props));var N={updateSelectedToIndex:A,updateSelectedByGroup:j,updateSelectedByItem:ee,getValidItems:te},F=Y(),L=q(F),ne=e=>{var n=oo(),r=q(n);a(r);var i=z(r,2);_(i,()=>t.child,()=>({props:E(M)})),y(e,n)},re=e=>{var r=so();P(r,()=>({...E(M)}));var i=W(r);a(i);var o=z(i,2);_(o,()=>t.children??R),n(r),y(e,r)};return h(L,e=>{t.child?e(ne):e(re,-1)}),y(e,F),x(N)}var lo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`,`forceMount`]),uo=r(`<div><!></div>`);function fo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`forceMount`,3,!1),c=U(t,lo),l=Ja.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e)),forceMount:Q(()=>s())}),d=I(()=>tn(l.props,c));var f=Y(),p=q(f),m=e=>{var r=Y(),i=q(r),a=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},o=e=>{var r=uo();P(r,()=>({...E(d)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)};h(p,e=>{l.shouldRender&&e(m)}),y(e,f),x()}var po=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`forceMount`,`children`,`child`]),mo=r(`<div><!></div>`);function ho(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`forceMount`,3,!1),l=U(t,po),d=Ya.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e)),forceMount:Q(()=>c()),value:Q(()=>s())}),f=I(()=>tn(l,d.props));var p=Y(),m=q(p),g=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},v=e=>{var r=mo();P(r,()=>({...E(f)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(m,e=>{t.child?e(g):e(v,-1)}),y(e,p),x()}var go=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),_o=r(`<div><!></div>`);function vo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,go),c=Xa.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=Y(),f=q(d),p=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=_o();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var yo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),bo=r(`<div><!></div>`),xo=r(`<div style="display: contents;"><!></div>`);function So(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,yo),c=Za.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=xo(),f=W(d),p=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=bo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),n(d),y(e,d),x()}var Co=new Set([`$$slots`,`$$events`,`$$legacy`,`value`,`autofocus`,`id`,`ref`,`child`]),wo=r(`<input/>`);function To(e,t){let n=u();i(t,!0);let r=k(t,`value`,15,``),a=k(t,`autofocus`,3,!1),o=k(t,`id`,19,()=>En(n)),s=k(t,`ref`,15,null),c=U(t,Co),l=Qa.create({id:Q(()=>o()),ref:Q(()=>s(),e=>s(e)),value:Q(()=>r(),e=>{r(e)}),autofocus:Q(()=>a()??!1)}),d=I(()=>tn(c,l.props));var f=Y(),p=q(f),m=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},g=e=>{var t=wo();P(t,()=>({...E(d)}),void 0,void 0,void 0,void 0,!0),N(t,r),y(e,t)};h(p,e=>{t.child?e(m):e(g,-1)}),y(e,f),x()}var Eo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`disabled`,`children`,`child`,`onSelect`,`forceMount`,`keywords`]),Do=r(`<div><!></div>`),Oo=r(`<div style="display: contents;" data-item-wrapper=""><!></div>`);function ko(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`disabled`,3,!1),l=k(t,`onSelect`,3,Qt),d=k(t,`forceMount`,3,!1),f=k(t,`keywords`,19,()=>[]),m=U(t,Eo),g=$a.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e)),value:Q(()=>s()),disabled:Q(()=>c()),onSelect:Q(()=>l()),forceMount:Q(()=>d()),keywords:Q(()=>f())}),v=I(()=>tn(m,g.props));var b=Y(),S=q(b);p(S,()=>g.root.key,e=>{var r=Oo(),i=W(r),a=e=>{var r=Y(),i=q(r),a=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(v)})),y(e,n)},o=e=>{var r=Do();P(r,()=>({...E(v)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)};h(i,e=>{g.shouldRender&&e(a)}),n(r),H(()=>B(r,`data-value`,g.trueValue)),y(e,r)}),y(e,b),x()}var Ao=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`aria-label`]),jo=r(`<div><!></div>`);function Mo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,Ao),c=eo.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e)),ariaLabel:Q(()=>t[`aria-label`]??`Suggestions...`)}),l=I(()=>tn(s,c.props));var d=Y(),f=q(d);p(f,()=>c.root._commandState.search===``,e=>{var r=Y(),i=q(r),a=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},o=e=>{var r=jo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)}),y(e,d),x()}var No=1,Po=.9,Fo=.8,Io=.17,Lo=.1,Ro=.999,zo=.9999,Bo=.99,Vo=/[\\/_+.#"@[({&]/,Ho=/[\\/_+.#"@[({&]/g,Uo=/[\s-]/,Wo=/[\s-]/g;function Go(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?No:Bo;let s=`${i},${a}`;if(o[s]!==void 0)return o[s];let c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;for(;l>=0;)d=Go(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=No:Vo.test(e.charAt(l-1))?(d*=Fo,p=e.slice(i,l-1).match(Ho),p&&i>0&&(d*=Ro**p.length)):Uo.test(e.charAt(l-1))?(d*=Po,m=e.slice(i,l-1).match(Wo),m&&i>0&&(d*=Ro**m.length)):(d*=Io,i>0&&(d*=Ro**(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=zo)),(d<Lo&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Go(e,t,n,r,l+1,a+2,o),f*Lo>d&&(d=f*Lo)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ko(e){return e.toLowerCase().replace(Wo,` `)}function qo(e,t,n){return e=n&&n.length>0?`${`${e} ${n?.join(` `)}`}`:e,Go(e,t,Ko(e),Ko(t),0,0,{})}var Jo=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`onSelect`,`closeOnSelect`]),Yo=r(`<div><!></div>`);function Xo(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=k(t,`disabled`,3,!1),c=k(t,`onSelect`,3,Qt),l=k(t,`closeOnSelect`,3,!0),d=U(t,Jo),f=Tn.create({id:Q(()=>o()),disabled:Q(()=>s()),onSelect:Q(()=>c()),ref:Q(()=>a(),e=>a(e)),closeOnSelect:Q(()=>l())}),p=I(()=>tn(d,f.props));var m=Y(),g=q(m),v=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(p)})),y(e,n)},b=e=>{var r=Yo();P(r,()=>({...E(p)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(g,e=>{t.child?e(v):e(b,-1)}),y(e,m),x()}var Zo=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),Qo=r(`<div><!></div>`);function $o(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,Zo),c=rn.create({id:Q(()=>o()),ref:Q(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=Y(),f=q(d),p=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=Qo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var es=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),ts=r(`<div><!></div>`);function ns(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,es),c=un.create({id:Q(()=>o()),ref:Q(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=Y(),f=q(d),p=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=ts();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var rs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`id`,`child`,`children`]),is=r(`<div><!></div>`);function as(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,rs),c=Dn.create({id:Q(()=>o()),ref:Q(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=Y(),f=q(d),p=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=is();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}function os(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=k(t,`dir`,3,`ltr`),a=k(t,`onOpenChange`,3,Qt),o=k(t,`onOpenChangeComplete`,3,Qt),s=k(t,`_internal_variant`,3,`dropdown-menu`),c=k(t,`_internal_should_skip_exit_animation`,3,void 0),l=on.create({variant:Q(()=>s()),dir:Q(()=>r()),onClose:()=>{n(!1),a()(!1)},shouldSkipExitAnimation:()=>c()?.()??!1});On.create({open:Q(()=>n(),e=>{n(e),a()(e)}),onOpenChangeComplete:Q(()=>o())},l),ya(e,{children:(e,n)=>{var r=Y(),i=q(r);_(i,()=>t.children??R),y(e,r)},$$slots:{default:!0}}),x()}var ss=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`child`,`children`,`ref`,`loop`,`onInteractOutside`,`onEscapeKeydown`,`onCloseAutoFocus`,`forceMount`,`trapFocus`,`style`]),cs=r(`<div><div><!></div></div>`);function ls(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`loop`,3,!0),c=k(t,`onInteractOutside`,3,Qt),l=k(t,`onEscapeKeydown`,3,Qt),d=k(t,`onCloseAutoFocus`,3,Qt),f=k(t,`forceMount`,3,!1),p=k(t,`trapFocus`,3,!1),m=U(t,ss),g=dn.create({id:Q(()=>a()),loop:Q(()=>s()),ref:Q(()=>o(),e=>o(e)),onCloseAutoFocus:Q(()=>d())}),v=I(()=>tn(m,g.props));function b(e){if(g.handleInteractOutside(e),!e.defaultPrevented&&(c()(e),!e.defaultPrevented)){if(e.target&&e.target instanceof Element){let t=`[${g.parentMenu.root.getBitsAttr(`sub-content`)}]`;if(e.target.closest(t))return}g.parentMenu.onClose()}}function S(e){l()(e),!e.defaultPrevented&&g.parentMenu.onClose()}var C=Y(),w=q(C),T=e=>{ja(e,K(()=>E(v),()=>g.popperProps,{get ref(){return g.opts.ref},get enabled(){return g.parentMenu.opts.open.current},onInteractOutside:b,onEscapeKeydown:S,get trapFocus(){return p()},get loop(){return s()},forceMount:!0,get id(){return a()},get shouldRender(){return g.shouldRender},popper:(e,r)=>{let i=()=>(r?.()).props,a=()=>(r?.()).wrapperProps,o=I(()=>tn(i(),{style:aa(`dropdown-menu`)},{style:t.style}));var s=Y(),c=q(s),l=e=>{var n=Y(),r=q(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=cs();P(r,()=>({...a()}));var i=W(r);P(i,()=>({...E(o)}));var s=W(i);_(s,()=>t.children??R),n(i),n(r),y(e,r)};h(c,e=>{t.child?e(l):e(u,-1)}),y(e,s)},$$slots:{popper:!0}}))},D=e=>{ka(e,K(()=>E(v),()=>g.popperProps,{get ref(){return g.opts.ref},get open(){return g.parentMenu.opts.open.current},onInteractOutside:b,onEscapeKeydown:S,get trapFocus(){return p()},get loop(){return s()},forceMount:!1,get id(){return a()},get shouldRender(){return g.shouldRender},popper:(e,r)=>{let i=()=>(r?.()).props,a=()=>(r?.()).wrapperProps,o=I(()=>tn(i(),{style:aa(`dropdown-menu`)},{style:t.style}));var s=Y(),c=q(s),l=e=>{var n=Y(),r=q(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=cs();P(r,()=>({...a()}));var i=W(r);P(i,()=>({...E(o)}));var s=W(i);_(s,()=>t.children??R),n(i),n(r),y(e,r)};h(c,e=>{t.child?e(l):e(u,-1)}),y(e,s)},$$slots:{popper:!0}}))};h(w,e=>{f()?e(T):f()||e(D,1)}),y(e,C),x()}var us=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`disabled`,`type`]),ds=r(`<button><!></button>`);function fs(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`disabled`,3,!1),c=k(t,`type`,3,`button`),l=U(t,us),d=gn.create({id:Q(()=>a()),disabled:Q(()=>s()??!1),ref:Q(()=>o(),e=>o(e))}),f=I(()=>tn(l,d.props,{type:c()}));ba(e,{get id(){return a()},get ref(){return d.opts.ref},children:(e,r)=>{var i=Y(),a=q(i),o=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},s=e=>{var r=ds();P(r,()=>({...E(f)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(a,e=>{t.child?e(o):e(s,-1)}),y(e,i)},$$slots:{default:!0}}),x()}var ps=Bt({component:`label`,parts:[`root`]}),ms=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=Ut(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}onmousedown(e){e.detail>1&&e.preventDefault()}#e=I(()=>({id:this.opts.id.current,[ps.root]:``,onmousedown:this.onmousedown,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},hs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`for`]),gs=r(`<label><!></label>`);function _s(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,hs),c=ms.create({id:Q(()=>a()),ref:Q(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props,{for:t.for}));var d=Y(),f=q(d),p=e=>{var n=Y(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=gs();P(r,()=>({...E(l),for:t.for}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var vs=class{#e;#t;#n=null;constructor(e,t){this.#t=e,this.#e=t,this.stop=this.stop.bind(this),this.start=this.start.bind(this),It(this.stop)}#r(){this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)}stop(){this.#r()}start(...e){this.#r(),this.#n=window.setTimeout(()=>{this.#n=null,this.#t(...e)},this.#e)}};Bt({component:`tooltip`,parts:[`content`,`trigger`]});var ys=new $t(`Tooltip.Provider`);new $t(`Tooltip.Root`);var bs=class e{static create(t){return ys.set(new e(t))}opts;#e=V(!0);get isOpenDelayed(){return E(this.#e)}set isOpenDelayed(e){F(this.#e,e,!0)}isPointerInTransit=nn(!1);#t;#n=V(null);constructor(e){this.opts=e,this.#t=new vs(()=>{this.isOpenDelayed=!0},this.opts.skipDelayDuration.current),ir(()=>G(window,`scroll`,e=>{let t=E(this.#n);if(!t)return;let n=t.triggerNode;if(!n)return;let r=e.target;(r instanceof Element||r instanceof Document)&&r.contains(n)&&t.handleClose()}))}#r=()=>{if(this.opts.skipDelayDuration.current===0){this.isOpenDelayed=!0;return}this.#t.start()};#i=()=>{this.#t.stop()};onOpen=e=>{E(this.#n)&&E(this.#n)!==e&&E(this.#n).handleClose(),this.#i(),this.isOpenDelayed=!1,F(this.#n,e,!0)};onClose=e=>{E(this.#n)===e&&(F(this.#n,null),this.#r())};isTooltipOpen=e=>E(this.#n)===e};function xs(e,t){i(t,!0);let n=k(t,`delayDuration`,3,700),r=k(t,`disableCloseOnTriggerClick`,3,!1),a=k(t,`disableHoverableContent`,3,!1),o=k(t,`disabled`,3,!1),s=k(t,`ignoreNonKeyboardFocus`,3,!1),c=k(t,`skipDelayDuration`,3,300);bs.create({delayDuration:Q(()=>n()),disableCloseOnTriggerClick:Q(()=>r()),disableHoverableContent:Q(()=>a()),disabled:Q(()=>o()),ignoreNonKeyboardFocus:Q(()=>s()),skipDelayDuration:Q(()=>c())});var l=Y(),u=q(l);_(u,()=>t.children??R),y(e,l),x()}var Ss=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Cs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Ss);var o=Y(),s=q(o);{let e=I(()=>Fn(`gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed`,t.class));a(s,()=>_s,(t,i)=>{i(t,K({"data-slot":`label`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var ws=r(`<!> Import workspace`,1),Ts=r(`<!> <!>`,1),Es=r(`<div class="rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive"> </div>`),Ds=r(`Display name <span class="text-muted-foreground">(optional)</span>`,1),Os=r(`<!> Import`,1),ks=r(`<!> <!> <div class="space-y-3"><div class="space-y-1.5"><!> <!> <p class="text-[11px] text-muted-foreground">Absolute path to a directory containing skill folders.</p></div> <div class="space-y-1.5"><!> <!></div> <div class="flex justify-end gap-2 pt-1"><!> <!></div></div>`,1);function As(e,t){i(t,!0);let r=V(!1);de(()=>{Ee.open=E(r)}),de(()=>{Ee.open&&F(r,!0)}),de(()=>{E(r)&&(F(o,``),F(s,``),F(u,null))});let o=V(``),s=V(``),l=V(!1),u=V(null);async function d(){if(!E(o).trim()){F(u,`A directory path is required.`);return}F(l,!0),F(u,null);try{let e=await Pt(E(o).trim(),E(s).trim()||void 0);if(!e)return;F(r,!1),await _e(Nt(e))}catch(e){F(u,e instanceof Error?e.message:String(e),!0)}finally{F(l,!1)}}var f=Y(),p=q(f);a(p,()=>Sn,(e,t)=>{t(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,t)=>{var i=Y(),f=q(i);a(f,()=>fn,(e,t)=>{t(e,{class:`sm:max-w-[460px]`,children:(e,t)=>{var i=ks(),f=q(i);a(f,()=>an,(e,t)=>{t(e,{children:(e,t)=>{var n=Ts(),r=q(n);a(r,()=>vn,(e,t)=>{t(e,{class:`flex items-center gap-2`,children:(e,t)=>{var n=ws(),r=q(n);Vn(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>xn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`Import a directory as a skill workspace. Its skills will be discovered and managed here.`);y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var p=z(f,2),m=e=>{var t=Es(),n=M(t,!0);H(()=>c(n,E(u))),y(e,t)};h(p,e=>{E(u)&&e(m)});var g=z(p,2),_=W(g),v=W(_);Cs(v,{for:`ws-path`,children:(e,t)=>{oe();var n=C(`Directory path`);y(e,n)},$$slots:{default:!0}});var b=z(v,2);zn(b,{id:`ws-path`,placeholder:`/Users/me/.claude/skills`,class:`font-mono text-xs`,get value(){return E(o)},set value(e){F(o,e,!0)}}),oe(2),n(_);var x=z(_,2),S=W(x);Cs(S,{for:`ws-label`,children:(e,t)=>{oe();var n=Ds();oe(),y(e,n)},$$slots:{default:!0}});var w=z(S,2);zn(w,{id:`ws-label`,placeholder:`My Skills`,get value(){return E(s)},set value(e){F(s,e,!0)}}),n(x);var T=z(x,2),D=W(T);An(D,{variant:`outline`,size:`sm`,onclick:()=>F(r,!1),children:(e,t)=>{oe();var n=C(`Cancel`);y(e,n)},$$slots:{default:!0}});var O=z(D,2);An(O,{size:`sm`,get disabled(){return E(l)},onclick:d,children:(e,t)=>{var n=Os(),r=q(n),i=e=>{jn(e,{class:`h-3.5 w-3.5 animate-spin`})};h(r,e=>{E(l)&&e(i)}),oe(),y(e,n)},$$slots:{default:!0}}),n(T),n(g),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,f),x()}var js=new Set([`$$slots`,`$$events`,`$$legacy`,`api`,`ref`,`value`,`class`]);function Ms(e,t){i(t,!0);let n=k(t,`api`,15,null),r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=U(t,js);var c=Y(),l=q(c);{let e=I(()=>Fn(`bg-popover text-popover-foreground rounded-xl p-1 flex size-full flex-col overflow-hidden`,t.class));a(l,()=>co,(t,i)=>{se(i(t,K({"data-slot":`command`,get class(){return E(e)}},()=>s,{get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}})),e=>n(e),()=>n())})}y(e,c),x()}var Ns=new Set([`$$slots`,`$$events`,`$$legacy`,`open`,`ref`,`value`,`title`,`description`,`showCloseButton`,`portalProps`,`children`,`class`]),Ps=r(`<!> <!>`,1);function Fs(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=k(t,`title`,3,`Command Palette`),l=k(t,`description`,3,`Search for a command to run...`),u=k(t,`showCloseButton`,3,!1),d=U(t,Ns);var f=Y(),p=q(f);a(p,()=>Sn,(e,i)=>{i(e,K(()=>d,{get open(){return n()},set open(e){n(e)},children:(e,n)=>{var i=Ps(),f=q(i);a(f,()=>an,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{var n=Ps(),r=q(n);a(r,()=>vn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,s())),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>xn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,l())),y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var p=z(f,2);{let e=I(()=>Fn(`rounded-xl! p-0 top-1/3 translate-y-0 overflow-hidden p-0`,t.class));a(p,()=>fn,(n,i)=>{i(n,{get class(){return E(e)},get showCloseButton(){return u()},get portalProps(){return t.portalProps},children:(e,n)=>{Ms(e,K(()=>d,{get children(){return t.children},get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}}))},$$slots:{default:!0}})})}y(e,i)},$$slots:{default:!0}}))}),y(e,f),x()}var Is=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Ls(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Is);var o=Y(),s=q(o);{let e=I(()=>Fn(`py-6 text-center text-xs/relaxed`,t.class));a(s,()=>fo,(t,i)=>{i(t,K({"data-slot":`command-empty`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var Rs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`heading`,`value`]),zs=r(`<!> <!>`,1);function Bs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Rs);var o=Y(),s=q(o);{let e=I(()=>Fn(`text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium`,t.class)),i=I(()=>t.value??t.heading??`----${hn()}`);a(s,()=>ho,(o,s)=>{s(o,K({"data-slot":`command-group`,get class(){return E(e)},get value(){return E(i)}},()=>r,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=zs(),i=q(r),o=e=>{var n=Y(),r=q(n);a(r,()=>vo,(e,n)=>{n(e,{class:`text-muted-foreground px-2 py-1.5 text-xs font-medium`,children:(e,n)=>{oe();var r=C();H(()=>c(r,t.heading)),y(e,r)},$$slots:{default:!0}})}),y(e,n)};h(i,e=>{t.heading&&e(o)});var s=z(i,2);a(s,()=>So,(e,n)=>{n(e,{get children(){return t.children}})}),y(e,r)},$$slots:{default:!0}}))})}y(e,o),x()}var Vs=new Set([`$$slots`,`$$events`,`$$legacy`]);function Hs(e,t){let n=U(t,Vs),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];be(e,K({name:`check`},()=>n,{get iconNode(){return r}}))}var Us=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),Ws=r(`<!> <!>`,1);function Gs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Us);var o=Y(),s=q(o);{let e=I(()=>Fn(`group/command-item data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,t.class));a(s,()=>ko,(i,a)=>{a(i,K({"data-slot":`command-item`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=Ws(),i=q(r);_(i,()=>t.children??R),Hs(z(i,2),{class:`cn-command-item-indicator ml-auto opacity-0 group-has-[[data-slot=command-shortcut]]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`}),y(e,r)},$$slots:{default:!0}}))})}y(e,o),x()}var Ks=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),qs=r(`<div><!></div>`);function Js(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,Ks);var o=qs();P(o,e=>({"data-slot":`input-group`,role:`group`,class:e,...a}),[()=>Fn(`group/input-group border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-7 rounded-md border transition-colors in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-2 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto`,t.class)]);var s=W(o);_(s,()=>t.children??R),n(o),se(o,e=>r(e),()=>r()),y(e,o),x()}var Ys=Nn({base:`text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-xs/relaxed font-medium group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5 flex cursor-text items-center justify-center select-none`,variants:{align:{"inline-start":`pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem] order-first`,"inline-end":`pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem] order-last`,"block-start":`px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start`,"block-end":`px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start`}},defaultVariants:{align:`inline-start`}}),Xs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`align`]),Zs=r(`<div><!></div>`);function Qs(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=k(t,`align`,3,`inline-start`),o=U(t,Xs);var s=Zs(),c=e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()};P(s,e=>({role:`group`,"data-slot":`input-group-addon`,"data-align":a(),class:e,onclick:c,...o}),[()=>Fn(Ys({align:a()}),t.class)]);var l=W(s);_(l,()=>t.children??R),n(s),se(s,e=>r(e),()=>r()),y(e,s),x()}Nn({base:`gap-2 rounded-md text-xs/relaxed flex items-center shadow-none`,variants:{size:{xs:`h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3`,sm:`gap-1`,"icon-xs":`size-6 p-0 has-[>svg]:p-0`,"icon-sm":`size-7 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});var $s=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`value`,`class`]);function ec(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`value`,15),a=U(t,$s);{let i=I(()=>Fn(`rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1`,t.class));zn(e,K({"data-slot":`input-group-control`,get class(){return E(i)}},()=>a,{get ref(){return n()},set ref(e){n(e)},get value(){return r()},set value(e){r(e)}}))}x()}var tc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`value`]),nc=r(`<!> <!>`,1),rc=r(`<div data-slot="command-input-wrapper" class="p-1 pb-0"><!></div>`);function ic(e,t){i(t,!0);let r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=U(t,tc);var c=rc(),l=W(c);a(l,()=>Js,(e,n)=>{n(e,{class:`bg-input/20 dark:bg-input/30 h-8!`,children:(e,n)=>{var i=nc(),c=q(i);{let e=(e,t)=>{let n=()=>(t?.()).props;var i=Y(),s=q(i);a(s,()=>ec,(e,t)=>{t(e,K(n,{get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}}))}),y(e,i)},n=I(()=>Fn(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,t.class));a(c,()=>To,(t,r)=>{r(t,K({get value(){return o()},"data-slot":`command-input`,get class(){return E(n)}},()=>s,{child:e,$$slots:{child:!0}}))})}var l=z(c,2);a(l,()=>Qs,(e,t)=>{t(e,{children:(e,t)=>{Un(e,{class:`size-3.5 shrink-0 opacity-50`})},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),n(c),y(e,c),x()}var ac=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function oc(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,ac);var o=Y(),s=q(o);{let e=I(()=>Fn(`no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto`,t.class));a(s,()=>Mo,(t,i)=>{i(t,K({"data-slot":`command-list`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var sc=new Set([`$$slots`,`$$events`,`$$legacy`]);function cc(e,t){let n=U(t,sc),r=[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M14 19h6`}],[`path`,{d:`M17 16v6`}]];be(e,K({name:`file-plus-corner`},()=>n,{get iconNode(){return r}}))}var lc=new Set([`$$slots`,`$$events`,`$$legacy`]);function uc(e,t){let n=U(t,lc),r=[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`}]];be(e,K({name:`layout-grid`},()=>n,{get iconNode(){return r}}))}var dc=r(`<!> Workspaces`,1),fc=r(`<!> Creator`,1),pc=r(`<!> Repository`,1),mc=r(`<!> <!> <!>`,1),hc=r(`<!> <span class="flex-1 truncate"> </span> <span class="text-[10px] tabular-nums text-muted-foreground"> </span>`,1),gc=r(`<!> <!>`,1);function _c(e,n){i(n,!0);let r=V(!1);de(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),F(r,!E(r)))};return globalThis.addEventListener(`keydown`,e),()=>globalThis.removeEventListener(`keydown`,e)});function o(e){F(r,!1),e()}var s=Y(),l=q(s);a(l,()=>Fs,(e,n)=>{n(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,n)=>{var r=gc(),i=q(r);a(i,()=>ic,(e,t)=>{t(e,{placeholder:`Search navigation and workspaces…`})});var s=z(i,2);a(s,()=>oc,(e,n)=>{n(e,{children:(e,n)=>{var r=mc(),i=q(r);a(i,()=>Ls,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`No matching destination.`);y(e,n)},$$slots:{default:!0}})});var s=z(i,2);a(s,()=>Bs,(e,t)=>{t(e,{heading:`Navigate`,children:(e,t)=>{var n=mc(),r=q(n);a(r,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>_e(`/workspaces`)),value:`go workspaces manage locations`,children:(e,t)=>{var n=dc();uc(q(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>_e(`/creator`)),value:`go creator new skill`,children:(e,t)=>{var n=fc();cc(q(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var s=z(i,2);a(s,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>_e(`/repository`)),value:`go repository browse remote`,children:(e,t)=>{var n=pc(),r=q(n);Te(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var l=z(s,2),u=e=>{var n=Y(),r=q(n);a(r,()=>Bs,(e,n)=>{n(e,{heading:`Workspaces`,children:(e,n)=>{var r=Y(),i=q(r);t(i,17,()=>jt.workspaces,e=>e.id,(e,t)=>{var n=Y(),r=q(n);{let e=I(()=>`workspace ${E(t).label} ${E(t).path}`);a(r,()=>Gs,(n,r)=>{r(n,{get value(){return E(e)},onSelect:()=>o(()=>_e(Nt(E(t)))),children:(e,n)=>{var r=hc(),i=q(r);Vn(i,{class:`h-4 w-4`});var a=z(i,2),o=M(a,!0),s=z(a,2),l=M(s,!0);H(()=>{c(o,E(t).label),c(l,E(t).skillCount??0)}),y(e,r)},$$slots:{default:!0}})})}y(e,n)}),y(e,r)},$$slots:{default:!0}})}),y(e,n)};h(l,e=>{jt.workspaces.length>0&&e(u)}),y(e,r)},$$slots:{default:!0}})}),y(e,r)},$$slots:{default:!0}})}),y(e,s),x()}var vc=r(`<button class="text-xs font-medium text-primary hover:underline"> </button>`),yc=r(`<div class="pointer-events-auto flex items-center gap-3 rounded-md border border-border bg-popover px-4 py-2.5 text-sm"><span class="flex-1 text-foreground"> </span> <!> <button class="text-muted-foreground hover:text-foreground" aria-label="Dismiss notification" title="Dismiss notification"><!></button></div>`),bc=r(`<div class="pointer-events-none fixed bottom-4 right-4 z-50 flex flex-col gap-2" aria-live="polite" aria-relevant="additions text"></div>`);function xc(e,r){i(r,!1),te();var a=bc();t(a,5,()=>Pn,e=>e.id,(e,t)=>{var r=yc(),i=W(r),a=M(i,!0),o=z(i,2),s=e=>{var n=vc(),r=M(n,!0);H(()=>c(r,E(t).action.label)),l(`click`,n,()=>{E(t).action.run(),In(E(t).id)}),y(e,n)};h(o,e=>{E(t).action&&e(s)});var u=z(o,2),d=W(u);Ln(d,{class:`h-3.5 w-3.5`}),n(u),n(r),H(()=>c(a,E(t).message)),l(`click`,u,()=>In(E(t).id)),y(e,r)}),n(a),y(e,a),x()}T([`click`]);var Sc=new Set([`$$slots`,`$$events`,`$$legacy`,`delayDuration`]);function Cc(e,t){let n=k(t,`delayDuration`,3,0),r=U(t,Sc);var i=Y(),o=q(i);a(o,()=>xs,(e,t)=>{t(e,K({get delayDuration(){return n()}},()=>r))}),y(e,i)}var wc=()=>navigator.opentrayWindow??navigator.opentray?.window??void 0,Tc={width:960,height:680},Ec={width:1100,height:760};async function Dc(e){let t=wc();if(t?.resizeTo&&t.getBounds)try{let n=await t.getBounds(),r=Math.max(n.width,e.width),i=Math.max(n.height,e.height);if(r===n.width&&i===n.height)return;await t.resizeTo(r,i)}catch{}}var Oc=new Set([`$$slots`,`$$events`,`$$legacy`]);function kc(e,t){let n=U(t,Oc),r=[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`}]];be(e,K({name:`command`},()=>n,{get iconNode(){return r}}))}var Ac=new Set([`$$slots`,`$$events`,`$$legacy`]);function jc(e,t){let n=U(t,Ac),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];be(e,K({name:`settings`},()=>n,{get iconNode(){return r}}))}var Mc=r(`<option>New session…</option>`),Nc=r(`<option>No sessions</option>`),Pc=r(`<option> </option>`),Fc=r(`<button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground" title="New session" aria-label="New session"><!></button>`),Ic=r(`<header class="flex h-10 shrink-0 items-center gap-1 border-b border-border px-2"><span class="px-1 text-xs font-medium text-muted-foreground">Agent</span> <select class="h-8 min-w-0 flex-1 rounded-md border border-border bg-transparent px-2 py-0 text-xs" aria-label="Session"><!><!><!></select> <!> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground" title="Close panel" aria-label="Close panel"><!></button></header>`);function Lc(e,r){i(r,!0);let a=I(()=>{let e=Me.sessions.find(e=>e.sessionId===Re.sessionId);return e?`${e.title||e.sessionId} (${e.status})`:void 0});var o=Ic(),s=z(W(o),2),u=W(s),d=e=>{var t=Mc();t.value=t.__value=``,y(e,t)};h(u,e=>{Re.sessionId===null&&e(d)});var f=z(u),p=e=>{var t=Nc();t.value=t.__value=``,y(e,t)};h(f,e=>{Me.sessions.length===0&&Re.sessionId!==null&&e(p)});var m=z(f);t(m,17,()=>Me.sessions,e=>e.sessionId,(e,t)=>{var n=Pc(),r=M(n),i={};H(e=>{c(r,`${e??``}
3
- ${E(t).status===`disposed`?`· ended`:`· ${E(t).status}`}`),i!==(i=E(t).sessionId)&&(n.value=(n.__value=i)??``)},[()=>E(t).title||E(t).sessionId.slice(0,14)]),y(e,n)}),n(s);var g;pe(s);var _=z(s,2),v=e=>{var t=Fc(),r=W(t);Hn(r,{class:`h-4 w-4`}),n(t),l(`click`,t,()=>Ke()),y(e,t)};h(_,e=>{Re.sessionId&&e(v)});var b=z(_,2),S=W(b);Ln(S,{class:`h-4 w-4`}),n(b),n(o),H(()=>{B(s,`title`,E(a)),g!==(g=Re.sessionId??``)&&(s.value=(s.__value=g)??``,ge(s,g))}),l(`change`,s,e=>He(e.currentTarget.value)),l(`click`,b,()=>je(!1)),y(e,o),x()}T([`change`,`click`]);var Rc=new Set([`$$slots`,`$$events`,`$$legacy`]);function zc(e,t){let n=U(t,Rc),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];be(e,K({name:`copy`},()=>n,{get iconNode(){return r}}))}var Bc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vc(e,t){let n=U(t,Bc),r=[[`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`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}]];be(e,K({name:`file`},()=>n,{get iconNode(){return r}}))}var Hc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uc(e,t){let n=U(t,Hc),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}]];be(e,K({name:`image`},()=>n,{get iconNode(){return r}}))}var Wc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gc(e,t){let n=U(t,Wc),r=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]];be(e,K({name:`arrow-down`},()=>n,{get iconNode(){return r}}))}var Kc=r(`<div class="text-[11px] font-medium text-muted-foreground"> </div>`),qc=r(`<div class="whitespace-pre-wrap text-[11px] text-muted-foreground"> </div>`),Jc=r(`<span class="block text-[10px] text-muted-foreground"> </span>`),Yc=r(`<button> <!></button>`),Xc=r(`<div class="flex flex-wrap gap-1.5"></div>`),Zc=r(`<div class="mb-2 space-y-1.5"><!> <div class="whitespace-pre-wrap"> </div> <!> <!> <!></div>`),Qc=r(`<div class="flex justify-end"><!></div>`),$c=r(`<div class="rounded-lg border border-amber-500/40 bg-amber-500/5 px-3 py-2.5 text-xs" role="group"><div class="mb-2 flex items-center gap-1.5 font-medium text-amber-600 dark:text-amber-400"> </div> <!> <!></div>`);function el(e,r){i(r,!0);let a=fe({}),o=fe({});function s(e,t){let n=a[e.id]??[];e.multiSelect?a[e.id]=n.includes(t)?n.filter(e=>e!==t):[...n,t]:a[e.id]=n.includes(t)?[]:[t]}function u(){return r.questions.every(e=>(a[e.id]??[]).length>0||(o[e.id]??``).trim().length>0)}function d(){We(r.seq,r.questions.map(e=>({id:e.id,selected:a[e.id]??[],custom:(o[e.id]??``).trim()||void 0})))}var f=$c(),p=W(f),m=M(p,!0),g=z(p,2);t(g,17,()=>r.questions,e=>e.id,(e,i)=>{var u=Zc(),d=W(u),f=e=>{var t=Kc(),n=M(t,!0);H(()=>c(n,E(i).header)),y(e,t)};h(d,e=>{E(i).header&&e(f)});var p=z(d,2),m=M(p,!0),g=z(p,2),_=e=>{var t=qc(),n=M(t,!0);H(()=>c(n,E(i).detail)),y(e,t)};h(g,e=>{E(i).detail&&e(_)});var v=z(g,2),b=e=>{var o=Xc();t(o,21,()=>E(i).options,e=>e.label,(e,t)=>{var o=Yc(),u=W(o),d=z(u),f=e=>{var n=Jc(),r=M(n,!0);H(()=>c(r,E(t).description)),y(e,n)};h(d,e=>{E(t).description&&e(f)}),n(o),H((e,n)=>{J(o,1,`rounded-md border px-2 py-1 transition-colors ${e??``}`),o.disabled=r.resolved,B(o,`aria-pressed`,n),c(u,`${E(t).label??``} `)},[()=>(a[E(i).id]??[]).includes(E(t).label)?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`,()=>(a[E(i).id]??[]).includes(E(t).label)]),l(`click`,o,()=>s(E(i),E(t).label)),y(e,o)}),n(o),y(e,o)};h(v,e=>{E(i).options&&E(i).options.length>0&&e(b)});var x=z(v,2);{let e=I(()=>o[E(i).id]??``);zn(x,{placeholder:`Custom answer (optional)`,get disabled(){return r.resolved},get value(){return E(e)},onchange:e=>o[E(i).id]=e.currentTarget.value,class:`h-7 text-xs`,get"aria-label"(){return`Custom answer for ${E(i).question??``}`}})}n(u),H(()=>c(m,E(i).question)),y(e,u)});var _=z(g,2),v=e=>{var t=Qc(),r=W(t);{let e=I(()=>!u());An(r,{size:`sm`,get disabled(){return E(e)},onclick:d,children:(e,t)=>{oe();var n=C(`Submit answer`);y(e,n)},$$slots:{default:!0}})}n(t),y(e,t)};h(_,e=>{r.resolved||e(v)}),n(f),H(()=>{B(f,`aria-label`,r.resolved?`Answered question`:`Pending question`),c(m,r.resolved?`Answered`:`Your decision`)}),y(e,f),x()}T([`click`]);var tl=new Set([`$$slots`,`$$events`,`$$legacy`]);function nl(e,t){let n=U(t,tl),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];be(e,K({name:`terminal`},()=>n,{get iconNode(){return r}}))}var rl=new Set([`$$slots`,`$$events`,`$$legacy`]);function il(e,t){let n=U(t,rl),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];be(e,K({name:`wrench`},()=>n,{get iconNode(){return r}}))}var al=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-destructive" title="Tool error" aria-label="Tool error"></span>`),ol=r(`<button type="button" class="disclosure-row"><span class="flex items-center justify-center text-muted-foreground" aria-hidden="true"><!></span> <span class="flex items-center gap-1 overflow-hidden"><span class="max-w-40 truncate text-left font-medium text-foreground"> </span> <!></span> <span class="text-center text-muted-foreground/70" aria-hidden="true">·</span> <span> </span> <!></button>`);function sl(e,t){i(t,!0);let r=k(t,`summary`,3,``),o=k(t,`open`,3,!1),s=k(t,`running`,3,!1),u=k(t,`error`,3,!1);var d=ol(),f=W(d),p=W(f);a(p,()=>t.icon,(e,t)=>{t(e,{class:`h-3.5 w-3.5`})}),n(f);var m=z(f,2),g=W(m),_=M(g,!0),v=z(g,2),b=e=>{var t=al();y(e,t)};h(v,e=>{u()&&e(b)}),n(m);var S=z(m,4),C=M(S,!0),w=z(S,2);qn(w,{class:`disclosure-chevron h-3.5 w-3.5 shrink-0 text-muted-foreground`}),n(d),H(()=>{B(d,`data-open`,o()),B(d,`aria-expanded`,o()),B(d,`title`,r().length>0?`${t.title} · ${r()}`:t.title),c(_,t.title),J(S,1,`disclosure-summary ${s()?`sweep`:``}`),c(C,r())}),l(`click`,d,function(...e){t.onToggle?.apply(this,e)}),y(e,d),x()}T([`click`]);var cl=r(`<iframe sandbox="allow-scripts"></iframe>`),ll=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground"> </div>`),ul=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground" role="status">Loading card…</div>`),dl=r(`<div class="my-1 overflow-hidden rounded-lg border border-border"><!></div>`);function fl(e,t){i(t,!0);let r=V(null),a=V(!1),o=V(null),s=V(null);de(()=>{let e=t.resourceUri;F(r,null),F(a,!1),Tt().agent.card.get({uri:e}).then(e=>{if(e.html===null){F(a,!0);return}F(r,e.html,!0)}).catch(()=>{F(a,!0)})});function l(e){let t=e.data;if(typeof t==`object`&&t&&t.source===`skill-creator-card`&&E(s)!==null&&e.source===E(s).contentWindow){if(t.type===`ui/navigate`&&typeof t.intent==`string`&&t.intent.startsWith(`/`)&&!t.intent.startsWith(`//`)){_e(t.intent);return}if(t.type===`ui/resize`){let e=Number(t.height);Number.isFinite(e)&&e>0&&F(o,Math.min(400,Math.max(40,Math.ceil(e))),!0)}}}function u(e,t){return e.srcdoc=t,{update(t){e.srcdoc=t}}}var p=dl();f(`message`,A,l);var m=W(p),g=e=>{var n=cl();se(n,e=>F(s,e),()=>E(s)),me(n,(e,t)=>u?.(e,t),()=>E(r)),H(()=>{B(n,`title`,t.title),J(n,1,`w-full border-0 bg-transparent ${E(o)===null?`h-44`:``}`),j(n,E(o)===null?void 0:`height:${E(o)}px`)}),d(n),y(e,n)},_=e=>{var n=ll(),r=M(n);H(()=>c(r,`Card unavailable: ${t.title??``}`)),y(e,n)},v=e=>{var t=ul();y(e,t)};h(m,e=>{E(r)===null?E(a)?e(_,1):e(v,-1):e(g)}),n(p),H(()=>B(p,`data-card-uri`,t.resourceUri)),y(e,p),x()}var pl=r(`<div class="mt-2 flex justify-end gap-1.5"><!> <!></div>`),ml=r(`<div class="rounded-lg border border-amber-500/40 bg-amber-500/5 px-3 py-2.5 text-xs" role="group" aria-label="Mutation proposal"><div class="mb-1.5 flex items-center gap-1.5 font-medium text-amber-600 dark:text-amber-400"> </div> <div class="font-mono text-[11px]"> </div> <pre class="mt-1 max-h-32 overflow-auto rounded bg-muted/40 p-1.5 font-mono text-[10px] whitespace-pre-wrap"> </pre> <!></div>`);function hl(e,t){i(t,!0);let r=V(!1),a=V(null),o=I(()=>E(a)??t.status),s=I(()=>{try{return JSON.stringify(t.input,null,2)}catch{return String(t.input)}});async function l(e){F(r,!0);try{let n=Tt(),r=e===`approve`?await n.agent.proposals.approve({proposalId:t.proposalId}):await n.agent.proposals.reject({proposalId:t.proposalId});F(a,r.proposal.status,!0),Mn(e===`approve`?E(o)===`executed`?`Proposal executed: ${t.capability}`:`Proposal failed: ${t.capability}`:`Proposal rejected: ${t.capability}`)}catch(e){Mn(e instanceof Error?e.message:String(e))}finally{F(r,!1)}}var u=ml(),d=W(u),f=M(d),p=z(d,2),m=M(p,!0),g=z(p,2),_=M(g,!0),v=z(g,2),b=e=>{var t=pl(),i=W(t);An(i,{size:`sm`,variant:`outline`,get disabled(){return E(r)},onclick:()=>void l(`reject`),children:(e,t)=>{oe();var n=C(`Reject`);y(e,n)},$$slots:{default:!0}});var a=z(i,2);An(a,{size:`sm`,get disabled(){return E(r)},onclick:()=>void l(`approve`),children:(e,t)=>{oe();var n=C(`Approve`);y(e,n)},$$slots:{default:!0}}),n(t),y(e,t)};h(v,e=>{E(o)===`pending`&&e(b)}),n(u),H(()=>{c(f,`Proposal — ${E(o)??``}`),c(m,t.capability),c(_,E(s))}),y(e,u),x()}var gl=lt(dt(),st()),_l=bt([dt(),ut({content:ct(ut({text:dt().optional()}).loose()).optional()}).loose(),lt(dt(),st())]),vl=ut({kind:pt(`proposed`),proposalId:dt().min(1),capability:dt().optional(),status:dt().optional()}),yl=ut({uiCard:ut({resourceUri:dt().min(1),title:dt().optional()})}),bl=ut({content:ct(st()).optional()}),xl=ut({text:dt().optional()}),Sl=ut({status:dt().optional()}),Cl=ut({error:dt().min(1).optional()});function wl(e){if(e===void 0||e.length===0)return null;try{let t=JSON.parse(e),n=gl.safeParse(t);return n.success?n.data:null}catch{let t={};for(let n of[`command`,`description`,`file_path`,`path`,`pattern`,`url`,`query`]){let r=e.match(RegExp(`"${n}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"`))??e.match(RegExp(`"${n}"\\s*:\\s*"((?:[^"\\\\]|\\.)*)$`));r&&(t[n]=r[1])}return Object.keys(t).length>0?t:null}}function Tl(e){if(e===void 0)return``;let t=_l.safeParse(e);if(t.success){let e=t.data;if(typeof e==`string`)return e;if(Array.isArray(e.content)){let t=[];for(let n of e.content)typeof n.text==`string`&&t.push(n.text);if(t.length>0)return t.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/Ce6RiTD3.js","../chunks/CmCJ0SKP.js","../chunks/CLVPf5uP.js","../chunks/xihTtKlq.js","../chunks/DrGEPnFY.js","../chunks/BkEnd9_Z.js","../chunks/DbA0Nfjq.js","../chunks/DFx4VmvA.js","../chunks/CNPsST_i.js","../chunks/CryWMAmp.js","../chunks/DUYTokm-.js","../chunks/Dl8eQ129.js","../chunks/BEPs9Z9s.js","../chunks/Bs27XW8_.js","../chunks/BIfnT_mK.js","../chunks/D-V0xBeS.js","../chunks/Ce_bE79q.js","../chunks/BNZqT8Gb.js","../chunks/CLM6PwBO.js","../assets/shell.U4CQV8re.css","../chunks/Ckw1quWt.js","../chunks/CIFG41pU.js","../chunks/s48N5eaK.js","../chunks/D8Der6oM.js","../assets/ProviderView.DEH95hqa.css","../chunks/CQhmWGDZ.js","../chunks/UeEccMjN.js","../chunks/CeR4do8T.js","../chunks/C36hgawG.js","../chunks/0umLG1IN.js","../chunks/BYNWtKcf.js","../chunks/DkjKuLZP.js","../chunks/CQD9uzpA.js","../chunks/CnsFCObb.js","../chunks/D68T6slS.js","../chunks/BFnZD865.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,A as t,At as n,B as r,Ct as i,D as a,Dt as o,E as s,F as c,G as l,H as u,J as d,K as f,M as p,Mt as m,N as h,Nt as g,O as _,Q as v,R as y,S as b,St as x,T as S,U as C,V as w,W as T,X as E,_ as D,_t as O,a as k,at as A,b as j,bt as ee,c as te,ct as M,d as N,f as P,ft as F,gt as I,h as L,ht as ne,it as re,j as ie,jt as R,k as ae,kt as oe,l as se,lt as z,m as B,mt as V,n as ce,nt as H,o as U,ot as W,p as le,q as G,r as ue,rt as de,s as K,st as q,ut as J,v as fe,w as pe,wt as me,x as Y,y as he,z as X}from"../chunks/CmCJ0SKP.js";import{t as ge}from"../chunks/CLVPf5uP.js";import{t as _e}from"../chunks/HclGiUj8.js";import"../chunks/xihTtKlq.js";import{t as ve}from"../chunks/CLM6PwBO.js";import"../chunks/DrGEPnFY.js";import{t as ye}from"../chunks/BkEnd9_Z.js";import{A as be,C as xe,D as Z,E as Se,F as Ce,I as we,M as Te,N as Ee,O as De,P as Oe,S as ke,T as Ae,_ as je,a as Me,b as Ne,c as Pe,d as Fe,f as Ie,g as Le,h as Re,i as ze,j as Be,k as Ve,l as He,m as Ue,n as We,o as Ge,p as Ke,r as Q,s as qe,t as Je,u as Ye,v as Xe,w as Ze,y as Qe}from"../chunks/DbA0Nfjq.js";import{c as $e,d as et,l as tt,n as nt,o as rt,s as it,t as at,u as ot}from"../chunks/BNZqT8Gb.js";import{A as st,C as ct,D as lt,E as ut,O as dt,S as ft,T as pt,a as mt,b as ht,c as gt,f as _t,g as vt,i as yt,k as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,t as Et,v as Dt,w as Ot,x as kt}from"../chunks/DFx4VmvA.js";import{r as At}from"../chunks/CryWMAmp.js";import{i as jt,n as Mt,o as Nt,t as Pt}from"../chunks/DUYTokm-.js";import{A as Ft,B as It,C as Lt,D as Rt,E as zt,F as Bt,G as Vt,H as Ht,I as Ut,J as $,K as Wt,L as Gt,M as Kt,N as qt,O as Jt,P as Yt,R as Xt,S as Zt,T as Qt,U as $t,V as en,W as tn,Y as nn,_ as rn,a as an,b as on,c as sn,d as cn,f as ln,g as un,h as dn,i as fn,j as pn,k as mn,l as hn,m as gn,n as _n,o as vn,p as yn,q as bn,r as xn,s as Sn,t as Cn,u as wn,v as Tn,w as En,x as Dn,y as On,z as kn}from"../chunks/Dl8eQ129.js";import"../chunks/DZ_Kltd5.js";import{a as An,i as jn,n as Mn,o as Nn,r as Pn,s as Fn,t as In}from"../chunks/CNPsST_i.js";import{t as Ln}from"../chunks/BEPs9Z9s.js";import{n as Rn,r as zn,t as Bn}from"../chunks/Ckw1quWt.js";import{n as Vn,t as Hn}from"../chunks/0umLG1IN.js";import{t as Un}from"../chunks/CIFG41pU.js";import{t as Wn}from"../chunks/BIfnT_mK.js";import{t as Gn}from"../chunks/UeEccMjN.js";import{n as Kn,r as qn,t as Jn}from"../chunks/CQD9uzpA.js";var Yn=g({prerender:()=>!1,ssr:()=>!1,trailingSlash:()=>Xn}),Xn=`ignore`;it({id:`workspaces`,name:`Workspaces`,icon:we,activities:[$e({pattern:`/workspaces`,entry:!0,root:tt({id:`workspaces.home`,component:()=>_e(()=>import(`../chunks/Ce6RiTD3.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url)})}),$e({pattern:`/workspaces`,root:ot({id:`workspaces.provider`,pattern:`:wsId/:providerId`,params:ut({wsId:kt,providerId:ht}),search:ut({q:dt().optional(),skill:dt().optional(),view:ft([`list`,`detail`]).optional()}),component:()=>_e(()=>import(`../chunks/Ce_bE79q.js`),__vite__mapDeps([16,1,3,5,17,2,18,4,7,19,9,10,8,12,20,21,22,15,23,24]),import.meta.url)})}),$e({pattern:`/workspaces`,root:ot({id:`workspaces.intelligence`,pattern:`intelligence/:wsId/:providerId`,params:ut({wsId:kt,providerId:ht}),search:ut({severity:ft([`all`,`error`,`warning`,`info`]).optional()}),component:()=>_e(()=>import(`../chunks/CQhmWGDZ.js`),__vite__mapDeps([25,1,3,5,17,2,18,4,7,19,9,10,8,14,26,13,27,15,23]),import.meta.url)})})]});var Zn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qn(e,t){let n=U(t,Zn),r=[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`}],[`path`,{d:`M8 18h1`}]];ye(e,K({name:`file-pen-line`},()=>n,{get iconNode(){return r}}))}it({id:`creator`,name:`Creator`,icon:Qn,activities:[$e({pattern:`/creator`,entry:!0,root:tt({id:`creator.home`,component:()=>_e(()=>import(`../chunks/C36hgawG.js`),__vite__mapDeps([28,1,2,3,4,5,9,7,10,29,30]),import.meta.url)})}),$e({pattern:`/creator`,root:ot({id:`creator.workspace`,pattern:`:mode/:wsId/:providerId`,params:ut({mode:ft([`edit`,`new`]),wsId:kt,providerId:ht}),search:ut({subview:ft([`file`,`log`,`preview`,`validate`,`test`]).optional(),template:dt().optional()}),component:()=>_e(()=>import(`../chunks/DkjKuLZP.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,9,10,11,8,12,13,20,32,30,22,27]),import.meta.url),children:[ot({id:`creator.workspace.skill`,pattern:`:skillId`,params:ut({skillId:Dt}),component:()=>_e(()=>import(`../chunks/DkjKuLZP.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,9,10,11,8,12,13,20,32,30,22,27]),import.meta.url)})]})})]});var $n=new Set([`$$slots`,`$$events`,`$$legacy`]);function er(e,t){let n=U(t,$n),r=[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}]];ye(e,K({name:`git-branch`},()=>n,{get iconNode(){return r}}))}it({id:`repository`,name:`Repository`,icon:er,activities:[$e({pattern:`/repository`,entry:!0,root:ot({id:`repository.home`,pattern:``,search:ut({q:dt().optional()}),component:()=>_e(()=>import(`../chunks/CnsFCObb.js`),__vite__mapDeps([33,1,2,3,4,5,17,18,7,19,11,8,12,13,34]),import.meta.url),children:[ot({id:`repository.scan`,pattern:`scan/:sourceId`,params:ut({sourceId:dt().min(1).max(128).regex(/^[a-z0-9_-]+$/i)}),search:ut({selected:dt().optional(),targets:dt().optional(),skill:dt().optional()}),component:()=>_e(()=>import(`../chunks/BFnZD865.js`),__vite__mapDeps([35,1,2,3,18,4,17,7,19,10,34]),import.meta.url)})]})})]});var tr=r(`<div class="drag-strip no-drag shrink-0 svelte-11tvdi8" role="banner" aria-label="window titlebar"><!> <div class="flex-1"></div> <!></div>`);function nr(e,t){i(t,!0);let r=k(t,`variant`,3,`main`),a=k(t,`left`,3,null),o=k(t,`right`,3,null),s=V(8),c=V(8),u=()=>navigator.opentrayWindow??navigator.opentray?.window??void 0;function d(e){let t=u();try{t?.startAppRegionDrag?.({x:e.clientX,y:e.clientY,pointerId:e.pointerId})?.catch?.(()=>{})}catch{}}function f(e){let t=globalThis.innerWidth,n=Math.max(0,Math.round(e.x)),r=Math.max(0,Math.round(t-e.x-e.width));F(s,n+(n>0?4:0)),F(c,r+(r>0?4:0))}ue(()=>{let e=u()?.overlay;if(!e)return;let t=null;return(async()=>{try{if(f(await e.getTitlebarAreaRect()),e.listen)t=await e.listen(`geometrychange`,e=>f(e.titlebarAreaRect));else if(e.addEventListener){let n=e=>f(e.titlebarAreaRect);e.addEventListener(`geometrychange`,n),t=()=>e.removeEventListener?.(`geometrychange`,n)}}catch{}})(),()=>{t?.()}});var p=tr(),m=W(p),g=e=>{var t=X(),n=q(t);_(n,a),y(e,t)};h(m,e=>{r()===`main`&&a()&&e(g)});var v=z(m,4),b=e=>{var t=X(),n=q(t);_(n,o),y(e,t)};h(v,e=>{r()===`main`&&o()&&e(b)}),n(p),H(()=>j(p,`padding-left: ${E(s)??``}px; padding-right: ${E(c)??``}px`)),l(`pointerdown`,p,d),y(e,p),x()}T([`pointerdown`]);var rr={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,transform:`translateX(-100%)`};Vt(rr);function ir(t){de(()=>e(()=>t()))}var ar=[`top`,`right`,`bottom`,`left`],or=Math.min,sr=Math.max,cr=Math.round,lr=Math.floor,ur=e=>({x:e,y:e}),dr={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function fr(e,t,n){return sr(e,or(t,n))}function pr(e,t){return typeof e==`function`?e(t):e}function mr(e){return e.split(`-`)[0]}function hr(e){return e.split(`-`)[1]}function gr(e){return e===`x`?`y`:`x`}function _r(e){return e===`y`?`height`:`width`}function vr(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function yr(e){return gr(vr(e))}function br(e,t,n){n===void 0&&(n=!1);let r=hr(e),i=yr(e),a=_r(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=kr(o)),[o,kr(o)]}function xr(e){let t=kr(e);return[Sr(e),t,Sr(t)]}function Sr(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Cr=[`left`,`right`],wr=[`right`,`left`],Tr=[`top`,`bottom`],Er=[`bottom`,`top`];function Dr(e,t,n){switch(e){case`top`:case`bottom`:return n?t?wr:Cr:t?Cr:wr;case`left`:case`right`:return t?Tr:Er;default:return[]}}function Or(e,t,n,r){let i=hr(e),a=Dr(mr(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Sr)))),a}function kr(e){let t=mr(e);return dr[t]+e.slice(t.length)}function Ar(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function jr(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ar(e)}function Mr(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Nr(e,t,n){let{reference:r,floating:i}=e,a=vr(t),o=yr(t),s=_r(o),c=mr(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=hr(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Pr(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=pr(t,e),p=jr(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Mr(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Mr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Fr=50,Ir=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Pr},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Nr(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Fr&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Nr(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Lr=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=pr(e,t)||{};if(l==null)return{};let d=jr(u),f={x:n,y:r},p=yr(i),m=_r(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=or(d[_],T),D=or(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=fr(E,k,O),j=!c.arrow&&hr(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),Rr=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=pr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=mr(r),_=vr(o),v=mr(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[kr(o)]:xr(o)),x=p!==`none`;!d&&x&&b.push(...Or(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=br(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===vr(t)||T.every(e=>vr(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vr(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function zr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Br(e){return ar.some(t=>e[t]>=0)}var Vr=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=pr(e,t);switch(i){case`referenceHidden`:{let e=zr(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Br(e)}}}case`escaped`:{let e=zr(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Br(e)}}}default:return{}}}}},Hr=new Set([`left`,`top`]);async function Ur(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=mr(n),s=hr(n),c=vr(n)===`y`,l=Hr.has(o)?-1:1,u=a&&c?-1:1,d=pr(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Wr=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ur(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Gr=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=pr(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=vr(i),p=gr(f),m=u[p],h=u[f],g=(e,t)=>fr(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Kr=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=pr(e,t),u={x:n,y:r},d=vr(i),f=gr(d),p=u[f],m=u[d],h=pr(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Hr.has(mr(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},qr=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=pr(e,t),c=await i.detectOverflow(t,s),l=mr(n),u=hr(n),d=vr(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=or(p-c[m],g),y=or(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*sr(c.left,c.right):S=p-2*sr(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Jr(){return typeof window<`u`}function Yr(e){return Qr(e)?(e.nodeName||``).toLowerCase():`#document`}function Xr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zr(e){return((Qr(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Qr(e){return Jr()?e instanceof Node||e instanceof Xr(e).Node:!1}function $r(e){return Jr()?e instanceof Element||e instanceof Xr(e).Element:!1}function ei(e){return Jr()?e instanceof HTMLElement||e instanceof Xr(e).HTMLElement:!1}function ti(e){return!Jr()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Xr(e).ShadowRoot}function ni(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=pi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ri(e){return/^(table|td|th)$/.test(Yr(e))}function ii(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ai=/transform|translate|scale|rotate|perspective|filter/,oi=/paint|layout|strict|content/,si=e=>!!e&&e!==`none`,ci;function li(e){let t=$r(e)?pi(e):e;return si(t.transform)||si(t.translate)||si(t.scale)||si(t.rotate)||si(t.perspective)||!di()&&(si(t.backdropFilter)||si(t.filter))||ai.test(t.willChange||``)||oi.test(t.contain||``)}function ui(e){let t=hi(e);for(;ei(t)&&!fi(t);){if(li(t))return t;if(ii(t))return null;t=hi(t)}return null}function di(){return ci??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ci}function fi(e){return/^(html|body|#document)$/.test(Yr(e))}function pi(e){return Xr(e).getComputedStyle(e)}function mi(e){return $r(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hi(e){if(Yr(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ti(e)&&e.host||Zr(e);return ti(t)?t.host:t}function gi(e){let t=hi(e);return fi(t)?(e.ownerDocument||e).body:ei(t)&&ni(t)?t:gi(t)}function _i(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=gi(e),i=r===e.ownerDocument?.body,a=Xr(r);if(i){let e=vi(a);return t.concat(a,a.visualViewport||[],ni(r)?r:[],e&&n?_i(e):[])}return t.concat(r,_i(r,[],n))}function vi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yi(e){let t=pi(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ei(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=cr(n)!==a||cr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function bi(e){return $r(e)?e:e.contextElement}function xi(e){let t=bi(e);if(!ei(t))return ur(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=yi(t),o=(a?cr(n.width):n.width)/r,s=(a?cr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Si=ur(0);function Ci(e){let t=Xr(e);return!di()||!t.visualViewport?Si:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wi(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Xr(e)}function Ti(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=bi(e),o=ur(1);t&&(r?$r(r)&&(o=xi(r)):o=xi(e));let s=wi(a,n,r)?Ci(a):ur(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Xr(a),t=$r(r)?Xr(r):r,n=e,i=vi(n);for(;i&&t!==n;){let e=xi(i),t=i.getBoundingClientRect(),r=pi(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Xr(i),i=vi(n)}}return Mr({width:u,height:d,x:c,y:l})}function Ei(e,t){let n=mi(e).scrollLeft;return t?t.left+n:Ti(Zr(e)).left+n}function Di(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ei(e,n),y:n.top+t.scrollTop}}function Oi(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Zr(r),s=t?ii(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ur(1),u=ur(0),d=ei(r);if((d||!a)&&((Yr(r)!==`body`||ni(o))&&(c=mi(r)),d)){let e=Ti(r);l=xi(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Di(o,c):ur(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ki(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ai(e){let t=mi(e),n=e.ownerDocument.body,r=sr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=sr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ei(e),o=-t.scrollTop;return pi(n).direction===`rtl`&&(a+=sr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ji=25;function Mi(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Xr(e),a=Zr(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!di()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ei(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ji&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ni(e,t){let n=Ti(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=xi(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Pi(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Mi(e,n,t);else if(t===`document`)r=Ai(Zr(e));else if($r(t))r=Ni(t,n);else{let n=Ci(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Mr(r)}function Fi(e,t){let n=t.get(e);if(n)return n;let r=_i(e,[],!1).filter(e=>$r(e)&&Yr(e)!==`body`),i=null,a=pi(e).position===`fixed`,o=a?hi(e):e;for(;$r(o)&&!fi(o);){let e=pi(o),t=li(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=hi(o)}return t.set(e,r),r}function Ii(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ii(t)?[]:Fi(t,this._c):[].concat(n),r],o=Pi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Pi(t,a[e],i);s=sr(n.top,s),c=or(n.right,c),l=or(n.bottom,l),u=sr(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Li(e){let{width:t,height:n}=yi(e);return{width:t,height:n}}function Ri(e,t,n){let r=ei(t),i=Zr(t),a=n===`fixed`,o=Ti(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ur(0);if((r||!a)&&((Yr(t)!==`body`||ni(i))&&(s=mi(t)),r)){let e=Ti(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ei(i));let l=i&&!r&&!a?Di(i,s):ur(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function zi(e){return pi(e).position===`static`}function Bi(e,t){if(!ei(e)||pi(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Zr(e)===n&&(n=n.ownerDocument.body),n}function Vi(e,t){let n=Xr(e);if(ii(e))return n;if(!ei(e)){let t=hi(e);for(;t&&!fi(t);){if($r(t)&&!zi(t))return t;t=hi(t)}return n}let r=Bi(e,t);for(;r&&ri(r)&&zi(r);)r=Bi(r,t);return r&&fi(r)&&zi(r)&&!li(r)?n:r||ui(e)||n}var Hi=async function(e){let t=this.getOffsetParent||Vi,n=this.getDimensions,r=await n(e.floating);return{reference:Ri(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ui(e){return pi(e).direction===`rtl`}var Wi={convertOffsetParentRelativeRectToViewportRelativeRect:Oi,getDocumentElement:Zr,getClippingRect:Ii,getOffsetParent:Vi,getElementRects:Hi,getClientRects:ki,getDimensions:Li,getScale:xi,isElement:$r,isRTL:Ui};function Gi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ki(e,t,n){let r=null,i,a=Zr(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=lr(d),h=lr(a.clientWidth-(u+f)),g=lr(a.clientHeight-(d+p)),_=lr(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:sr(0,or(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Gi(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Xr(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function qi(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=bi(e),u=i||a?[...l?_i(l):[],...t?_i(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ki(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ti(e):null;c&&g();function g(){let t=Ti(e);h&&!Gi(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ji=Wr,Yi=Gr,Xi=Rr,Zi=qr,Qi=Vr,$i=Lr,ea=Kr,ta=(e,t,n)=>{let r=new Map,i=n??{},a={...Wi,...i.platform,_c:r};return Ir(e,t,{...i,platform:a})};function na(e){return typeof e==`function`?e():e}function ra(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ia(e,t){let n=ra(e);return Math.round(t*n)/n}function aa(e){return{[`--bits-${e}-content-transform-origin`]:`var(--bits-floating-transform-origin)`,[`--bits-${e}-content-available-width`]:`var(--bits-floating-available-width)`,[`--bits-${e}-content-available-height`]:`var(--bits-floating-available-height)`,[`--bits-${e}-anchor-width`]:`var(--bits-floating-anchor-width)`,[`--bits-${e}-anchor-height`]:`var(--bits-floating-anchor-height)`}}function oa(e){let t=e.whileElementsMounted,n=I(()=>na(e.open)??!0),r=I(()=>na(e.middleware)),i=I(()=>na(e.transform)??!0),a=I(()=>na(e.placement)??`bottom`),o=I(()=>na(e.strategy)??`absolute`),s=I(()=>na(e.sideOffset)??0),c=I(()=>na(e.alignOffset)??0),l=e.reference,u=V(0),d=V(0),f=nn(null),p=V(J(E(o))),m=V(J(E(a))),h=V(J({})),g=V(!1),_=!1,v=0,y=I(()=>{let e=f.current?ia(f.current,E(u)):E(u),t=f.current?ia(f.current,E(d)):E(d);return E(i)?{position:E(p),left:`0`,top:`0`,transform:`translate(${e}px, ${t}px)`,...f.current&&ra(f.current)>=1.5&&{willChange:`transform`}}:{position:E(p),left:`${e}px`,top:`${t}px`}}),b;function x(){if(l.current===null||f.current===null)return;let e=l.current,t=f.current,i=++v;ta(e,t,{middleware:E(r),placement:E(a),strategy:E(o)}).then(r=>{if(i===v&&l.current===e&&f.current===t){if(sa(e)){F(h,{...E(h),hide:{...E(h).hide,referenceHidden:!0}},!0);return}if(!E(n)&&E(u)!==0&&E(d)!==0){let e=Math.max(Math.abs(E(s)),Math.abs(E(c)),15);if(r.x<=e&&r.y<=e)return}F(u,r.x,!0),F(d,r.y,!0),F(p,r.strategy,!0),F(m,r.placement,!0),F(h,r.middlewareData,!0),F(g,!0)}})}function S(){typeof b==`function`&&(b(),b=void 0),v++}function C(){if(S(),t===void 0){x();return}E(n)&&l.current!==null&&f.current!==null&&(b=t(l.current,f.current,x))}function w(){!E(n)&&f.current===null&&F(g,!1)}function T(){return[E(r),E(a),E(o),E(s),E(c),E(n)]}return de(()=>{t===void 0&&E(n)&&x()}),de(C),de(()=>{if(t!==void 0){if(T(),!E(n)){_=!1;return}if(!E(g)){_=!1;return}if(!_){_=!0;return}x()}}),de(w),de(()=>S),{floating:f,reference:l,get strategy(){return E(p)},get placement(){return E(m)},get middlewareData(){return E(h)},get isPositioned(){return E(g)},get floatingStyles(){return E(y)},get update(){return x}}}function sa(e){return e instanceof Element?!e.isConnected||e instanceof HTMLElement&&e.hidden?!0:e.getClientRects().length===0:!1}var ca={top:`bottom`,right:`left`,bottom:`top`,left:`right`},la=new $t(`Floating.Root`),ua=new $t(`Floating.Content`),da=new $t(`Floating.Root`),fa=class e{static create(t=!1){return t?da.set(new e):la.set(new e)}anchorNode=nn(null);customAnchorNode=nn(null);triggerNode=nn(null);constructor(){de(()=>{this.customAnchorNode.current?typeof this.customAnchorNode.current==`string`?this.anchorNode.current=document.querySelector(this.customAnchorNode.current):this.anchorNode.current=this.customAnchorNode.current:this.anchorNode.current=this.triggerNode.current})}},pa=class e{static create(t,n=!1){return n?ua.set(new e(t,da.get())):ua.set(new e(t,la.get()))}opts;root;contentRef=nn(null);wrapperRef=nn(null);arrowRef=nn(null);contentAttachment=Ut(this.contentRef);wrapperAttachment=Ut(this.wrapperRef);arrowAttachment=Ut(this.arrowRef);arrowId=nn(hn());#e=I(()=>{if(typeof this.opts.style==`string`)return Wt(this.opts.style);if(!this.opts.style)return{}});#t=void 0;#n=new en(()=>this.arrowRef.current??void 0);#r=I(()=>this.#n?.width??0);#i=I(()=>this.#n?.height??0);#a=I(()=>this.opts.side?.current+(this.opts.align.current===`center`?``:`-${this.opts.align.current}`));#o=I(()=>Array.isArray(this.opts.collisionBoundary.current)?this.opts.collisionBoundary.current:[this.opts.collisionBoundary.current]);#s=I(()=>E(this.#o).length>0);get hasExplicitBoundaries(){return E(this.#s)}set hasExplicitBoundaries(e){F(this.#s,e)}#c=I(()=>({padding:this.opts.collisionPadding.current,boundary:E(this.#o).filter(zt),altBoundary:this.hasExplicitBoundaries}));get detectOverflowOptions(){return E(this.#c)}set detectOverflowOptions(e){F(this.#c,e)}#l=V(void 0);#u=V(void 0);#d=V(void 0);#f=V(void 0);#p=I(()=>[Ji({mainAxis:this.opts.sideOffset.current+E(this.#i),alignmentAxis:this.opts.alignOffset.current}),this.opts.avoidCollisions.current&&Yi({mainAxis:!0,crossAxis:!1,limiter:this.opts.sticky.current===`partial`?ea():void 0,...this.detectOverflowOptions}),this.opts.avoidCollisions.current&&Xi({...this.detectOverflowOptions}),Zi({...this.detectOverflowOptions,apply:({rects:e,availableWidth:t,availableHeight:n})=>{let{width:r,height:i}=e.reference;F(this.#l,t,!0),F(this.#u,n,!0),F(this.#d,r,!0),F(this.#f,i,!0)}}),this.arrowRef.current&&$i({element:this.arrowRef.current,padding:this.opts.arrowPadding.current}),ha({arrowWidth:E(this.#r),arrowHeight:E(this.#i)}),this.opts.hideWhenDetached.current&&Qi({strategy:`referenceHidden`,...this.detectOverflowOptions})].filter(Boolean));get middleware(){return E(this.#p)}set middleware(e){F(this.#p,e)}floating;#m=I(()=>_a(this.floating.placement));get placedSide(){return E(this.#m)}set placedSide(e){F(this.#m,e)}#h=I(()=>va(this.floating.placement));get placedAlign(){return E(this.#h)}set placedAlign(e){F(this.#h,e)}#g=I(()=>this.floating.middlewareData.arrow?.x??0);get arrowX(){return E(this.#g)}set arrowX(e){F(this.#g,e)}#_=I(()=>this.floating.middlewareData.arrow?.y??0);get arrowY(){return E(this.#_)}set arrowY(e){F(this.#_,e)}#v=I(()=>this.floating.middlewareData.arrow?.centerOffset!==0);get cannotCenterArrow(){return E(this.#v)}set cannotCenterArrow(e){F(this.#v,e)}#y=V();get contentZIndex(){return E(this.#y)}set contentZIndex(e){F(this.#y,e,!0)}#b=I(()=>ca[this.placedSide]);get arrowBaseSide(){return E(this.#b)}set arrowBaseSide(e){F(this.#b,e)}#x=I(()=>({id:this.opts.wrapperId.current,"data-bits-floating-content-wrapper":``,style:{...this.floating.floatingStyles,transform:this.floating.isPositioned?this.floating.floatingStyles.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:this.contentZIndex,"--bits-floating-transform-origin":`${this.floating.middlewareData.transformOrigin?.x} ${this.floating.middlewareData.transformOrigin?.y}`,"--bits-floating-available-width":`${E(this.#l)}px`,"--bits-floating-available-height":`${E(this.#u)}px`,"--bits-floating-anchor-width":`${E(this.#d)}px`,"--bits-floating-anchor-height":`${E(this.#f)}px`,...this.floating.middlewareData.hide?.referenceHidden&&{visibility:`hidden`,"pointer-events":`none`},...E(this.#e)},dir:this.opts.dir.current,...this.wrapperAttachment}));get wrapperProps(){return E(this.#x)}set wrapperProps(e){F(this.#x,e)}#S=I(()=>({"data-side":this.placedSide,"data-align":this.placedAlign,style:Vt({...E(this.#e)}),...this.contentAttachment}));get props(){return E(this.#S)}set props(e){F(this.#S,e)}#C=I(()=>({position:`absolute`,left:this.arrowX?`${this.arrowX}px`:void 0,top:this.arrowY?`${this.arrowY}px`:void 0,[this.arrowBaseSide]:0,"transform-origin":{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[this.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[this.placedSide],visibility:this.cannotCenterArrow?`hidden`:void 0}));get arrowStyle(){return E(this.#C)}set arrowStyle(e){F(this.#C,e)}constructor(e,t){this.opts=e,this.root=t,this.#t=e.updatePositionStrategy,e.customAnchor&&(this.root.customAnchorNode.current=e.customAnchor.current),Ht(()=>e.customAnchor.current,e=>{this.root.customAnchorNode.current=e}),this.floating=oa({strategy:()=>this.opts.strategy.current,placement:()=>E(this.#a),middleware:()=>this.middleware,reference:this.root.anchorNode,whileElementsMounted:(...e)=>qi(...e,{animationFrame:this.#t?.current===`always`}),open:()=>this.opts.enabled.current,sideOffset:()=>this.opts.sideOffset.current,alignOffset:()=>this.opts.alignOffset.current}),de(()=>{this.floating.isPositioned&&this.opts.onPlaced?.current()}),Ht(()=>this.contentRef.current,e=>{if(!e||!this.opts.enabled.current)return;let t=Gt(e),n=t.requestAnimationFrame(()=>{if(this.contentRef.current!==e||!this.opts.enabled.current)return;let n=t.getComputedStyle(e).zIndex;n!==this.contentZIndex&&(this.contentZIndex=n)});return()=>{t.cancelAnimationFrame(n)}}),de(()=>{this.floating.floating.current=this.wrapperRef.current})}},ma=class e{static create(t,n=!1){return n?new e(t,da.get()):new e(t,la.get())}opts;root;constructor(e,t){this.opts=e,this.root=t,t.triggerNode=e.virtualEl&&e.virtualEl.current?bn(e.virtualEl.current):e.ref}};function ha(e){return{name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ga(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}}function ga(e){let[t,n=`center`]=e.split(`-`);return[t,n]}function _a(e){return ga(e)[0]}function va(e){return ga(e)[1]}function ya(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);fa.create(n());var r=X(),a=q(r);_(a,()=>t.children??R),y(e,r),x()}function ba(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);ma.create({id:$(()=>t.id),virtualEl:$(()=>t.virtualEl),ref:t.ref},n());var r=X(),a=q(r);_(a,()=>t.children??R),y(e,r),x()}function xa(e,t){i(t,!0);let n=k(t,`side`,3,`bottom`),r=k(t,`sideOffset`,3,0),a=k(t,`align`,3,`center`),o=k(t,`alignOffset`,3,0),s=k(t,`arrowPadding`,3,0),c=k(t,`avoidCollisions`,3,!0),l=k(t,`collisionBoundary`,19,()=>[]),u=k(t,`collisionPadding`,3,0),d=k(t,`hideWhenDetached`,3,!1),f=k(t,`onPlaced`,3,()=>{}),p=k(t,`sticky`,3,`partial`),m=k(t,`updatePositionStrategy`,3,`optimized`),h=k(t,`strategy`,3,`fixed`),g=k(t,`dir`,3,`ltr`),v=k(t,`style`,19,()=>({})),b=k(t,`wrapperId`,19,hn),S=k(t,`customAnchor`,3,null),C=k(t,`tooltip`,3,!1),w=pa.create({side:$(()=>n()),sideOffset:$(()=>r()),align:$(()=>a()),alignOffset:$(()=>o()),id:$(()=>t.id),arrowPadding:$(()=>s()),avoidCollisions:$(()=>c()),collisionBoundary:$(()=>l()),collisionPadding:$(()=>u()),hideWhenDetached:$(()=>d()),onPlaced:$(()=>f()),sticky:$(()=>p()),updatePositionStrategy:$(()=>m()),strategy:$(()=>h()),dir:$(()=>g()),style:$(()=>v()),enabled:$(()=>t.enabled),wrapperId:$(()=>b()),customAnchor:$(()=>S())},C()),T=I(()=>tn(w.wrapperProps,{style:{pointerEvents:`auto`}}));var D=X(),O=q(D);_(O,()=>t.content??R,()=>({props:w.props,wrapperProps:E(T)})),y(e,D),x()}function Sa(e,t){i(t,!0),ue(()=>{t.onPlaced?.()});var n=X(),r=q(n);_(r,()=>t.content??R,()=>({props:{},wrapperProps:{}})),y(e,n),x()}var Ca=new Set([`$$slots`,`$$events`,`$$legacy`,`content`,`isStatic`,`onPlaced`]);function wa(e,t){let n=k(t,`isStatic`,3,!1),r=U(t,Ca);var i=X(),a=q(i),o=e=>{Sa(e,{get content(){return t.content},get onPlaced(){return t.onPlaced}})},s=e=>{xa(e,K({get content(){return t.content},get onPlaced(){return t.onPlaced}},()=>r))};h(a,e=>{n()?e(o):e(s,-1)}),y(e,i)}var Ta=new Set(`$$slots.$$events.$$legacy.popper.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.enabled.ref.tooltip.contentPointerEvents`.split(`.`)),Ea=r(`<!> <!>`,1);function Da(e,t){i(t,!0);let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),a=k(t,`isValidEvent`,3,()=>!1),o=k(t,`customAnchor`,3,null),s=k(t,`isStatic`,3,!1),c=k(t,`tooltip`,3,!1),l=k(t,`contentPointerEvents`,3,`auto`),u=U(t,Ta),d=I(()=>t.preventScroll??!0),f=I(()=>t.strategy??(E(d)?`fixed`:`absolute`));wa(e,{get isStatic(){return s()},get id(){return t.id},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return E(f)},get dir(){return t.dir},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return o()},get enabled(){return t.enabled},get tooltip(){return c()},content:(e,i)=>{let o=()=>(i?.()).props,s=()=>(i?.()).wrapperProps;var c=Ea(),f=q(c),p=e=>{sn(e,{get preventScroll(){return E(d)}})},m=e=>{sn(e,{get preventScroll(){return E(d)}})};h(f,e=>{t.forceMount&&t.enabled?e(p):t.forceMount||e(m,1)});var g=z(f,2);cn(g,{get onOpenAutoFocus(){return t.onOpenAutoFocus},get onCloseAutoFocus(){return t.onCloseAutoFocus},get loop(){return t.loop},get enabled(){return t.enabled},get trapFocus(){return r()},get forceMount(){return t.forceMount},get ref(){return t.ref},focusScope:(e,r)=>{let i=()=>(r?.()).props;ln(e,{get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,r)=>{yn(e,{get id(){return t.id},get onInteractOutside(){return t.onInteractOutside},get onFocusOutside(){return t.onFocusOutside},get interactOutsideBehavior(){return n()},get isValidEvent(){return a()},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,n)=>{let r=()=>(n?.()).props;wn(e,{get id(){return t.id},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,n)=>{var a=X(),c=q(a);{let e=I(()=>({props:tn(u,o(),r(),i(),{style:{pointerEvents:l()}}),wrapperProps:s()}));_(c,()=>t.popper??R,()=>E(e))}y(e,a)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),y(e,c)},$$slots:{content:!0}}),x()}var Oa=new Set(`$$slots.$$events.$$legacy.popper.open.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.ref.shouldRender`.split(`.`));function ka(e,t){let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),i=k(t,`isValidEvent`,3,()=>!1),a=k(t,`customAnchor`,3,null),o=k(t,`isStatic`,3,!1),s=U(t,Oa);var c=X(),l=q(c),u=e=>{Da(e,K({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return a()},get isStatic(){return o()},get enabled(){return t.open},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside},forceMount:!1,get ref(){return t.ref}},()=>s))};h(l,e=>{t.shouldRender&&e(u)}),y(e,c)}var Aa=new Set(`$$slots.$$events.$$legacy.popper.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.enabled`.split(`.`));function ja(e,t){let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),i=k(t,`isValidEvent`,3,()=>!1),a=k(t,`customAnchor`,3,null),o=k(t,`isStatic`,3,!1),s=U(t,Aa);Da(e,K({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return a()},get isStatic(){return o()},get enabled(){return t.enabled},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside}},()=>s,{forceMount:!0}))}function Ma(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Na(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Pa(e){if(typeof CSS<`u`&&typeof CSS.escape==`function`)return CSS.escape(e);let t=e.length,n=-1,r,i=``,a=e.charCodeAt(0);if(t===1&&a===45)return`\\`+e;for(;++n<t;){if(r=e.charCodeAt(n),r===0){i+=`�`;continue}if(r>=1&&r<=31||r===127||n===0&&r>=48&&r<=57||n===1&&r>=48&&r<=57&&a===45){i+=`\\`+r.toString(16)+` `;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){i+=e.charAt(n);continue}i+=`\\`+e.charAt(n)}return i}var Fa=`data-value`,Ia=Bt({component:`command`,parts:[`root`,`list`,`input`,`separator`,`loading`,`empty`,`group`,`group-items`,`group-heading`,`item`,`viewport`,`input-label`]}),La=Ia.selector(`group`),Ra=Ia.selector(`group-items`),za=Ia.selector(`group-heading`),Ba=Ia.selector(`item`),Va=`${Ia.selector(`item`)}:not([aria-disabled="true"])`,Ha=new $t(`Command.Root`),Ua=new $t(`Command.List`),Wa=new $t(`Command.Group`),Ga={search:``,value:``,filtered:{count:0,items:new Map,groups:new Set}},Ka=class e{static create(t){return Ha.set(new e(t))}opts;attachment;#e=!1;#t=!0;sortAfterTick=!1;sortAndFilterAfterTick=!1;allItems=new Set;allGroups=new Map;allIds=new Map;#n=V(0);get key(){return E(this.#n)}set key(e){F(this.#n,e,!0)}#r=V(null);get viewportNode(){return E(this.#r)}set viewportNode(e){F(this.#r,e,!0)}#i=V(null);get inputNode(){return E(this.#i)}set inputNode(e){F(this.#i,e,!0)}#a=V(null);get labelNode(){return E(this.#a)}set labelNode(e){F(this.#a,e,!0)}#o=V(Ga);get commandState(){return E(this.#o)}set commandState(e){F(this.#o,e)}#s=V(J(Ga));get _commandState(){return E(this.#s)}set _commandState(e){F(this.#s,e,!0)}#c(){return o(this._commandState)}#l(){this.#e||(this.#e=!0,Xt(()=>{this.#e=!1;let e=this.#c();Object.is(this.commandState,e)||(this.commandState=e,this.opts.onStateChange?.current?.(e))}))}setState(e,t,n){Object.is(this._commandState[e],t)||(this._commandState[e]=t,e===`search`?(this.#m(),this.#d()):e===`value`&&(n||this.#g()),this.#l())}constructor(e){this.opts=e,this.attachment=Ut(this.opts.ref);let t={...this._commandState,value:this.opts.value.current??``};this._commandState=t,this.commandState=t,this.onkeydown=this.onkeydown.bind(this)}#u(e,t){let n=this.opts.filter.current??qo;return e?n(e,this._commandState.search,t):0}#d(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){!this._commandState.value||!this.#t?this.#f():this.#t&&this._commandState.value&&this.#p();return}let e=this._commandState.filtered.items,t=[];for(let n of this._commandState.filtered.groups){let r=this.allGroups.get(n),i=0;if(!r){t.push([n,i]);continue}for(let t of r){let n=e.get(t);i=Math.max(n??0,i)}t.push([n,i])}let n=this.viewportNode,r=this.getValidItems().sort((t,n)=>{let r=t.getAttribute(`data-value`),i=n.getAttribute(`data-value`),a=e.get(r)??0;return(e.get(i)??0)-a});for(let e of r){let t=e.closest(Ra);if(t){let n=e.parentElement===t?e:e.closest(`${Ra} > *`);n&&t.appendChild(n)}else{let t=e.parentElement===n?e:e.closest(`${Ra} > *`);t&&n?.appendChild(t)}}let i=t.sort((e,t)=>t[1]-e[1]);for(let e of i){let t=n?.querySelector(`${La}[${Fa}="${Pa(e[0])}"]`);t?.parentElement?.appendChild(t)}this.#f()}setValue(e,t){e!==this.opts.value.current&&e===``&&Xt(()=>{this.key++}),this.setState(`value`,e,t),this.opts.value.current=e}#f(){Xt(()=>{let e=this.getValidItems().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Fa),t=this.#t&&this.opts.disableInitialScroll.current;this.setValue(e??``,t),this.#t=!1})}#p(){Xt(()=>{this.opts.disableInitialScroll.current||this.#g(),this.#t=!1})}#m(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){this._commandState.filtered.count=this.allItems.size;return}this._commandState.filtered.groups=new Set;let e=0;for(let t of this.allItems){let n=this.allIds.get(t)?.value??``,r=this.allIds.get(t)?.keywords??[],i=this.#u(n,r);this._commandState.filtered.items.set(t,i),i>0&&e++}for(let[e,t]of this.allGroups)for(let n of t){let t=this._commandState.filtered.items.get(n);if(t&&t>0){this._commandState.filtered.groups.add(e);break}}this._commandState.filtered.count=e}getValidItems(){let e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Va)).filter(e=>!!e):[]}getVisibleItems(){let e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Ba)).filter(e=>!!e):[]}get itemsGrid(){if(!this.isGrid)return[];let e=this.opts.columns.current??1,t=this.getVisibleItems(),n=[[]],r=t[0]?.getAttribute(`data-group`),i=0,a=0;for(let o=0;o<t.length;o++){let s=t[o],c=s?.getAttribute(`data-group`);r===c?(i++,i>e&&(a++,i=1,n.push([])),n[a]?.push({index:o,firstRowOfGroup:n[a]?.[0]?.firstRowOfGroup??o===0,ref:s})):(r=c,i=1,a++,n.push([{index:o,firstRowOfGroup:!0,ref:s}]))}return n}#h(){let e=this.opts.ref.current;if(!e)return;let t=e.querySelector(`${Va}[data-selected]`);if(t)return t}#g(){Xt(()=>{let e=this.#h();if(!e)return;let t=e.parentElement?.parentElement;if(t){if(this.isGrid){let t=this.#_(e);if(e.scrollIntoView({block:`nearest`}),t){(e?.closest(La)?.querySelector(za))?.scrollIntoView({block:`nearest`});return}}else{let n=Zt(t);if(n&&n.dataset?.value===e.dataset?.value){(e?.closest(La)?.querySelector(za))?.scrollIntoView({block:`nearest`});return}}e.scrollIntoView({block:`nearest`})}})}#_(e){let t=this.itemsGrid;if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t[n];if(r!==void 0)for(let t=0;t<r.length;t++){let n=r[t];if(n!==void 0&&n.ref===e)return n.firstRowOfGroup}}return!1}updateSelectedToIndex(e){let t=this.getValidItems()[e];t&&this.setValue(t.getAttribute(Fa)??``)}updateSelectedByItem(e){let t=this.#h(),n=this.getValidItems(),r=n.findIndex(e=>e===t),i=n[r+e];this.opts.loop.current&&(i=r+e<0?n[n.length-1]:r+e===n.length?n[0]:n[r+e]),i&&this.setValue(i.getAttribute(Fa)??``)}updateSelectedByGroup(e){let t=this.#h()?.closest(La),n;for(;t&&!n;)t=e>0?Ma(t,La):Na(t,La),n=t?.querySelector(Va);n?this.setValue(n.getAttribute(Fa)??``):this.updateSelectedByItem(e)}registerValue(e,t){return e&&e===this.allIds.get(e)?.value||this.allIds.set(e,{value:e,keywords:t}),this._commandState.filtered.items.set(e,this.#u(e,t)),this.sortAfterTick||(this.sortAfterTick=!0,Xt(()=>{this.#d(),this.sortAfterTick=!1})),()=>{this.allIds.delete(e)}}registerItem(e,t){return this.allItems.add(e),t&&(this.allGroups.has(t)?this.allGroups.get(t).add(e):this.allGroups.set(t,new Set([e]))),this.sortAndFilterAfterTick||(this.sortAndFilterAfterTick=!0,Xt(()=>{this.#m(),this.#d(),this.sortAndFilterAfterTick=!1})),this.#l(),()=>{let t=this.#h();this.allItems.delete(e),this.commandState.filtered.items.delete(e),this.#m(),t?.getAttribute(`id`)===e&&this.#f(),this.#l()}}registerGroup(e){return this.allGroups.has(e)||this.allGroups.set(e,new Set),()=>{this.allIds.delete(e),this.allGroups.delete(e)}}get isGrid(){return this.opts.columns.current!==null}#v(){return this.updateSelectedToIndex(this.getValidItems().length-1)}#y(e){e.preventDefault(),e.metaKey?this.#v():e.altKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(1)}#b(e){this.opts.columns.current!==null&&(e.preventDefault(),e.metaKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(this.#S(e)))}#x(e,t){if(t.length===0)return null;for(let n=0;n<t.length;n++){let r=t[n];if(r!==void 0)for(let t=0;t<r.length;t++){let i=r[t];if(i!==void 0&&i.ref===e)return{columnIndex:t,rowIndex:n}}}return null}#S(e){let t=this.itemsGrid,n=this.#h();if(!n)return 0;let r=this.#x(n,t);if(!r)return 0;let i=null,a=+!!e.altKey;if(e.altKey&&r.rowIndex===t.length-2&&!this.opts.loop.current)i=this.#C({start:t.length-1,end:t.length,expectedColumnIndex:r.columnIndex,grid:t});else if(r.rowIndex===t.length-1){if(!this.opts.loop.current)return 0;i=this.#C({start:0+a,end:r.rowIndex,expectedColumnIndex:r.columnIndex,grid:t})}else i=this.#C({start:r.rowIndex+1+a,end:t.length,expectedColumnIndex:r.columnIndex,grid:t}),i===null&&this.opts.loop.current&&(i=this.#C({start:0,end:r.rowIndex,expectedColumnIndex:r.columnIndex,grid:t}));return this.#w(n,i)}#C({start:e,end:t,grid:n,expectedColumnIndex:r}){let i=null;for(let a=e;a<t;a++){let e=n[a];if(i=e[r]?.ref??null,i!==null&&qa(i)){i=null;continue}if(i===null)for(let t=e.length-1;t>=0;t--){let t=e[e.length-1];if(!(t===void 0||qa(t.ref))){i=t.ref;break}}break}return i}#w(e,t){if(t===null)return 0;let n=this.getValidItems(),r=n.findIndex(t=>t===e);return n.findIndex(e=>e===t)-r}#T(e){this.opts.columns.current!==null&&(e.preventDefault(),e.metaKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(this.#E(e)))}#E(e){let t=this.itemsGrid,n=this.#h();if(n===void 0)return 0;let r=this.#x(n,t);if(r===null)return 0;let i=null,a=+!!e.altKey;if(e.altKey&&r.rowIndex===1&&this.opts.loop.current===!1)i=this.#D({start:0,end:0,expectedColumnIndex:r.columnIndex,grid:t});else if(r.rowIndex===0){if(this.opts.loop.current===!1)return 0;i=this.#D({start:t.length-1-a,end:r.rowIndex+1,expectedColumnIndex:r.columnIndex,grid:t})}else i=this.#D({start:r.rowIndex-1-a,end:0,expectedColumnIndex:r.columnIndex,grid:t}),i===null&&this.opts.loop.current&&(i=this.#D({start:t.length-1,end:r.rowIndex+1,expectedColumnIndex:r.columnIndex,grid:t}));return this.#w(n,i)}#D({start:e,end:t,grid:n,expectedColumnIndex:r}){let i=null;for(let a=e;a>=t;a--){let e=n[a];if(e!==void 0){if(i=e[r]?.ref??null,i!==null&&qa(i)){i=null;continue}if(i===null)for(let t=e.length-1;t>=0;t--){let t=e[e.length-1];if(!(t===void 0||qa(t.ref))){i=t.ref;break}}break}}return i}#O(e){e.preventDefault(),e.metaKey?this.updateSelectedToIndex(0):e.altKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(-1)}onkeydown(e){let t=this.opts.vimBindings.current&&e.ctrlKey;switch(e.key){case`n`:case`j`:t&&(this.isGrid?this.#b(e):this.#y(e));break;case`l`:t&&this.isGrid&&this.#y(e);break;case Rt:this.isGrid?this.#b(e):this.#y(e);break;case mn:if(!this.isGrid)break;this.#y(e);break;case`p`:case`k`:t&&(this.isGrid?this.#T(e):this.#O(e));break;case`h`:t&&this.isGrid&&this.#O(e);break;case Ft:this.isGrid?this.#T(e):this.#O(e);break;case Jt:if(!this.isGrid)break;this.#O(e);break;case Kt:e.preventDefault(),this.updateSelectedToIndex(0);break;case`End`:e.preventDefault(),this.#v();break;case pn:if(!e.isComposing&&e.keyCode!==229){e.preventDefault();let t=this.#h();t&&t?.click()}}}#k=I(()=>({id:this.opts.id.current,role:`application`,[Ia.root]:``,tabindex:-1,onkeydown:this.onkeydown,...this.attachment}));get props(){return E(this.#k)}set props(e){F(this.#k,e)}};function qa(e){return e.getAttribute(`aria-disabled`)===`true`}var Ja=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;#e=I(()=>this.root._commandState.filtered.count===0&&this.#t===!1||this.opts.forceMount.current);get shouldRender(){return E(this.#e)}set shouldRender(e){F(this.#e,e)}#t=!0;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref),re(()=>{this.#t=!1})}#n=I(()=>({id:this.opts.id.current,role:`presentation`,[Ia.empty]:``,...this.attachment}));get props(){return E(this.#n)}set props(e){F(this.#n,e)}},Ya=class e{static create(t){return Wa.set(new e(t,Ha.get()))}opts;root;attachment;#e=I(()=>this.opts.forceMount.current||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search?!0:this.root._commandState.filtered.groups.has(this.trueValue));get shouldRender(){return E(this.#e)}set shouldRender(e){F(this.#e,e)}#t=V(null);get headingNode(){return E(this.#t)}set headingNode(e){F(this.#t,e,!0)}#n=V(``);get trueValue(){return E(this.#n)}set trueValue(e){F(this.#n,e,!0)}constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref),this.trueValue=e.value.current??e.id.current,Ht(()=>this.trueValue,()=>this.root.registerGroup(this.trueValue)),de(()=>this.opts.value.current?(this.trueValue=this.opts.value.current,this.root.registerValue(this.opts.value.current)):this.headingNode&&this.headingNode.textContent?(this.trueValue=this.headingNode.textContent.trim().toLowerCase(),this.root.registerValue(this.trueValue)):(this.trueValue=`-----${this.opts.id.current}`,this.root.registerValue(this.trueValue)))}#r=I(()=>({id:this.opts.id.current,role:`presentation`,hidden:!this.shouldRender||void 0,"data-value":this.trueValue,[Ia.group]:``,...this.attachment}));get props(){return E(this.#r)}set props(e){F(this.#r,e)}},Xa=class e{static create(t){return new e(t,Wa.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Ut(this.opts.ref,e=>this.group.headingNode=e)}#e=I(()=>({id:this.opts.id.current,[Ia[`group-heading`]]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Za=class e{static create(t){return new e(t,Wa.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Ut(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`group`,[Ia[`group-items`]]:``,"aria-labelledby":this.group.headingNode?.id??void 0,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Qa=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;#e=I(()=>{let e=this.root.viewportNode?.querySelector(`${Ba}[${Fa}="${Pa(this.root.opts.value.current)}"]`);if(e!=null)return e.getAttribute(`id`)??void 0});constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref,e=>this.root.inputNode=e),Ht(()=>this.opts.ref.current,()=>{let e=this.opts.ref.current;e&&this.opts.autofocus.current&&kn(10,()=>e.focus())}),Ht(()=>this.opts.value.current,()=>{this.root.commandState.search!==this.opts.value.current&&this.root.setState(`search`,this.opts.value.current)})}#t=I(()=>({id:this.opts.id.current,type:`text`,[Ia.input]:``,autocomplete:`off`,autocorrect:`off`,spellcheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":Yt(!0),"aria-controls":this.root.viewportNode?.id??void 0,"aria-labelledby":this.root.labelNode?.id??void 0,"aria-activedescendant":E(this.#e),...this.attachment}));get props(){return E(this.#t)}set props(e){F(this.#t,e)}},$a=class e{static create(t){let n=Wa.getOr(null);return new e({...t,group:n},Ha.get())}opts;root;attachment;#e=null;#t=I(()=>this.opts.forceMount.current||this.#e?.opts.forceMount.current===!0);#n=I(()=>{if(this.opts.ref.current,E(this.#t)||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search)return!0;let e=this.root.commandState.filtered.items.get(this.trueValue);return e!==void 0&&e>0});get shouldRender(){return E(this.#n)}set shouldRender(e){F(this.#n,e)}#r=I(()=>this.root.opts.value.current===this.trueValue&&this.trueValue!==``);get isSelected(){return E(this.#r)}set isSelected(e){F(this.#r,e)}#i=V(``);get trueValue(){return E(this.#i)}set trueValue(e){F(this.#i,e,!0)}constructor(e,t){this.opts=e,this.root=t,this.#e=Wa.getOr(null),this.trueValue=e.value.current,this.attachment=Ut(this.opts.ref),Ht([()=>this.trueValue,()=>this.#e?.trueValue,()=>this.opts.forceMount.current],()=>{if(!this.opts.forceMount.current&&this.trueValue)return this.root.registerItem(this.trueValue,this.#e?.trueValue)}),Ht([()=>this.opts.value.current,()=>this.opts.ref.current],()=>{this.opts.value.current?this.trueValue=this.opts.value.current:this.opts.ref.current?.textContent&&(this.trueValue=this.opts.ref.current.textContent.trim()),this.trueValue&&(this.root.registerValue(this.trueValue,e.keywords.current.map(e=>e.trim())),this.opts.ref.current?.setAttribute(Fa,this.trueValue))}),this.onclick=this.onclick.bind(this),this.onpointermove=this.onpointermove.bind(this)}#a(){this.opts.disabled.current||(this.#o(),this.opts.onSelect?.current())}#o(){this.opts.disabled.current||this.root.setValue(this.trueValue,!0)}onpointermove(e){this.opts.disabled.current||this.root.opts.disablePointerSelection.current||this.#o()}onclick(e){this.opts.disabled.current||this.#a()}#s=I(()=>({id:this.opts.id.current,"aria-disabled":Yt(this.opts.disabled.current),"aria-selected":Yt(this.isSelected),"data-disabled":qt(this.opts.disabled.current),"data-selected":qt(this.isSelected),"data-value":this.trueValue,"data-group":this.#e?.trueValue,[Ia.item]:``,role:`option`,onpointermove:this.onpointermove,onclick:this.onclick,...this.attachment}));get props(){return E(this.#s)}set props(e){F(this.#s,e)}},eo=class e{static create(t){return Ua.set(new e(t,Ha.get()))}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`listbox`,"aria-label":this.opts.ariaLabel.current,[Ia.list]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},to=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref,e=>this.root.labelNode=e)}#e=I(()=>({id:this.opts.id.current,[Ia[`input-label`]]:``,for:this.opts.for?.current,style:rr,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},no=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`]),ro=r(`<label><!></label>`);function io(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,no),c=to.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=ro();P(d,()=>({...E(l)}));var f=W(d);_(f,()=>t.children??R),n(d),y(e,d),x()}var ao=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`onValueChange`,`onStateChange`,`loop`,`shouldFilter`,`filter`,`label`,`vimBindings`,`disablePointerSelection`,`disableInitialScroll`,`columns`,`children`,`child`]),oo=r(`<!> <!>`,1),so=r(`<div><!> <!></div>`);function co(e,t){let r=u();i(t,!0);let a=e=>{io(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,v())),y(e,n)},$$slots:{default:!0}})},o=k(t,`id`,19,()=>En(r)),s=k(t,`ref`,15,null),l=k(t,`value`,15,``),d=k(t,`onValueChange`,3,Qt),f=k(t,`onStateChange`,3,Qt),p=k(t,`loop`,3,!1),m=k(t,`shouldFilter`,3,!0),g=k(t,`filter`,3,qo),v=k(t,`label`,3,``),b=k(t,`vimBindings`,3,!0),S=k(t,`disablePointerSelection`,3,!1),w=k(t,`disableInitialScroll`,3,!1),T=k(t,`columns`,3,null),D=U(t,ao),O=Ka.create({id:$(()=>o()),ref:$(()=>s(),e=>s(e)),filter:$(()=>g()),shouldFilter:$(()=>m()),loop:$(()=>p()),value:$(()=>l(),e=>{l()!==e&&(l(e),d()(e))}),vimBindings:$(()=>b()),disablePointerSelection:$(()=>S()),disableInitialScroll:$(()=>w()),onStateChange:$(()=>f()),columns:$(()=>T())}),A=e=>O.updateSelectedToIndex(e),j=e=>O.updateSelectedByGroup(e),ee=e=>O.updateSelectedByItem(e),te=()=>O.getValidItems(),M=I(()=>tn(D,O.props));var N={updateSelectedToIndex:A,updateSelectedByGroup:j,updateSelectedByItem:ee,getValidItems:te},F=X(),L=q(F),ne=e=>{var n=oo(),r=q(n);a(r);var i=z(r,2);_(i,()=>t.child,()=>({props:E(M)})),y(e,n)},re=e=>{var r=so();P(r,()=>({...E(M)}));var i=W(r);a(i);var o=z(i,2);_(o,()=>t.children??R),n(r),y(e,r)};return h(L,e=>{t.child?e(ne):e(re,-1)}),y(e,F),x(N)}var lo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`,`forceMount`]),uo=r(`<div><!></div>`);function fo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`forceMount`,3,!1),c=U(t,lo),l=Ja.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),forceMount:$(()=>s())}),d=I(()=>tn(l.props,c));var f=X(),p=q(f),m=e=>{var r=X(),i=q(r),a=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},o=e=>{var r=uo();P(r,()=>({...E(d)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)};h(p,e=>{l.shouldRender&&e(m)}),y(e,f),x()}var po=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`forceMount`,`children`,`child`]),mo=r(`<div><!></div>`);function ho(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`forceMount`,3,!1),l=U(t,po),d=Ya.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),forceMount:$(()=>c()),value:$(()=>s())}),f=I(()=>tn(l,d.props));var p=X(),m=q(p),g=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},v=e=>{var r=mo();P(r,()=>({...E(f)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(m,e=>{t.child?e(g):e(v,-1)}),y(e,p),x()}var go=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),_o=r(`<div><!></div>`);function vo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,go),c=Xa.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=_o();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var yo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),bo=r(`<div><!></div>`),xo=r(`<div style="display: contents;"><!></div>`);function So(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,yo),c=Za.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=xo(),f=W(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=bo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),n(d),y(e,d),x()}var Co=new Set([`$$slots`,`$$events`,`$$legacy`,`value`,`autofocus`,`id`,`ref`,`child`]),wo=r(`<input/>`);function To(e,t){let n=u();i(t,!0);let r=k(t,`value`,15,``),a=k(t,`autofocus`,3,!1),o=k(t,`id`,19,()=>En(n)),s=k(t,`ref`,15,null),c=U(t,Co),l=Qa.create({id:$(()=>o()),ref:$(()=>s(),e=>s(e)),value:$(()=>r(),e=>{r(e)}),autofocus:$(()=>a()??!1)}),d=I(()=>tn(c,l.props));var f=X(),p=q(f),m=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},g=e=>{var t=wo();P(t,()=>({...E(d)}),void 0,void 0,void 0,void 0,!0),N(t,r),y(e,t)};h(p,e=>{t.child?e(m):e(g,-1)}),y(e,f),x()}var Eo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`disabled`,`children`,`child`,`onSelect`,`forceMount`,`keywords`]),Do=r(`<div><!></div>`),Oo=r(`<div style="display: contents;" data-item-wrapper=""><!></div>`);function ko(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`disabled`,3,!1),l=k(t,`onSelect`,3,Qt),d=k(t,`forceMount`,3,!1),f=k(t,`keywords`,19,()=>[]),m=U(t,Eo),g=$a.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),value:$(()=>s()),disabled:$(()=>c()),onSelect:$(()=>l()),forceMount:$(()=>d()),keywords:$(()=>f())}),v=I(()=>tn(m,g.props));var b=X(),S=q(b);p(S,()=>g.root.key,e=>{var r=Oo(),i=W(r),a=e=>{var r=X(),i=q(r),a=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(v)})),y(e,n)},o=e=>{var r=Do();P(r,()=>({...E(v)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)};h(i,e=>{g.shouldRender&&e(a)}),n(r),H(()=>B(r,`data-value`,g.trueValue)),y(e,r)}),y(e,b),x()}var Ao=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`aria-label`]),jo=r(`<div><!></div>`);function Mo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,Ao),c=eo.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),ariaLabel:$(()=>t[`aria-label`]??`Suggestions...`)}),l=I(()=>tn(s,c.props));var d=X(),f=q(d);p(f,()=>c.root._commandState.search===``,e=>{var r=X(),i=q(r),a=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},o=e=>{var r=jo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)}),y(e,d),x()}var No=1,Po=.9,Fo=.8,Io=.17,Lo=.1,Ro=.999,zo=.9999,Bo=.99,Vo=/[\\/_+.#"@[({&]/,Ho=/[\\/_+.#"@[({&]/g,Uo=/[\s-]/,Wo=/[\s-]/g;function Go(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?No:Bo;let s=`${i},${a}`;if(o[s]!==void 0)return o[s];let c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;for(;l>=0;)d=Go(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=No:Vo.test(e.charAt(l-1))?(d*=Fo,p=e.slice(i,l-1).match(Ho),p&&i>0&&(d*=Ro**p.length)):Uo.test(e.charAt(l-1))?(d*=Po,m=e.slice(i,l-1).match(Wo),m&&i>0&&(d*=Ro**m.length)):(d*=Io,i>0&&(d*=Ro**(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=zo)),(d<Lo&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Go(e,t,n,r,l+1,a+2,o),f*Lo>d&&(d=f*Lo)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ko(e){return e.toLowerCase().replace(Wo,` `)}function qo(e,t,n){return e=n&&n.length>0?`${`${e} ${n?.join(` `)}`}`:e,Go(e,t,Ko(e),Ko(t),0,0,{})}var Jo=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`onSelect`,`closeOnSelect`]),Yo=r(`<div><!></div>`);function Xo(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=k(t,`disabled`,3,!1),c=k(t,`onSelect`,3,Qt),l=k(t,`closeOnSelect`,3,!0),d=U(t,Jo),f=Tn.create({id:$(()=>o()),disabled:$(()=>s()),onSelect:$(()=>c()),ref:$(()=>a(),e=>a(e)),closeOnSelect:$(()=>l())}),p=I(()=>tn(d,f.props));var m=X(),g=q(m),v=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(p)})),y(e,n)},b=e=>{var r=Yo();P(r,()=>({...E(p)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(g,e=>{t.child?e(v):e(b,-1)}),y(e,m),x()}var Zo=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),Qo=r(`<div><!></div>`);function $o(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,Zo),c=rn.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=Qo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var es=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),ts=r(`<div><!></div>`);function ns(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,es),c=un.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=ts();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var rs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`id`,`child`,`children`]),is=r(`<div><!></div>`);function as(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,rs),c=Dn.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=is();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}function os(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=k(t,`dir`,3,`ltr`),a=k(t,`onOpenChange`,3,Qt),o=k(t,`onOpenChangeComplete`,3,Qt),s=k(t,`_internal_variant`,3,`dropdown-menu`),c=k(t,`_internal_should_skip_exit_animation`,3,void 0),l=on.create({variant:$(()=>s()),dir:$(()=>r()),onClose:()=>{n(!1),a()(!1)},shouldSkipExitAnimation:()=>c()?.()??!1});On.create({open:$(()=>n(),e=>{n(e),a()(e)}),onOpenChangeComplete:$(()=>o())},l),ya(e,{children:(e,n)=>{var r=X(),i=q(r);_(i,()=>t.children??R),y(e,r)},$$slots:{default:!0}}),x()}var ss=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`child`,`children`,`ref`,`loop`,`onInteractOutside`,`onEscapeKeydown`,`onCloseAutoFocus`,`forceMount`,`trapFocus`,`style`]),cs=r(`<div><div><!></div></div>`);function ls(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`loop`,3,!0),c=k(t,`onInteractOutside`,3,Qt),l=k(t,`onEscapeKeydown`,3,Qt),d=k(t,`onCloseAutoFocus`,3,Qt),f=k(t,`forceMount`,3,!1),p=k(t,`trapFocus`,3,!1),m=U(t,ss),g=dn.create({id:$(()=>a()),loop:$(()=>s()),ref:$(()=>o(),e=>o(e)),onCloseAutoFocus:$(()=>d())}),v=I(()=>tn(m,g.props));function b(e){if(g.handleInteractOutside(e),!e.defaultPrevented&&(c()(e),!e.defaultPrevented)){if(e.target&&e.target instanceof Element){let t=`[${g.parentMenu.root.getBitsAttr(`sub-content`)}]`;if(e.target.closest(t))return}g.parentMenu.onClose()}}function S(e){l()(e),!e.defaultPrevented&&g.parentMenu.onClose()}var C=X(),w=q(C),T=e=>{ja(e,K(()=>E(v),()=>g.popperProps,{get ref(){return g.opts.ref},get enabled(){return g.parentMenu.opts.open.current},onInteractOutside:b,onEscapeKeydown:S,get trapFocus(){return p()},get loop(){return s()},forceMount:!0,get id(){return a()},get shouldRender(){return g.shouldRender},popper:(e,r)=>{let i=()=>(r?.()).props,a=()=>(r?.()).wrapperProps,o=I(()=>tn(i(),{style:aa(`dropdown-menu`)},{style:t.style}));var s=X(),c=q(s),l=e=>{var n=X(),r=q(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=cs();P(r,()=>({...a()}));var i=W(r);P(i,()=>({...E(o)}));var s=W(i);_(s,()=>t.children??R),n(i),n(r),y(e,r)};h(c,e=>{t.child?e(l):e(u,-1)}),y(e,s)},$$slots:{popper:!0}}))},D=e=>{ka(e,K(()=>E(v),()=>g.popperProps,{get ref(){return g.opts.ref},get open(){return g.parentMenu.opts.open.current},onInteractOutside:b,onEscapeKeydown:S,get trapFocus(){return p()},get loop(){return s()},forceMount:!1,get id(){return a()},get shouldRender(){return g.shouldRender},popper:(e,r)=>{let i=()=>(r?.()).props,a=()=>(r?.()).wrapperProps,o=I(()=>tn(i(),{style:aa(`dropdown-menu`)},{style:t.style}));var s=X(),c=q(s),l=e=>{var n=X(),r=q(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=cs();P(r,()=>({...a()}));var i=W(r);P(i,()=>({...E(o)}));var s=W(i);_(s,()=>t.children??R),n(i),n(r),y(e,r)};h(c,e=>{t.child?e(l):e(u,-1)}),y(e,s)},$$slots:{popper:!0}}))};h(w,e=>{f()?e(T):f()||e(D,1)}),y(e,C),x()}var us=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`disabled`,`type`]),ds=r(`<button><!></button>`);function fs(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`disabled`,3,!1),c=k(t,`type`,3,`button`),l=U(t,us),d=gn.create({id:$(()=>a()),disabled:$(()=>s()??!1),ref:$(()=>o(),e=>o(e))}),f=I(()=>tn(l,d.props,{type:c()}));ba(e,{get id(){return a()},get ref(){return d.opts.ref},children:(e,r)=>{var i=X(),a=q(i),o=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},s=e=>{var r=ds();P(r,()=>({...E(f)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(a,e=>{t.child?e(o):e(s,-1)}),y(e,i)},$$slots:{default:!0}}),x()}var ps=Bt({component:`label`,parts:[`root`]}),ms=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=Ut(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}onmousedown(e){e.detail>1&&e.preventDefault()}#e=I(()=>({id:this.opts.id.current,[ps.root]:``,onmousedown:this.onmousedown,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},hs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`for`]),gs=r(`<label><!></label>`);function _s(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,hs),c=ms.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props,{for:t.for}));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=gs();P(r,()=>({...E(l),for:t.for}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var vs=class{#e;#t;#n=null;constructor(e,t){this.#t=e,this.#e=t,this.stop=this.stop.bind(this),this.start=this.start.bind(this),It(this.stop)}#r(){this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)}stop(){this.#r()}start(...e){this.#r(),this.#n=window.setTimeout(()=>{this.#n=null,this.#t(...e)},this.#e)}};Bt({component:`tooltip`,parts:[`content`,`trigger`]});var ys=new $t(`Tooltip.Provider`);new $t(`Tooltip.Root`);var bs=class e{static create(t){return ys.set(new e(t))}opts;#e=V(!0);get isOpenDelayed(){return E(this.#e)}set isOpenDelayed(e){F(this.#e,e,!0)}isPointerInTransit=nn(!1);#t;#n=V(null);constructor(e){this.opts=e,this.#t=new vs(()=>{this.isOpenDelayed=!0},this.opts.skipDelayDuration.current),ir(()=>G(window,`scroll`,e=>{let t=E(this.#n);if(!t)return;let n=t.triggerNode;if(!n)return;let r=e.target;(r instanceof Element||r instanceof Document)&&r.contains(n)&&t.handleClose()}))}#r=()=>{if(this.opts.skipDelayDuration.current===0){this.isOpenDelayed=!0;return}this.#t.start()};#i=()=>{this.#t.stop()};onOpen=e=>{E(this.#n)&&E(this.#n)!==e&&E(this.#n).handleClose(),this.#i(),this.isOpenDelayed=!1,F(this.#n,e,!0)};onClose=e=>{E(this.#n)===e&&(F(this.#n,null),this.#r())};isTooltipOpen=e=>E(this.#n)===e};function xs(e,t){i(t,!0);let n=k(t,`delayDuration`,3,700),r=k(t,`disableCloseOnTriggerClick`,3,!1),a=k(t,`disableHoverableContent`,3,!1),o=k(t,`disabled`,3,!1),s=k(t,`ignoreNonKeyboardFocus`,3,!1),c=k(t,`skipDelayDuration`,3,300);bs.create({delayDuration:$(()=>n()),disableCloseOnTriggerClick:$(()=>r()),disableHoverableContent:$(()=>a()),disabled:$(()=>o()),ignoreNonKeyboardFocus:$(()=>s()),skipDelayDuration:$(()=>c())});var l=X(),u=q(l);_(u,()=>t.children??R),y(e,l),x()}var Ss=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Cs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Ss);var o=X(),s=q(o);{let e=I(()=>Fn(`gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed`,t.class));a(s,()=>_s,(t,i)=>{i(t,K({"data-slot":`label`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var ws=r(`<!> Import workspace`,1),Ts=r(`<!> <!>`,1),Es=r(`<div class="rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive"> </div>`),Ds=r(`Display name <span class="text-muted-foreground">(optional)</span>`,1),Os=r(`<!> Import`,1),ks=r(`<!> <!> <div class="space-y-3"><div class="space-y-1.5"><!> <!> <p class="text-[11px] text-muted-foreground">Absolute path to a directory containing skill folders.</p></div> <div class="space-y-1.5"><!> <!></div> <div class="flex justify-end gap-2 pt-1"><!> <!></div></div>`,1);function As(e,t){i(t,!0);let r=V(!1);de(()=>{Oe.open=E(r)}),de(()=>{Oe.open&&F(r,!0)}),de(()=>{E(r)&&(F(o,``),F(s,``),F(u,null))});let o=V(``),s=V(``),l=V(!1),u=V(null);async function d(){if(!E(o).trim()){F(u,`A directory path is required.`);return}F(l,!0),F(u,null);try{let e=await Pt(E(o).trim(),E(s).trim()||void 0);if(!e)return;F(r,!1),await ge(Nt(e))}catch(e){F(u,e instanceof Error?e.message:String(e),!0)}finally{F(l,!1)}}var f=X(),p=q(f);a(p,()=>Sn,(e,t)=>{t(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,t)=>{var i=X(),f=q(i);a(f,()=>fn,(e,t)=>{t(e,{class:`sm:max-w-[460px]`,children:(e,t)=>{var i=ks(),f=q(i);a(f,()=>an,(e,t)=>{t(e,{children:(e,t)=>{var n=Ts(),r=q(n);a(r,()=>vn,(e,t)=>{t(e,{class:`flex items-center gap-2`,children:(e,t)=>{var n=ws(),r=q(n);Vn(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>xn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`Import a directory as a skill workspace. Its skills will be discovered and managed here.`);y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var p=z(f,2),m=e=>{var t=Es(),n=M(t,!0);H(()=>c(n,E(u))),y(e,t)};h(p,e=>{E(u)&&e(m)});var g=z(p,2),_=W(g),v=W(_);Cs(v,{for:`ws-path`,children:(e,t)=>{oe();var n=C(`Directory path`);y(e,n)},$$slots:{default:!0}});var b=z(v,2);zn(b,{id:`ws-path`,placeholder:`/Users/me/.claude/skills`,class:`font-mono text-xs`,get value(){return E(o)},set value(e){F(o,e,!0)}}),oe(2),n(_);var x=z(_,2),S=W(x);Cs(S,{for:`ws-label`,children:(e,t)=>{oe();var n=Ds();oe(),y(e,n)},$$slots:{default:!0}});var w=z(S,2);zn(w,{id:`ws-label`,placeholder:`My Skills`,get value(){return E(s)},set value(e){F(s,e,!0)}}),n(x);var T=z(x,2),D=W(T);An(D,{variant:`outline`,size:`sm`,onclick:()=>F(r,!1),children:(e,t)=>{oe();var n=C(`Cancel`);y(e,n)},$$slots:{default:!0}});var O=z(D,2);An(O,{size:`sm`,get disabled(){return E(l)},onclick:d,children:(e,t)=>{var n=Os(),r=q(n),i=e=>{jn(e,{class:`h-3.5 w-3.5 animate-spin`})};h(r,e=>{E(l)&&e(i)}),oe(),y(e,n)},$$slots:{default:!0}}),n(T),n(g),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,f),x()}var js=new Set([`$$slots`,`$$events`,`$$legacy`,`api`,`ref`,`value`,`class`]);function Ms(e,t){i(t,!0);let n=k(t,`api`,15,null),r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=U(t,js);var c=X(),l=q(c);{let e=I(()=>Fn(`bg-popover text-popover-foreground rounded-xl p-1 flex size-full flex-col overflow-hidden`,t.class));a(l,()=>co,(t,i)=>{se(i(t,K({"data-slot":`command`,get class(){return E(e)}},()=>s,{get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}})),e=>n(e),()=>n())})}y(e,c),x()}var Ns=new Set([`$$slots`,`$$events`,`$$legacy`,`open`,`ref`,`value`,`title`,`description`,`showCloseButton`,`portalProps`,`children`,`class`]),Ps=r(`<!> <!>`,1);function Fs(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=k(t,`title`,3,`Command Palette`),l=k(t,`description`,3,`Search for a command to run...`),u=k(t,`showCloseButton`,3,!1),d=U(t,Ns);var f=X(),p=q(f);a(p,()=>Sn,(e,i)=>{i(e,K(()=>d,{get open(){return n()},set open(e){n(e)},children:(e,n)=>{var i=Ps(),f=q(i);a(f,()=>an,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{var n=Ps(),r=q(n);a(r,()=>vn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,s())),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>xn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,l())),y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var p=z(f,2);{let e=I(()=>Fn(`rounded-xl! p-0 top-1/3 translate-y-0 overflow-hidden p-0`,t.class));a(p,()=>fn,(n,i)=>{i(n,{get class(){return E(e)},get showCloseButton(){return u()},get portalProps(){return t.portalProps},children:(e,n)=>{Ms(e,K(()=>d,{get children(){return t.children},get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}}))},$$slots:{default:!0}})})}y(e,i)},$$slots:{default:!0}}))}),y(e,f),x()}var Is=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Ls(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Is);var o=X(),s=q(o);{let e=I(()=>Fn(`py-6 text-center text-xs/relaxed`,t.class));a(s,()=>fo,(t,i)=>{i(t,K({"data-slot":`command-empty`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var Rs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`heading`,`value`]),zs=r(`<!> <!>`,1);function Bs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Rs);var o=X(),s=q(o);{let e=I(()=>Fn(`text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium`,t.class)),i=I(()=>t.value??t.heading??`----${hn()}`);a(s,()=>ho,(o,s)=>{s(o,K({"data-slot":`command-group`,get class(){return E(e)},get value(){return E(i)}},()=>r,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=zs(),i=q(r),o=e=>{var n=X(),r=q(n);a(r,()=>vo,(e,n)=>{n(e,{class:`text-muted-foreground px-2 py-1.5 text-xs font-medium`,children:(e,n)=>{oe();var r=C();H(()=>c(r,t.heading)),y(e,r)},$$slots:{default:!0}})}),y(e,n)};h(i,e=>{t.heading&&e(o)});var s=z(i,2);a(s,()=>So,(e,n)=>{n(e,{get children(){return t.children}})}),y(e,r)},$$slots:{default:!0}}))})}y(e,o),x()}var Vs=new Set([`$$slots`,`$$events`,`$$legacy`]);function Hs(e,t){let n=U(t,Vs),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];ye(e,K({name:`check`},()=>n,{get iconNode(){return r}}))}var Us=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),Ws=r(`<!> <!>`,1);function Gs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Us);var o=X(),s=q(o);{let e=I(()=>Fn(`group/command-item data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,t.class));a(s,()=>ko,(i,a)=>{a(i,K({"data-slot":`command-item`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=Ws(),i=q(r);_(i,()=>t.children??R),Hs(z(i,2),{class:`cn-command-item-indicator ml-auto opacity-0 group-has-[[data-slot=command-shortcut]]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`}),y(e,r)},$$slots:{default:!0}}))})}y(e,o),x()}var Ks=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),qs=r(`<div><!></div>`);function Js(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,Ks);var o=qs();P(o,e=>({"data-slot":`input-group`,role:`group`,class:e,...a}),[()=>Fn(`group/input-group border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-7 rounded-md border transition-colors in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-2 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto`,t.class)]);var s=W(o);_(s,()=>t.children??R),n(o),se(o,e=>r(e),()=>r()),y(e,o),x()}var Ys=Nn({base:`text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-xs/relaxed font-medium group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5 flex cursor-text items-center justify-center select-none`,variants:{align:{"inline-start":`pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem] order-first`,"inline-end":`pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem] order-last`,"block-start":`px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start`,"block-end":`px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start`}},defaultVariants:{align:`inline-start`}}),Xs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`align`]),Zs=r(`<div><!></div>`);function Qs(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=k(t,`align`,3,`inline-start`),o=U(t,Xs);var s=Zs(),c=e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()};P(s,e=>({role:`group`,"data-slot":`input-group-addon`,"data-align":a(),class:e,onclick:c,...o}),[()=>Fn(Ys({align:a()}),t.class)]);var l=W(s);_(l,()=>t.children??R),n(s),se(s,e=>r(e),()=>r()),y(e,s),x()}Nn({base:`gap-2 rounded-md text-xs/relaxed flex items-center shadow-none`,variants:{size:{xs:`h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3`,sm:`gap-1`,"icon-xs":`size-6 p-0 has-[>svg]:p-0`,"icon-sm":`size-7 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});var $s=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`value`,`class`]);function ec(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`value`,15),a=U(t,$s);{let i=I(()=>Fn(`rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1`,t.class));zn(e,K({"data-slot":`input-group-control`,get class(){return E(i)}},()=>a,{get ref(){return n()},set ref(e){n(e)},get value(){return r()},set value(e){r(e)}}))}x()}var tc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`value`]),nc=r(`<!> <!>`,1),rc=r(`<div data-slot="command-input-wrapper" class="p-1 pb-0"><!></div>`);function ic(e,t){i(t,!0);let r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=U(t,tc);var c=rc(),l=W(c);a(l,()=>Js,(e,n)=>{n(e,{class:`bg-input/20 dark:bg-input/30 h-8!`,children:(e,n)=>{var i=nc(),c=q(i);{let e=(e,t)=>{let n=()=>(t?.()).props;var i=X(),s=q(i);a(s,()=>ec,(e,t)=>{t(e,K(n,{get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}}))}),y(e,i)},n=I(()=>Fn(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,t.class));a(c,()=>To,(t,r)=>{r(t,K({get value(){return o()},"data-slot":`command-input`,get class(){return E(n)}},()=>s,{child:e,$$slots:{child:!0}}))})}var l=z(c,2);a(l,()=>Qs,(e,t)=>{t(e,{children:(e,t)=>{Un(e,{class:`size-3.5 shrink-0 opacity-50`})},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),n(c),y(e,c),x()}var ac=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function oc(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,ac);var o=X(),s=q(o);{let e=I(()=>Fn(`no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto`,t.class));a(s,()=>Mo,(t,i)=>{i(t,K({"data-slot":`command-list`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var sc=new Set([`$$slots`,`$$events`,`$$legacy`]);function cc(e,t){let n=U(t,sc),r=[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M14 19h6`}],[`path`,{d:`M17 16v6`}]];ye(e,K({name:`file-plus-corner`},()=>n,{get iconNode(){return r}}))}var lc=new Set([`$$slots`,`$$events`,`$$legacy`]);function uc(e,t){let n=U(t,lc),r=[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`}]];ye(e,K({name:`layout-grid`},()=>n,{get iconNode(){return r}}))}var dc=r(`<!> Workspaces`,1),fc=r(`<!> Creator`,1),pc=r(`<!> Repository`,1),mc=r(`<!> <!> <!>`,1),hc=r(`<!> <span class="flex-1 truncate"> </span> <span class="text-[10px] tabular-nums text-muted-foreground"> </span>`,1),gc=r(`<!> <!>`,1);function _c(e,n){i(n,!0);let r=V(!1);de(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),F(r,!E(r)))};return globalThis.addEventListener(`keydown`,e),()=>globalThis.removeEventListener(`keydown`,e)});function o(e){F(r,!1),e()}var s=X(),l=q(s);a(l,()=>Fs,(e,n)=>{n(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,n)=>{var r=gc(),i=q(r);a(i,()=>ic,(e,t)=>{t(e,{placeholder:`Search navigation and workspaces…`})});var s=z(i,2);a(s,()=>oc,(e,n)=>{n(e,{children:(e,n)=>{var r=mc(),i=q(r);a(i,()=>Ls,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`No matching destination.`);y(e,n)},$$slots:{default:!0}})});var s=z(i,2);a(s,()=>Bs,(e,t)=>{t(e,{heading:`Navigate`,children:(e,t)=>{var n=mc(),r=q(n);a(r,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>ge(`/workspaces`)),value:`go workspaces manage locations`,children:(e,t)=>{var n=dc();uc(q(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>ge(`/creator`)),value:`go creator new skill`,children:(e,t)=>{var n=fc();cc(q(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var s=z(i,2);a(s,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>ge(`/repository`)),value:`go repository browse remote`,children:(e,t)=>{var n=pc(),r=q(n);Ee(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var l=z(s,2),u=e=>{var n=X(),r=q(n);a(r,()=>Bs,(e,n)=>{n(e,{heading:`Workspaces`,children:(e,n)=>{var r=X(),i=q(r);t(i,17,()=>jt.workspaces,e=>e.id,(e,t)=>{var n=X(),r=q(n);{let e=I(()=>`workspace ${E(t).label} ${E(t).path}`);a(r,()=>Gs,(n,r)=>{r(n,{get value(){return E(e)},onSelect:()=>o(()=>ge(Nt(E(t)))),children:(e,n)=>{var r=hc(),i=q(r);Vn(i,{class:`h-4 w-4`});var a=z(i,2),o=M(a,!0),s=z(a,2),l=M(s,!0);H(()=>{c(o,E(t).label),c(l,E(t).skillCount??0)}),y(e,r)},$$slots:{default:!0}})})}y(e,n)}),y(e,r)},$$slots:{default:!0}})}),y(e,n)};h(l,e=>{jt.workspaces.length>0&&e(u)}),y(e,r)},$$slots:{default:!0}})}),y(e,r)},$$slots:{default:!0}})}),y(e,s),x()}var vc=r(`<button class="text-xs font-medium text-primary hover:underline"> </button>`),yc=r(`<div class="pointer-events-auto flex items-center gap-3 rounded-md border border-border bg-popover px-4 py-2.5 text-sm"><span class="flex-1 text-foreground"> </span> <!> <button class="text-muted-foreground hover:text-foreground" aria-label="Dismiss notification" title="Dismiss notification"><!></button></div>`),bc=r(`<div class="pointer-events-none fixed bottom-4 right-4 z-50 flex flex-col gap-2" aria-live="polite" aria-relevant="additions text"></div>`);function xc(e,r){i(r,!1),te();var a=bc();t(a,5,()=>Pn,e=>e.id,(e,t)=>{var r=yc(),i=W(r),a=M(i,!0),o=z(i,2),s=e=>{var n=vc(),r=M(n,!0);H(()=>c(r,E(t).action.label)),l(`click`,n,()=>{E(t).action.run(),In(E(t).id)}),y(e,n)};h(o,e=>{E(t).action&&e(s)});var u=z(o,2),d=W(u);Ln(d,{class:`h-3.5 w-3.5`}),n(u),n(r),H(()=>c(a,E(t).message)),l(`click`,u,()=>In(E(t).id)),y(e,r)}),n(a),y(e,a),x()}T([`click`]);var Sc=new Set([`$$slots`,`$$events`,`$$legacy`,`delayDuration`]);function Cc(e,t){let n=k(t,`delayDuration`,3,0),r=U(t,Sc);var i=X(),o=q(i);a(o,()=>xs,(e,t)=>{t(e,K({get delayDuration(){return n()}},()=>r))}),y(e,i)}var wc=()=>navigator.opentrayWindow??navigator.opentray?.window??void 0,Tc={width:960,height:680},Ec={width:1100,height:760};async function Dc(e){let t=wc();if(t?.resizeTo&&t.getBounds)try{let n=await t.getBounds(),r=Math.max(n.width,e.width),i=Math.max(n.height,e.height);if(r===n.width&&i===n.height)return;await t.resizeTo(r,i)}catch{}}var Oc=new Set([`$$slots`,`$$events`,`$$legacy`]);function kc(e,t){let n=U(t,Oc),r=[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`}]];ye(e,K({name:`command`},()=>n,{get iconNode(){return r}}))}var Ac=new Set([`$$slots`,`$$events`,`$$legacy`]);function jc(e,t){let n=U(t,Ac),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];ye(e,K({name:`settings`},()=>n,{get iconNode(){return r}}))}var Mc=r(`<option>New session…</option>`),Nc=r(`<option>No sessions</option>`),Pc=r(`<option> </option>`),Fc=r(`<button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground" title="New session" aria-label="New session"><!></button>`),Ic=r(`<header class="flex h-10 shrink-0 items-center gap-1 border-b border-border px-2"><span class="px-1 text-xs font-medium text-muted-foreground">Agent</span> <select class="h-8 min-w-0 flex-1 rounded-md border border-border bg-transparent px-2 py-0 text-xs" aria-label="Session"><!><!><!></select> <!> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground" title="Close panel" aria-label="Close panel"><!></button></header>`);function Lc(e,r){i(r,!0);let a=I(()=>{let e=Me.sessions.find(e=>e.sessionId===ze.sessionId);return e?`${e.title||e.sessionId} (${e.status})`:void 0});var o=Ic(),s=z(W(o),2),u=W(s),d=e=>{var t=Mc();t.value=t.__value=``,y(e,t)};h(u,e=>{ze.sessionId===null&&e(d)});var f=z(u),p=e=>{var t=Nc();t.value=t.__value=``,y(e,t)};h(f,e=>{Me.sessions.length===0&&ze.sessionId!==null&&e(p)});var m=z(f);t(m,17,()=>Me.sessions,e=>e.sessionId,(e,t)=>{var n=Pc(),r=M(n),i={};H(e=>{c(r,`${e??``}
3
+ ${E(t).status===`disposed`?`· ended`:`· ${E(t).status}`}`),i!==(i=E(t).sessionId)&&(n.value=(n.__value=i)??``)},[()=>E(t).title||E(t).sessionId.slice(0,14)]),y(e,n)}),n(s);var g;fe(s);var _=z(s,2),v=e=>{var t=Fc(),r=W(t);Hn(r,{class:`h-4 w-4`}),n(t),l(`click`,t,()=>qe()),y(e,t)};h(_,e=>{ze.sessionId&&e(v)});var b=z(_,2),S=W(b);Ln(S,{class:`h-4 w-4`}),n(b),n(o),H(()=>{B(s,`title`,E(a)),g!==(g=ze.sessionId??``)&&(s.value=(s.__value=g)??``,he(s,g))}),l(`change`,s,e=>Re(e.currentTarget.value)),l(`click`,b,()=>Xe(!1)),y(e,o),x()}T([`change`,`click`]);var Rc=new Set([`$$slots`,`$$events`,`$$legacy`]);function zc(e,t){let n=U(t,Rc),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];ye(e,K({name:`copy`},()=>n,{get iconNode(){return r}}))}var Bc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vc(e,t){let n=U(t,Bc),r=[[`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`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}]];ye(e,K({name:`file`},()=>n,{get iconNode(){return r}}))}var Hc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uc(e,t){let n=U(t,Hc),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}]];ye(e,K({name:`image`},()=>n,{get iconNode(){return r}}))}var Wc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gc(e,t){let n=U(t,Wc),r=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]];ye(e,K({name:`arrow-down`},()=>n,{get iconNode(){return r}}))}var Kc=r(`<div class="text-[11px] font-medium text-muted-foreground"> </div>`),qc=r(`<div class="whitespace-pre-wrap text-[11px] text-muted-foreground"> </div>`),Jc=r(`<span class="block text-[10px] text-muted-foreground"> </span>`),Yc=r(`<button> <!></button>`),Xc=r(`<div class="flex flex-wrap gap-1.5"></div>`),Zc=r(`<div class="mb-2 space-y-1.5"><!> <div class="whitespace-pre-wrap"> </div> <!> <!> <!></div>`),Qc=r(`<div class="flex justify-end"><!></div>`),$c=r(`<div class="rounded-lg border border-amber-500/40 bg-amber-500/5 px-3 py-2.5 text-xs" role="group"><div class="mb-2 flex items-center gap-1.5 font-medium text-amber-600 dark:text-amber-400"> </div> <!> <!></div>`);function el(e,r){i(r,!0);let a=J({}),o=J({});function s(e,t){let n=a[e.id]??[];e.multiSelect?a[e.id]=n.includes(t)?n.filter(e=>e!==t):[...n,t]:a[e.id]=n.includes(t)?[]:[t]}function u(){return r.questions.every(e=>(a[e.id]??[]).length>0||(o[e.id]??``).trim().length>0)}function d(){Ge(r.seq,r.questions.map(e=>({id:e.id,selected:a[e.id]??[],custom:(o[e.id]??``).trim()||void 0})))}var f=$c(),p=W(f),m=M(p,!0),g=z(p,2);t(g,17,()=>r.questions,e=>e.id,(e,i)=>{var u=Zc(),d=W(u),f=e=>{var t=Kc(),n=M(t,!0);H(()=>c(n,E(i).header)),y(e,t)};h(d,e=>{E(i).header&&e(f)});var p=z(d,2),m=M(p,!0),g=z(p,2),_=e=>{var t=qc(),n=M(t,!0);H(()=>c(n,E(i).detail)),y(e,t)};h(g,e=>{E(i).detail&&e(_)});var v=z(g,2),b=e=>{var o=Xc();t(o,21,()=>E(i).options,e=>e.label,(e,t)=>{var o=Yc(),u=W(o),d=z(u),f=e=>{var n=Jc(),r=M(n,!0);H(()=>c(r,E(t).description)),y(e,n)};h(d,e=>{E(t).description&&e(f)}),n(o),H((e,n)=>{Y(o,1,`rounded-md border px-2 py-1 transition-colors ${e??``}`),o.disabled=r.resolved,B(o,`aria-pressed`,n),c(u,`${E(t).label??``} `)},[()=>(a[E(i).id]??[]).includes(E(t).label)?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`,()=>(a[E(i).id]??[]).includes(E(t).label)]),l(`click`,o,()=>s(E(i),E(t).label)),y(e,o)}),n(o),y(e,o)};h(v,e=>{E(i).options&&E(i).options.length>0&&e(b)});var x=z(v,2);{let e=I(()=>o[E(i).id]??``);zn(x,{placeholder:`Custom answer (optional)`,get disabled(){return r.resolved},get value(){return E(e)},onchange:e=>o[E(i).id]=e.currentTarget.value,class:`h-7 text-xs`,get"aria-label"(){return`Custom answer for ${E(i).question??``}`}})}n(u),H(()=>c(m,E(i).question)),y(e,u)});var _=z(g,2),v=e=>{var t=Qc(),r=W(t);{let e=I(()=>!u());An(r,{size:`sm`,get disabled(){return E(e)},onclick:d,children:(e,t)=>{oe();var n=C(`Submit answer`);y(e,n)},$$slots:{default:!0}})}n(t),y(e,t)};h(_,e=>{r.resolved||e(v)}),n(f),H(()=>{B(f,`aria-label`,r.resolved?`Answered question`:`Pending question`),c(m,r.resolved?`Answered`:`Your decision`)}),y(e,f),x()}T([`click`]);var tl=new Set([`$$slots`,`$$events`,`$$legacy`]);function nl(e,t){let n=U(t,tl),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];ye(e,K({name:`terminal`},()=>n,{get iconNode(){return r}}))}var rl=new Set([`$$slots`,`$$events`,`$$legacy`]);function il(e,t){let n=U(t,rl),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];ye(e,K({name:`wrench`},()=>n,{get iconNode(){return r}}))}var al=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-destructive" title="Tool error" aria-label="Tool error"></span>`),ol=r(`<button type="button" class="disclosure-row"><span class="flex items-center justify-center text-muted-foreground" aria-hidden="true"><!></span> <span class="flex items-center gap-1 overflow-hidden"><span class="max-w-40 truncate text-left font-medium text-foreground"> </span> <!></span> <span class="text-center text-muted-foreground/70" aria-hidden="true">·</span> <span> </span> <!></button>`);function sl(e,t){i(t,!0);let r=k(t,`summary`,3,``),o=k(t,`open`,3,!1),s=k(t,`running`,3,!1),u=k(t,`error`,3,!1);var d=ol(),f=W(d),p=W(f);a(p,()=>t.icon,(e,t)=>{t(e,{class:`h-3.5 w-3.5`})}),n(f);var m=z(f,2),g=W(m),_=M(g,!0),v=z(g,2),b=e=>{var t=al();y(e,t)};h(v,e=>{u()&&e(b)}),n(m);var S=z(m,4),C=M(S,!0),w=z(S,2);qn(w,{class:`disclosure-chevron h-3.5 w-3.5 shrink-0 text-muted-foreground`}),n(d),H(()=>{B(d,`data-open`,o()),B(d,`aria-expanded`,o()),B(d,`title`,r().length>0?`${t.title} · ${r()}`:t.title),c(_,t.title),Y(S,1,`disclosure-summary ${s()?`sweep`:``}`),c(C,r())}),l(`click`,d,function(...e){t.onToggle?.apply(this,e)}),y(e,d),x()}T([`click`]);var cl=r(`<iframe sandbox="allow-scripts"></iframe>`),ll=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground"> </div>`),ul=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground" role="status">Loading card…</div>`),dl=r(`<div class="my-1 overflow-hidden rounded-lg border border-border"><!></div>`);function fl(e,t){i(t,!0);let r=V(null),a=V(!1),o=V(null),s=V(null);de(()=>{let e=t.resourceUri;F(r,null),F(a,!1),Tt().agent.card.get({uri:e}).then(e=>{if(e.html===null){F(a,!0);return}F(r,e.html,!0)}).catch(()=>{F(a,!0)})});function l(e){let t=e.data;if(typeof t==`object`&&t&&t.source===`skill-creator-card`&&E(s)!==null&&e.source===E(s).contentWindow){if(t.type===`ui/navigate`&&typeof t.intent==`string`&&t.intent.startsWith(`/`)&&!t.intent.startsWith(`//`)){ge(t.intent);return}if(t.type===`ui/resize`){let e=Number(t.height);Number.isFinite(e)&&e>0&&F(o,Math.min(400,Math.max(40,Math.ceil(e))),!0)}}}function u(e,t){return e.srcdoc=t,{update(t){e.srcdoc=t}}}var p=dl();f(`message`,A,l);var m=W(p),g=e=>{var n=cl();se(n,e=>F(s,e),()=>E(s)),pe(n,(e,t)=>u?.(e,t),()=>E(r)),H(()=>{B(n,`title`,t.title),Y(n,1,`w-full border-0 bg-transparent ${E(o)===null?`h-44`:``}`),j(n,E(o)===null?void 0:`height:${E(o)}px`)}),d(n),y(e,n)},_=e=>{var n=ll(),r=M(n);H(()=>c(r,`Card unavailable: ${t.title??``}`)),y(e,n)},v=e=>{var t=ul();y(e,t)};h(m,e=>{E(r)===null?E(a)?e(_,1):e(v,-1):e(g)}),n(p),H(()=>B(p,`data-card-uri`,t.resourceUri)),y(e,p),x()}var pl=r(`<div class="mt-2 flex justify-end gap-1.5"><!> <!></div>`),ml=r(`<div class="rounded-lg border border-amber-500/40 bg-amber-500/5 px-3 py-2.5 text-xs" role="group" aria-label="Mutation proposal"><div class="mb-1.5 flex items-center gap-1.5 font-medium text-amber-600 dark:text-amber-400"> </div> <div class="font-mono text-[11px]"> </div> <pre class="mt-1 max-h-32 overflow-auto rounded bg-muted/40 p-1.5 font-mono text-[10px] whitespace-pre-wrap"> </pre> <!></div>`);function hl(e,t){i(t,!0);let r=V(!1),a=V(null),o=I(()=>E(a)??t.status),s=I(()=>{try{return JSON.stringify(t.input,null,2)}catch{return String(t.input)}});async function l(e){F(r,!0);try{let n=Tt(),r=e===`approve`?await n.agent.proposals.approve({proposalId:t.proposalId}):await n.agent.proposals.reject({proposalId:t.proposalId});F(a,r.proposal.status,!0),Mn(e===`approve`?E(o)===`executed`?`Proposal executed: ${t.capability}`:`Proposal failed: ${t.capability}`:`Proposal rejected: ${t.capability}`)}catch(e){Mn(e instanceof Error?e.message:String(e))}finally{F(r,!1)}}var u=ml(),d=W(u),f=M(d),p=z(d,2),m=M(p,!0),g=z(p,2),_=M(g,!0),v=z(g,2),b=e=>{var t=pl(),i=W(t);An(i,{size:`sm`,variant:`outline`,get disabled(){return E(r)},onclick:()=>void l(`reject`),children:(e,t)=>{oe();var n=C(`Reject`);y(e,n)},$$slots:{default:!0}});var a=z(i,2);An(a,{size:`sm`,get disabled(){return E(r)},onclick:()=>void l(`approve`),children:(e,t)=>{oe();var n=C(`Approve`);y(e,n)},$$slots:{default:!0}}),n(t),y(e,t)};h(v,e=>{E(o)===`pending`&&e(b)}),n(u),H(()=>{c(f,`Proposal — ${E(o)??``}`),c(m,t.capability),c(_,E(s))}),y(e,u),x()}var gl=lt(dt(),st()),_l=bt([dt(),ut({content:ct(ut({text:dt().optional()}).loose()).optional()}).loose(),lt(dt(),st())]),vl=ut({kind:pt(`proposed`),proposalId:dt().min(1),capability:dt().optional(),status:dt().optional()}),yl=ut({uiCard:ut({resourceUri:dt().min(1),title:dt().optional()})}),bl=ut({content:ct(st()).optional()}),xl=ut({text:dt().optional()}),Sl=ut({status:dt().optional()}),Cl=ut({error:dt().min(1).optional()});function wl(e){if(e===void 0||e.length===0)return null;try{let t=JSON.parse(e),n=gl.safeParse(t);return n.success?n.data:null}catch{let t={};for(let n of[`command`,`description`,`file_path`,`path`,`pattern`,`url`,`query`]){let r=e.match(RegExp(`"${n}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"`))??e.match(RegExp(`"${n}"\\s*:\\s*"((?:[^"\\\\]|\\.)*)$`));r&&(t[n]=r[1])}return Object.keys(t).length>0?t:null}}function Tl(e){if(e===void 0)return``;let t=_l.safeParse(e);if(t.success){let e=t.data;if(typeof e==`string`)return e;if(Array.isArray(e.content)){let t=[];for(let n of e.content)typeof n.text==`string`&&t.push(n.text);if(t.length>0)return t.join(`
4
4
  `)}}try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function El(e,t){if(e===void 0)return null;let n=vl.safeParse(e);return n.success?{proposalId:n.data.proposalId,capability:n.data.capability??t,status:n.data.status??`pending`}:null}function Dl(e){if(e===void 0)return null;let t=[e],n=bl.safeParse(e);if(n.success&&n.data.content!==void 0)for(let e of n.data.content){let n=xl.safeParse(e);n.success&&typeof n.data.text==`string`&&t.push(n.data.text)}for(let e of t)if(typeof e==`string`)try{let t=JSON.parse(e),n=yl.safeParse(t);if(n.success)return{resourceUri:n.data.uiCard.resourceUri,title:n.data.uiCard.title??`Card`}}catch{}return null}function Ol(e){if(!Array.isArray(e))return null;let t=0;for(let n of e){let e=Sl.safeParse(n);e.success&&e.data.status===`completed`&&(t+=1)}let n=e.length;return`${n} todo${n===1?``:`s`} · ${t} done`}function kl(e,t){let n=Cl.safeParse(e);if(n.success&&n.data.error!==void 0)return(n.data.error.split(`
5
5
  `,1)[0]??``).trim();let r=(t.split(`
6
6
  `,1)[0]??``).trim();return r.length>80?`${r.slice(0,80)}…`:r}function Al(e){return/^\+(?![-+])/.test(e)?`bg-emerald-500/10`:/^-(?![-+])/.test(e)?`bg-rose-500/10`:``}var jl=r(`<div class="mt-1 rounded-lg bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive"> </div>`),Ml=r(`<span class="sweep px-1">running</span>`),Nl=r(`<div class="tool-card mt-1 overflow-hidden border-border bg-[#0c1016] text-zinc-200"><div class="flex items-center justify-between px-2 py-1 text-[10px] text-zinc-400"><span> </span> <!></div> <pre class="max-h-[260px] overflow-auto border-t border-white/10 px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),Pl=r(`<span> </span>`),Fl=r(`<div class="tool-card mt-1 overflow-hidden"><div class="truncate border-b border-border px-2 py-1 text-[10px] text-muted-foreground"> </div> <div class="max-h-[150px] overflow-auto px-2 py-1.5 whitespace-pre-wrap"></div></div>`),Il=r(`<div class="tool-card mt-1 overflow-hidden"><div class="border-b border-border px-2 py-1 text-[10px] text-muted-foreground"> </div> <pre class="max-h-[150px] overflow-auto px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),Ll=r(`<div class="tool-card max-h-[150px] overflow-auto"><div class="sticky top-0 bg-muted px-2 py-1 text-[10px] text-muted-foreground">Input</div> <pre class="px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),Rl=r(`<div class="tool-card max-h-[150px] overflow-auto"><div class="sticky top-0 bg-muted px-2 py-1 text-[10px] text-muted-foreground">Output</div> <pre class="px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),zl=r(`<div class="tool-card sweep px-2 py-1.5 text-muted-foreground">running…</div>`),Bl=r(`<div class="mt-1 space-y-1"><!> <!></div>`),Vl=r(`<!> <!>`,1),Hl=r(`<div class="flow-item"><!> <!> <!></div>`);function Ul(e,r){i(r,!0);let a=k(r,`running`,3,!1),o=V(!1),s=I(()=>r.toolName.replace(/^mcp__[^_]+__/,``)),l=I(()=>{let e=r.toolName.toLowerCase();return e.includes(`bash`)||e.includes(`shell`)||e.includes(`terminal`)?`bash`:/read|write|edit|file|glob|grep/.test(e)?`file`:e.includes(`image`)?`image`:`generic`}),u=I(()=>E(l)===`bash`?nl:E(l)===`file`?Rn:E(l)===`image`?Uc:il),d=I(()=>wl(r.argsText)),f=e=>typeof e==`string`?e:``;function p(e){return(e.split(`
7
7
  `,1)[0]??``).trim()}let m=I(()=>{let e=E(d);if(E(l)===`bash`){let t=f(e?.description);if(t.length>0)return t;let n=f(e?.command);return n.length>0?p(n):``}if(E(l)===`file`){let t=f(e?.file_path)||f(e?.path);if(t.length>0)return t}let t=Ol(e?.todos);if(t!==null)return t;if(e!==null){for(let t of Object.values(e))if(typeof t==`string`&&t.length>0)return t.length>64?`${t.slice(0,64)}…`:t;let t=(()=>{try{return JSON.stringify(e)}catch{return``}})();if(t.length>0)return t.length>64?`${t.slice(0,64)}…`:t}return``}),g=I(()=>Tl(r.result)),_=I(()=>r.phase===`error`?kl(r.result,E(g)):``),v=I(()=>El(r.result,r.toolName)),S=I(()=>Dl(r.result)),C=I(()=>{if(r.argsText===void 0||r.argsText.length===0)return``;try{let e=JSON.parse(r.argsText);return JSON.stringify(e,null,2)??r.argsText}catch{return r.argsText}}),w=I(()=>(E(g).length>0?E(g):E(C)).split(`
8
- `)),T=I(()=>{if(r.startedAt===void 0||r.endedAt===void 0)return``;let e=Date.parse(r.endedAt)-Date.parse(r.startedAt);return!Number.isFinite(e)||e<0?``:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}),D=I(()=>{let e=[E(s)];return E(T)&&e.push(E(T)),r.phase===`error`&&e.push(`error`),e.join(` · `)});var O=Hl(),A=W(O),j=e=>{hl(e,{get proposalId(){return E(v).proposalId},get capability(){return E(v).capability},get input(){return r.result},get status(){return E(v).status}})},ee=e=>{fl(e,{get resourceUri(){return E(S).resourceUri},get title(){return E(S).title}})};h(A,e=>{E(v)?e(j):E(S)&&e(ee,1)});var te=z(A,2);{let e=I(()=>a()&&r.phase===`calling`),t=I(()=>r.phase===`error`);sl(te,{get icon(){return E(u)},get title(){return E(s)},get summary(){return E(m)},get open(){return E(o)},get running(){return E(e)},get error(){return E(t)},onToggle:()=>F(o,!E(o))})}var N=z(te,2),P=e=>{var i=Vl(),o=q(i),s=e=>{var t=jl(),n=M(t,!0);H(()=>c(n,E(_))),y(e,t)};h(o,e=>{r.phase===`error`&&E(_).length>0&&e(s)});var u=z(o,2),p=e=>{let t=I(()=>f(E(d)?.command));var i=Nl(),o=W(i),s=W(o),l=M(s,!0),u=z(s,2),p=e=>{var t=Ml();y(e,t)};h(u,e=>{a()&&r.phase===`calling`&&e(p)}),n(o);var m=z(o,2),_=M(m,!0);n(i),H(()=>{c(l,E(D)),c(_,E(t).length>0?`$ ${E(t)}${E(g).length>0?`\n\n${E(g)}`:``}`:E(g))}),y(e,i)},m=e=>{var r=Fl(),i=W(r),a=M(i,!0),o=z(i,2);t(o,21,()=>E(w),ie,(e,t,n)=>{var r=Pl(),i=M(r);H(e=>{J(r,1,e),c(i,`${E(t)??``}${n<E(w).length-1?`
8
+ `)),T=I(()=>{if(r.startedAt===void 0||r.endedAt===void 0)return``;let e=Date.parse(r.endedAt)-Date.parse(r.startedAt);return!Number.isFinite(e)||e<0?``:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}),D=I(()=>{let e=[E(s)];return E(T)&&e.push(E(T)),r.phase===`error`&&e.push(`error`),e.join(` · `)});var O=Hl(),A=W(O),j=e=>{hl(e,{get proposalId(){return E(v).proposalId},get capability(){return E(v).capability},get input(){return r.result},get status(){return E(v).status}})},ee=e=>{fl(e,{get resourceUri(){return E(S).resourceUri},get title(){return E(S).title}})};h(A,e=>{E(v)?e(j):E(S)&&e(ee,1)});var te=z(A,2);{let e=I(()=>a()&&r.phase===`calling`),t=I(()=>r.phase===`error`);sl(te,{get icon(){return E(u)},get title(){return E(s)},get summary(){return E(m)},get open(){return E(o)},get running(){return E(e)},get error(){return E(t)},onToggle:()=>F(o,!E(o))})}var N=z(te,2),P=e=>{var i=Vl(),o=q(i),s=e=>{var t=jl(),n=M(t,!0);H(()=>c(n,E(_))),y(e,t)};h(o,e=>{r.phase===`error`&&E(_).length>0&&e(s)});var u=z(o,2),p=e=>{let t=I(()=>f(E(d)?.command));var i=Nl(),o=W(i),s=W(o),l=M(s,!0),u=z(s,2),p=e=>{var t=Ml();y(e,t)};h(u,e=>{a()&&r.phase===`calling`&&e(p)}),n(o);var m=z(o,2),_=M(m,!0);n(i),H(()=>{c(l,E(D)),c(_,E(t).length>0?`$ ${E(t)}${E(g).length>0?`\n\n${E(g)}`:``}`:E(g))}),y(e,i)},m=e=>{var r=Fl(),i=W(r),a=M(i,!0),o=z(i,2);t(o,21,()=>E(w),ie,(e,t,n)=>{var r=Pl(),i=M(r);H(e=>{Y(r,1,e),c(i,`${E(t)??``}${n<E(w).length-1?`
9
9
  `:``}`)},[()=>b(Al(E(t)))]),y(e,r)}),n(o),n(r),H(e=>c(a,e),[()=>f(E(d)?.file_path)||f(E(d)?.path)||E(D)]),y(e,r)},v=e=>{var t=Il(),r=W(t),i=M(r,!0),a=z(r,2),o=M(a,!0);n(t),H(()=>{c(i,E(D)),c(o,E(C)||E(g))}),y(e,t)},x=e=>{var t=Bl(),i=W(t),a=e=>{var t=Ll(),r=z(W(t),2),i=M(r,!0);n(t),H(()=>c(i,E(C))),y(e,t)};h(i,e=>{E(C).length>0&&e(a)});var o=z(i,2),s=e=>{var t=Rl(),r=z(W(t),2),i=M(r,!0);n(t),H(()=>c(i,E(g))),y(e,t)},l=e=>{var t=zl();y(e,t)};h(o,e=>{E(g).length>0?e(s):r.phase===`calling`&&e(l,1)}),n(t),y(e,t)};h(u,e=>{E(l)===`bash`?e(p):E(l)===`file`?e(m,1):E(l)===`image`?e(v,2):e(x,-1)}),y(e,i)};h(N,e=>{E(o)&&e(P)}),n(O),y(e,O),x()}function Wl(e){return Number.isFinite(e)?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function Gl(e){return!Number.isFinite(e)||e<0?``:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}var Kl=Object.create,ql=Object.defineProperty,Jl=Object.getOwnPropertyDescriptor,Yl=Object.getOwnPropertyNames,Xl=Object.getPrototypeOf,Zl=Object.prototype.hasOwnProperty,Ql=(e,t)=>function(){return t||(0,e[Yl(e)[0]])((t={exports:{}}).exports,t),t.exports},$l=e=>{let t={};for(var n in e)ql(t,n,{get:e[n],enumerable:!0});return t},eu=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Yl(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Zl.call(e,s)&&s!==n&&ql(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Jl(t,s))||r.enumerable});return e},tu=(e,t,n)=>(n=e==null?{}:Kl(Xl(e)),eu(t||!e||!e.__esModule?ql(n,`default`,{value:e,enumerable:!0}):n,e));function nu(e,t,n,r){let i=Number(e[t].meta.id+1).toString(),a=``;return typeof r.docId==`string`&&(a=`-${r.docId}-`),a+i}function ru(e,t){let n=Number(e[t].meta.id+1).toString();return e[t].meta.subId>0&&(n+=`:${e[t].meta.subId}`),`[${n}]`}function iu(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i),o=i.rules.footnote_caption(e,t,n,r,i),s=a;return e[t].meta.subId>0&&(s+=`:${e[t].meta.subId}`),`<sup class="footnote-ref"><a href="#fn${a}" id="fnref${s}">${o}</a></sup>`}function au(e,t,n){return(n.xhtmlOut?`<hr class="footnotes-sep" />
10
10
  `:`<hr class="footnotes-sep">
11
11
  `)+`<section class="footnotes">
@@ -171,13 +171,13 @@ import{$ as e,A as t,At as n,B as r,Ct as i,D as a,Dt as o,E as s,F as c,G as l,
171
171
  </div>
172
172
  <div class="code-editor"></div>
173
173
  </div>`};let c=/^\[(\d+)\]/,l=/^\[([^\]\n]+)\]/,u=e=>{if(!e.startsWith(`[`))return!1;let t=l.exec(e);if(!t)return e!==`[`&&!/^\[\d+$/.test(e);let n=String(t[1]??``);return!e.slice(t[0].length).startsWith(`(`)&&!/^\d+$/.test(n)};n.inline.ruler.before(`escape`,`reference`,(e,t)=>{let n=e;if(n.src[n.pos]!==`[`)return!1;let r=c.exec(n.src.slice(n.pos));if(!r)return!1;let i=n.src.slice(Math.max(0,n.pos-120),n.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(i))return!1;let a=n.src.slice(n.pos+r[0].length);if(a.startsWith(`](`)||a.startsWith(`(`)||u(a))return!1;if(!t){let e=r[1],t=n.push(`reference`,`span`,0);t.content=e,t.markup=r[0],t.raw=r[0]}return n.pos+=r[0].length,!0}),n.renderer.rules.reference=(e,t)=>{let n=String(e[t].content??``);return`<span class="reference-link" data-reference-id="${n}" role="button" tabindex="0" title="Click to view reference">${n}</span>`};let d=n.use.bind(n);return n.use=((...e)=>(r.__markstreamHasCustomParserExtensions=!0,d(...e))),n}var aA=/<\/?([A-Z][\w:-]*)(?:\s[^<>]*)?>/gi;function oA(e,t,n){let r=py(n),i=new Set(r);if(!t||i.size===0||!Array.isArray(e)||e.length===0)return Array.isArray(e)?e.slice():[];let a=sA(t,i);if(a.length===0)return e.slice();let o=0,s=e.map(e=>dA(e)),c=e=>{if(!e||typeof e!=`object`)return;let t=uA(e,i);if(t){let n=lA(a,t,()=>o,e=>o=e);n&&(e.tag=t,e.type=t,e.content=n.innerContent,e.raw=n.raw,typeof e.loading!=`boolean`&&(e.loading=n.loading))}for(let t of Object.values(e))if(Array.isArray(t))for(let e of t)e&&typeof e==`object`&&c(e)};for(let e of s)c(e);return s}function sA(e,t){let n=[],r=[],i;for(aA.lastIndex=0;(i=aA.exec(e))!==null;){let a=i[0],o=fy(i[1]);if(!o||!t.has(o))continue;if(!a.startsWith(`</`)){n.push({tag:o,start:i.index,openEnd:aA.lastIndex});continue}let s=cA(n,o);if(s<0)continue;let[c]=n.splice(s,1),l=i.index,u=aA.lastIndex;r.push({tag:o,start:c.start,end:u,innerContent:e.slice(c.openEnd,l),raw:e.slice(c.start,u),loading:!1})}for(let t of n)r.push({tag:t.tag,start:t.start,end:e.length,innerContent:e.slice(t.openEnd),raw:e.slice(t.start),loading:!0});return r.sort((e,t)=>e.start===t.start?t.end-e.end:e.start-t.start)}function cA(e,t){for(let n=e.length-1;n>=0;--n)if(e[n]?.tag===t)return n;return-1}function lA(e,t,n,r){let i=n();for(;i<e.length;){let n=e[i];if(i+=1,n.tag===t)return r(i),n}return r(i),null}function uA(e,t){let n=fy(e.tag);if(n&&t.has(n))return n;let r=fy(e.type);return r&&t.has(r)?r:``}function dA(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?e.map(e=>dA(e)):{...e};if(!Array.isArray(t))for(let[e,n]of Object.entries(t))Array.isArray(n)&&(t[e]=n.map(e=>dA(e)));return t}var fA=new Map,pA=new Set([`table`,`code_block`,`html_block`,`blockquote`,`list`,`list_item`,`definition_list`,`footnote`,`admonition`,`thematic_break`,`math_block`,`thinking`,`vmr_container`]);function mA(e,t={},n,r){let i=py([...e.customHtmlTags||[],...e.parseOptions?.customHtmlTags||[]]);return{customId:e.customId,isDark:e.isDark,indexKey:e.indexKey==null?void 0:String(e.indexKey),final:e.final,typewriter:e.typewriter,fade:e.fade,textStreamState:n,streamRenderVersion:r,showTooltips:e.showTooltips,codeBlockStream:e.codeBlockStream,renderCodeBlocksAsPre:e.renderCodeBlocksAsPre,allowHtml:e.allowHtml!==!1,htmlPolicy:e.htmlPolicy??`safe`,customHtmlTags:i,parseOptions:e.parseOptions,customMarkdownIt:e.customMarkdownIt,codeBlockOptions:e.codeBlockOptions,codeBlockProps:e.codeBlockProps,mermaidProps:e.mermaidProps,d2Props:e.d2Props,infographicProps:e.infographicProps,customComponents:e.customComponents,codeBlockThemes:{themes:e.themes,darkTheme:e.codeBlockDarkTheme,lightTheme:e.codeBlockLightTheme,minWidth:e.codeBlockMinWidth,maxWidth:e.codeBlockMaxWidth},events:t}}function hA(e){if(Array.isArray(e.nodes))return e.nodes;let t=_A(e.content);if(!t)return[];let n=py([...e.customHtmlTags||[],...e.parseOptions?.customHtmlTags||[]]),r=`${e.customId||`markstream-svelte`}::${n.join(`,`)}`,i=fA.get(r);i||(i=iA(r,{customHtmlTags:n}),fA.set(r,i));let a=e.customMarkdownIt?e.customMarkdownIt(i):i,o={...e.parseOptions??{}};return typeof e.final==`boolean`&&(o.final=e.final),n.length>0&&(o.customHtmlTags=n),oA(uk(t,a,o),t,n)}function gA(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function _A(e){return typeof e==`string`?e:e==null?``:String(e)}function vA(e){return _A(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function yA(e){return vA(e).replace(/`/g,`&#96;`)}function bA(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function xA(e){let t=Math.trunc(Number(e)||1);return Math.min(6,Math.max(1,t))}function SA(e){return String(String(e??``).split(/\s+/g)[0]??``).toLowerCase().replace(/[^\w-]/g,``)||`plaintext`}function CA(e){return SA(e?.language)}function wA(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`utf8`).toString(`base64`);if(typeof TextEncoder<`u`&&typeof globalThis.btoa==`function`){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return globalThis.btoa(n)}return``}function TA(e){let t=[],n=[],r=()=>{n.length&&=(t.push({kind:`inline`,nodes:n.slice()}),0)};for(let i of e)pA.has(String(i?.type||``))?(r(),t.push({kind:`block`,node:i})):n.push(i);return r(),t}function EA(e,t,n){return Ok(e,t,n)}function DA(e){let t=[],n=0;for(;n<e.length;){if(e.startsWith(`<!--`,n)){let t=e.indexOf(`-->`,n);if(t!==-1){n=t+3;continue}break}let r=e.indexOf(`<`,n);if(r===-1){n<e.length&&t.push({type:`text`,content:e.slice(n)});break}if(r>n&&t.push({type:`text`,content:e.slice(n,r)}),e.startsWith(`![CDATA[`,r+1)){let i=e.indexOf(`]]>`,r);if(i!==-1){t.push({type:`text`,content:e.slice(r,i+3)}),n=i+3;continue}break}if(e.startsWith(`!`,r+1)){let t=e.indexOf(`>`,r);if(t!==-1){n=t+1;continue}break}let i=e.indexOf(`>`,r);if(i===-1)break;let a=e.slice(r+1,i).trim();if(!a){n=i+1;continue}let o=a.startsWith(`/`),s=a.endsWith(`/`);if(o){let e=a.slice(1).trim();t.push({type:`tag_close`,tagName:e}),n=i+1;continue}let c=a.indexOf(` `),l=``,u=``;c===-1?l=s?a.slice(0,-1).trim():a.trim():(l=a.slice(0,c).trim(),u=a.slice(c+1));let d={};if(u){let e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g,t;for(;(t=e.exec(u))!==null;){let e=t[1],n=t[2]??t[3]??t[4]??``;e&&!e.endsWith(`/`)&&(d[e]=n)}}t.push({type:s||Pv.has(l.toLowerCase())?`self_closing`:`tag_open`,tagName:l,attrs:d}),n=i+1}return t}function OA(e){return String(e??``).trim().toLowerCase()}function kA(e){let t=Object.entries(e);return t.length===0?``:t.map(([e,t])=>t===``?` ${e}`:` ${e}="${yA(t)}"`).join(``)}function AA(e){let t=String(e.tagName??``).trim();if(!t)return``;if(e.type===`tag_close`)return`&lt;/${vA(t)}&gt;`;let n=Object.entries(e.attrs??{}).map(([e,t])=>t===``?` ${vA(e)}`:` ${vA(e)}="${yA(t)}"`).join(``);return e.type===`self_closing`?`&lt;${vA(t)}${n} /&gt;`:`&lt;${vA(t)}${n}&gt;`}function jA(e,t=`safe`){if(!e)return``;if(t===`escape`)return vA(e);let n=DA(e),r=[],i=[],a=0;for(let e of n){if(e.type===`text`){a===0&&i.push(vA(e.content??``));continue}let n=OA(e.tagName);if(!n)continue;if(zv.has(n)||Ck(n,t)){e.type===`tag_open`?a+=1:e.type===`tag_close`&&a>0&&--a;continue}if(a>0)continue;if(t===`safe`&&Sk(n,t)){i.push(AA(e));continue}if(e.type===`self_closing`){i.push(`<${n}${kA(EA(e.attrs??{},t,n))}>`);continue}if(e.type===`tag_open`){i.push(`<${n}${kA(EA(e.attrs??{},t,n))}>`),Pv.has(n)||r.push(n);continue}let o=r.lastIndexOf(n);if(o===-1)continue;for(;r.length>o+1;){let e=r.pop();e&&i.push(`</${e}>`)}let s=r.pop();s&&i.push(`</${s}>`)}for(;r.length>0;){let e=r.pop();e&&i.push(`</${e}>`)}return i.join(``)}var MA=`markstream-svelte-html`,NA=`div`,PA=new Map,FA=new Set(`admonition.blockquote.checkbox.checkbox_input.code_block.definition_item.definition_list.emoji.emphasis.footnote.footnote_reference.footnote_anchor.hardbreak.heading.highlight.html_block.html_inline.image.inline_code.insert.link.list.list_item.math_block.math_inline.paragraph.reference.strikethrough.strong.subscript.superscript.table.table_cell.table_row.text.thematic_break`.split(`.`));function IA(e,t={}){return zA(e,LA(t))}function LA(e){let t=py(e.customHtmlTags),n=`${e.cacheKey||MA}::${t.join(`,`)}`,r=PA.get(n);return r||(r=iA(n,{customHtmlTags:t}),PA.set(n,r)),{markdown:r,options:{allowHtml:e.allowHtml!==!1,htmlPolicy:e.htmlPolicy??`safe`,customNodeTag:fy(e.customNodeTag)||NA,customNodeClass:e.customNodeClass}}}function RA(e,t){return(Array.isArray(e)?e:[]).map(e=>zA(e,t)).join(``)}function zA(e,t){if(!e||typeof e!=`object`)return``;switch(e.type){case`text`:return BA(e);case`paragraph`:return`<p>${RA(dj(e.children),t)}</p>`;case`strong`:return`<strong>${RA(dj(e.children),t)}</strong>`;case`emphasis`:return`<em>${RA(dj(e.children),t)}</em>`;case`strikethrough`:return`<del>${RA(dj(e.children),t)}</del>`;case`highlight`:return`<mark>${RA(dj(e.children),t)}</mark>`;case`insert`:return`<ins>${RA(dj(e.children),t)}</ins>`;case`subscript`:return`<sub>${RA(dj(e.children),t)}</sub>`;case`superscript`:return`<sup>${RA(dj(e.children),t)}</sup>`;case`inline_code`:return`<code>${hj(fj(e.code))}</code>`;case`hardbreak`:return`<br>`;case`link`:return VA(e,t);case`image`:return WA(e);case`list`:return GA(e,t);case`list_item`:return`<li>${RA(dj(e.children),t)}</li>`;case`blockquote`:return`<blockquote>${RA(dj(e.children),t)}</blockquote>`;case`heading`:return KA(e,t);case`code_block`:return qA(e);case`thematic_break`:return`<hr>`;case`table`:return JA(e,t);case`table_row`:return YA(e,t);case`table_cell`:return XA(e,t);case`definition_list`:return ZA(e,t);case`definition_item`:return QA(e,t);case`footnote`:return $A(e,t);case`footnote_reference`:return ej(e);case`footnote_anchor`:return tj(e);case`admonition`:return nj(e,t);case`checkbox`:case`checkbox_input`:return`<input type="checkbox" disabled${e.checked?` checked`:``}>`;case`emoji`:return hj(fj(e.raw||e.markup||e.content||e.name));case`math_inline`:return HA(e);case`math_block`:return UA(e);case`reference`:return`<span class="markstream-nested-reference">${hj(fj(e.id))}</span>`;case`html_inline`:case`html_block`:return rj(e,t);default:return ij(e,t)}}function BA(e){let t=fj(e.content),n=hj(t),r=!!e.center;return!r&&!t.includes(`
174
- `)?n:`<span class="${r?`markstream-svelte-text-node markstream-svelte-text--centered`:`markstream-svelte-text-node`}">${n}</span>`}function VA(e,t){let n=fj(e.href),r=fj(e.title),i=dj(e.children).length>0?RA(dj(e.children),t):hj(fj(e.text||n)),a=r?` title="${gj(r)}"`:``,o=n&&!$v(n)?n:``;return`<a${o?` href="${gj(o)}"`:``}${a}${ey(o)?` target="_blank" rel="noreferrer noopener"`:``}>${i}</a>`}function HA(e){return`<span class="markstream-nested-math" data-display="inline"><span class="markstream-nested-math__source">${hj(fj(e.content||e.markup||e.raw))}</span><span class="markstream-nested-math__render" aria-hidden="true"></span></span>`}function UA(e){return`<div class="markstream-nested-math-block"><pre class="markstream-nested-math-block__source"><code>${hj(fj(e.content||e.markup||e.raw))}</code></pre><div class="markstream-nested-math-block__render" aria-hidden="true"></div></div>`}function WA(e){let t=ny(e.src);if(!t)return``;let n=fj(e.alt),r=fj(e.title),i=r?` title="${gj(r)}"`:``;return`<img src="${gj(t)}" alt="${gj(n)}"${i}>`}function GA(e,t){let n=e.ordered?`ol`:`ul`;return`<${n}${e.ordered&&Number.isFinite(e.start)?` start="${Number(e.start)}"`:``}>${RA(dj(e.items),t)}</${n}>`}function KA(e,t){let n=mj(e.level);return`<h${n}>${RA(dj(e.children),t)}</h${n}>`}function qA(e){let t=fj(e.language).trim(),n=pj(t),r=n?` class="language-${n}"`:``,i=!!e.diff,a=fj(e.code),o=e.loading===!0;return o&&!a.trim()?``:`<pre ${[`data-markstream-code-block="1"`,t?`data-markstream-language="${gj(t)}"`:``,o?`data-markstream-loading="1"`:``,i?`data-markstream-diff="1"`:``,i?`data-markstream-original="${gj(vj(fj(e.originalCode)))}"`:``,i?`data-markstream-updated="${gj(vj(fj(e.updatedCode)))}"`:``,o?`aria-busy="true"`:``].filter(Boolean).join(` `)}><code${r}>${hj(a)}</code></pre>`}function JA(e,t){let n=e.header?YA(e.header,t,!0):``,r=RA(dj(e.rows),t);return`<table>${n?`<thead>${n}</thead>`:``}${r?`<tbody>${r}</tbody>`:``}</table>`}function YA(e,t,n=!1){return`<tr>${dj(e.cells).map(e=>XA(e,t,n)).join(``)}</tr>`}function XA(e,t,n=!1){let r=n||e.header?`th`:`td`,i=fj(e.align);return`<${r}${i?` style="text-align:${gj(i)}"`:``}>${RA(dj(e.children),t)}</${r}>`}function ZA(e,t){return`<dl>${dj(e.items).map(e=>QA(e,t)).join(``)}</dl>`}function QA(e,t){return`<dt>${RA(dj(e.term),t)}</dt><dd>${RA(dj(e.definition),t)}</dd>`}function $A(e,t){let n=gj(fj(e.id));return`<div${n?` id="fnref--${n}"`:``} class="footnote-node markstream-nested-footnote"><div class="footnote-node__content">${RA(dj(e.children),t)}</div></div>`}function ej(e){let t=fj(e.id),n=hj(t),r=gj(t);return`<sup${r?` id="fnref-${r}"`:``} class="footnote-reference markstream-nested-footnote-ref"><span${r?` href="#fnref--${r}"`:``}${r?` title="查看脚注 ${r}"`:``} class="footnote-link cursor-pointer">[${n}]</span></sup>`}function tj(e){let t=gj(fj(e.id));return`<a class="footnote-anchor"${t?` href="#fnref-${t}"`:``}${t?` title="返回引用 ${t}"`:``} aria-label="${t?`返回引用 ${t}`:`返回引用`}">↩︎</a>`}function nj(e,t){let n=pj(fj(e.kind||`note`))||`note`;return`<div class="markstream-nested-admonition markstream-nested-admonition--${n}"><div class="markstream-nested-admonition__title">${hj(fj(e.title)||_j(n))}</div><div class="markstream-nested-admonition__content">${RA(dj(e.children),t)}</div></div>`}function rj(e,t){let n=fj(e.content)||fj(e.raw),r=fj(e.tag).trim().toLowerCase(),i=dj(e.children);return!t.options.allowHtml||t.options.htmlPolicy===`escape`||e.loading&&!e.autoClosed?hj(n):r&&i.length>0&&!Bv.has(r)&&!Sk(r,t.options.htmlPolicy)?`<${r}${lj(e.attrs,``,t.options.htmlPolicy,r)}>${RA(i,t)}</${r}>`:jA(n,t.options.htmlPolicy)}function ij(e,t){let n=fj(e.tag||e.type);if(!n||FA.has(n))return hj(fj(e.content||e.raw));let r=[`markstream-nested-custom`,`markstream-nested-custom--${pj(n)||`node`}`,sj(e,t.options.customNodeClass)].filter(Boolean).join(` `),i=lj(e.attrs,r,t.options.htmlPolicy),a=aj(e,t),o=t.options.customNodeTag;return`<${o}${i} data-markstream-custom-tag="${gj(n)}">${a}</${o}>`}function aj(e,t){let n=dj(e.children);if(n.length>0)return RA(n,t);let r=fj(e.content);return r?oj(r,t):hj(fj(e.raw))}function oj(e,t){return e?t.markdown.render(e):``}function sj(e,t){return t?cj(typeof t==`function`?t(e):t):``}function cj(e){return Array.isArray(e)?e.map(e=>cj(e)).filter(Boolean).join(` `):typeof e==`string`?e.trim():``}function lj(e,t=``,n=`safe`,r){let i=uj(e),a={},o=[t];for(let[e,t]of i){let n=String(e).trim();if(n){if(n.toLowerCase()===`class`){o.push(String(t));continue}a[n]=t===!0?``:String(t)}}let s=Object.entries(Ok(a,n,r)).map(([e,t])=>t===``?` ${e}`:` ${e}="${gj(String(t))}"`),c=o.map(e=>e.trim()).filter(Boolean).join(` `);return c&&s.unshift(` class="${gj(c)}"`),s.join(``)}function uj(e){if(!e)return[];if(Array.isArray(e)){if(e.length===0)return[];let t=e[0];return Array.isArray(t)?e.map(([e,t])=>[String(e),t]):e.map(e=>[String(e.name),e.value])}return Object.entries(e).map(([e,t])=>[e,t])}function dj(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function fj(e){return typeof e==`string`?e:e==null?``:String(e)}function pj(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function mj(e){let t=Math.trunc(Number(e)||1);return Math.min(6,Math.max(1,t))}function hj(e){return fj(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function gj(e){return hj(e).replace(/`/g,`&#96;`)}function _j(e){return e?`${e[0].toUpperCase()}${e.slice(1)}`:``}function vj(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`utf8`).toString(`base64`);if(typeof TextEncoder<`u`&&typeof globalThis.btoa==`function`){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return globalThis.btoa(n)}return``}function yj(e,t){return IA(e,{cacheKey:t?.customId?`markstream-svelte-${t.customId}`:`markstream-svelte-node`,customHtmlTags:t?.customHtmlTags,allowHtml:t?.allowHtml!==!1,htmlPolicy:t?.htmlPolicy??`safe`})}function bj(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=Y(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var xj=`__global__`,Sj=`__MARKSTREAM_SVELTE_CUSTOM_COMPONENTS_STORE__`,Cj=(()=>{let e=globalThis;if(e[Sj])return e[Sj];let t={scopedComponents:{},revision:0,listeners:new Set};return e[Sj]=t,t})();function wj(e){return Cj.listeners.add(e),()=>{Cj.listeners.delete(e)}}function Tj(e){let t=Cj.scopedComponents[xj]||{};if(!e)return t;let n=Cj.scopedComponents[e]||{};return!t||Object.keys(t).length===0?n:!n||Object.keys(n).length===0?t:{...t,...n}}var Ej=r(`<input class="checkbox-node" type="checkbox" disabled=""/>`);function Dj(e,t){i(t,!0);var n=Ej();le(n),H(e=>L(n,e),[()=>!!t.node?.checked]),y(e,n),x()}function Oj(e){return(e.split(`.`).pop()||e).replace(/[_-]/g,` `).replace(/([A-Z])/g,` $1`).replace(/\s+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}var kj={"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease`,"common.reset":`Reset`,"common.increase":`Increase`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.close":`Close`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"artifacts.htmlPreviewTitle":`HTML Preview`,"artifacts.svgPreviewTitle":`SVG Preview`,"image.preview":`Preview image`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`};function Aj(){return{t(e){return kj[e]??Oj(e)}}}var jj=null,Mj=!1,Nj=null,Pj=!1;function Fj(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}async function Ij(e){Pj||(Pj=!0,typeof e?.preloadStreamDiffs==`function`&&await e.preloadStreamDiffs())}async function Lj(){if(jj)return jj;if(Nj)return await Nj;if(Mj)return null;Nj=(async()=>{try{let e=Fj(await ve(()=>import(`../chunks/BEsyQXpe.js`),[],import.meta.url));return e?(jj=e,await Ij(jj),jj):null}catch{return Mj=!0,null}})();try{return await Nj}finally{Nj=null}}var Rj=null,zj=null,Bj=null,Vj=null,Hj=null,Uj=null;function Wj(){Vj&&=(clearTimeout(Vj),null),Hj&&=(clearTimeout(Hj),null)}function Gj(){return Rj||typeof document>`u`?Rj:(Rj=document.createElement(`div`),Rj.className=`ms-tooltip`,Rj.setAttribute(`role`,`tooltip`),Rj.dataset.visible=`false`,Rj.style.position=`fixed`,Rj.style.left=`0px`,Rj.style.top=`0px`,Rj.style.transform=`translate3d(0,0,0)`,document.body.appendChild(Rj),Rj)}function Kj(e){if(typeof e==`boolean`)return e;if(typeof document<`u`)try{if(document.documentElement.classList.contains(`dark`))return!0}catch{}if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{}return!1}async function qj(e){if(!Rj||!zj)return;let{x:t,y:n}=await ta(zj,Rj,{placement:e,middleware:[Ji(8),Xi(),Yi({padding:8})],strategy:`fixed`});Rj.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Jj(e,t,n=`top`,r=!1,i,a){if(!e||typeof document>`u`||(Gj(),!Rj))return;Wj();let o=async()=>{if(Rj){zj=e,Rj.textContent=t,Rj.dataset.placement=n,Rj.dataset.dark=Kj(a)?`true`:`false`,Rj.dataset.visible=`false`,Uj=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Rj.id=Uj;try{e.setAttribute(`aria-describedby`,Uj)}catch{}await qj(n),Rj.dataset.visible=`true`,Bj?.(),Bj=qi(e,Rj,()=>{qj(n)})}};r?o():Vj=setTimeout(o,80)}function $(e=!1){if(!Rj)return;Wj();let t=()=>{if(Rj){if(Rj.dataset.visible=`false`,zj&&Uj)try{zj.removeAttribute(`aria-describedby`)}catch{}zj=null,Uj=null,Bj&&=(Bj(),null)}};e?t():Hj=setTimeout(t,120)}var Yj=`
174
+ `)?n:`<span class="${r?`markstream-svelte-text-node markstream-svelte-text--centered`:`markstream-svelte-text-node`}">${n}</span>`}function VA(e,t){let n=fj(e.href),r=fj(e.title),i=dj(e.children).length>0?RA(dj(e.children),t):hj(fj(e.text||n)),a=r?` title="${gj(r)}"`:``,o=n&&!$v(n)?n:``;return`<a${o?` href="${gj(o)}"`:``}${a}${ey(o)?` target="_blank" rel="noreferrer noopener"`:``}>${i}</a>`}function HA(e){return`<span class="markstream-nested-math" data-display="inline"><span class="markstream-nested-math__source">${hj(fj(e.content||e.markup||e.raw))}</span><span class="markstream-nested-math__render" aria-hidden="true"></span></span>`}function UA(e){return`<div class="markstream-nested-math-block"><pre class="markstream-nested-math-block__source"><code>${hj(fj(e.content||e.markup||e.raw))}</code></pre><div class="markstream-nested-math-block__render" aria-hidden="true"></div></div>`}function WA(e){let t=ny(e.src);if(!t)return``;let n=fj(e.alt),r=fj(e.title),i=r?` title="${gj(r)}"`:``;return`<img src="${gj(t)}" alt="${gj(n)}"${i}>`}function GA(e,t){let n=e.ordered?`ol`:`ul`;return`<${n}${e.ordered&&Number.isFinite(e.start)?` start="${Number(e.start)}"`:``}>${RA(dj(e.items),t)}</${n}>`}function KA(e,t){let n=mj(e.level);return`<h${n}>${RA(dj(e.children),t)}</h${n}>`}function qA(e){let t=fj(e.language).trim(),n=pj(t),r=n?` class="language-${n}"`:``,i=!!e.diff,a=fj(e.code),o=e.loading===!0;return o&&!a.trim()?``:`<pre ${[`data-markstream-code-block="1"`,t?`data-markstream-language="${gj(t)}"`:``,o?`data-markstream-loading="1"`:``,i?`data-markstream-diff="1"`:``,i?`data-markstream-original="${gj(vj(fj(e.originalCode)))}"`:``,i?`data-markstream-updated="${gj(vj(fj(e.updatedCode)))}"`:``,o?`aria-busy="true"`:``].filter(Boolean).join(` `)}><code${r}>${hj(a)}</code></pre>`}function JA(e,t){let n=e.header?YA(e.header,t,!0):``,r=RA(dj(e.rows),t);return`<table>${n?`<thead>${n}</thead>`:``}${r?`<tbody>${r}</tbody>`:``}</table>`}function YA(e,t,n=!1){return`<tr>${dj(e.cells).map(e=>XA(e,t,n)).join(``)}</tr>`}function XA(e,t,n=!1){let r=n||e.header?`th`:`td`,i=fj(e.align);return`<${r}${i?` style="text-align:${gj(i)}"`:``}>${RA(dj(e.children),t)}</${r}>`}function ZA(e,t){return`<dl>${dj(e.items).map(e=>QA(e,t)).join(``)}</dl>`}function QA(e,t){return`<dt>${RA(dj(e.term),t)}</dt><dd>${RA(dj(e.definition),t)}</dd>`}function $A(e,t){let n=gj(fj(e.id));return`<div${n?` id="fnref--${n}"`:``} class="footnote-node markstream-nested-footnote"><div class="footnote-node__content">${RA(dj(e.children),t)}</div></div>`}function ej(e){let t=fj(e.id),n=hj(t),r=gj(t);return`<sup${r?` id="fnref-${r}"`:``} class="footnote-reference markstream-nested-footnote-ref"><span${r?` href="#fnref--${r}"`:``}${r?` title="查看脚注 ${r}"`:``} class="footnote-link cursor-pointer">[${n}]</span></sup>`}function tj(e){let t=gj(fj(e.id));return`<a class="footnote-anchor"${t?` href="#fnref-${t}"`:``}${t?` title="返回引用 ${t}"`:``} aria-label="${t?`返回引用 ${t}`:`返回引用`}">↩︎</a>`}function nj(e,t){let n=pj(fj(e.kind||`note`))||`note`;return`<div class="markstream-nested-admonition markstream-nested-admonition--${n}"><div class="markstream-nested-admonition__title">${hj(fj(e.title)||_j(n))}</div><div class="markstream-nested-admonition__content">${RA(dj(e.children),t)}</div></div>`}function rj(e,t){let n=fj(e.content)||fj(e.raw),r=fj(e.tag).trim().toLowerCase(),i=dj(e.children);return!t.options.allowHtml||t.options.htmlPolicy===`escape`||e.loading&&!e.autoClosed?hj(n):r&&i.length>0&&!Bv.has(r)&&!Sk(r,t.options.htmlPolicy)?`<${r}${lj(e.attrs,``,t.options.htmlPolicy,r)}>${RA(i,t)}</${r}>`:jA(n,t.options.htmlPolicy)}function ij(e,t){let n=fj(e.tag||e.type);if(!n||FA.has(n))return hj(fj(e.content||e.raw));let r=[`markstream-nested-custom`,`markstream-nested-custom--${pj(n)||`node`}`,sj(e,t.options.customNodeClass)].filter(Boolean).join(` `),i=lj(e.attrs,r,t.options.htmlPolicy),a=aj(e,t),o=t.options.customNodeTag;return`<${o}${i} data-markstream-custom-tag="${gj(n)}">${a}</${o}>`}function aj(e,t){let n=dj(e.children);if(n.length>0)return RA(n,t);let r=fj(e.content);return r?oj(r,t):hj(fj(e.raw))}function oj(e,t){return e?t.markdown.render(e):``}function sj(e,t){return t?cj(typeof t==`function`?t(e):t):``}function cj(e){return Array.isArray(e)?e.map(e=>cj(e)).filter(Boolean).join(` `):typeof e==`string`?e.trim():``}function lj(e,t=``,n=`safe`,r){let i=uj(e),a={},o=[t];for(let[e,t]of i){let n=String(e).trim();if(n){if(n.toLowerCase()===`class`){o.push(String(t));continue}a[n]=t===!0?``:String(t)}}let s=Object.entries(Ok(a,n,r)).map(([e,t])=>t===``?` ${e}`:` ${e}="${gj(String(t))}"`),c=o.map(e=>e.trim()).filter(Boolean).join(` `);return c&&s.unshift(` class="${gj(c)}"`),s.join(``)}function uj(e){if(!e)return[];if(Array.isArray(e)){if(e.length===0)return[];let t=e[0];return Array.isArray(t)?e.map(([e,t])=>[String(e),t]):e.map(e=>[String(e.name),e.value])}return Object.entries(e).map(([e,t])=>[e,t])}function dj(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function fj(e){return typeof e==`string`?e:e==null?``:String(e)}function pj(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function mj(e){let t=Math.trunc(Number(e)||1);return Math.min(6,Math.max(1,t))}function hj(e){return fj(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function gj(e){return hj(e).replace(/`/g,`&#96;`)}function _j(e){return e?`${e[0].toUpperCase()}${e.slice(1)}`:``}function vj(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`utf8`).toString(`base64`);if(typeof TextEncoder<`u`&&typeof globalThis.btoa==`function`){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return globalThis.btoa(n)}return``}function yj(e,t){return IA(e,{cacheKey:t?.customId?`markstream-svelte-${t.customId}`:`markstream-svelte-node`,customHtmlTags:t?.customHtmlTags,allowHtml:t?.allowHtml!==!1,htmlPolicy:t?.htmlPolicy??`safe`})}function bj(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var xj=`__global__`,Sj=`__MARKSTREAM_SVELTE_CUSTOM_COMPONENTS_STORE__`,Cj=(()=>{let e=globalThis;if(e[Sj])return e[Sj];let t={scopedComponents:{},revision:0,listeners:new Set};return e[Sj]=t,t})();function wj(e){return Cj.listeners.add(e),()=>{Cj.listeners.delete(e)}}function Tj(e){let t=Cj.scopedComponents[xj]||{};if(!e)return t;let n=Cj.scopedComponents[e]||{};return!t||Object.keys(t).length===0?n:!n||Object.keys(n).length===0?t:{...t,...n}}var Ej=r(`<input class="checkbox-node" type="checkbox" disabled=""/>`);function Dj(e,t){i(t,!0);var n=Ej();le(n),H(e=>L(n,e),[()=>!!t.node?.checked]),y(e,n),x()}function Oj(e){return(e.split(`.`).pop()||e).replace(/[_-]/g,` `).replace(/([A-Z])/g,` $1`).replace(/\s+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}var kj={"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease`,"common.reset":`Reset`,"common.increase":`Increase`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.close":`Close`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"artifacts.htmlPreviewTitle":`HTML Preview`,"artifacts.svgPreviewTitle":`SVG Preview`,"image.preview":`Preview image`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`};function Aj(){return{t(e){return kj[e]??Oj(e)}}}var jj=null,Mj=!1,Nj=null,Pj=!1;function Fj(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}async function Ij(e){Pj||(Pj=!0,typeof e?.preloadStreamDiffs==`function`&&await e.preloadStreamDiffs())}async function Lj(){if(jj)return jj;if(Nj)return await Nj;if(Mj)return null;Nj=(async()=>{try{let e=Fj(await _e(()=>import(`../chunks/BEsyQXpe.js`),[],import.meta.url));return e?(jj=e,await Ij(jj),jj):null}catch{return Mj=!0,null}})();try{return await Nj}finally{Nj=null}}var Rj=null,zj=null,Bj=null,Vj=null,Hj=null,Uj=null;function Wj(){Vj&&=(clearTimeout(Vj),null),Hj&&=(clearTimeout(Hj),null)}function Gj(){return Rj||typeof document>`u`?Rj:(Rj=document.createElement(`div`),Rj.className=`ms-tooltip`,Rj.setAttribute(`role`,`tooltip`),Rj.dataset.visible=`false`,Rj.style.position=`fixed`,Rj.style.left=`0px`,Rj.style.top=`0px`,Rj.style.transform=`translate3d(0,0,0)`,document.body.appendChild(Rj),Rj)}function Kj(e){if(typeof e==`boolean`)return e;if(typeof document<`u`)try{if(document.documentElement.classList.contains(`dark`))return!0}catch{}if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{}return!1}async function qj(e){if(!Rj||!zj)return;let{x:t,y:n}=await ta(zj,Rj,{placement:e,middleware:[Ji(8),Xi(),Yi({padding:8})],strategy:`fixed`});Rj.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Jj(e,t,n=`top`,r=!1,i,a){if(!e||typeof document>`u`||(Gj(),!Rj))return;Wj();let o=async()=>{if(Rj){zj=e,Rj.textContent=t,Rj.dataset.placement=n,Rj.dataset.dark=Kj(a)?`true`:`false`,Rj.dataset.visible=`false`,Uj=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Rj.id=Uj;try{e.setAttribute(`aria-describedby`,Uj)}catch{}await qj(n),Rj.dataset.visible=`true`,Bj?.(),Bj=qi(e,Rj,()=>{qj(n)})}};r?o():Vj=setTimeout(o,80)}function Yj(e=!1){if(!Rj)return;Wj();let t=()=>{if(Rj){if(Rj.dataset.visible=`false`,zj&&Uj)try{zj.removeAttribute(`aria-describedby`)}catch{}zj=null,Uj=null,Bj&&=(Bj(),null)}};e?t():Hj=setTimeout(t,120)}var Xj=`
175
175
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
176
176
  <path d="M14 3h5a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5" />
177
177
  <path d="M8 11l-3 3l3 3" />
178
178
  <path d="M16 11l3 3l-3 3" />
179
179
  <path d="M13 9l-2 10" />
180
- </svg>`,Xj=`
180
+ </svg>`,Zj=`
181
181
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
182
182
  <rect x="3" y="4" width="7" height="5" rx="1.5" />
183
183
  <rect x="14" y="4" width="7" height="5" rx="1.5" />
@@ -186,46 +186,46 @@ import{$ as e,A as t,At as n,B as r,Ct as i,D as a,Dt as o,E as s,F as c,G as l,
186
186
  <path d="M12 9v2.5" />
187
187
  <path d="M12 11.5l-3.5 3.5" />
188
188
  <path d="M12 11.5l3.5 3.5" />
189
- </svg>`,Zj=`
189
+ </svg>`,Qj=`
190
190
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
191
191
  <path d="M8 7l-4 5l4 5" />
192
192
  <path d="M16 7l4 5l-4 5" />
193
193
  <path d="M14 4l-4 16" />
194
- </svg>`,Qj=`
194
+ </svg>`,$j=`
195
195
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
196
196
  <rect x="3" y="4" width="18" height="16" rx="2" />
197
197
  <path d="M7 15V9l3 3l3-3v6" />
198
198
  <path d="M16 9v6" />
199
199
  <path d="M14 13l2 2l2-2" />
200
- </svg>`,$j=`
200
+ </svg>`,eM=`
201
201
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
202
202
  <path d="M9 4c-2 0-3 1.5-3 3.5v2c0 1.1-.4 1.8-1.5 2.5C5.6 12.7 6 13.4 6 14.5v2C6 18.5 7 20 9 20" />
203
203
  <path d="M15 4c2 0 3 1.5 3 3.5v2c0 1.1.4 1.8 1.5 2.5c-1.1.7-1.5 1.4-1.5 2.5v2c0 2-1 3.5-3 3.5" />
204
- </svg>`,eM=`
204
+ </svg>`,tM=`
205
205
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
206
206
  <path d="M5 6h14" />
207
207
  <path d="M12 6v12" />
208
208
  <path d="M8 18h8" />
209
- </svg>`,tM={"":``,cjs:`javascript`,"c++":`cpp`,"c#":`csharp`,d2lang:`d2`,golang:`go`,js:`javascript`,jsx:`jsx`,kt:`kotlin`,md:`markdown`,mjs:`javascript`,"objective-c":`objectivec`,"objective-c++":`objectivecpp`,plaintext:`plain`,rb:`ruby`,rs:`rust`,py:`python`,bash:`shell`,bat:`shell`,batch:`shell`,ps1:`powershell`,sh:`shell`,shellscript:`shell`,text:`plain`,ts:`typescript`,tsx:`tsx`,yml:`yaml`,zsh:`shell`},nM={"":`Text`,css:`CSS`,c:`C`,cpp:`C++`,csharp:`C#`,d2:`D2`,go:`Go`,html:`HTML`,java:`Java`,javascript:`JavaScript`,json:`JSON`,jsx:`JSX`,markdown:`Markdown`,mermaid:`Mermaid`,php:`PHP`,plain:`Text`,plaintext:`Text`,python:`Python`,ruby:`Ruby`,rust:`Rust`,shell:`Shell`,sql:`SQL`,svg:`SVG`,tsx:`TSX`,typescript:`TypeScript`,vue:`Vue`,yaml:`YAML`},rM={"":eM,html:Zj,javascript:Yj,json:$j,jsx:Yj,markdown:Qj,mermaid:Xj,plain:eM,python:Yj,shell:Yj,svg:Zj,tsx:Yj,typescript:Yj},iM=Array.from(new Set([...Object.keys(tM),...Object.keys(nM),...Object.keys(rM),`bash`,`c`,`cpp`,`csharp`,`diff`,`go`,`java`,`php`,`ruby`,`rust`,`sql`,`yaml`,`zsh`]));function aM(e){if(!e)return``;let t=e.trim();if(!t)return``;let[n]=t.split(/\s+/),[r]=n.split(`:`);return r.toLowerCase()}function oM(e){let t=aM(e);return tM[t]??t}function sM(e){let t=oM(e);return!t||t===`plain`?`plaintext`:t===`shell`?`zsh`:t===`objectivec`?`objective-c`:t===`objectivecpp`?`objective-cpp`:t}function cM(e){let t=aM(e);return!t||iM.includes(t)?!1:iM.some(e=>e.startsWith(t))}function lM(e){return rM[oM(e)]||Yj}var uM=nM,dM=r(`<div><div class="html-preview-frame__header"><span> </span><button type="button">Close</button></div> <iframe class="html-preview-frame__iframe"></iframe></div>`);function fM(e,t){i(t,!0);let r=k(t,`code`,3,``),a=k(t,`title`,3,`Preview`),o=k(t,`isDark`,3,!1),s=k(t,`htmlPreviewAllowScripts`,3,!1),u=I(()=>t.htmlPreviewSandbox??(s()?`allow-scripts`:``));var d=dM();let f;var p=W(d),m=W(p),h=M(m,!0),g=z(m);n(p);var _=z(p,2);n(d),H(()=>{f=J(d,1,`html-preview-frame`,null,f,{"is-dark":o()}),c(h,a()),B(_,`title`,a()),B(_,`srcdoc`,r()),B(_,`sandbox`,E(u))}),l(`click`,g,()=>t.onClose?.()),y(e,d),x()}T([`click`]);var pM=r(`<span class="markstream-pre__line-numbers" aria-hidden="true"><span class="markstream-pre__line-numbers-text"> </span></span>`),mM=r(`<pre data-markstream-pre="1"><!><code class="markstream-pre__code" translate="no"> </code></pre>`);function hM(e,t){i(t,!0);let r=k(t,`showLineNumbers`,3,!1),a=k(t,`enhanceable`,3,!0),o=k(t,`class`,3,void 0),s=k(t,`style`,3,void 0),l=I(()=>_A(t.node?.language).trim()),u=I(()=>bA(E(l))),d=I(()=>_A(t.node?.code)),f=I(()=>!!t.node?.diff),p=I(()=>t.node?.loading===!0),m=I(()=>E(p)?E(d):E(d).replace(/\r\n$|\n$|\r$/,``)),g=I(()=>r()===!0&&!E(f)),_=I(()=>w(E(m))),v=I(()=>T(E(_))),S=I(()=>E(g)?`--markstream-pre-line-number-width: ${Math.max(2,String(E(_)).length)}ch; --markstream-pre-diff-line-number-width: ${Math.max(2,String(E(_)).length)}ch; --markstream-code-padding-left: calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch));`:``),C=I(()=>[E(S),s()].filter(Boolean).join(` `));function w(e){let t=1;for(let n=0;n<e.length;n++)e[n]===`
209
+ </svg>`,nM={"":``,cjs:`javascript`,"c++":`cpp`,"c#":`csharp`,d2lang:`d2`,golang:`go`,js:`javascript`,jsx:`jsx`,kt:`kotlin`,md:`markdown`,mjs:`javascript`,"objective-c":`objectivec`,"objective-c++":`objectivecpp`,plaintext:`plain`,rb:`ruby`,rs:`rust`,py:`python`,bash:`shell`,bat:`shell`,batch:`shell`,ps1:`powershell`,sh:`shell`,shellscript:`shell`,text:`plain`,ts:`typescript`,tsx:`tsx`,yml:`yaml`,zsh:`shell`},rM={"":`Text`,css:`CSS`,c:`C`,cpp:`C++`,csharp:`C#`,d2:`D2`,go:`Go`,html:`HTML`,java:`Java`,javascript:`JavaScript`,json:`JSON`,jsx:`JSX`,markdown:`Markdown`,mermaid:`Mermaid`,php:`PHP`,plain:`Text`,plaintext:`Text`,python:`Python`,ruby:`Ruby`,rust:`Rust`,shell:`Shell`,sql:`SQL`,svg:`SVG`,tsx:`TSX`,typescript:`TypeScript`,vue:`Vue`,yaml:`YAML`},iM={"":tM,html:Qj,javascript:Xj,json:eM,jsx:Xj,markdown:$j,mermaid:Zj,plain:tM,python:Xj,shell:Xj,svg:Qj,tsx:Xj,typescript:Xj},aM=Array.from(new Set([...Object.keys(nM),...Object.keys(rM),...Object.keys(iM),`bash`,`c`,`cpp`,`csharp`,`diff`,`go`,`java`,`php`,`ruby`,`rust`,`sql`,`yaml`,`zsh`]));function oM(e){if(!e)return``;let t=e.trim();if(!t)return``;let[n]=t.split(/\s+/),[r]=n.split(`:`);return r.toLowerCase()}function sM(e){let t=oM(e);return nM[t]??t}function cM(e){let t=sM(e);return!t||t===`plain`?`plaintext`:t===`shell`?`zsh`:t===`objectivec`?`objective-c`:t===`objectivecpp`?`objective-cpp`:t}function lM(e){let t=oM(e);return!t||aM.includes(t)?!1:aM.some(e=>e.startsWith(t))}function uM(e){return iM[sM(e)]||Xj}var dM=rM,fM=r(`<div><div class="html-preview-frame__header"><span> </span><button type="button">Close</button></div> <iframe class="html-preview-frame__iframe"></iframe></div>`);function pM(e,t){i(t,!0);let r=k(t,`code`,3,``),a=k(t,`title`,3,`Preview`),o=k(t,`isDark`,3,!1),s=k(t,`htmlPreviewAllowScripts`,3,!1),u=I(()=>t.htmlPreviewSandbox??(s()?`allow-scripts`:``));var d=fM();let f;var p=W(d),m=W(p),h=M(m,!0),g=z(m);n(p);var _=z(p,2);n(d),H(()=>{f=Y(d,1,`html-preview-frame`,null,f,{"is-dark":o()}),c(h,a()),B(_,`title`,a()),B(_,`srcdoc`,r()),B(_,`sandbox`,E(u))}),l(`click`,g,()=>t.onClose?.()),y(e,d),x()}T([`click`]);var mM=r(`<span class="markstream-pre__line-numbers" aria-hidden="true"><span class="markstream-pre__line-numbers-text"> </span></span>`),hM=r(`<pre data-markstream-pre="1"><!><code class="markstream-pre__code" translate="no"> </code></pre>`);function gM(e,t){i(t,!0);let r=k(t,`showLineNumbers`,3,!1),a=k(t,`enhanceable`,3,!0),o=k(t,`class`,3,void 0),s=k(t,`style`,3,void 0),l=I(()=>_A(t.node?.language).trim()),u=I(()=>bA(E(l))),d=I(()=>_A(t.node?.code)),f=I(()=>!!t.node?.diff),p=I(()=>t.node?.loading===!0),m=I(()=>E(p)?E(d):E(d).replace(/\r\n$|\n$|\r$/,``)),g=I(()=>r()===!0&&!E(f)),_=I(()=>w(E(m))),v=I(()=>T(E(_))),S=I(()=>E(g)?`--markstream-pre-line-number-width: ${Math.max(2,String(E(_)).length)}ch; --markstream-pre-diff-line-number-width: ${Math.max(2,String(E(_)).length)}ch; --markstream-code-padding-left: calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch));`:``),C=I(()=>[E(S),s()].filter(Boolean).join(` `));function w(e){let t=1;for(let n=0;n<e.length;n++)e[n]===`
210
210
  `?t++:e[n]===`\r`&&(t++,e[n+1]===`
211
211
  `&&n++);return e.length?t:1}function T(e){let t=``;for(let n=1;n<=e;n++)t+=`${t?`
212
- `:``}${n}`;return t}var D=Y(),O=q(D),A=e=>{var r=mM();let i;var s=W(r),d=e=>{var t=pM(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(v))),y(e,t)};h(s,e=>{E(g)&&e(d)});var _=z(s),x=M(_,!0);n(r),H((e,t,n)=>{B(r,`data-markstream-code-block`,a()?`1`:void 0),B(r,`data-markstream-language`,E(l)||void 0),B(r,`data-markstream-loading`,E(p)?`1`:void 0),B(r,`data-markstream-diff`,E(f)?`1`:void 0),B(r,`data-markstream-original`,e),B(r,`data-markstream-updated`,t),B(r,`data-markstream-line-numbers`,E(g)?`1`:void 0),B(r,`aria-busy`,E(p)?`true`:void 0),i=J(r,1,n,null,i,{"markstream-pre--line-numbers":E(g)}),j(r,E(C)||void 0),c(x,E(m))},[()=>E(f)?wA(_A(t.node?.originalCode)):void 0,()=>E(f)?wA(_A(t.node?.updatedCode)):void 0,()=>b([E(u)?`language-${E(u)}`:``,o()].filter(Boolean).join(` `)||void 0)]),y(e,r)},ee=I(()=>!(E(p)&&!E(d).trim()));h(O,e=>{E(ee)&&e(A)}),y(e,D),x()}async function gM(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),!0}catch{return!1}finally{t.remove()}}function _M(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function vM(e,t){if(!e||typeof document>`u`||typeof URL>`u`)return;let n=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function yM(e,t){return e==null||e===``?t??null:typeof e==`number`?`${e}px`:String(e)}var bM=w(`<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),xM=w(`<svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),SM=r(`<button type="button" class="code-action-btn"><!></button>`),CM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14"></path></svg></button> <button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8m0-5v5h5"></path></svg></button> <button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7-7v14"></path></svg></button>`,1),wM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg></button>`),TM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg></button>`),EM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),DM=r(`<div class="code-block-header"><div class="code-block-header__meta"><span class="code-block-language-icon" aria-hidden="true"></span> <span class="code-block-header__label"> </span></div> <div class="code-block-header__actions"><!> <!> <!> <!> <!></div></div>`),OM=r(`<div></div>`),kM=r(`<div><!> <div><!></div></div>`),AM=r(`<div data-markstream-code-block="1"><!> <!> <!></div>`);function jM(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`isDark`,3,void 0),o=k(t,`loading`,3,void 0),s=k(t,`stream`,3,void 0),u=k(t,`codeBlockOptions`,3,void 0),d=k(t,`theme`,3,void 0),p=k(t,`darkTheme`,3,void 0),m=k(t,`lightTheme`,3,void 0),g=k(t,`themes`,3,void 0),_=k(t,`minWidth`,3,void 0),b=k(t,`maxWidth`,3,void 0),S=k(t,`isShowPreview`,3,!0),C=k(t,`enableFontSizeControl`,3,!0),w=k(t,`showHeader`,3,!0),T=k(t,`showCopyButton`,3,!0),D=k(t,`showExpandButton`,3,!0),O=k(t,`showPreviewButton`,3,!0),A=k(t,`showCollapseButton`,3,!0),ee=k(t,`showFontSizeButtons`,3,!0),te=k(t,`showLineNumbers`,3,void 0),N=k(t,`htmlPreviewAllowScripts`,3,!1),P=k(t,`htmlPreviewSandbox`,3,void 0),{t:L}=Aj(),re=[`javascript`,`plaintext`,`shellscript`,`typescript`];function ie(e){let t=(e instanceof Error?e.message:String(e??``)).match(/Language `([^`]+)` is not included/)?.[1];return t&&cM(t)?t:``}function R(e){let t=ie(e);if(t){F(ge,t,!0),F(he,!1),U(t);return}F(ge,E(He),!0),F(he,!0)}function oe(e){let t=e.trim().split(/\s+/)[0]?.split(`:`)[0]?.toLowerCase()||``;return t.length>=3&&re.some(e=>e!==t&&e.startsWith(t))}function U(e){if(E(Fe))return;let t=()=>{if(F(Fe,null),E(Se)){if(E(He)!==e&&!cM(E(He))&&!oe(E(He))&&!E(ft)&&!E(mt)){F(ge,``),Nt();return}F(Fe,setTimeout(t,50),!0)}};F(Fe,setTimeout(t,50),!0)}let le=V(null),G=V(null),K=V(null),pe=V(null),me=V(!1),he=V(!1),ge=V(``),_e=V(null),ve=V(null),ye=V(!1),be=V(!1),xe=V(null),Se=V(!1),Ce=V(!1),X=V(!1),we=V(!1),Te=V(!1),Ee=V(12),De=V(null),Oe=V(0),ke=V(null),Ae=V(fe([])),je=V(null),Me=V(null),Ne=V(``),Pe,Fe=V(null),Ie=V(null),Le=V(null),Re=V(``),ze=V(null),Be=V(null),Ve=V(!1),He=I(()=>_A(t.node?.language).trim()),Ue=I(()=>oM(E(He))),We=I(()=>sM(E(Ue)||E(He)||`plaintext`)),Ge=I(()=>yt(t.node)),Z=I(()=>!!t.node?.diff),Ke=I(()=>_A(t.node?.originalCode)),qe=I(()=>_A(t.node?.updatedCode)),Je=I(()=>t.node?.loading===!0),Ye=I(()=>o()??E(Je)),Xe=I(()=>s()??r()?.codeBlockStream??!0),Ze=I(()=>a()??r()?.isDark??!1),Qe=I(()=>r()?.codeBlockThemes),$e=I(()=>u()??r()?.codeBlockOptions),et=I(()=>te()??E($e)?.disableLineNumbers!==!0),tt=I(()=>{let e=E($e)?.parseDiffOptions;return{options:{...E($e)??{}},parseDiffOptions:e&&typeof e==`object`?{...e}:e,showLineNumbers:E(et)}}),nt=I(kt),rt=I(Dt),it=I(()=>bt(E($e)?.fontSize)??12),at=I(()=>yM(_()??E(Qe)?.minWidth)),ot=I(()=>yM(b()??E(Qe)?.maxWidth)),st=I(()=>[E(at)?`min-width: ${E(at)}`:``,E(ot)?`max-width: ${E(ot)}`:``].filter(Boolean).join(`; `)),ct=I(()=>lM(E(Ue)||E(He)||`plain`)),lt=I(()=>uM[E(Ue)]||(E(He)?E(He).toUpperCase():uM[``])),ut=I(()=>S()!==!1&&(E(Ue)===`html`||E(Ue)===`svg`)),dt=I(()=>E(Ue)===`svg`?L(`artifacts.svgPreviewTitle`):L(`artifacts.htmlPreviewTitle`)),ft=I(()=>E(Xe)===!1&&E(Ye)),pt=I(()=>r()?.final===!1||E(Ye)),mt=I(()=>E(Xe)!==!1&&E(pt)&&(cM(E(He))||oe(E(He)))),ht=I(()=>!(E(Ye)&&!E(Ge).trim())),gt=I(()=>({...t.node,code:E(Ge),loading:E(Ye)})),_t=I(Tt),vt=I(()=>E(Z)?`${E(We)}\0${E(Ke)}\0${E(qe)||E(Ge)}`:`${E(We)}\0${E(Ge)}`);de(()=>{E(he)&&E(ge)&&E(He)!==E(ge)&&cM(E(ge))&&(F(he,!1),F(ge,``))}),de(()=>{E(Se),E(Ye),E(vt),E(ft),E(mt),E(Se)&&E(Ye)===!1&&!E(ft)&&!E(mt)&&E(vt)!==E(Re)&&(F(Re,E(vt),!0),Bt())}),de(()=>{E(Se),E(le),E(ht),E(Ce),E(ft),E(mt),E(Z),E(Ge),E(Ke),E(qe),E(We),E(rt),E(nt),E($e),E(tt),E(Ee),E(X),E(Se)&&(Pe!==E(tt)&&(Pe=E(tt),F(Ee,E(it),!0),Ht()),Nt())}),ue(()=>{F(Se,!0),F(Ee,E(it),!0)}),ce(()=>{F(Se,!1),F(Oe,E(Oe)+1),E(De)&&clearTimeout(E(De)),E(Fe)&&clearTimeout(E(Fe)),E(Le)&&clearTimeout(E(Le)),Jt(),Ht()});function yt(e){return e?.diff?_A(e?.updatedCode??e?.code):_A(e?.code)}function bt(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}function xt(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function St(){return bt(E($e)?.lineHeight)??(E(Ee)===12?18:Math.max(12,Math.round(E(Ee)*1.5)))}function Ct(){let e=E($e)?.padding,t=E(Z)?0:8,n=xt(e)??t;return{top:n,bottom:n}}function wt(){return typeof E($e)?.fontFamily==`string`&&E($e).fontFamily.trim()?E($e).fontFamily.trim():`"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace`}function Tt(){let e=Ct(),t=wt(),n=bt(E($e)?.tabSize)??4,r=St();return[`--markstream-code-font-family: ${t}`,`--vscode-editor-font-size: ${E(Ee)}px`,`--vscode-editor-line-height: ${r}px`,`--markstream-code-padding-y: ${e.top}px`,`--markstream-pre-line-number-top: ${e.top}px`,`font-family: ${t}`,`font-size: ${E(Ee)}px`,`line-height: ${r}px`,`padding-top: ${e.top}px`,`padding-right: var(--markstream-code-padding-x, 12px)`,`padding-bottom: ${e.bottom}px`,`padding-left: var(--markstream-code-padding-left, 52px)`,`tab-size: ${n}`,`max-height: ${Wt()}px`,`overflow: auto`,`white-space: ${E($e)?.overflow===`scroll`?`pre`:`pre-wrap`}`].join(`; `)}function Et(e){return!!e&&typeof e==`object`&&typeof e.dark==`string`&&typeof e.light==`string`}function Dt(){return typeof d()==`string`&&d()?d():Et(d())?E(Ze)?d().dark:d().light:(E(Ze)?p():m())||(g()?E(Ze)?g()[0]:g()[1]:(E(Ze)?E(Qe)?.darkTheme:E(Qe)?.lightTheme)||(E(Qe)?.themes?E(Ze)?E(Qe).themes[0]:E(Qe).themes[1]:E(Ze)?`vitesse-dark`:`vitesse-light`))}function Ot(){return[p()??g()?.[0]??E(Qe)?.darkTheme??E(Qe)?.themes?.[0]??`vitesse-dark`,m()??g()?.[1]??E(Qe)?.lightTheme??E(Qe)?.themes?.[1]??`vitesse-light`]}function kt(){let e={...E($e)??{}};for(let t of[`maxHeight`,`padding`,`tabSize`,`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete e[t];let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n=E(Z)?{diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,...e,parseDiffOptions:{context:2,...t}}:e,r=typeof n.unsafeCSS==`string`?n.unsafeCSS:``;return{overflow:`wrap`,...n,MAX_HEIGHT:E(X)?900:E($e)?.maxHeight??500,fontFamily:wt(),fontSize:E(Ee),lineHeight:St(),disableLineNumbers:!E(et),unsafeCSS:`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }
213
- ${r}`.trim(),disableFileHeader:!0,stream:!1,themes:Ot(),themeType:E(Ze)?`dark`:`light`,onThemeChange(){Q(),Gt()}}}function At(){let e={...E(nt),theme:E(rt)};if(!E(K))return F(K,e,!0),E(K);for(let t of Object.keys(E(K)))t in e||delete E(K)[t];return Object.assign(E(K),e),E(K)}async function jt(){if(E(G)||E(he)||typeof window>`u`)return;if(E(pe))return E(pe);let e=E(Oe),t=(async()=>{let t=await Lj();if(E(Se)&&E(Oe)===e){if(!t||typeof t.createCodeBlockRuntime!=`function`){F(he,!0);return}F(G,t.createCodeBlockRuntime(At()),!0),await Promise.resolve(E(G).setTheme?.(E(rt))),E(Se)&&E(Oe)===e&&F(Ne,E(rt),!0)}})().finally(()=>{E(pe)===t&&F(pe,null)});return F(pe,t,!0),t}function Mt(){E(G)&&E(rt)&&E(rt)!==E(Ne)&&(F(Ne,E(rt),!0),Promise.resolve(E(G).setTheme?.(E(rt))).catch(e=>{typeof console<`u`&&console.warn(`[markstream-svelte] Failed to apply code-block theme:`,e)}))}async function Nt(){if(!E(Se)||!E(ht)||!E(le)||E(Ce)||E(ft)||E(mt))return;let e=E(Oe);try{await jt()}catch(t){E(Se)&&E(Oe)===e&&R(t);return}if(!E(Se)||E(Oe)!==e||E(he)||!E(G))return;At();let t=E(Z)?`diff`:`single`;if((!((t===`diff`?E(G).getDiffEditorView?.():E(G).getEditorView?.())&&Pt(t))||E(_e)!==t||E(ve)!==!1)&&(await Rt(t),!E(Se)||E(he)||!E(G)||!Pt(t)||E(_e)!==t))return;let n=E(Oe);try{E(Z)&&typeof E(G).updateDiff==`function`?await Promise.resolve(E(G).updateDiff(E(Ke),E(qe)||E(Ge),E(We))):typeof E(G).updateCode==`function`&&(await Promise.resolve(E(G).updateCode(E(Ge),E(We))),qt()),!E(me)&&await Lt(t,E(Oe))&&(F(ye,!0),F(be,!0),F(me,!0)),Mt(),Ut(),Gt()}catch(e){E(Se)&&E(Oe)===n&&R(e)}}function Pt(e){if(!E(le))return!1;let t=[`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`);return!!E(le).querySelector(t)}function Ft(){return E(le)?.querySelector([`diffs-container`,`[data-stream-diffs-state]`,`.stream-diffs-shell`].join(`,`))??null}function It(e,t=!1){if(!E(le)||!Pt(e))return!1;if(t){let e=window.getComputedStyle(E(le));if(e.display===`none`||e.visibility===`hidden`||Number.parseFloat(e.opacity||`1`)<=.01)return!1}let n=Ft();if(!n)return!1;let r=n.getBoundingClientRect();if(r.width<=0||r.height<=0)return!1;let i=window.getComputedStyle(n);return i.display!==`none`&&i.visibility!==`hidden`&&Number.parseFloat(i.opacity||`1`)>.01}async function Lt(e,t){await v();let n=Date.now()+1500,r=0;for(;Date.now()<n&&r<30;){if(r+=1,!E(Se)||!E(le)||E(Oe)!==t)return!1;if(Qt(!0),await Vt(),It(e))return Qt(!0),await Vt(),It(e)}return!!(E(Se)&&E(le)&&E(Oe)===t&&It(e))}async function Rt(e){if(!E(le)||!E(G)||E(xe))return E(xe);let t=E(G),n=ne(Oe);F(me,!1);let r=(async()=>{try{if(Ht(!1),!E(Se)||!E(le)||E(Oe)!==n||E(G)!==t)return;if(E(le).replaceChildren(),F(je,null),F(Me,null),F(ve,!1),e===`diff`&&typeof t.createDiffEditor==`function`){if(await t.createDiffEditor(E(le),E(Ke),E(qe)||E(Ge),E(We)),!E(Se)||E(Oe)!==n||E(G)!==t||(await Promise.resolve(t.updateDiff?.(E(Ke),E(qe)||E(Ge),E(We))),!E(Se)||E(Oe)!==n||E(G)!==t))return;F(_e,`diff`)}else{if(await t.createEditor(E(le),E(Ge),E(We)),!E(Se)||E(Oe)!==n||E(G)!==t||(await Promise.resolve(t.updateCode?.(E(Ge),E(We))),!E(Se)||E(Oe)!==n||E(G)!==t))return;F(_e,`single`)}if(Ut(),Xt(),Mt(),!await Lt(e,n))return;F(ye,!0),F(be,!0),F(me,!0),Gt()}catch(e){E(Se)&&E(Oe)===n&&E(G)===t&&R(e)}})().finally(()=>{E(xe)===r&&F(xe,null)});return F(xe,r,!0),r}function zt(){return E(Ie)||F(Ie,(async()=>{if(await v(),await Vt(),E(xe))try{await E(xe)}catch{}if(!E(Se)||!E(ht)||!E(le)||E(Ce)||E(ft)||E(mt)||(await jt(),!E(Se)||E(he)||!E(G)))return;At();let e=E(Z)?`diff`:`single`;if((!Pt(e)||E(_e)!==e)&&await Rt(e),E(Se)&&!E(he)&&E(G)&&Pt(e)&&E(_e)===e){if(E(Z)){await Promise.resolve(E(G).updateDiff?.(E(Ke),E(qe)||E(Ge),E(We))),E(G).refreshDiffPresentation?.(),Ut(),Gt();return}await Promise.resolve(E(G).updateCode?.(E(Ge),E(We))),qt(140,!0),Ut(),Gt()}})().finally(()=>{F(Ie,null)}),!0),E(Ie)}function Bt(){E(Le)&&clearTimeout(E(Le)),F(Le,setTimeout(()=>{F(Le,null),zt()},80),!0)}function Vt(){return typeof window>`u`||typeof window.requestAnimationFrame!=`function`?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e()))}function Ht(e=!0){e&&(F(Oe,E(Oe)+1),F(xe,null),F(pe,null)),Zt(),Kt();try{e?E(G)?.cleanupEditor?.():(E(G)?.safeClean||E(G)?.cleanupEditor)?.()}catch{}F(_e,null),F(ve,null),F(ye,!1),F(be,!1),F(me,!1),F(je,null),F(Me,null),e&&(F(G,null),F(K,null),F(pe,null),F(Ne,``))}function Ut(){(E(Z)?E(G)?.getDiffEditorView?.():E(G)?.getEditorView?.())?.updateOptions?.({fontSize:E(Ee)}),Q(),Gt()}function Q(){if(!E(le))return;let e=bt(E($e)?.tabSize)??4;E(le).style.setProperty(`--diffs-tab-size`,String(e)),typeof E($e)?.padding==`number`?E(le).style.setProperty(`--diffs-gap-block`,`${Ct().top}px`):E(le).style.removeProperty(`--diffs-gap-block`)}function Wt(){return E($e)?.maxHeight??500}function Gt(){typeof window>`u`||!E(le)||!E(me)||(E(ke)??F(ke,window.requestAnimationFrame(()=>{F(ke,null),window.requestAnimationFrame(()=>Qt())}),!0))}function Kt(){E(ke)==null||typeof window>`u`||(window.cancelAnimationFrame(E(ke)),F(ke,null))}function qt(e=140,t=!1){typeof window>`u`||(F(Ve,E(Ve)||t,!0),E(ze)&&clearTimeout(E(ze)),F(ze,setTimeout(()=>{F(ze,null),E(Be)??F(Be,window.requestAnimationFrame(()=>{let e=E(Ve);F(Ve,!1),F(Be,null),Yt(e)}),!0)},e),!0))}function Jt(){E(ze)&&(clearTimeout(E(ze)),F(ze,null)),F(Ve,!1),!(E(Be)==null||typeof window>`u`)&&(window.cancelAnimationFrame(E(Be)),F(Be,null))}function Yt(e=!1){try{let t=E(Z)?E(G)?.getDiffEditorView?.()?.getModifiedEditor?.():E(G)?.getEditorView?.(),n=t?.getModel?.(),r=n?.forceTokenization;if(e&&!E(Z)&&typeof n?.setValue==`function`){let e=Number(t?.getScrollTop?.()||0),r=Number(t?.getScrollLeft?.()||0),i=t?.getSelection?.();n.setValue(E(Ge)),i&&t?.setSelection?.(i),Number.isFinite(e)&&t?.setScrollTop?.(e),Number.isFinite(r)&&t?.setScrollLeft?.(r)}let i=Number(n?.getLineCount?.()||0);if(typeof r!=`function`||!Number.isFinite(i)||i<=0)return;for(let e=1;e<=i;e+=1)r.call(n,e);t?.render?.(!0)}catch{}}function Xt(){Zt();let e=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>Gt());r&&E(Ae).push(r)}catch{}};if(E(Z)){let t=E(G)?.getDiffEditorView?.(),n=t?.getOriginalEditor?.(),r=t?.getModifiedEditor?.();try{let e=t?.onDidUpdateDiff?.(()=>Gt());e&&E(Ae).push(e)}catch{}e(n,`onDidContentSizeChange`),e(r,`onDidContentSizeChange`),e(n,`onDidLayoutChange`),e(r,`onDidLayoutChange`);return}let t=E(G)?.getEditorView?.();e(t,`onDidContentSizeChange`),e(t,`onDidLayoutChange`)}function Zt(){for(let e of E(Ae))try{typeof e==`function`?e():e?.dispose?.()}catch{}F(Ae,[],!0)}function Qt(e=!1){if(!E(le)||!E(G)||!E(me)&&!e||E(Ce))return;let t=Wt(),n=E(Z)?nn(E(le))??tn():tn();if(!n||n<=0)return;let r=$t(),i=E(X)||!Number.isFinite(t)?Math.ceil(n):Math.ceil(Math.min(n,t)),a=Math.max(r,i);E(le).style.height=`${a}px`,E(le).style.minHeight=`${a}px`,E(le).style.maxHeight=E(X)||!Number.isFinite(t)?`none`:`${Math.ceil(t)}px`,E(le).style.overflow=E(Z)?`hidden`:n>a?`auto`:`hidden`,en(a)}function $t(){if(!E(le)||typeof window>`u`)return 0;let e=[window.getComputedStyle(E(le).parentElement||E(le)).minHeight,window.getComputedStyle(E(le)).minHeight];for(let t of e){let e=Number.parseFloat(t);if(Number.isFinite(e)&&e>0)return Math.ceil(e)}return 0}function en(e){let t=Math.max(0,E(le)?.clientWidth||0),n=Math.ceil(t),r=Math.ceil(e);if(E(je)!==n||E(Me)!==r){F(je,n,!0),F(Me,r,!0);try{E(Z)?E(G)?.getDiffEditorView?.()?.layout?.(t>0?{width:n,height:r}:void 0):E(G)?.getEditorView?.()?.layout?.(t>0?{width:n,height:r}:void 0)}catch{}}}function tn(){try{if(E(Z)){let e=E(G)?.getDiffEditorView?.(),t=e?.getOriginalEditor?.(),n=e?.getModifiedEditor?.(),r=Number(t?.getContentHeight?.()||0),i=Number(n?.getContentHeight?.()||0),a=Math.max(r,i);if(a>0)return Math.ceil(a+1)}let e=E(G)?.getEditorView?.(),t=Number(e?.getContentHeight?.()||0);if(t>0)return Math.ceil(t)}catch{}return null}function nn(e){if(typeof window>`u`)return null;try{let t=e.getBoundingClientRect();if(t.height<=0)return null;let n=e.querySelector([`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`));if(!n)return null;let r=n.getBoundingClientRect().bottom-t.top;return r>0?Math.ceil(r+1):null}catch{return null}}async function rn(){await gM(E(Ge)),r()?.events?.onCopy?.(E(Ge)),F(we,!0),E(De)&&clearTimeout(E(De)),F(De,setTimeout(()=>{F(we,!1)},1e3),!0)}function an(){C()&&(F(Ee,Math.max(10,E(Ee)-1),!0),Ut())}function on(){C()&&(F(Ee,E(it),!0),Ut())}function sn(){C()&&(F(Ee,Math.min(24,E(Ee)+1),!0),Ut())}function cn(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(Ze))}function ln(e){cn(e,E(we)?L(`common.copied`)||`Copied`:L(`common.copy`)||`Copy`)}var un=Y(),dn=q(un),fn=e=>{var t=AM();let r;var i=W(t),a=e=>{var t=DM(),r=W(t),i=W(r);ae(i,()=>E(ct),!0),n(i);var a=z(i,2),o=M(a,!0);n(r);var s=z(r,2),u=W(s),d=e=>{var t=SM(),r=W(t),i=e=>{var t=bM();y(e,t)},a=e=>{var t=xM();y(e,t)};h(r,e=>{E(we)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(we)?L(`common.copied`):L(`common.copy`)]),f(`blur`,t,()=>$()),l(`click`,t,rn),f(`focus`,t,ln),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,ln),y(e,t)};h(u,e=>{T()&&e(d)});var p=z(u,2),m=e=>{var t=CM(),n=q(t),r=z(n,2),i=z(r,2);H((e,t,a)=>{B(n,`aria-label`,e),B(r,`aria-label`,t),B(i,`aria-label`,a)},[()=>L(`common.decrease`),()=>L(`common.reset`),()=>L(`common.increase`)]),f(`blur`,n,()=>$()),l(`click`,n,an),f(`focus`,n,e=>cn(e,L(`common.decrease`)||`Decrease`)),f(`mouseleave`,n,()=>$()),f(`mouseenter`,n,e=>cn(e,L(`common.decrease`)||`Decrease`)),f(`blur`,r,()=>$()),l(`click`,r,on),f(`focus`,r,e=>cn(e,L(`common.reset`)||`Reset`)),f(`mouseleave`,r,()=>$()),f(`mouseenter`,r,e=>cn(e,L(`common.reset`)||`Reset`)),f(`blur`,i,()=>$()),l(`click`,i,sn),f(`focus`,i,e=>cn(e,L(`common.increase`)||`Increase`)),f(`mouseleave`,i,()=>$()),f(`mouseenter`,i,e=>cn(e,L(`common.increase`)||`Increase`)),y(e,t)};h(p,e=>{ee()&&C()&&e(m)});var g=z(p,2),_=e=>{var t=wM();H(e=>B(t,`aria-label`,e),[()=>L(`common.preview`)]),f(`blur`,t,()=>$()),l(`click`,t,()=>F(Te,!E(Te))),f(`focus`,t,e=>cn(e,L(`common.preview`)||`Preview`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>cn(e,L(`common.preview`)||`Preview`)),y(e,t)};h(g,e=>{E(ut)&&O()&&e(_)});var v=z(g,2),b=e=>{var t=TM(),r=W(t),i=M(r);n(t),H(e=>{B(t,`aria-pressed`,E(X)),B(t,`aria-label`,e),B(i,`d`,E(X)?`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`)},[()=>E(X)?L(`common.collapse`):L(`common.expand`)]),f(`blur`,t,()=>$()),l(`click`,t,()=>F(X,!E(X))),f(`focus`,t,e=>cn(e,E(X)?L(`common.collapse`)||`Collapse`:L(`common.expand`)||`Expand`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>cn(e,E(X)?L(`common.collapse`)||`Collapse`:L(`common.expand`)||`Expand`)),y(e,t)};h(v,e=>{D()&&e(b)});var x=z(v,2),S=e=>{var t=EM(),r=W(t);let i;n(t),H(e=>{B(t,`aria-pressed`,E(Ce)),B(t,`aria-label`,e),i=j(r,``,i,{rotate:E(Ce)?`0deg`:`90deg`})},[()=>E(Ce)?L(`common.expand`):L(`common.collapse`)]),f(`blur`,t,()=>$()),l(`click`,t,()=>F(Ce,!E(Ce))),f(`focus`,t,e=>cn(e,E(Ce)?L(`common.expand`)||`Expand`:L(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>cn(e,E(Ce)?L(`common.expand`)||`Expand`:L(`common.collapse`)||`Collapse`)),y(e,t)};h(x,e=>{A()&&e(S)}),n(s),n(t),H(()=>c(o,E(Z)?`Diff / ${E(lt)}`:E(lt))),y(e,t)};h(i,e=>{w()&&e(a)});var o=z(i,2),s=e=>{var t=kM();let r;var i=W(t),a=e=>{var t=OM();let n;se(t,e=>F(le,e),()=>E(le)),H(()=>n=J(t,1,`code-editor-container`,null,n,{"is-hidden":!E(ye)})),y(e,t)};h(i,e=>{E(ft)||e(a)});var o=z(i,2);let s;hM(W(o),{class:`code-pre-fallback`,enhanceable:!1,get node(){return E(gt)},get showLineNumbers(){return E(et)},get style(){return E(_t)}}),n(o),n(t),H(()=>{r=J(t,1,`code-block-body`,null,r,{"code-block-body--expanded":E(X)}),s=J(o,1,`code-editor-fallback-surface`,null,s,{"is-hidden":E(be)})}),y(e,t)};h(o,e=>{E(Ce)||e(s)});var u=z(o,2),d=e=>{fM(e,{get code(){return E(Ge)},get title(){return E(dt)},get isDark(){return E(Ze)},get htmlPreviewAllowScripts(){return N()},get htmlPreviewSandbox(){return P()},onClose:()=>F(Te,!1)})};h(u,e=>{E(Te)&&E(ut)&&e(d)}),n(t),H(()=>{r=J(t,1,`code-block-container`,null,r,{"is-dark":E(Ze),"is-plain-text":E(We)===`plaintext`,"is-rendering":E(Ye),"is-diff":E(Z)}),B(t,`data-markstream-enhanced`,E(me)&&!E(he)?`true`:`false`),j(t,E(st))}),y(e,t)};h(dn,e=>{E(ht)&&e(fn)}),y(e,un),x()}T([`click`]);var MM=()=>ve(()=>import(`../chunks/Y--VMh3y.js`),[],import.meta.url),NM=null,PM=MM,FM=null;function IM(e){if(!e)return e;if(e.D2&&typeof e.D2==`function`)return e.D2;if(e.default&&e.default.D2&&typeof e.default.D2==`function`)return e.default.D2;let t=e.default??e;return typeof t==`function`?t:t?.D2&&typeof t.D2==`function`?t.D2:t}async function LM(){if(NM)return NM;if(FM)return await FM;let e=PM;if(!e)return null;FM=(async()=>{let t;try{t=await e()}catch(t){throw e===MM?Error(`Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.`):t}return t?(NM=IM(t),NM):null})();try{return await FM}finally{FM=null}}var RM=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],zM=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function BM(e){return e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function VM(e){if(!e)return``;let t=e.trim();return zM.test(t)?t:``}function HM(e){let t=new Set([`script`]),n=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of n){if(t.has(e.tagName.toLowerCase())){e.remove();continue}let n=Array.from(e.attributes);for(let t of n){let n=t.name;if(/^on/i.test(n)){e.removeAttribute(n);continue}if(n===`style`&&t.value&&RM.some(e=>e.test(t.value))){e.removeAttribute(n);continue}if((n===`href`||n===`xlink:href`)&&t.value){let r=VM(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}function UM(e){if(typeof DOMParser>`u`||!e)return``;let t=BM(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return HM(r),r.outerHTML}function WM(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}var GM=r(`<div class="d2-mode-toggle"><button type="button"> </button> <button type="button"> </button></div>`),KM=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),qM=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),JM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><!></button>`),YM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"></path></svg></button>`),XM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),ZM=r(`<div class="markstream-svelte-enhanced-block__header d2-block-header"><div class="d2-header-title"><span class="d2-label">D2</span></div> <div class="markstream-svelte-enhanced-block__actions d2-header-actions"><!> <!> <!> <!></div></div>`),QM=r(`<p class="d2-error"> </p>`),$M=r(`<div class="d2-source"><pre class="d2-code"><code> </code></pre> <!></div>`),eN=r(`<div class="d2-render"><div class="d2-svg"></div> <!></div>`),tN=r(`<div class="markstream-svelte-enhanced-block__body d2-block-body"><!></div>`),nN=r(`<div data-markstream-d2="1"><!> <!></div>`);function rN(t,r){i(r,!0);let a={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},o=k(r,`context`,3,void 0),s=k(r,`maxHeight`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`themeId`,3,void 0),m=k(r,`darkThemeId`,3,void 0),g=k(r,`showHeader`,3,!0),_=k(r,`showModeToggle`,3,!0),v=k(r,`showCopyButton`,3,!0),b=k(r,`showExportButton`,3,!0),S=k(r,`showCollapseButton`,3,!0),{t:C}=Aj(),w=V(!1),T=V(0),D=V(``),O=V(``),A=V(``),ee=V(``),te=V(!1),N=V(!1),P=V(!1),L=V(!1),re=V(!1),ie=V(!1),R=null,oe=I(()=>_A(r.node?.code)),se=I(()=>u()??r.node?.loading===!0),U=I(()=>d()??o()?.isDark??!1),le=I(()=>!(E(se)&&!E(oe).trim())),G=I(()=>E(ie)||!E(A)),K=I(()=>s()?`max-height: ${s()}; --ms-d2-render-max-height: ${s()}`:``);ue(()=>{F(w,!0),fe(!0)}),de(()=>{E(w)&&(pe(),E(re),E(ie),e(()=>{fe()}))}),ce(()=>{F(w,!1),F(T,E(T)+1),R&&clearTimeout(R)});async function fe(e=!1){if(!E(w)||E(re)||E(ie)||!E(oe).trim())return;let t=pe();if(E(te)){(t!==E(O)||e)&&(F(N,!0),F(P,E(P)||e,!0));return}if(!e&&t===E(D)&&(E(A)||E(ee)))return;let n=ne(T);F(O,t,!0),F(D,t,!0),F(te,!0),F(ee,``);try{let e=await LM();if(!E(w)||n!==E(T))return;let t=me(e);if(!t||typeof t.compile!=`function`||typeof t.render!=`function`)throw Error(`D2 renderer is not available.`);let r=await t.compile(E(oe)),i=r?.diagram??r,o=r?.renderOptions??r?.options??{},s={...o};s.themeID=E(U)&&m()!=null?m():p()??o.themeID,s.darkThemeID=null,s.darkThemeOverrides=null,E(U)&&(s.themeOverrides={...a,...o.themeOverrides||{}});let c=await t.render(i,s);if(!E(w)||n!==E(T))return;let l=UM(WM(c));if(!l)throw Error(`D2 rendered empty SVG.`);F(A,l.replace(`<svg`,`<svg class="markstream-d2-root-svg"`),!0)}catch(e){n===E(T)&&(F(A,``),F(ee,e instanceof Error?e.message:String(e),!0))}finally{if(n===E(T)&&(F(te,!1),F(O,``),E(N))){let e=E(P);F(N,!1),F(P,!1),fe(e)}}}function pe(){return`${E(oe)}\n${E(U)}\n${p()}\n${m()}`}function me(e){if(typeof e==`function`){let t=new e;if(t&&typeof t.compile==`function`)return t;if(typeof e.compile==`function`)return e}return e?.D2&&typeof e.D2==`function`?new e.D2:typeof e?.compile==`function`?e:null}async function he(){await gM(E(oe)),o()?.events?.onCopy?.(E(oe)),F(L,!0),R&&clearTimeout(R),R=setTimeout(()=>{F(L,!1)},1e3)}function ge(){E(A)&&vM(E(A),`d2-diagram-${Date.now()}.svg`)}function _e(e){F(ie,e===`source`),E(ie)||fe(!0)}function ve(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(U))}function ye(e){ve(e,E(L)?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`)}var be=Y(),xe=q(be),Se=e=>{var t=nN();let r;var i=W(t),a=e=>{var t=ZM(),r=z(W(t),2),i=W(r),a=e=>{var t=GM(),r=W(t);let i;var a=M(r,!0),o=z(r,2);let s;var u=M(o,!0);n(t),H((e,t)=>{i=J(r,1,`markstream-svelte-enhanced-block__action mode-btn d2-mode-btn`,null,i,{"is-active":!E(ie)}),c(a,e),s=J(o,1,`markstream-svelte-enhanced-block__action mode-btn d2-mode-btn`,null,s,{"is-active":E(ie)}),c(u,t)},[()=>C(`common.preview`),()=>C(`common.source`)]),f(`blur`,r,()=>$()),l(`click`,r,()=>_e(`preview`)),f(`focus`,r,e=>ve(e,C(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>$()),f(`mouseenter`,r,e=>ve(e,C(`common.preview`)||`Preview`)),f(`blur`,o,()=>$()),l(`click`,o,()=>_e(`source`)),f(`focus`,o,e=>ve(e,C(`common.source`)||`Source`)),f(`mouseleave`,o,()=>$()),f(`mouseenter`,o,e=>ve(e,C(`common.source`)||`Source`)),y(e,t)};h(i,e=>{_()&&e(a)});var o=z(i,2),s=e=>{var t=JM(),r=W(t),i=e=>{var t=KM();y(e,t)},a=e=>{var t=qM();y(e,t)};h(r,e=>{E(L)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(L)?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`]),f(`blur`,t,()=>$()),l(`click`,t,he),f(`focus`,t,ye),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,ye),y(e,t)};h(o,e=>{v()&&e(s)});var u=z(o,2),d=e=>{var t=YM();H(e=>B(t,`aria-label`,e),[()=>C(`common.export`)||`Export`]),f(`blur`,t,()=>$()),l(`click`,t,ge),f(`focus`,t,e=>ve(e,C(`common.export`)||`Export`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>ve(e,C(`common.export`)||`Export`)),y(e,t)};h(u,e=>{b()&&E(A)&&e(d)});var p=z(u,2),m=e=>{var t=XM(),r=W(t);let i;n(t),H(e=>{B(t,`aria-label`,e),B(t,`aria-pressed`,E(re)),i=j(r,``,i,{transform:E(re)?`rotate(0deg)`:`rotate(90deg)`})},[()=>E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`]),f(`blur`,t,()=>$()),l(`click`,t,()=>F(re,!E(re))),f(`focus`,t,e=>ve(e,E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>ve(e,E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`)),y(e,t)};h(p,e=>{S()&&e(m)}),n(r),n(t),y(e,t)};h(i,e=>{g()&&e(a)});var o=z(i,2),s=e=>{var t=tN(),r=W(t),i=e=>{var t=$M(),r=W(t),i=W(r),a=M(i,!0);n(r);var o=z(r,2),s=e=>{var t=QM(),n=M(t,!0);H(()=>c(n,E(ee))),y(e,t)};h(o,e=>{E(ee)&&e(s)}),n(t),H(()=>c(a,E(oe))),y(e,t)},a=e=>{var t=eN(),r=W(t);ae(r,()=>E(A),!0),n(r);var i=z(r,2),a=e=>{var t=QM(),n=M(t,!0);H(()=>c(n,E(ee))),y(e,t)};h(i,e=>{E(ee)&&e(a)}),n(t),H(()=>j(t,E(K))),y(e,t)};h(r,e=>{E(G)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(re)||e(s)}),n(t),H(()=>{r=J(t,1,`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--d2`,null,r,{dark:E(U),"is-rendering":E(te)||E(se)}),B(t,`data-markstream-mode`,E(G)?`fallback`:`preview`)}),y(e,t)};h(xe,e=>{E(le)&&e(Se)}),y(t,be),x()}T([`click`]);function iN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=Y(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var aN=r(`<span class="emoji-node"> </span>`);function oN(e,t){i(t,!0);let n=I(()=>_A(t.node?.raw||t.node?.markup||t.node?.content||t.node?.name));var r=aN(),a=M(r,!0);H(()=>c(a,E(n))),y(e,r),x()}function sN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),a=k(t,`tag`,3,`span`);var o=Y(),c=q(o);s(c,a,!1,(e,i)=>{{let e=I(()=>gA(t.node?.children)),o=I(()=>String(r()??a())+`-`+a());pI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(o)}})}}),y(e,o),x()}function cN(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);sN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`em`})}function lN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=Y(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var uN=r(`<a class="footnote-anchor">↩︎</a>`);function dN(e,t){i(t,!0);let n=I(()=>_A(t.node?.id)),r=I(()=>E(n)?`#fnref-${E(n)}`:void 0);function a(e){e.preventDefault(),!(typeof document>`u`||!E(n))&&document.getElementById(`fnref-${E(n)}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}var o=uN();H(()=>{B(o,`href`,E(r)),B(o,`title`,E(n)?`返回引用 ${E(n)}`:void 0)}),l(`click`,o,a),y(e,o),x()}T([`click`]);var fN=r(`<div class="footnote-node"><div class="footnote-node__content"><!></div></div>`);function pN(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>_A(t.node?.id)),s=I(()=>gA(t.node?.children)),c=I(()=>`footnote-${a()??(E(o)||`node`)}`);var l=fN(),u=W(l);pI(W(u),{get nodes(){return E(s)},get context(){return r()},get prefix(){return E(c)}}),n(u),n(l),H(()=>B(l,`id`,E(o)?`fnref--${E(o)}`:void 0)),y(e,l),x()}var mN=r(`<sup class="footnote-reference"><span> </span></sup>`);function hN(e,t){i(t,!0);let r=I(()=>_A(t.node?.id)),a=I(()=>E(r)?`#fnref--${E(r)}`:void 0),o=I(()=>E(a)?{href:E(a)}:{});function s(e){e.preventDefault(),!(typeof document>`u`||!E(r))&&document.querySelector(E(a)||``)?.scrollIntoView({behavior:`smooth`,block:`start`})}var u=mN(),d=W(u);P(d,()=>({...E(o),title:E(r)?`查看脚注 ${E(r)}`:void 0,class:`footnote-link cursor-pointer`}));var f=M(d);n(u),H(()=>{B(u,`id`,E(r)?`fnref-${E(r)}`:void 0),c(f,`[${E(r)??``}]`)}),l(`click`,u,s),y(e,u),x()}T([`click`]);var gN=r(`<br/>`);function _N(e){var t=gN();y(e,t)}function vN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),a=I(()=>xA(t.node?.level)),o=I(()=>`h`+E(a));var c=Y(),l=q(c);s(l,()=>E(o),!1,(e,i)=>{P(e,()=>({class:`heading-node heading-${E(a)??``}`}));{let e=I(()=>gA(t.node?.children)),a=I(()=>String(r()??`heading`)+`-heading`);pI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(a)}})}}),y(e,c),x()}function yN(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);sN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`mark`})}function bN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=Y(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function xN(e,t){i(t,!0);let n=I(()=>yj(t.node,t.context));var r=Y(),a=q(r);ae(a,()=>E(n)),y(e,r),x()}var SN=r(`<img/>`),CN=r(`<span class="image-shimmer"></span>`),wN=r(`<span class="image-node__raw-text"> </span>`),TN=r(`<span class="image-placeholder"><!></span>`),EN=r(`<span class="image-error"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"></path></svg> <span> </span></span>`),DN=r(`<span class="image-node-container"><!></span>`);function ON(t,r){i(r,!0);let a=k(r,`fallbackSrc`,3,``),o=k(r,`lazy`,3,!1),s=k(r,`usePlaceholder`,3,!0),{t:l}=Aj();function u(e,t,n){return n||e?{src:e,stage:`primary`}:t?{src:t,stage:`fallback`}:{src:``,stage:`failed`}}let p=I(()=>ny(r.node?.src)),m=I(()=>ny(a())),g=I(()=>_A(r.node?.alt)),_=I(()=>_A(r.node?.title)),v=I(()=>_A(r.node?.raw)),b=I(()=>!!r.node?.loading),S=I(()=>!o()),C=e(()=>ny(r.node?.src)),w=e(()=>ny(a())),T=e(()=>!!r.node?.loading),D=u(C,w,T),O=V(fe(C)),A=V(fe(w)),j=V(fe(T)),ee=V(fe(D.src)),te=V(fe(D.stage)),N=V(!1),P=V(D.stage===`failed`);re(()=>{if(E(p)!==E(O)||E(m)!==E(A)||E(b)!==E(j)){F(O,E(p),!0),F(A,E(m),!0),F(j,E(b),!0);let e=u(E(p),E(m),E(b));F(ee,e.src,!0),F(te,e.stage,!0),F(N,!1),F(P,e.stage===`failed`)}});function L(){if(E(te)===`primary`&&E(m)&&E(m)!==E(ee)){F(ee,E(m),!0),F(te,`fallback`),F(N,!1),F(P,!1);return}F(te,`failed`),F(P,!0),F(N,!1)}function ne(e){let t=e.currentTarget;if(t&&t.naturalWidth===0&&t.naturalHeight===0){L();return}F(N,!0),F(P,!1)}var ie=DN(),R=W(ie),ae=e=>{var t=SN();let n;H(e=>{n=J(t,1,`image-node__img`,null,n,{"is-loaded":E(S)||E(N),"is-loading":!E(S)&&!E(N)}),B(t,`src`,E(ee)),B(t,`alt`,E(g)),B(t,`title`,E(_)||E(g)||void 0),B(t,`loading`,o()?`lazy`:void 0),B(t,`fetchpriority`,E(S)?`high`:void 0),B(t,`decoding`,E(S)?`sync`:`async`),B(t,`aria-label`,e)},[()=>E(g)||l(`image.preview`)]),f(`error`,t,L),f(`load`,t,ne),d(t),y(e,t)},oe=e=>{var t=TN(),r=W(t),i=e=>{var t=CN();y(e,t)},a=e=>{var t=wN(),n=M(t,!0);H(()=>c(n,E(v))),y(e,t)};h(r,e=>{s()?e(i):e(a,-1)}),n(t),y(e,t)},se=e=>{var t=EN(),r=z(W(t),2),i=M(r,!0);n(t),H(e=>c(i,e),[()=>l(`image.loadError`)]),y(e,t)};h(R,e=>{!E(b)&&!E(P)&&E(ee)?e(ae):E(P)?e(se,-1):e(oe,1)}),n(ie),y(t,ie),x()}var kN=null,AN=null;async function jN(){return AN||(kN||=ve(()=>import(`../chunks/C3mlWJXx.js`).then(e=>{let t=e&&e.default?e.default:e,n=t;return typeof t==`function`&&t.prototype&&t.prototype.render?n=t:e?.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),AN=n,n}),[],import.meta.url).catch(e=>(console.warn(`[markstream-svelte] Failed to load @antv/infographic`,e),null)),await kN)}function MN(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function NN(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(e&&!e.startsWith(`%%`))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}function PN(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`%%`)),n=Math.max(1,t.length),r=NN(e);return r===`gantt`?220+n*28:r===`sequencediagram`?180+n*26:r===`classdiagram`||r===`statediagram`||r===`erdiagram`?180+n*24:r===`flowchart`||r===`graph`?170+n*28:200+n*22}function FN(e){let t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+t*60:360}function IN(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function LN(e,t){return MN(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??t}var RN=r(`<div class="infographic-mode-toggle"><button type="button"><span class="markstream-svelte-enhanced-block__action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg> <span> </span></span></button> <button type="button"><span class="markstream-svelte-enhanced-block__action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 18l6-6l-6-6M8 6l-6 6l6 6"></path></svg> <span> </span></span></button></div>`),zN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),BN=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),VN=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),HN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><!></button>`),UN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10l5 5l5-5"></path></g></svg></button>`),WN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"></path></svg></button>`),GN=r(`<div class="markstream-svelte-enhanced-block__header infographic-block-header"><div class="markstream-svelte-enhanced-block__title"><span class="markstream-svelte-enhanced-block__title-icon icon-slot action-icon" aria-hidden="true"></span> <span class="markstream-svelte-enhanced-block__title-text infographic-label">Infographic</span></div> <!> <div class="markstream-svelte-enhanced-block__actions infographic-header-actions"><!> <!> <!> <!></div></div>`),KN=r(`<div class="infographic-source"><pre class="infographic-source-code"><code> </code></pre></div>`),qN=r(`<div class="markstream-svelte-zoom-controls"><button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action infographic-action-btn infographic-zoom-reset"> </button></div>`),JN=r(`<pre class="infographic-source-code infographic-pending-source"><code> </code></pre>`),YN=r(`<p class="d2-error"> </p>`),XN=r(`<!> <div class="infographic-render"><!> <div></div> <!></div>`,1),ZN=r(`<div class="markstream-svelte-enhanced-block__body infographic-block-body"><!></div>`),QN=r(`<div><div class="mermaid-modal-overlay infographic-modal-overlay" role="dialog" aria-modal="true" tabindex="-1"><div class="mermaid-modal-panel infographic-modal-panel"><div class="mermaid-modal-controls"><button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action infographic-action-btn infographic-zoom-reset"> </button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L6 18M6 6l12 12"></path></svg></button></div> <div class="mermaid-modal-body"><div class="mermaid-modal-content infographic-modal-content"></div></div></div></div></div>`),$N=r(`<div data-markstream-infographic="1"><!> <!> <!></div>`);function eP(t,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`maxHeight`,3,`500px`),s=k(r,`estimatedPreviewHeightPx`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`showHeader`,3,!0),m=k(r,`showModeToggle`,3,!0),g=k(r,`showCopyButton`,3,!0),_=k(r,`showCollapseButton`,3,!0),b=k(r,`showExportButton`,3,!0),S=k(r,`showFullscreenButton`,3,!0),C=k(r,`showZoomControls`,3,!0),{t:w}=Aj(),T=V(null),D=V(null),O=V(!1),A=V(0),ee=V(``),te=V(``),N=V(``),P=V(null),L=V(``),re=V(!1),ie=V(!1),R=V(!1),U=V(!1),le=V(!1),G=V(!1),K=V(!1),fe=V(!1),pe=V(!1),he=V(!1),ge=V(``),_e=V(1),ve=null,ye=I(()=>_A(r.node?.code)),be=I(()=>typeof r.node?.loading!=`boolean`||!!r.node?.loading),xe=I(()=>u()??E(be)),Se=I(()=>a()?.final??E(xe)===!1),Ce=I(()=>E(xe)!==!1||E(Se)===!1),X=I(()=>d()??a()?.isDark??!1),we=I(()=>o()===`none`?null:MN(o())),Te=I(()=>IN(MN(s())??FN(E(ye)),LN(E(D),360),E(we)??void 0)),Ee=I(()=>[`min-height: ${E(Te)}px`,o()&&o()!==`none`?`max-height: ${o()}`:``].filter(Boolean).join(`; `)),De=I(()=>`transform: scale(${E(_e)}); transform-origin: center center;`),Oe=I(()=>!(E(xe)&&!E(ye).trim()));ue(()=>{F(O,!0),ke(!0)}),de(()=>{E(O)&&(`${E(ye)}${E(X)}${E(Se)}${E(Ce)}`,E(fe),E(pe),e(()=>{ke()}))}),ce(()=>{F(O,!1),F(A,E(A)+1),je(),F(ee,``),ve&&clearTimeout(ve)});function ke(e=!1){E(O)&&E(T)&&!E(fe)&&!E(pe)&&E(ye).trim()&&(F(le,E(le)||e,!0),!E(U)&&(F(U,!0),v().then(()=>{F(U,!1);let e=E(le);return F(le,!1),Ae(e)})))}async function Ae(e=!1){if(!E(O)||!E(T)||E(fe)||E(pe))return;if(!E(ye).trim()){je(),E(T)&&_M(E(T)),F(G,!1),F(L,``),F(ee,``),F(N,``);return}let t=E(ye),n=E(Se),r=`${t}\n${E(X)}\n${n}\n${E(Ce)}`;if(!e&&r===E(ee)&&E(G)||!e&&r===E(N))return;if(E(re)){(r!==E(te)||e)&&(F(ie,!0),F(R,E(R)||e,!0));return}let i=ne(A);F(te,r);let a=!E(Ce);F(re,!0),a&&F(L,``);let o=null,s=null;try{let e=await jN();if(!E(O)||i!==E(A)||E(fe)||E(pe)||!E(T))return;if(!e)throw Error(`Infographic renderer is not available.`);if(!(r===`${E(ye)}\n${E(X)}\n${E(Se)}\n${E(Ce)}`||!n&&E(xe)&&E(ye).startsWith(t)))return;s=Array.from(E(T).childNodes),o=new e({container:E(T),width:`100%`,height:`100%`});let a=``,c=!1;if(o.on?.(`error`,e=>{a=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:typeof e==`string`?e:e&&typeof e==`object`&&`message`in e?String(e.message??``):String(e??``)).filter(Boolean).join(`; `)}),o.on?.(`rendered`,()=>{c=!0}),o.render(t),a)throw Error(a);let l=Array.from(E(T).childNodes),u=l.length>0&&(l.length!==s.length||l.some((e,t)=>e!==s?.[t]));if(!c&&!u)throw Error(`Infographic render returned empty output.`);E(P)?.destroy?.(),F(P,o,!0),o=null,F(G,!0),F(L,``),F(ee,r),F(N,``)}catch(e){if(i===E(A)){o?.destroy?.(),o=null,F(ee,``);let t=`${E(ye)}\n${E(X)}\n${E(Se)}\n${E(Ce)}`;a&&r===t?(F(N,``),je(),_M(E(T)),F(G,!1),F(L,e instanceof Error?e.message:String(e),!0)):(s&&E(T)&&E(T).replaceChildren(...s),r===t&&F(N,r))}}finally{if(o?.destroy?.(),i===E(A)&&(F(re,!1),F(te,``),E(ie))){let e=E(R);F(ie,!1),F(R,!1),ke(e)}}}function je(){try{E(P)?.destroy?.()}catch{}F(P,null)}function Me(){F(A,E(A)+1),je(),E(T)&&_M(E(T)),F(re,!1),F(ie,!1),F(R,!1),F(U,!1),F(le,!1),F(G,!1),F(L,``),F(te,``),F(ee,``),F(N,``)}async function Ne(){await gM(E(ye)),a()?.events?.onCopy?.(E(ye)),F(K,!0),ve&&clearTimeout(ve),ve=setTimeout(()=>{F(K,!1)},1e3)}function Pe(){let e=E(T)?.querySelector(`svg`);return e?UM(e.outerHTML):``}function Fe(){let e=Pe();e&&vM(e,`infographic-${Date.now()}.svg`)}function Ie(){F(ge,E(T)?.innerHTML||``,!0),E(ge)&&F(he,!0)}async function Le(e){let t=e===`source`;E(pe)!==t&&(F(pe,t),Me(),E(pe)||(await v(),ke(!0)))}async function Re(){F(fe,!E(fe)),Me(),E(fe)||(await v(),ke(!0))}function ze(){F(_e,Math.min(3,Math.round((E(_e)+.1)*10)/10),!0)}function Be(){F(_e,Math.max(.5,Math.round((E(_e)-.1)*10)/10),!0)}function Ve(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(X))}function He(e){Ve(e,E(K)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`)}function Ue(e){return document.body.appendChild(e),{destroy(){e.remove()}}}function We(){F(he,!1)}function Ge(e){e.target===e.currentTarget&&We()}function Z(e){e.key===`Escape`&&We()}var Ke=Y(),qe=q(Ke),Je=e=>{var t=$N();let r;var i=W(t),a=e=>{var t=GN(),r=W(t),i=W(r);ae(i,()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><path fill="#5b8ff9" d="M5 4.25A2.25 2.25 0 0 1 7.25 2h2.5A2.25 2.25 0 0 1 12 4.25v2.5A2.25 2.25 0 0 1 9.75 9h-2.5A2.25 2.25 0 0 1 5 6.75z"/><path fill="#61d9a6" d="M12 17.25A2.25 2.25 0 0 1 14.25 15h2.5A2.25 2.25 0 0 1 19 17.25v2.5A2.25 2.25 0 0 1 16.75 22h-2.5A2.25 2.25 0 0 1 12 19.75z"/><path fill="#f6bd16" d="M12 4.25A2.25 2.25 0 0 1 14.25 2h2.5A2.25 2.25 0 0 1 19 4.25v2.5A2.25 2.25 0 0 1 16.75 9h-2.5A2.25 2.25 0 0 1 12 6.75z"/><path fill="#5ad8a6" d="M7.5 10.75h1.75a6.25 6.25 0 0 1 6.25 6.25v.25h-2V17a4.25 4.25 0 0 0-4.25-4.25H7.5z"/><path fill="#7262fd" d="M15.5 11.1l3.75 2.16v4.33l-3.75 2.16l-3.75-2.16v-4.33z"/></svg>`,!0),n(i),oe(2),n(r);var a=z(r,2),o=e=>{var t=RN(),r=W(t);let i;var a=W(r),o=z(W(a),2),s=M(o,!0);n(a),n(r);var u=z(r,2);let d;var p=W(u),m=z(W(p),2),h=M(m,!0);n(p),n(u),n(t),H((e,t)=>{i=J(r,1,`markstream-svelte-enhanced-block__action mode-btn infographic-mode-btn`,null,i,{"is-active":!E(pe)}),c(s,e),d=J(u,1,`markstream-svelte-enhanced-block__action mode-btn infographic-mode-btn`,null,d,{"is-active":E(pe)}),c(h,t)},[()=>w(`common.preview`),()=>w(`common.source`)]),f(`blur`,r,()=>$()),l(`click`,r,()=>Le(`preview`)),f(`focus`,r,e=>Ve(e,w(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>$()),f(`mouseenter`,r,e=>Ve(e,w(`common.preview`)||`Preview`)),f(`blur`,u,()=>$()),l(`click`,u,()=>Le(`source`)),f(`focus`,u,e=>Ve(e,w(`common.source`)||`Source`)),f(`mouseleave`,u,()=>$()),f(`mouseenter`,u,e=>Ve(e,w(`common.source`)||`Source`)),y(e,t)};h(a,e=>{m()&&e(o)});var s=z(a,2),u=W(s),d=e=>{var t=zN(),r=W(t);let i;n(t),H(e=>{B(t,`aria-label`,e),B(t,`aria-pressed`,E(fe)),i=j(r,``,i,{transform:E(fe)?`rotate(0deg)`:`rotate(90deg)`})},[()=>E(fe)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`]),f(`blur`,t,()=>$()),l(`click`,t,Re),f(`focus`,t,e=>Ve(e,E(fe)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>Ve(e,E(fe)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`)),y(e,t)};h(u,e=>{_()&&e(d)});var p=z(u,2),v=e=>{var t=HN(),r=W(t),i=e=>{var t=BN();y(e,t)},a=e=>{var t=VN();y(e,t)};h(r,e=>{E(K)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(K)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`]),f(`blur`,t,()=>$()),l(`click`,t,Ne),f(`focus`,t,He),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,He),y(e,t)};h(p,e=>{g()&&e(v)});var x=z(p,2),C=e=>{var t=UN();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(pe)||E(fe)},[()=>w(`common.export`)||`Export`]),f(`blur`,t,()=>$()),l(`click`,t,Fe),f(`focus`,t,e=>Ve(e,w(`common.export`)||`Export`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>Ve(e,w(`common.export`)||`Export`)),y(e,t)};h(x,e=>{b()&&e(C)});var T=z(x,2),D=e=>{var t=WN();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(pe)||E(fe)},[()=>w(`common.open`)||`Open`]),f(`blur`,t,()=>$()),l(`click`,t,Ie),f(`focus`,t,e=>Ve(e,w(`common.open`)||`Open`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>Ve(e,w(`common.open`)||`Open`)),y(e,t)};h(T,e=>{S()&&e(D)}),n(s),n(t),y(e,t)};h(i,e=>{p()&&e(a)});var o=z(i,2),s=e=>{var t=ZN(),r=W(t),i=e=>{var t=KN(),r=W(t),i=W(r),a=M(i,!0);n(r),n(t),H(()=>c(a,E(ye))),y(e,t)},a=e=>{var t=XN(),r=q(t),i=e=>{var t=qN(),r=W(t),i=z(r,2),a=z(i,2),o=M(a);n(t),H((e,t,n)=>{B(r,`aria-label`,e),B(i,`aria-label`,t),c(o,`${n??``}%`)},[()=>w(`common.zoomIn`)||`Zoom in`,()=>w(`common.zoomOut`)||`Zoom out`,()=>Math.round(E(_e)*100)]),f(`blur`,r,()=>$()),l(`click`,r,ze),f(`focus`,r,e=>Ve(e,w(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>$()),f(`mouseenter`,r,e=>Ve(e,w(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>$()),l(`click`,i,Be),f(`focus`,i,e=>Ve(e,w(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>$()),f(`mouseenter`,i,e=>Ve(e,w(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>$()),l(`click`,a,()=>F(_e,1)),f(`focus`,a,e=>Ve(e,w(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>$()),f(`mouseenter`,a,e=>Ve(e,w(`common.resetZoom`)||`Reset zoom`)),y(e,t)};h(r,e=>{C()&&e(i)});var a=z(r,2),o=W(a),s=e=>{var t=JN(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(ye))),y(e,t)};h(o,e=>{!E(G)&&!E(L)&&e(s)});var u=z(o,2);se(u,e=>F(T,e),()=>E(T));var d=z(u,2),p=e=>{var t=YN(),n=M(t,!0);H(()=>c(n,E(L))),y(e,t)};h(d,e=>{E(L)&&e(p)}),n(a),H(()=>{j(a,E(Ee)),j(u,E(De))}),y(e,t)};h(r,e=>{E(pe)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(fe)||e(s)});var u=z(o,2),d=e=>{var t=QN();let r;var i=W(t),a=W(i),o=W(a),s=W(o),u=z(s,2),d=z(u,2),f=M(d),p=z(d,2);n(o);var m=z(o,2),h=W(m);ae(h,()=>E(ge),!0),n(h),n(m),n(a),n(i),n(t),me(t,e=>Ue?.(e)),H((e,n,i,a,o)=>{r=J(t,1,`markstream-svelte markstream-svelte-modal-root`,null,r,{dark:E(X)}),B(s,`aria-label`,e),B(u,`aria-label`,n),B(d,`aria-label`,i),c(f,`${a??``}%`),B(p,`aria-label`,o),j(h,`transform: scale(${E(_e)});`)},[()=>w(`common.zoomIn`)||`Zoom in`,()=>w(`common.zoomOut`)||`Zoom out`,()=>w(`common.resetZoom`)||`Reset zoom`,()=>Math.round(E(_e)*100),()=>w(`common.close`)||`Close`]),l(`click`,i,Ge),l(`keydown`,i,Z),l(`click`,s,ze),l(`click`,u,Be),l(`click`,d,()=>F(_e,1)),l(`click`,p,We),y(e,t)};h(u,e=>{E(he)&&e(d)}),n(t),se(t,e=>F(D,e),()=>E(D)),H(()=>{r=J(t,1,`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--infographic`,null,r,{dark:E(X),"is-rendering":E(re)||E(xe)}),B(t,`data-markstream-mode`,E(pe)?`source`:E(G)?`preview`:`fallback`)}),y(e,t)};h(qe,e=>{E(Oe)&&e(Je)}),y(t,Ke),x()}T([`click`,`keydown`]);function tP({nextContent:e,previousContent:t,typewriterEnabled:n}){return!n||e===t?{settledContent:e,streamedDelta:``,appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:``,appended:!1}}function nP(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.max(n,r):t}function rP(e,t){let n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var iP=2048;function aP(){return typeof performance<`u`?performance.now():Date.now()}var oP=class{constructor(e={},t){this.source=``,this.visible=``,this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges=[],this.atomicRevealRangeIndex=0,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=e=>this.destroyed?()=>{}:(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.enqueue=e=>{if(this.destroyed||!e)return;this.done&&=!1;let t=this.source.length>0,n=this.pendingChars<=0,r=this.isRevealBlocked();if(this.source+=e,this.scanAppendedSource(),n||r&&!this.isRevealBlocked()){let e=aP();this.startedAt=t&&this.hasStarted?e-this.normalizedStartDelayMs:e,this.lastTick=e,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(e={})=>{if(!this.destroyed){if(this.done=!0,this.releaseTrailingFenceCandidate(),e.flush??this.flushOnFinish){this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.releaseTrailingFenceCandidate(),this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(e=``,t)=>{if(this.destroyed)return;this.cancelLoop(),t?.prefixKnown||e.startsWith(this.source)?(this.source=e,this.scanAppendedSource()):(this.resetFenceScanner(),this.source=e,this.scanAppendedSource());let n=this.getRevealableEnd();this.visible=n>=this.source.length?this.source:this.source.slice(0,n),this.discardConsumedAtomicRanges(),this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;let e=aP();this.lastTick=e,this.startedAt||=e,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=e=>{if(this.rafId=0,this.destroyed||this.paused)return;if(!this.hasRevealableChars()){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(e-this.startedAt<this.normalizedStartDelayMs){this.rafId=requestAnimationFrame(this.tick);return}let t=this.pendingChars;if(this.burstInitialContent&&t>=this.burstRevealThresholdChars){let e=this.getRevealableEnd();this.visible.length<e&&(this.visible=e>=this.source.length?this.source:this.source.slice(0,e),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()),this.ensureLoop();return}let n=1e3/Math.max(1,this.maxCommitFps),r=Math.min(100,Math.max(0,e-this.lastTick));if(r<n){this.rafId=requestAnimationFrame(this.tick);return}this.lastTick=e;let i=this.pendingChars,a=i>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,o=uP(i/Math.max(.001,a/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(o-this.currentCps)*.2,this.charBudget+=this.currentCps*(r/1e3),this.charBudget<1){this.ensureLoop();return}let s=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),c=this.takeNextRevealSlice(s);c.text&&(this.visible+=c.text,this.charBudget=Math.max(0,this.charBudget-c.graphemeCount),this.emit()),this.ensureLoop()};let{minCharsPerSecond:n=40,maxCharsPerSecond:r=1e3,targetLatencyMs:i=900,catchUpLatencyMs:a=350,catchUpThreshold:o=600,maxCommitFps:s=30,startDelayMs:c=80,maxCharsPerCommit:l=80,flushOnFinish:u=!1,burstInitialContent:d=!1,burstRevealThresholdChars:f=iP}=e;this.minCharsPerSecond=nP(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,nP(r,1e3,1)),this.normalizedTargetLatencyMs=nP(i,900,1),this.normalizedCatchUpLatencyMs=nP(a,350,1),this.normalizedCatchUpThreshold=rP(o,600),this.normalizedStartDelayMs=rP(c,80),this.maxCommitFps=Math.trunc(nP(s,30,1)),this.maxCharsPerCommit=Math.trunc(nP(l,80,1)),this.flushOnFinish=u,this.burstInitialContent=d===!0,this.burstRevealThresholdChars=Math.max(1,Math.trunc(nP(f,iP,1))),this.segmenter=cP(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}resetFenceScanner(){this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges.length=0,this.atomicRevealRangeIndex=0}scanAppendedSource(e=!1){for(;this.fenceScanOffset<this.source.length;){let t=this.source[this.fenceScanOffset];if(t===`\r`){if(this.fenceScanOffset+1>=this.source.length&&!e)break;if(this.source[this.fenceScanOffset+1]===`
212
+ `:``}${n}`;return t}var D=X(),O=q(D),A=e=>{var r=hM();let i;var s=W(r),d=e=>{var t=mM(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(v))),y(e,t)};h(s,e=>{E(g)&&e(d)});var _=z(s),x=M(_,!0);n(r),H((e,t,n)=>{B(r,`data-markstream-code-block`,a()?`1`:void 0),B(r,`data-markstream-language`,E(l)||void 0),B(r,`data-markstream-loading`,E(p)?`1`:void 0),B(r,`data-markstream-diff`,E(f)?`1`:void 0),B(r,`data-markstream-original`,e),B(r,`data-markstream-updated`,t),B(r,`data-markstream-line-numbers`,E(g)?`1`:void 0),B(r,`aria-busy`,E(p)?`true`:void 0),i=Y(r,1,n,null,i,{"markstream-pre--line-numbers":E(g)}),j(r,E(C)||void 0),c(x,E(m))},[()=>E(f)?wA(_A(t.node?.originalCode)):void 0,()=>E(f)?wA(_A(t.node?.updatedCode)):void 0,()=>b([E(u)?`language-${E(u)}`:``,o()].filter(Boolean).join(` `)||void 0)]),y(e,r)},ee=I(()=>!(E(p)&&!E(d).trim()));h(O,e=>{E(ee)&&e(A)}),y(e,D),x()}async function _M(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),!0}catch{return!1}finally{t.remove()}}function vM(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function yM(e,t){if(!e||typeof document>`u`||typeof URL>`u`)return;let n=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function bM(e,t){return e==null||e===``?t??null:typeof e==`number`?`${e}px`:String(e)}var xM=w(`<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),SM=w(`<svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),CM=r(`<button type="button" class="code-action-btn"><!></button>`),wM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14"></path></svg></button> <button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8m0-5v5h5"></path></svg></button> <button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7-7v14"></path></svg></button>`,1),TM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg></button>`),EM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg></button>`),DM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),OM=r(`<div class="code-block-header"><div class="code-block-header__meta"><span class="code-block-language-icon" aria-hidden="true"></span> <span class="code-block-header__label"> </span></div> <div class="code-block-header__actions"><!> <!> <!> <!> <!></div></div>`),kM=r(`<div></div>`),AM=r(`<div><!> <div><!></div></div>`),jM=r(`<div data-markstream-code-block="1"><!> <!> <!></div>`);function MM(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`isDark`,3,void 0),o=k(t,`loading`,3,void 0),s=k(t,`stream`,3,void 0),u=k(t,`codeBlockOptions`,3,void 0),d=k(t,`theme`,3,void 0),p=k(t,`darkTheme`,3,void 0),m=k(t,`lightTheme`,3,void 0),g=k(t,`themes`,3,void 0),_=k(t,`minWidth`,3,void 0),b=k(t,`maxWidth`,3,void 0),S=k(t,`isShowPreview`,3,!0),C=k(t,`enableFontSizeControl`,3,!0),w=k(t,`showHeader`,3,!0),T=k(t,`showCopyButton`,3,!0),D=k(t,`showExpandButton`,3,!0),O=k(t,`showPreviewButton`,3,!0),A=k(t,`showCollapseButton`,3,!0),ee=k(t,`showFontSizeButtons`,3,!0),te=k(t,`showLineNumbers`,3,void 0),N=k(t,`htmlPreviewAllowScripts`,3,!1),P=k(t,`htmlPreviewSandbox`,3,void 0),{t:L}=Aj(),re=[`javascript`,`plaintext`,`shellscript`,`typescript`];function ie(e){let t=(e instanceof Error?e.message:String(e??``)).match(/Language `([^`]+)` is not included/)?.[1];return t&&lM(t)?t:``}function R(e){let t=ie(e);if(t){F(he,t,!0),F(me,!1),U(t);return}F(he,E(Ve),!0),F(me,!0)}function oe(e){let t=e.trim().split(/\s+/)[0]?.split(`:`)[0]?.toLowerCase()||``;return t.length>=3&&re.some(e=>e!==t&&e.startsWith(t))}function U(e){if(E(Pe))return;let t=()=>{if(F(Pe,null),E(xe)){if(E(Ve)!==e&&!lM(E(Ve))&&!oe(E(Ve))&&!E(dt)&&!E(pt)){F(he,``),Mt();return}F(Pe,setTimeout(t,50),!0)}};F(Pe,setTimeout(t,50),!0)}let le=V(null),G=V(null),K=V(null),fe=V(null),pe=V(!1),me=V(!1),he=V(``),ge=V(null),_e=V(null),ve=V(!1),ye=V(!1),be=V(null),xe=V(!1),Z=V(!1),Se=V(!1),Ce=V(!1),we=V(!1),Te=V(12),Ee=V(null),De=V(0),Oe=V(null),ke=V(J([])),Ae=V(null),je=V(null),Me=V(``),Ne,Pe=V(null),Fe=V(null),Ie=V(null),Le=V(``),Re=V(null),ze=V(null),Be=V(!1),Ve=I(()=>_A(t.node?.language).trim()),He=I(()=>sM(E(Ve))),Ue=I(()=>cM(E(He)||E(Ve)||`plaintext`)),We=I(()=>vt(t.node)),Ge=I(()=>!!t.node?.diff),Ke=I(()=>_A(t.node?.originalCode)),Q=I(()=>_A(t.node?.updatedCode)),qe=I(()=>t.node?.loading===!0),Je=I(()=>o()??E(qe)),Ye=I(()=>s()??r()?.codeBlockStream??!0),Xe=I(()=>a()??r()?.isDark??!1),Ze=I(()=>r()?.codeBlockThemes),Qe=I(()=>u()??r()?.codeBlockOptions),$e=I(()=>te()??E(Qe)?.disableLineNumbers!==!0),et=I(()=>{let e=E(Qe)?.parseDiffOptions;return{options:{...E(Qe)??{}},parseDiffOptions:e&&typeof e==`object`?{...e}:e,showLineNumbers:E($e)}}),tt=I(Ot),nt=I(Et),rt=I(()=>yt(E(Qe)?.fontSize)??12),it=I(()=>bM(_()??E(Ze)?.minWidth)),at=I(()=>bM(b()??E(Ze)?.maxWidth)),ot=I(()=>[E(it)?`min-width: ${E(it)}`:``,E(at)?`max-width: ${E(at)}`:``].filter(Boolean).join(`; `)),st=I(()=>uM(E(He)||E(Ve)||`plain`)),ct=I(()=>dM[E(He)]||(E(Ve)?E(Ve).toUpperCase():dM[``])),lt=I(()=>S()!==!1&&(E(He)===`html`||E(He)===`svg`)),ut=I(()=>E(He)===`svg`?L(`artifacts.svgPreviewTitle`):L(`artifacts.htmlPreviewTitle`)),dt=I(()=>E(Ye)===!1&&E(Je)),ft=I(()=>r()?.final===!1||E(Je)),pt=I(()=>E(Ye)!==!1&&E(ft)&&(lM(E(Ve))||oe(E(Ve)))),mt=I(()=>!(E(Je)&&!E(We).trim())),ht=I(()=>({...t.node,code:E(We),loading:E(Je)})),gt=I(wt),_t=I(()=>E(Ge)?`${E(Ue)}\0${E(Ke)}\0${E(Q)||E(We)}`:`${E(Ue)}\0${E(We)}`);de(()=>{E(me)&&E(he)&&E(Ve)!==E(he)&&lM(E(he))&&(F(me,!1),F(he,``))}),de(()=>{E(xe),E(Je),E(_t),E(dt),E(pt),E(xe)&&E(Je)===!1&&!E(dt)&&!E(pt)&&E(_t)!==E(Le)&&(F(Le,E(_t),!0),zt())}),de(()=>{E(xe),E(le),E(mt),E(Z),E(dt),E(pt),E(Ge),E(We),E(Ke),E(Q),E(Ue),E(nt),E(tt),E(Qe),E(et),E(Te),E(Se),E(xe)&&(Ne!==E(et)&&(Ne=E(et),F(Te,E(rt),!0),Vt()),Mt())}),ue(()=>{F(xe,!0),F(Te,E(rt),!0)}),ce(()=>{F(xe,!1),F(De,E(De)+1),E(Ee)&&clearTimeout(E(Ee)),E(Pe)&&clearTimeout(E(Pe)),E(Ie)&&clearTimeout(E(Ie)),qt(),Vt()});function vt(e){return e?.diff?_A(e?.updatedCode??e?.code):_A(e?.code)}function yt(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}function bt(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function xt(){return yt(E(Qe)?.lineHeight)??(E(Te)===12?18:Math.max(12,Math.round(E(Te)*1.5)))}function St(){let e=E(Qe)?.padding,t=E(Ge)?0:8,n=bt(e)??t;return{top:n,bottom:n}}function Ct(){return typeof E(Qe)?.fontFamily==`string`&&E(Qe).fontFamily.trim()?E(Qe).fontFamily.trim():`"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace`}function wt(){let e=St(),t=Ct(),n=yt(E(Qe)?.tabSize)??4,r=xt();return[`--markstream-code-font-family: ${t}`,`--vscode-editor-font-size: ${E(Te)}px`,`--vscode-editor-line-height: ${r}px`,`--markstream-code-padding-y: ${e.top}px`,`--markstream-pre-line-number-top: ${e.top}px`,`font-family: ${t}`,`font-size: ${E(Te)}px`,`line-height: ${r}px`,`padding-top: ${e.top}px`,`padding-right: var(--markstream-code-padding-x, 12px)`,`padding-bottom: ${e.bottom}px`,`padding-left: var(--markstream-code-padding-left, 52px)`,`tab-size: ${n}`,`max-height: ${$()}px`,`overflow: auto`,`white-space: ${E(Qe)?.overflow===`scroll`?`pre`:`pre-wrap`}`].join(`; `)}function Tt(e){return!!e&&typeof e==`object`&&typeof e.dark==`string`&&typeof e.light==`string`}function Et(){return typeof d()==`string`&&d()?d():Tt(d())?E(Xe)?d().dark:d().light:(E(Xe)?p():m())||(g()?E(Xe)?g()[0]:g()[1]:(E(Xe)?E(Ze)?.darkTheme:E(Ze)?.lightTheme)||(E(Ze)?.themes?E(Xe)?E(Ze).themes[0]:E(Ze).themes[1]:E(Xe)?`vitesse-dark`:`vitesse-light`))}function Dt(){return[p()??g()?.[0]??E(Ze)?.darkTheme??E(Ze)?.themes?.[0]??`vitesse-dark`,m()??g()?.[1]??E(Ze)?.lightTheme??E(Ze)?.themes?.[1]??`vitesse-light`]}function Ot(){let e={...E(Qe)??{}};for(let t of[`maxHeight`,`padding`,`tabSize`,`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete e[t];let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n=E(Ge)?{diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,...e,parseDiffOptions:{context:2,...t}}:e,r=typeof n.unsafeCSS==`string`?n.unsafeCSS:``;return{overflow:`wrap`,...n,MAX_HEIGHT:E(Se)?900:E(Qe)?.maxHeight??500,fontFamily:Ct(),fontSize:E(Te),lineHeight:xt(),disableLineNumbers:!E($e),unsafeCSS:`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }
213
+ ${r}`.trim(),disableFileHeader:!0,stream:!1,themes:Dt(),themeType:E(Xe)?`dark`:`light`,onThemeChange(){Ut(),Wt()}}}function kt(){let e={...E(tt),theme:E(nt)};if(!E(K))return F(K,e,!0),E(K);for(let t of Object.keys(E(K)))t in e||delete E(K)[t];return Object.assign(E(K),e),E(K)}async function At(){if(E(G)||E(me)||typeof window>`u`)return;if(E(fe))return E(fe);let e=E(De),t=(async()=>{let t=await Lj();if(E(xe)&&E(De)===e){if(!t||typeof t.createCodeBlockRuntime!=`function`){F(me,!0);return}F(G,t.createCodeBlockRuntime(kt()),!0),await Promise.resolve(E(G).setTheme?.(E(nt))),E(xe)&&E(De)===e&&F(Me,E(nt),!0)}})().finally(()=>{E(fe)===t&&F(fe,null)});return F(fe,t,!0),t}function jt(){E(G)&&E(nt)&&E(nt)!==E(Me)&&(F(Me,E(nt),!0),Promise.resolve(E(G).setTheme?.(E(nt))).catch(e=>{typeof console<`u`&&console.warn(`[markstream-svelte] Failed to apply code-block theme:`,e)}))}async function Mt(){if(!E(xe)||!E(mt)||!E(le)||E(Z)||E(dt)||E(pt))return;let e=E(De);try{await At()}catch(t){E(xe)&&E(De)===e&&R(t);return}if(!E(xe)||E(De)!==e||E(me)||!E(G))return;kt();let t=E(Ge)?`diff`:`single`;if((!((t===`diff`?E(G).getDiffEditorView?.():E(G).getEditorView?.())&&Nt(t))||E(ge)!==t||E(_e)!==!1)&&(await Lt(t),!E(xe)||E(me)||!E(G)||!Nt(t)||E(ge)!==t))return;let n=E(De);try{E(Ge)&&typeof E(G).updateDiff==`function`?await Promise.resolve(E(G).updateDiff(E(Ke),E(Q)||E(We),E(Ue))):typeof E(G).updateCode==`function`&&(await Promise.resolve(E(G).updateCode(E(We),E(Ue))),Kt()),!E(pe)&&await It(t,E(De))&&(F(ve,!0),F(ye,!0),F(pe,!0)),jt(),Ht(),Wt()}catch(e){E(xe)&&E(De)===n&&R(e)}}function Nt(e){if(!E(le))return!1;let t=[`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`);return!!E(le).querySelector(t)}function Pt(){return E(le)?.querySelector([`diffs-container`,`[data-stream-diffs-state]`,`.stream-diffs-shell`].join(`,`))??null}function Ft(e,t=!1){if(!E(le)||!Nt(e))return!1;if(t){let e=window.getComputedStyle(E(le));if(e.display===`none`||e.visibility===`hidden`||Number.parseFloat(e.opacity||`1`)<=.01)return!1}let n=Pt();if(!n)return!1;let r=n.getBoundingClientRect();if(r.width<=0||r.height<=0)return!1;let i=window.getComputedStyle(n);return i.display!==`none`&&i.visibility!==`hidden`&&Number.parseFloat(i.opacity||`1`)>.01}async function It(e,t){await v();let n=Date.now()+1500,r=0;for(;Date.now()<n&&r<30;){if(r+=1,!E(xe)||!E(le)||E(De)!==t)return!1;if(Zt(!0),await Bt(),Ft(e))return Zt(!0),await Bt(),Ft(e)}return!!(E(xe)&&E(le)&&E(De)===t&&Ft(e))}async function Lt(e){if(!E(le)||!E(G)||E(be))return E(be);let t=E(G),n=ne(De);F(pe,!1);let r=(async()=>{try{if(Vt(!1),!E(xe)||!E(le)||E(De)!==n||E(G)!==t)return;if(E(le).replaceChildren(),F(Ae,null),F(je,null),F(_e,!1),e===`diff`&&typeof t.createDiffEditor==`function`){if(await t.createDiffEditor(E(le),E(Ke),E(Q)||E(We),E(Ue)),!E(xe)||E(De)!==n||E(G)!==t||(await Promise.resolve(t.updateDiff?.(E(Ke),E(Q)||E(We),E(Ue))),!E(xe)||E(De)!==n||E(G)!==t))return;F(ge,`diff`)}else{if(await t.createEditor(E(le),E(We),E(Ue)),!E(xe)||E(De)!==n||E(G)!==t||(await Promise.resolve(t.updateCode?.(E(We),E(Ue))),!E(xe)||E(De)!==n||E(G)!==t))return;F(ge,`single`)}if(Ht(),Yt(),jt(),!await It(e,n))return;F(ve,!0),F(ye,!0),F(pe,!0),Wt()}catch(e){E(xe)&&E(De)===n&&E(G)===t&&R(e)}})().finally(()=>{E(be)===r&&F(be,null)});return F(be,r,!0),r}function Rt(){return E(Fe)||F(Fe,(async()=>{if(await v(),await Bt(),E(be))try{await E(be)}catch{}if(!E(xe)||!E(mt)||!E(le)||E(Z)||E(dt)||E(pt)||(await At(),!E(xe)||E(me)||!E(G)))return;kt();let e=E(Ge)?`diff`:`single`;if((!Nt(e)||E(ge)!==e)&&await Lt(e),E(xe)&&!E(me)&&E(G)&&Nt(e)&&E(ge)===e){if(E(Ge)){await Promise.resolve(E(G).updateDiff?.(E(Ke),E(Q)||E(We),E(Ue))),E(G).refreshDiffPresentation?.(),Ht(),Wt();return}await Promise.resolve(E(G).updateCode?.(E(We),E(Ue))),Kt(140,!0),Ht(),Wt()}})().finally(()=>{F(Fe,null)}),!0),E(Fe)}function zt(){E(Ie)&&clearTimeout(E(Ie)),F(Ie,setTimeout(()=>{F(Ie,null),Rt()},80),!0)}function Bt(){return typeof window>`u`||typeof window.requestAnimationFrame!=`function`?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e()))}function Vt(e=!0){e&&(F(De,E(De)+1),F(be,null),F(fe,null)),Xt(),Gt();try{e?E(G)?.cleanupEditor?.():(E(G)?.safeClean||E(G)?.cleanupEditor)?.()}catch{}F(ge,null),F(_e,null),F(ve,!1),F(ye,!1),F(pe,!1),F(Ae,null),F(je,null),e&&(F(G,null),F(K,null),F(fe,null),F(Me,``))}function Ht(){(E(Ge)?E(G)?.getDiffEditorView?.():E(G)?.getEditorView?.())?.updateOptions?.({fontSize:E(Te)}),Ut(),Wt()}function Ut(){if(!E(le))return;let e=yt(E(Qe)?.tabSize)??4;E(le).style.setProperty(`--diffs-tab-size`,String(e)),typeof E(Qe)?.padding==`number`?E(le).style.setProperty(`--diffs-gap-block`,`${St().top}px`):E(le).style.removeProperty(`--diffs-gap-block`)}function $(){return E(Qe)?.maxHeight??500}function Wt(){typeof window>`u`||!E(le)||!E(pe)||(E(Oe)??F(Oe,window.requestAnimationFrame(()=>{F(Oe,null),window.requestAnimationFrame(()=>Zt())}),!0))}function Gt(){E(Oe)==null||typeof window>`u`||(window.cancelAnimationFrame(E(Oe)),F(Oe,null))}function Kt(e=140,t=!1){typeof window>`u`||(F(Be,E(Be)||t,!0),E(Re)&&clearTimeout(E(Re)),F(Re,setTimeout(()=>{F(Re,null),E(ze)??F(ze,window.requestAnimationFrame(()=>{let e=E(Be);F(Be,!1),F(ze,null),Jt(e)}),!0)},e),!0))}function qt(){E(Re)&&(clearTimeout(E(Re)),F(Re,null)),F(Be,!1),!(E(ze)==null||typeof window>`u`)&&(window.cancelAnimationFrame(E(ze)),F(ze,null))}function Jt(e=!1){try{let t=E(Ge)?E(G)?.getDiffEditorView?.()?.getModifiedEditor?.():E(G)?.getEditorView?.(),n=t?.getModel?.(),r=n?.forceTokenization;if(e&&!E(Ge)&&typeof n?.setValue==`function`){let e=Number(t?.getScrollTop?.()||0),r=Number(t?.getScrollLeft?.()||0),i=t?.getSelection?.();n.setValue(E(We)),i&&t?.setSelection?.(i),Number.isFinite(e)&&t?.setScrollTop?.(e),Number.isFinite(r)&&t?.setScrollLeft?.(r)}let i=Number(n?.getLineCount?.()||0);if(typeof r!=`function`||!Number.isFinite(i)||i<=0)return;for(let e=1;e<=i;e+=1)r.call(n,e);t?.render?.(!0)}catch{}}function Yt(){Xt();let e=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>Wt());r&&E(ke).push(r)}catch{}};if(E(Ge)){let t=E(G)?.getDiffEditorView?.(),n=t?.getOriginalEditor?.(),r=t?.getModifiedEditor?.();try{let e=t?.onDidUpdateDiff?.(()=>Wt());e&&E(ke).push(e)}catch{}e(n,`onDidContentSizeChange`),e(r,`onDidContentSizeChange`),e(n,`onDidLayoutChange`),e(r,`onDidLayoutChange`);return}let t=E(G)?.getEditorView?.();e(t,`onDidContentSizeChange`),e(t,`onDidLayoutChange`)}function Xt(){for(let e of E(ke))try{typeof e==`function`?e():e?.dispose?.()}catch{}F(ke,[],!0)}function Zt(e=!1){if(!E(le)||!E(G)||!E(pe)&&!e||E(Z))return;let t=$(),n=E(Ge)?tn(E(le))??en():en();if(!n||n<=0)return;let r=Qt(),i=E(Se)||!Number.isFinite(t)?Math.ceil(n):Math.ceil(Math.min(n,t)),a=Math.max(r,i);E(le).style.height=`${a}px`,E(le).style.minHeight=`${a}px`,E(le).style.maxHeight=E(Se)||!Number.isFinite(t)?`none`:`${Math.ceil(t)}px`,E(le).style.overflow=E(Ge)?`hidden`:n>a?`auto`:`hidden`,$t(a)}function Qt(){if(!E(le)||typeof window>`u`)return 0;let e=[window.getComputedStyle(E(le).parentElement||E(le)).minHeight,window.getComputedStyle(E(le)).minHeight];for(let t of e){let e=Number.parseFloat(t);if(Number.isFinite(e)&&e>0)return Math.ceil(e)}return 0}function $t(e){let t=Math.max(0,E(le)?.clientWidth||0),n=Math.ceil(t),r=Math.ceil(e);if(E(Ae)!==n||E(je)!==r){F(Ae,n,!0),F(je,r,!0);try{E(Ge)?E(G)?.getDiffEditorView?.()?.layout?.(t>0?{width:n,height:r}:void 0):E(G)?.getEditorView?.()?.layout?.(t>0?{width:n,height:r}:void 0)}catch{}}}function en(){try{if(E(Ge)){let e=E(G)?.getDiffEditorView?.(),t=e?.getOriginalEditor?.(),n=e?.getModifiedEditor?.(),r=Number(t?.getContentHeight?.()||0),i=Number(n?.getContentHeight?.()||0),a=Math.max(r,i);if(a>0)return Math.ceil(a+1)}let e=E(G)?.getEditorView?.(),t=Number(e?.getContentHeight?.()||0);if(t>0)return Math.ceil(t)}catch{}return null}function tn(e){if(typeof window>`u`)return null;try{let t=e.getBoundingClientRect();if(t.height<=0)return null;let n=e.querySelector([`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`));if(!n)return null;let r=n.getBoundingClientRect().bottom-t.top;return r>0?Math.ceil(r+1):null}catch{return null}}async function nn(){await _M(E(We)),r()?.events?.onCopy?.(E(We)),F(Ce,!0),E(Ee)&&clearTimeout(E(Ee)),F(Ee,setTimeout(()=>{F(Ce,!1)},1e3),!0)}function rn(){C()&&(F(Te,Math.max(10,E(Te)-1),!0),Ht())}function an(){C()&&(F(Te,E(rt),!0),Ht())}function on(){C()&&(F(Te,Math.min(24,E(Te)+1),!0),Ht())}function sn(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(Xe))}function cn(e){sn(e,E(Ce)?L(`common.copied`)||`Copied`:L(`common.copy`)||`Copy`)}var ln=X(),un=q(ln),dn=e=>{var t=jM();let r;var i=W(t),a=e=>{var t=OM(),r=W(t),i=W(r);ae(i,()=>E(st),!0),n(i);var a=z(i,2),o=M(a,!0);n(r);var s=z(r,2),u=W(s),d=e=>{var t=CM(),r=W(t),i=e=>{var t=xM();y(e,t)},a=e=>{var t=SM();y(e,t)};h(r,e=>{E(Ce)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(Ce)?L(`common.copied`):L(`common.copy`)]),f(`blur`,t,()=>Yj()),l(`click`,t,nn),f(`focus`,t,cn),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,cn),y(e,t)};h(u,e=>{T()&&e(d)});var p=z(u,2),m=e=>{var t=wM(),n=q(t),r=z(n,2),i=z(r,2);H((e,t,a)=>{B(n,`aria-label`,e),B(r,`aria-label`,t),B(i,`aria-label`,a)},[()=>L(`common.decrease`),()=>L(`common.reset`),()=>L(`common.increase`)]),f(`blur`,n,()=>Yj()),l(`click`,n,rn),f(`focus`,n,e=>sn(e,L(`common.decrease`)||`Decrease`)),f(`mouseleave`,n,()=>Yj()),f(`mouseenter`,n,e=>sn(e,L(`common.decrease`)||`Decrease`)),f(`blur`,r,()=>Yj()),l(`click`,r,an),f(`focus`,r,e=>sn(e,L(`common.reset`)||`Reset`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>sn(e,L(`common.reset`)||`Reset`)),f(`blur`,i,()=>Yj()),l(`click`,i,on),f(`focus`,i,e=>sn(e,L(`common.increase`)||`Increase`)),f(`mouseleave`,i,()=>Yj()),f(`mouseenter`,i,e=>sn(e,L(`common.increase`)||`Increase`)),y(e,t)};h(p,e=>{ee()&&C()&&e(m)});var g=z(p,2),_=e=>{var t=TM();H(e=>B(t,`aria-label`,e),[()=>L(`common.preview`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(we,!E(we))),f(`focus`,t,e=>sn(e,L(`common.preview`)||`Preview`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>sn(e,L(`common.preview`)||`Preview`)),y(e,t)};h(g,e=>{E(lt)&&O()&&e(_)});var v=z(g,2),b=e=>{var t=EM(),r=W(t),i=M(r);n(t),H(e=>{B(t,`aria-pressed`,E(Se)),B(t,`aria-label`,e),B(i,`d`,E(Se)?`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`)},[()=>E(Se)?L(`common.collapse`):L(`common.expand`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(Se,!E(Se))),f(`focus`,t,e=>sn(e,E(Se)?L(`common.collapse`)||`Collapse`:L(`common.expand`)||`Expand`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>sn(e,E(Se)?L(`common.collapse`)||`Collapse`:L(`common.expand`)||`Expand`)),y(e,t)};h(v,e=>{D()&&e(b)});var x=z(v,2),S=e=>{var t=DM(),r=W(t);let i;n(t),H(e=>{B(t,`aria-pressed`,E(Z)),B(t,`aria-label`,e),i=j(r,``,i,{rotate:E(Z)?`0deg`:`90deg`})},[()=>E(Z)?L(`common.expand`):L(`common.collapse`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(Z,!E(Z))),f(`focus`,t,e=>sn(e,E(Z)?L(`common.expand`)||`Expand`:L(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>sn(e,E(Z)?L(`common.expand`)||`Expand`:L(`common.collapse`)||`Collapse`)),y(e,t)};h(x,e=>{A()&&e(S)}),n(s),n(t),H(()=>c(o,E(Ge)?`Diff / ${E(ct)}`:E(ct))),y(e,t)};h(i,e=>{w()&&e(a)});var o=z(i,2),s=e=>{var t=AM();let r;var i=W(t),a=e=>{var t=kM();let n;se(t,e=>F(le,e),()=>E(le)),H(()=>n=Y(t,1,`code-editor-container`,null,n,{"is-hidden":!E(ve)})),y(e,t)};h(i,e=>{E(dt)||e(a)});var o=z(i,2);let s;gM(W(o),{class:`code-pre-fallback`,enhanceable:!1,get node(){return E(ht)},get showLineNumbers(){return E($e)},get style(){return E(gt)}}),n(o),n(t),H(()=>{r=Y(t,1,`code-block-body`,null,r,{"code-block-body--expanded":E(Se)}),s=Y(o,1,`code-editor-fallback-surface`,null,s,{"is-hidden":E(ye)})}),y(e,t)};h(o,e=>{E(Z)||e(s)});var u=z(o,2),d=e=>{pM(e,{get code(){return E(We)},get title(){return E(ut)},get isDark(){return E(Xe)},get htmlPreviewAllowScripts(){return N()},get htmlPreviewSandbox(){return P()},onClose:()=>F(we,!1)})};h(u,e=>{E(we)&&E(lt)&&e(d)}),n(t),H(()=>{r=Y(t,1,`code-block-container`,null,r,{"is-dark":E(Xe),"is-plain-text":E(Ue)===`plaintext`,"is-rendering":E(Je),"is-diff":E(Ge)}),B(t,`data-markstream-enhanced`,E(pe)&&!E(me)?`true`:`false`),j(t,E(ot))}),y(e,t)};h(un,e=>{E(mt)&&e(dn)}),y(e,ln),x()}T([`click`]);var NM=()=>_e(()=>import(`../chunks/Y--VMh3y.js`),[],import.meta.url),PM=null,FM=NM,IM=null;function LM(e){if(!e)return e;if(e.D2&&typeof e.D2==`function`)return e.D2;if(e.default&&e.default.D2&&typeof e.default.D2==`function`)return e.default.D2;let t=e.default??e;return typeof t==`function`?t:t?.D2&&typeof t.D2==`function`?t.D2:t}async function RM(){if(PM)return PM;if(IM)return await IM;let e=FM;if(!e)return null;IM=(async()=>{let t;try{t=await e()}catch(t){throw e===NM?Error(`Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.`):t}return t?(PM=LM(t),PM):null})();try{return await IM}finally{IM=null}}var zM=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],BM=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function VM(e){return e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function HM(e){if(!e)return``;let t=e.trim();return BM.test(t)?t:``}function UM(e){let t=new Set([`script`]),n=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of n){if(t.has(e.tagName.toLowerCase())){e.remove();continue}let n=Array.from(e.attributes);for(let t of n){let n=t.name;if(/^on/i.test(n)){e.removeAttribute(n);continue}if(n===`style`&&t.value&&zM.some(e=>e.test(t.value))){e.removeAttribute(n);continue}if((n===`href`||n===`xlink:href`)&&t.value){let r=HM(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}function WM(e){if(typeof DOMParser>`u`||!e)return``;let t=VM(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return UM(r),r.outerHTML}function GM(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}var KM=r(`<div class="d2-mode-toggle"><button type="button"> </button> <button type="button"> </button></div>`),qM=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),JM=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),YM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><!></button>`),XM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"></path></svg></button>`),ZM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),QM=r(`<div class="markstream-svelte-enhanced-block__header d2-block-header"><div class="d2-header-title"><span class="d2-label">D2</span></div> <div class="markstream-svelte-enhanced-block__actions d2-header-actions"><!> <!> <!> <!></div></div>`),$M=r(`<p class="d2-error"> </p>`),eN=r(`<div class="d2-source"><pre class="d2-code"><code> </code></pre> <!></div>`),tN=r(`<div class="d2-render"><div class="d2-svg"></div> <!></div>`),nN=r(`<div class="markstream-svelte-enhanced-block__body d2-block-body"><!></div>`),rN=r(`<div data-markstream-d2="1"><!> <!></div>`);function iN(t,r){i(r,!0);let a={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},o=k(r,`context`,3,void 0),s=k(r,`maxHeight`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`themeId`,3,void 0),m=k(r,`darkThemeId`,3,void 0),g=k(r,`showHeader`,3,!0),_=k(r,`showModeToggle`,3,!0),v=k(r,`showCopyButton`,3,!0),b=k(r,`showExportButton`,3,!0),S=k(r,`showCollapseButton`,3,!0),{t:C}=Aj(),w=V(!1),T=V(0),D=V(``),O=V(``),A=V(``),ee=V(``),te=V(!1),N=V(!1),P=V(!1),L=V(!1),re=V(!1),ie=V(!1),R=null,oe=I(()=>_A(r.node?.code)),se=I(()=>u()??r.node?.loading===!0),U=I(()=>d()??o()?.isDark??!1),le=I(()=>!(E(se)&&!E(oe).trim())),G=I(()=>E(ie)||!E(A)),K=I(()=>s()?`max-height: ${s()}; --ms-d2-render-max-height: ${s()}`:``);ue(()=>{F(w,!0),J(!0)}),de(()=>{E(w)&&(fe(),E(re),E(ie),e(()=>{J()}))}),ce(()=>{F(w,!1),F(T,E(T)+1),R&&clearTimeout(R)});async function J(e=!1){if(!E(w)||E(re)||E(ie)||!E(oe).trim())return;let t=fe();if(E(te)){(t!==E(O)||e)&&(F(N,!0),F(P,E(P)||e,!0));return}if(!e&&t===E(D)&&(E(A)||E(ee)))return;let n=ne(T);F(O,t,!0),F(D,t,!0),F(te,!0),F(ee,``);try{let e=await RM();if(!E(w)||n!==E(T))return;let t=pe(e);if(!t||typeof t.compile!=`function`||typeof t.render!=`function`)throw Error(`D2 renderer is not available.`);let r=await t.compile(E(oe)),i=r?.diagram??r,o=r?.renderOptions??r?.options??{},s={...o};s.themeID=E(U)&&m()!=null?m():p()??o.themeID,s.darkThemeID=null,s.darkThemeOverrides=null,E(U)&&(s.themeOverrides={...a,...o.themeOverrides||{}});let c=await t.render(i,s);if(!E(w)||n!==E(T))return;let l=WM(GM(c));if(!l)throw Error(`D2 rendered empty SVG.`);F(A,l.replace(`<svg`,`<svg class="markstream-d2-root-svg"`),!0)}catch(e){n===E(T)&&(F(A,``),F(ee,e instanceof Error?e.message:String(e),!0))}finally{if(n===E(T)&&(F(te,!1),F(O,``),E(N))){let e=E(P);F(N,!1),F(P,!1),J(e)}}}function fe(){return`${E(oe)}\n${E(U)}\n${p()}\n${m()}`}function pe(e){if(typeof e==`function`){let t=new e;if(t&&typeof t.compile==`function`)return t;if(typeof e.compile==`function`)return e}return e?.D2&&typeof e.D2==`function`?new e.D2:typeof e?.compile==`function`?e:null}async function me(){await _M(E(oe)),o()?.events?.onCopy?.(E(oe)),F(L,!0),R&&clearTimeout(R),R=setTimeout(()=>{F(L,!1)},1e3)}function he(){E(A)&&yM(E(A),`d2-diagram-${Date.now()}.svg`)}function ge(e){F(ie,e===`source`),E(ie)||J(!0)}function _e(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(U))}function ve(e){_e(e,E(L)?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`)}var ye=X(),be=q(ye),xe=e=>{var t=rN();let r;var i=W(t),a=e=>{var t=QM(),r=z(W(t),2),i=W(r),a=e=>{var t=KM(),r=W(t);let i;var a=M(r,!0),o=z(r,2);let s;var u=M(o,!0);n(t),H((e,t)=>{i=Y(r,1,`markstream-svelte-enhanced-block__action mode-btn d2-mode-btn`,null,i,{"is-active":!E(ie)}),c(a,e),s=Y(o,1,`markstream-svelte-enhanced-block__action mode-btn d2-mode-btn`,null,s,{"is-active":E(ie)}),c(u,t)},[()=>C(`common.preview`),()=>C(`common.source`)]),f(`blur`,r,()=>Yj()),l(`click`,r,()=>ge(`preview`)),f(`focus`,r,e=>_e(e,C(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>_e(e,C(`common.preview`)||`Preview`)),f(`blur`,o,()=>Yj()),l(`click`,o,()=>ge(`source`)),f(`focus`,o,e=>_e(e,C(`common.source`)||`Source`)),f(`mouseleave`,o,()=>Yj()),f(`mouseenter`,o,e=>_e(e,C(`common.source`)||`Source`)),y(e,t)};h(i,e=>{_()&&e(a)});var o=z(i,2),s=e=>{var t=YM(),r=W(t),i=e=>{var t=qM();y(e,t)},a=e=>{var t=JM();y(e,t)};h(r,e=>{E(L)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(L)?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`]),f(`blur`,t,()=>Yj()),l(`click`,t,me),f(`focus`,t,ve),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,ve),y(e,t)};h(o,e=>{v()&&e(s)});var u=z(o,2),d=e=>{var t=XM();H(e=>B(t,`aria-label`,e),[()=>C(`common.export`)||`Export`]),f(`blur`,t,()=>Yj()),l(`click`,t,he),f(`focus`,t,e=>_e(e,C(`common.export`)||`Export`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>_e(e,C(`common.export`)||`Export`)),y(e,t)};h(u,e=>{b()&&E(A)&&e(d)});var p=z(u,2),m=e=>{var t=ZM(),r=W(t);let i;n(t),H(e=>{B(t,`aria-label`,e),B(t,`aria-pressed`,E(re)),i=j(r,``,i,{transform:E(re)?`rotate(0deg)`:`rotate(90deg)`})},[()=>E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(re,!E(re))),f(`focus`,t,e=>_e(e,E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>_e(e,E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`)),y(e,t)};h(p,e=>{S()&&e(m)}),n(r),n(t),y(e,t)};h(i,e=>{g()&&e(a)});var o=z(i,2),s=e=>{var t=nN(),r=W(t),i=e=>{var t=eN(),r=W(t),i=W(r),a=M(i,!0);n(r);var o=z(r,2),s=e=>{var t=$M(),n=M(t,!0);H(()=>c(n,E(ee))),y(e,t)};h(o,e=>{E(ee)&&e(s)}),n(t),H(()=>c(a,E(oe))),y(e,t)},a=e=>{var t=tN(),r=W(t);ae(r,()=>E(A),!0),n(r);var i=z(r,2),a=e=>{var t=$M(),n=M(t,!0);H(()=>c(n,E(ee))),y(e,t)};h(i,e=>{E(ee)&&e(a)}),n(t),H(()=>j(t,E(K))),y(e,t)};h(r,e=>{E(G)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(re)||e(s)}),n(t),H(()=>{r=Y(t,1,`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--d2`,null,r,{dark:E(U),"is-rendering":E(te)||E(se)}),B(t,`data-markstream-mode`,E(G)?`fallback`:`preview`)}),y(e,t)};h(be,e=>{E(le)&&e(xe)}),y(t,ye),x()}T([`click`]);function aN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var oN=r(`<span class="emoji-node"> </span>`);function sN(e,t){i(t,!0);let n=I(()=>_A(t.node?.raw||t.node?.markup||t.node?.content||t.node?.name));var r=oN(),a=M(r,!0);H(()=>c(a,E(n))),y(e,r),x()}function cN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),a=k(t,`tag`,3,`span`);var o=X(),c=q(o);s(c,a,!1,(e,i)=>{{let e=I(()=>gA(t.node?.children)),o=I(()=>String(r()??a())+`-`+a());mI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(o)}})}}),y(e,o),x()}function lN(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`em`})}function uN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var dN=r(`<a class="footnote-anchor">↩︎</a>`);function fN(e,t){i(t,!0);let n=I(()=>_A(t.node?.id)),r=I(()=>E(n)?`#fnref-${E(n)}`:void 0);function a(e){e.preventDefault(),!(typeof document>`u`||!E(n))&&document.getElementById(`fnref-${E(n)}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}var o=dN();H(()=>{B(o,`href`,E(r)),B(o,`title`,E(n)?`返回引用 ${E(n)}`:void 0)}),l(`click`,o,a),y(e,o),x()}T([`click`]);var pN=r(`<div class="footnote-node"><div class="footnote-node__content"><!></div></div>`);function mN(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>_A(t.node?.id)),s=I(()=>gA(t.node?.children)),c=I(()=>`footnote-${a()??(E(o)||`node`)}`);var l=pN(),u=W(l);mI(W(u),{get nodes(){return E(s)},get context(){return r()},get prefix(){return E(c)}}),n(u),n(l),H(()=>B(l,`id`,E(o)?`fnref--${E(o)}`:void 0)),y(e,l),x()}var hN=r(`<sup class="footnote-reference"><span> </span></sup>`);function gN(e,t){i(t,!0);let r=I(()=>_A(t.node?.id)),a=I(()=>E(r)?`#fnref--${E(r)}`:void 0),o=I(()=>E(a)?{href:E(a)}:{});function s(e){e.preventDefault(),!(typeof document>`u`||!E(r))&&document.querySelector(E(a)||``)?.scrollIntoView({behavior:`smooth`,block:`start`})}var u=hN(),d=W(u);P(d,()=>({...E(o),title:E(r)?`查看脚注 ${E(r)}`:void 0,class:`footnote-link cursor-pointer`}));var f=M(d);n(u),H(()=>{B(u,`id`,E(r)?`fnref-${E(r)}`:void 0),c(f,`[${E(r)??``}]`)}),l(`click`,u,s),y(e,u),x()}T([`click`]);var _N=r(`<br/>`);function vN(e){var t=_N();y(e,t)}function yN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),a=I(()=>xA(t.node?.level)),o=I(()=>`h`+E(a));var c=X(),l=q(c);s(l,()=>E(o),!1,(e,i)=>{P(e,()=>({class:`heading-node heading-${E(a)??``}`}));{let e=I(()=>gA(t.node?.children)),a=I(()=>String(r()??`heading`)+`-heading`);mI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(a)}})}}),y(e,c),x()}function bN(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`mark`})}function xN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function SN(e,t){i(t,!0);let n=I(()=>yj(t.node,t.context));var r=X(),a=q(r);ae(a,()=>E(n)),y(e,r),x()}var CN=r(`<img/>`),wN=r(`<span class="image-shimmer"></span>`),TN=r(`<span class="image-node__raw-text"> </span>`),EN=r(`<span class="image-placeholder"><!></span>`),DN=r(`<span class="image-error"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"></path></svg> <span> </span></span>`),ON=r(`<span class="image-node-container"><!></span>`);function kN(t,r){i(r,!0);let a=k(r,`fallbackSrc`,3,``),o=k(r,`lazy`,3,!1),s=k(r,`usePlaceholder`,3,!0),{t:l}=Aj();function u(e,t,n){return n||e?{src:e,stage:`primary`}:t?{src:t,stage:`fallback`}:{src:``,stage:`failed`}}let p=I(()=>ny(r.node?.src)),m=I(()=>ny(a())),g=I(()=>_A(r.node?.alt)),_=I(()=>_A(r.node?.title)),v=I(()=>_A(r.node?.raw)),b=I(()=>!!r.node?.loading),S=I(()=>!o()),C=e(()=>ny(r.node?.src)),w=e(()=>ny(a())),T=e(()=>!!r.node?.loading),D=u(C,w,T),O=V(J(C)),A=V(J(w)),j=V(J(T)),ee=V(J(D.src)),te=V(J(D.stage)),N=V(!1),P=V(D.stage===`failed`);re(()=>{if(E(p)!==E(O)||E(m)!==E(A)||E(b)!==E(j)){F(O,E(p),!0),F(A,E(m),!0),F(j,E(b),!0);let e=u(E(p),E(m),E(b));F(ee,e.src,!0),F(te,e.stage,!0),F(N,!1),F(P,e.stage===`failed`)}});function L(){if(E(te)===`primary`&&E(m)&&E(m)!==E(ee)){F(ee,E(m),!0),F(te,`fallback`),F(N,!1),F(P,!1);return}F(te,`failed`),F(P,!0),F(N,!1)}function ne(e){let t=e.currentTarget;if(t&&t.naturalWidth===0&&t.naturalHeight===0){L();return}F(N,!0),F(P,!1)}var ie=ON(),R=W(ie),ae=e=>{var t=CN();let n;H(e=>{n=Y(t,1,`image-node__img`,null,n,{"is-loaded":E(S)||E(N),"is-loading":!E(S)&&!E(N)}),B(t,`src`,E(ee)),B(t,`alt`,E(g)),B(t,`title`,E(_)||E(g)||void 0),B(t,`loading`,o()?`lazy`:void 0),B(t,`fetchpriority`,E(S)?`high`:void 0),B(t,`decoding`,E(S)?`sync`:`async`),B(t,`aria-label`,e)},[()=>E(g)||l(`image.preview`)]),f(`error`,t,L),f(`load`,t,ne),d(t),y(e,t)},oe=e=>{var t=EN(),r=W(t),i=e=>{var t=wN();y(e,t)},a=e=>{var t=TN(),n=M(t,!0);H(()=>c(n,E(v))),y(e,t)};h(r,e=>{s()?e(i):e(a,-1)}),n(t),y(e,t)},se=e=>{var t=DN(),r=z(W(t),2),i=M(r,!0);n(t),H(e=>c(i,e),[()=>l(`image.loadError`)]),y(e,t)};h(R,e=>{!E(b)&&!E(P)&&E(ee)?e(ae):E(P)?e(se,-1):e(oe,1)}),n(ie),y(t,ie),x()}var AN=null,jN=null;async function MN(){return jN||(AN||=_e(()=>import(`../chunks/C3mlWJXx.js`).then(e=>{let t=e&&e.default?e.default:e,n=t;return typeof t==`function`&&t.prototype&&t.prototype.render?n=t:e?.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),jN=n,n}),[],import.meta.url).catch(e=>(console.warn(`[markstream-svelte] Failed to load @antv/infographic`,e),null)),await AN)}function NN(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function PN(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(e&&!e.startsWith(`%%`))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}function FN(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`%%`)),n=Math.max(1,t.length),r=PN(e);return r===`gantt`?220+n*28:r===`sequencediagram`?180+n*26:r===`classdiagram`||r===`statediagram`||r===`erdiagram`?180+n*24:r===`flowchart`||r===`graph`?170+n*28:200+n*22}function IN(e){let t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+t*60:360}function LN(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function RN(e,t){return NN(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??t}var zN=r(`<div class="infographic-mode-toggle"><button type="button"><span class="markstream-svelte-enhanced-block__action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg> <span> </span></span></button> <button type="button"><span class="markstream-svelte-enhanced-block__action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 18l6-6l-6-6M8 6l-6 6l6 6"></path></svg> <span> </span></span></button></div>`),BN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),VN=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),HN=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),UN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><!></button>`),WN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10l5 5l5-5"></path></g></svg></button>`),GN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"></path></svg></button>`),KN=r(`<div class="markstream-svelte-enhanced-block__header infographic-block-header"><div class="markstream-svelte-enhanced-block__title"><span class="markstream-svelte-enhanced-block__title-icon icon-slot action-icon" aria-hidden="true"></span> <span class="markstream-svelte-enhanced-block__title-text infographic-label">Infographic</span></div> <!> <div class="markstream-svelte-enhanced-block__actions infographic-header-actions"><!> <!> <!> <!></div></div>`),qN=r(`<div class="infographic-source"><pre class="infographic-source-code"><code> </code></pre></div>`),JN=r(`<div class="markstream-svelte-zoom-controls"><button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action infographic-action-btn infographic-zoom-reset"> </button></div>`),YN=r(`<pre class="infographic-source-code infographic-pending-source"><code> </code></pre>`),XN=r(`<p class="d2-error"> </p>`),ZN=r(`<!> <div class="infographic-render"><!> <div></div> <!></div>`,1),QN=r(`<div class="markstream-svelte-enhanced-block__body infographic-block-body"><!></div>`),$N=r(`<div><div class="mermaid-modal-overlay infographic-modal-overlay" role="dialog" aria-modal="true" tabindex="-1"><div class="mermaid-modal-panel infographic-modal-panel"><div class="mermaid-modal-controls"><button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action infographic-action-btn infographic-zoom-reset"> </button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L6 18M6 6l12 12"></path></svg></button></div> <div class="mermaid-modal-body"><div class="mermaid-modal-content infographic-modal-content"></div></div></div></div></div>`),eP=r(`<div data-markstream-infographic="1"><!> <!> <!></div>`);function tP(t,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`maxHeight`,3,`500px`),s=k(r,`estimatedPreviewHeightPx`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`showHeader`,3,!0),m=k(r,`showModeToggle`,3,!0),g=k(r,`showCopyButton`,3,!0),_=k(r,`showCollapseButton`,3,!0),b=k(r,`showExportButton`,3,!0),S=k(r,`showFullscreenButton`,3,!0),C=k(r,`showZoomControls`,3,!0),{t:w}=Aj(),T=V(null),D=V(null),O=V(!1),A=V(0),ee=V(``),te=V(``),N=V(``),P=V(null),L=V(``),re=V(!1),ie=V(!1),R=V(!1),U=V(!1),le=V(!1),G=V(!1),K=V(!1),J=V(!1),fe=V(!1),me=V(!1),he=V(``),ge=V(1),_e=null,ve=I(()=>_A(r.node?.code)),ye=I(()=>typeof r.node?.loading!=`boolean`||!!r.node?.loading),be=I(()=>u()??E(ye)),xe=I(()=>a()?.final??E(be)===!1),Z=I(()=>E(be)!==!1||E(xe)===!1),Se=I(()=>d()??a()?.isDark??!1),Ce=I(()=>o()===`none`?null:NN(o())),we=I(()=>LN(NN(s())??IN(E(ve)),RN(E(D),360),E(Ce)??void 0)),Te=I(()=>[`min-height: ${E(we)}px`,o()&&o()!==`none`?`max-height: ${o()}`:``].filter(Boolean).join(`; `)),Ee=I(()=>`transform: scale(${E(ge)}); transform-origin: center center;`),De=I(()=>!(E(be)&&!E(ve).trim()));ue(()=>{F(O,!0),Oe(!0)}),de(()=>{E(O)&&(`${E(ve)}${E(Se)}${E(xe)}${E(Z)}`,E(J),E(fe),e(()=>{Oe()}))}),ce(()=>{F(O,!1),F(A,E(A)+1),Ae(),F(ee,``),_e&&clearTimeout(_e)});function Oe(e=!1){E(O)&&E(T)&&!E(J)&&!E(fe)&&E(ve).trim()&&(F(le,E(le)||e,!0),!E(U)&&(F(U,!0),v().then(()=>{F(U,!1);let e=E(le);return F(le,!1),ke(e)})))}async function ke(e=!1){if(!E(O)||!E(T)||E(J)||E(fe))return;if(!E(ve).trim()){Ae(),E(T)&&vM(E(T)),F(G,!1),F(L,``),F(ee,``),F(N,``);return}let t=E(ve),n=E(xe),r=`${t}\n${E(Se)}\n${n}\n${E(Z)}`;if(!e&&r===E(ee)&&E(G)||!e&&r===E(N))return;if(E(re)){(r!==E(te)||e)&&(F(ie,!0),F(R,E(R)||e,!0));return}let i=ne(A);F(te,r);let a=!E(Z);F(re,!0),a&&F(L,``);let o=null,s=null;try{let e=await MN();if(!E(O)||i!==E(A)||E(J)||E(fe)||!E(T))return;if(!e)throw Error(`Infographic renderer is not available.`);if(!(r===`${E(ve)}\n${E(Se)}\n${E(xe)}\n${E(Z)}`||!n&&E(be)&&E(ve).startsWith(t)))return;s=Array.from(E(T).childNodes),o=new e({container:E(T),width:`100%`,height:`100%`});let a=``,c=!1;if(o.on?.(`error`,e=>{a=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:typeof e==`string`?e:e&&typeof e==`object`&&`message`in e?String(e.message??``):String(e??``)).filter(Boolean).join(`; `)}),o.on?.(`rendered`,()=>{c=!0}),o.render(t),a)throw Error(a);let l=Array.from(E(T).childNodes),u=l.length>0&&(l.length!==s.length||l.some((e,t)=>e!==s?.[t]));if(!c&&!u)throw Error(`Infographic render returned empty output.`);E(P)?.destroy?.(),F(P,o,!0),o=null,F(G,!0),F(L,``),F(ee,r),F(N,``)}catch(e){if(i===E(A)){o?.destroy?.(),o=null,F(ee,``);let t=`${E(ve)}\n${E(Se)}\n${E(xe)}\n${E(Z)}`;a&&r===t?(F(N,``),Ae(),vM(E(T)),F(G,!1),F(L,e instanceof Error?e.message:String(e),!0)):(s&&E(T)&&E(T).replaceChildren(...s),r===t&&F(N,r))}}finally{if(o?.destroy?.(),i===E(A)&&(F(re,!1),F(te,``),E(ie))){let e=E(R);F(ie,!1),F(R,!1),Oe(e)}}}function Ae(){try{E(P)?.destroy?.()}catch{}F(P,null)}function je(){F(A,E(A)+1),Ae(),E(T)&&vM(E(T)),F(re,!1),F(ie,!1),F(R,!1),F(U,!1),F(le,!1),F(G,!1),F(L,``),F(te,``),F(ee,``),F(N,``)}async function Me(){await _M(E(ve)),a()?.events?.onCopy?.(E(ve)),F(K,!0),_e&&clearTimeout(_e),_e=setTimeout(()=>{F(K,!1)},1e3)}function Ne(){let e=E(T)?.querySelector(`svg`);return e?WM(e.outerHTML):``}function Pe(){let e=Ne();e&&yM(e,`infographic-${Date.now()}.svg`)}function Fe(){F(he,E(T)?.innerHTML||``,!0),E(he)&&F(me,!0)}async function Ie(e){let t=e===`source`;E(fe)!==t&&(F(fe,t),je(),E(fe)||(await v(),Oe(!0)))}async function Le(){F(J,!E(J)),je(),E(J)||(await v(),Oe(!0))}function Re(){F(ge,Math.min(3,Math.round((E(ge)+.1)*10)/10),!0)}function ze(){F(ge,Math.max(.5,Math.round((E(ge)-.1)*10)/10),!0)}function Be(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(Se))}function Ve(e){Be(e,E(K)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`)}function He(e){return document.body.appendChild(e),{destroy(){e.remove()}}}function Ue(){F(me,!1)}function We(e){e.target===e.currentTarget&&Ue()}function Ge(e){e.key===`Escape`&&Ue()}var Ke=X(),Q=q(Ke),qe=e=>{var t=eP();let r;var i=W(t),a=e=>{var t=KN(),r=W(t),i=W(r);ae(i,()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><path fill="#5b8ff9" d="M5 4.25A2.25 2.25 0 0 1 7.25 2h2.5A2.25 2.25 0 0 1 12 4.25v2.5A2.25 2.25 0 0 1 9.75 9h-2.5A2.25 2.25 0 0 1 5 6.75z"/><path fill="#61d9a6" d="M12 17.25A2.25 2.25 0 0 1 14.25 15h2.5A2.25 2.25 0 0 1 19 17.25v2.5A2.25 2.25 0 0 1 16.75 22h-2.5A2.25 2.25 0 0 1 12 19.75z"/><path fill="#f6bd16" d="M12 4.25A2.25 2.25 0 0 1 14.25 2h2.5A2.25 2.25 0 0 1 19 4.25v2.5A2.25 2.25 0 0 1 16.75 9h-2.5A2.25 2.25 0 0 1 12 6.75z"/><path fill="#5ad8a6" d="M7.5 10.75h1.75a6.25 6.25 0 0 1 6.25 6.25v.25h-2V17a4.25 4.25 0 0 0-4.25-4.25H7.5z"/><path fill="#7262fd" d="M15.5 11.1l3.75 2.16v4.33l-3.75 2.16l-3.75-2.16v-4.33z"/></svg>`,!0),n(i),oe(2),n(r);var a=z(r,2),o=e=>{var t=zN(),r=W(t);let i;var a=W(r),o=z(W(a),2),s=M(o,!0);n(a),n(r);var u=z(r,2);let d;var p=W(u),m=z(W(p),2),h=M(m,!0);n(p),n(u),n(t),H((e,t)=>{i=Y(r,1,`markstream-svelte-enhanced-block__action mode-btn infographic-mode-btn`,null,i,{"is-active":!E(fe)}),c(s,e),d=Y(u,1,`markstream-svelte-enhanced-block__action mode-btn infographic-mode-btn`,null,d,{"is-active":E(fe)}),c(h,t)},[()=>w(`common.preview`),()=>w(`common.source`)]),f(`blur`,r,()=>Yj()),l(`click`,r,()=>Ie(`preview`)),f(`focus`,r,e=>Be(e,w(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>Be(e,w(`common.preview`)||`Preview`)),f(`blur`,u,()=>Yj()),l(`click`,u,()=>Ie(`source`)),f(`focus`,u,e=>Be(e,w(`common.source`)||`Source`)),f(`mouseleave`,u,()=>Yj()),f(`mouseenter`,u,e=>Be(e,w(`common.source`)||`Source`)),y(e,t)};h(a,e=>{m()&&e(o)});var s=z(a,2),u=W(s),d=e=>{var t=BN(),r=W(t);let i;n(t),H(e=>{B(t,`aria-label`,e),B(t,`aria-pressed`,E(J)),i=j(r,``,i,{transform:E(J)?`rotate(0deg)`:`rotate(90deg)`})},[()=>E(J)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`]),f(`blur`,t,()=>Yj()),l(`click`,t,Le),f(`focus`,t,e=>Be(e,E(J)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>Be(e,E(J)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`)),y(e,t)};h(u,e=>{_()&&e(d)});var p=z(u,2),v=e=>{var t=UN(),r=W(t),i=e=>{var t=VN();y(e,t)},a=e=>{var t=HN();y(e,t)};h(r,e=>{E(K)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(K)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`]),f(`blur`,t,()=>Yj()),l(`click`,t,Me),f(`focus`,t,Ve),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,Ve),y(e,t)};h(p,e=>{g()&&e(v)});var x=z(p,2),C=e=>{var t=WN();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(fe)||E(J)},[()=>w(`common.export`)||`Export`]),f(`blur`,t,()=>Yj()),l(`click`,t,Pe),f(`focus`,t,e=>Be(e,w(`common.export`)||`Export`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>Be(e,w(`common.export`)||`Export`)),y(e,t)};h(x,e=>{b()&&e(C)});var T=z(x,2),D=e=>{var t=GN();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(fe)||E(J)},[()=>w(`common.open`)||`Open`]),f(`blur`,t,()=>Yj()),l(`click`,t,Fe),f(`focus`,t,e=>Be(e,w(`common.open`)||`Open`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>Be(e,w(`common.open`)||`Open`)),y(e,t)};h(T,e=>{S()&&e(D)}),n(s),n(t),y(e,t)};h(i,e=>{p()&&e(a)});var o=z(i,2),s=e=>{var t=QN(),r=W(t),i=e=>{var t=qN(),r=W(t),i=W(r),a=M(i,!0);n(r),n(t),H(()=>c(a,E(ve))),y(e,t)},a=e=>{var t=ZN(),r=q(t),i=e=>{var t=JN(),r=W(t),i=z(r,2),a=z(i,2),o=M(a);n(t),H((e,t,n)=>{B(r,`aria-label`,e),B(i,`aria-label`,t),c(o,`${n??``}%`)},[()=>w(`common.zoomIn`)||`Zoom in`,()=>w(`common.zoomOut`)||`Zoom out`,()=>Math.round(E(ge)*100)]),f(`blur`,r,()=>Yj()),l(`click`,r,Re),f(`focus`,r,e=>Be(e,w(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>Be(e,w(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>Yj()),l(`click`,i,ze),f(`focus`,i,e=>Be(e,w(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>Yj()),f(`mouseenter`,i,e=>Be(e,w(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>Yj()),l(`click`,a,()=>F(ge,1)),f(`focus`,a,e=>Be(e,w(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>Yj()),f(`mouseenter`,a,e=>Be(e,w(`common.resetZoom`)||`Reset zoom`)),y(e,t)};h(r,e=>{C()&&e(i)});var a=z(r,2),o=W(a),s=e=>{var t=YN(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(ve))),y(e,t)};h(o,e=>{!E(G)&&!E(L)&&e(s)});var u=z(o,2);se(u,e=>F(T,e),()=>E(T));var d=z(u,2),p=e=>{var t=XN(),n=M(t,!0);H(()=>c(n,E(L))),y(e,t)};h(d,e=>{E(L)&&e(p)}),n(a),H(()=>{j(a,E(Te)),j(u,E(Ee))}),y(e,t)};h(r,e=>{E(fe)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(J)||e(s)});var u=z(o,2),d=e=>{var t=$N();let r;var i=W(t),a=W(i),o=W(a),s=W(o),u=z(s,2),d=z(u,2),f=M(d),p=z(d,2);n(o);var m=z(o,2),h=W(m);ae(h,()=>E(he),!0),n(h),n(m),n(a),n(i),n(t),pe(t,e=>He?.(e)),H((e,n,i,a,o)=>{r=Y(t,1,`markstream-svelte markstream-svelte-modal-root`,null,r,{dark:E(Se)}),B(s,`aria-label`,e),B(u,`aria-label`,n),B(d,`aria-label`,i),c(f,`${a??``}%`),B(p,`aria-label`,o),j(h,`transform: scale(${E(ge)});`)},[()=>w(`common.zoomIn`)||`Zoom in`,()=>w(`common.zoomOut`)||`Zoom out`,()=>w(`common.resetZoom`)||`Reset zoom`,()=>Math.round(E(ge)*100),()=>w(`common.close`)||`Close`]),l(`click`,i,We),l(`keydown`,i,Ge),l(`click`,s,Re),l(`click`,u,ze),l(`click`,d,()=>F(ge,1)),l(`click`,p,Ue),y(e,t)};h(u,e=>{E(me)&&e(d)}),n(t),se(t,e=>F(D,e),()=>E(D)),H(()=>{r=Y(t,1,`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--infographic`,null,r,{dark:E(Se),"is-rendering":E(re)||E(be)}),B(t,`data-markstream-mode`,E(fe)?`source`:E(G)?`preview`:`fallback`)}),y(e,t)};h(Q,e=>{E(De)&&e(qe)}),y(t,Ke),x()}T([`click`,`keydown`]);function nP({nextContent:e,previousContent:t,typewriterEnabled:n}){return!n||e===t?{settledContent:e,streamedDelta:``,appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:``,appended:!1}}function rP(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.max(n,r):t}function iP(e,t){let n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var aP=2048;function oP(){return typeof performance<`u`?performance.now():Date.now()}var sP=class{constructor(e={},t){this.source=``,this.visible=``,this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges=[],this.atomicRevealRangeIndex=0,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=e=>this.destroyed?()=>{}:(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.enqueue=e=>{if(this.destroyed||!e)return;this.done&&=!1;let t=this.source.length>0,n=this.pendingChars<=0,r=this.isRevealBlocked();if(this.source+=e,this.scanAppendedSource(),n||r&&!this.isRevealBlocked()){let e=oP();this.startedAt=t&&this.hasStarted?e-this.normalizedStartDelayMs:e,this.lastTick=e,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(e={})=>{if(!this.destroyed){if(this.done=!0,this.releaseTrailingFenceCandidate(),e.flush??this.flushOnFinish){this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.releaseTrailingFenceCandidate(),this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(e=``,t)=>{if(this.destroyed)return;this.cancelLoop(),t?.prefixKnown||e.startsWith(this.source)?(this.source=e,this.scanAppendedSource()):(this.resetFenceScanner(),this.source=e,this.scanAppendedSource());let n=this.getRevealableEnd();this.visible=n>=this.source.length?this.source:this.source.slice(0,n),this.discardConsumedAtomicRanges(),this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;let e=oP();this.lastTick=e,this.startedAt||=e,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=e=>{if(this.rafId=0,this.destroyed||this.paused)return;if(!this.hasRevealableChars()){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(e-this.startedAt<this.normalizedStartDelayMs){this.rafId=requestAnimationFrame(this.tick);return}let t=this.pendingChars;if(this.burstInitialContent&&t>=this.burstRevealThresholdChars){let e=this.getRevealableEnd();this.visible.length<e&&(this.visible=e>=this.source.length?this.source:this.source.slice(0,e),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()),this.ensureLoop();return}let n=1e3/Math.max(1,this.maxCommitFps),r=Math.min(100,Math.max(0,e-this.lastTick));if(r<n){this.rafId=requestAnimationFrame(this.tick);return}this.lastTick=e;let i=this.pendingChars,a=i>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,o=dP(i/Math.max(.001,a/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(o-this.currentCps)*.2,this.charBudget+=this.currentCps*(r/1e3),this.charBudget<1){this.ensureLoop();return}let s=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),c=this.takeNextRevealSlice(s);c.text&&(this.visible+=c.text,this.charBudget=Math.max(0,this.charBudget-c.graphemeCount),this.emit()),this.ensureLoop()};let{minCharsPerSecond:n=40,maxCharsPerSecond:r=1e3,targetLatencyMs:i=900,catchUpLatencyMs:a=350,catchUpThreshold:o=600,maxCommitFps:s=30,startDelayMs:c=80,maxCharsPerCommit:l=80,flushOnFinish:u=!1,burstInitialContent:d=!1,burstRevealThresholdChars:f=aP}=e;this.minCharsPerSecond=rP(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,rP(r,1e3,1)),this.normalizedTargetLatencyMs=rP(i,900,1),this.normalizedCatchUpLatencyMs=rP(a,350,1),this.normalizedCatchUpThreshold=iP(o,600),this.normalizedStartDelayMs=iP(c,80),this.maxCommitFps=Math.trunc(rP(s,30,1)),this.maxCharsPerCommit=Math.trunc(rP(l,80,1)),this.flushOnFinish=u,this.burstInitialContent=d===!0,this.burstRevealThresholdChars=Math.max(1,Math.trunc(rP(f,aP,1))),this.segmenter=lP(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}resetFenceScanner(){this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges.length=0,this.atomicRevealRangeIndex=0}scanAppendedSource(e=!1){for(;this.fenceScanOffset<this.source.length;){let t=this.source[this.fenceScanOffset];if(t===`\r`){if(this.fenceScanOffset+1>=this.source.length&&!e)break;if(this.source[this.fenceScanOffset+1]===`
214
214
  `){let e=this.fenceScanOffset+2;this.completeFenceLine(e),this.fenceScanOffset=e;continue}}if(t===`
215
- `){let e=this.fenceScanOffset+1;this.completeFenceLine(e),this.fenceScanOffset=e;continue}this.consumeFenceCharacter(t),this.fenceScanOffset++}this.updateFenceRevealBlock()}consumeFenceCharacter(e){if(this.fenceLineState!==`normal`){if(this.fenceLineState===`opening`){this.fenceMarker==="`"&&e==="`"&&(this.fenceLineState=`normal`);return}if(this.fenceLineState===`closing`){e!==` `&&e!==` `&&(this.fenceLineState=`normal`);return}if(!this.fenceMarker){if(e===` `&&this.fenceIndent<3){this.fenceIndent++;return}if(e==="`"||e===`~`){this.fenceMarker=e,this.fenceMarkerLength=1;return}this.fenceLineState=`normal`;return}if(e===this.fenceMarker){this.fenceMarkerLength++;return}if(this.activeFenceMarker){this.fenceLineState=this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(e===` `||e===` `)?`closing`:`normal`;return}this.fenceLineState=this.fenceMarkerLength>=3?`opening`:`normal`}}completeFenceLine(e){let t=this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3;!this.activeFenceMarker&&(this.fenceLineState===`opening`||t)?(this.atomicRevealRanges.push({start:this.fenceLineStart,end:e}),this.activeFenceMarker=this.fenceMarker,this.activeFenceLength=this.fenceMarkerLength):this.activeFenceMarker&&this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(this.fenceLineState===`closing`||t)&&(this.activeFenceMarker=``,this.activeFenceLength=0),this.fenceLineStart=e,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.blockedRevealEnd=0}updateFenceRevealBlock(){this.blockedRevealEnd=!this.activeFenceMarker&&(this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&(this.fenceIndent>0||this.fenceMarkerLength>0))?this.fenceLineStart+1:0}releaseTrailingFenceCandidate(){this.scanAppendedSource(!0),this.blockedRevealEnd&&=((this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3)&&this.source.length>this.fenceLineStart&&this.atomicRevealRanges.push({start:this.fenceLineStart,end:this.source.length}),this.fenceLineState=`normal`,0)}isRevealBlocked(){return this.blockedRevealEnd!==0}getRevealableEnd(){return this.blockedRevealEnd?Math.min(this.source.length,this.blockedRevealEnd-1):this.source.length}hasRevealableChars(){return this.visible.length<this.getRevealableEnd()}takeNextRevealSlice(e){this.discardConsumedAtomicRanges();let t=this.getRevealableEnd();if(this.visible.length>=t)return{text:``,graphemeCount:0};let n=this.atomicRevealRanges[this.atomicRevealRangeIndex];if(n&&this.visible.length>=n.start&&this.visible.length<n.end)return lP(this.source,this.visible.length,n.end-this.visible.length,this.segmenter,Math.min(n.end,t));let r=n&&n.start>this.visible.length?Math.min(n.start,t):t;return lP(this.source,this.visible.length,e,this.segmenter,r)}discardConsumedAtomicRanges(){for(;this.atomicRevealRangeIndex<this.atomicRevealRanges.length&&this.atomicRevealRanges[this.atomicRevealRangeIndex].end<=this.visible.length;)this.atomicRevealRangeIndex++;this.atomicRevealRangeIndex>=64&&this.atomicRevealRangeIndex*2>=this.atomicRevealRanges.length&&(this.atomicRevealRanges.splice(0,this.atomicRevealRangeIndex),this.atomicRevealRangeIndex=0)}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||!this.hasRevealableChars())){if(typeof requestAnimationFrame!=`function`){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&=(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.rafId),0)}emit(){if(!this.destroyed)for(let e of this.listeners)e()}};function sP(e={},t){let n=new oP(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function cP(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function lP(e,t,n,r,i=e.length){let a=Math.min(e.length,Math.max(t,i));if(t>=a||n<=0)return{text:``,graphemeCount:0};if(!r){let r=t,i=0;for(;r<a&&i<n;){let t=e.charCodeAt(r),n=e.charCodeAt(r+1);r=Math.min(a,r+(t>=55296&&t<=56319&&n>=56320&&n<=57343?2:1)),i++}return{text:e.slice(t,r),graphemeCount:i}}let o=t,s=0,c=!0;for(;s<n&&o<a;){let t=e.codePointAt(o),n=t>65535?2:1;if(o+n>a||!fP(t)){c=!1;break}o+=n,s++}if(c&&o>t&&!(o<a&&e.charCodeAt(o-1)===13&&e.charCodeAt(o)===10)){let n=e.codePointAt(o),r=n!=null&&o+(n!=null&&n>65535?2:1)<=a&&fP(n);if(o>=a||r)return{text:e.slice(t,o),graphemeCount:s}}let l=a-t,u=Math.min(l,Math.max(64,n*2));for(;;){let i=u>=l,a=e.slice(t,t+u),o=0,s=0;for(let i of r.segment(a)){if(s>=n)return{text:e.slice(t,t+o),graphemeCount:s};o+=i.segment.length,s++}if(i)return{text:e.slice(t,t+o),graphemeCount:s};u=Math.min(l,u*2)}}function uP(e,t,n){return Math.min(n,Math.max(t,e))}function dP(e){return e>=11904&&e<=12329||e>=12336&&e<=12351||e>=12352&&e<=12440||e>=12443&&e<=12543||e>=12544&&e<=12799||e>=12800&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65437||e>=65440&&e<=65519||e>=127488&&e<=127743||e>=131072&&e<=196607}function fP(e){return e<=127||dP(e)}var pP=r(`<span> </span>`),mP=r(`<code class="inline-code-node"> <!></code>`);function hP(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=``,s=``,l=`markstream-svelte-text__stream-delta--a`,u=I(()=>_A(t.node?.code??t.node?.content??t.node?.raw)),d=I(()=>`${String(r()?.customId??`global`)}:${String(r()?.streamRenderVersion??0)}:${String(a()??`inline-code`)}`),f=I(()=>r()?.fade!==!1),p=I(()=>{let e=r()?.textStreamState,t=E(d)===o?s:e?.get(E(d))??``,n=tP({nextContent:E(u),previousContent:t,typewriterEnabled:E(f)});return n.appended&&(l=l.endsWith(`--a`)?`markstream-svelte-text__stream-delta--b`:`markstream-svelte-text__stream-delta--a`),o=E(d),s=E(u),e?.set(E(d),E(u)),{stableCode:n.settledContent,deltaCode:n.streamedDelta,deltaClass:l}});var m=mP(),g=W(m),_=z(g),v=e=>{var t=pP(),n=M(t,!0);H(()=>{J(t,1,`markstream-svelte-text__stream-delta text-node-stream-delta ${E(p).deltaClass??``}`),c(n,E(p).deltaCode)}),y(e,t)};h(_,e=>{E(p).deltaCode&&e(v)}),n(m),H(()=>c(g,`${E(p).stableCode??``} `)),y(e,m),x()}function gP(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);sN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`ins`})}var _P=r(`<span class="link-loading-indicator"></span>`),vP=r(`<a><span class="link-text-wrapper"><span class="link-text"><!></span><!></span></a>`);function yP(e,t){i(t,!0);let r=I(()=>Ok({href:_A(t.node?.href)},`safe`,`a`).href??``),a=I(()=>_A(t.node?.title||E(r))),o=I(()=>gA(t.node?.children)),s=I(()=>t.showTooltip??t.context?.showTooltips??!0),u=I(()=>E(r).startsWith(`#`)&&E(r).length>1),d=I(()=>ey(E(r)));function p(e){E(s)&&E(a)&&Jj(e.currentTarget,E(a),`top`,!1,void 0,t.context?.isDark)}function m(e){if(!E(u)||typeof document>`u`)return;e.preventDefault();let t=E(r).slice(1),n=g(t);(document.getElementById(t)||(n===t?null:document.getElementById(n)))?.scrollIntoView({behavior:`smooth`,block:`start`})}function g(e){try{return decodeURIComponent(e)}catch{return e}}var _=vP();let v;var b=W(_),S=W(b),w=W(S),T=e=>{{let n=I(()=>String(t.indexKey??`link`)+`-link`);pI(e,{get nodes(){return E(o)},get context(){return t.context},get prefix(){return E(n)}})}},D=e=>{var n=C();H(e=>c(n,e),[()=>_A(t.node?.text||E(r))]),y(e,n)};h(w,e=>{E(o).length?e(T):e(D,-1)}),n(S);var O=z(S),k=e=>{var t=_P();y(e,t)};h(O,e=>{t.node?.loading&&e(k)}),n(b),n(_),H(e=>{v=J(_,1,`link-node`,null,v,{"link-loading":e}),B(_,`href`,E(r)||void 0),B(_,`title`,E(s)?void 0:E(a)),B(_,`target`,E(d)?`_blank`:void 0),B(_,`rel`,E(d)?`noreferrer noopener`:void 0)},[()=>!!t.node?.loading]),f(`blur`,_,()=>$()),l(`click`,_,m),f(`focus`,_,p),f(`mouseleave`,_,()=>$()),f(`mouseenter`,_,p),y(e,_),x()}T([`click`]);var bP=r(`<li><!></li>`);function xP(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0);var o=bP(),s=W(o);{let e=I(()=>gA(t.node?.children)),n=I(()=>String(a()??`li`)+`-li`);pI(s,{get nodes(){return E(e)},get context(){return r()},get prefix(){return E(n)}})}n(o),y(e,o),x()}var SP=r(`<ol><!></ol>`),CP=r(`<ul><!></ul>`);function wP(e,t){i(t,!0);let r=I(()=>!!t.node?.ordered),a=I(()=>Number(t.node?.start));I(()=>E(r)?`ol`:`ul`);var o=Y(),s=q(o),c=e=>{var r=SP(),i=W(r);{let e=I(()=>gA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);pI(i,{get nodes(){return E(e)},get context(){return t.context},get prefix(){return E(n)}})}n(r),H(e=>B(r,`start`,e),[()=>Number.isFinite(E(a))?E(a):void 0]),y(e,r)},l=e=>{var r=CP(),i=W(r);{let e=I(()=>gA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);pI(i,{get nodes(){return E(e)},get context(){return t.context},get prefix(){return E(n)}})}n(r),y(e,r)};h(s,e=>{E(r)?e(c):e(l,-1)}),y(e,o),x()}var TP=null,EP=!1,DP=null,OP=jP;function kP(e){let t=e?.default??e;return t&&typeof t.renderToString==`function`?t:null}function AP(){try{return kP(globalThis?.katex)}catch{return null}}function jP(){return(async()=>{let e=AP();if(e)return e;let t=await ve(()=>import(`../chunks/DecrR9TK.js`),[],import.meta.url);try{await ve(()=>import(`../chunks/Dnkino9G.js`),[],import.meta.url)}catch{}return kP(t)})()}function MP(){return typeof OP==`function`}async function NP(){let e=AP();if(e)return TP=e,TP;if(TP)return TP;if(DP)return await DP;if(EP)return null;let t=OP;if(!t)return EP=!0,null;DP=(async()=>{try{let e=await t(),n=kP(e)??e;if(n)return TP=n,TP}catch{}return EP=!0,null})();try{return await DP}finally{DP=null}}function PP(e){return e?e.replace(/·/g,`⋅`).replace(/℃/g,`°C`):``}var FP=`WORKER_BUSY`,IP=null,LP=new Map,RP=new Map,zP=200,BP=new Set,VP=5;function HP(){if(LP.size>=VP||BP.size===0)return;let e=Array.from(BP);BP.clear();for(let t of e)try{t()}catch{}}function UP(e,t,n){if(RP.set(`${t?`d`:`i`}:${e}`,n),RP.size>zP){let e=RP.keys().next().value;e&&RP.delete(e)}}function WP(){return IP=Error(`[markstream-svelte:katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),IP.name=`WorkerInitError`,IP.code=`WORKER_INIT_ERROR`,null}async function GP(e,t=!0,n=2e3,r){let i=PP(e);if(!MP()){let e=Error(`KaTeX rendering disabled`);return e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,Promise.reject(e)}if(IP)return Promise.reject(IP);let a=`${t?`d`:`i`}:${i}`,o=RP.get(a);if(o)return o;let s=WP();if(!s)return Promise.reject(IP);if(LP.size>=VP){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=FP,e.busy=!0,e.inFlight=LP.size,e.max=VP,Promise.reject(e)}return new Promise((e,a)=>{if(r?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,a(e);return}let o=Math.random().toString(36).slice(2),c=globalThis.setTimeout(()=>{LP.delete(o),HP();let e=Error(`Worker render timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,a(e)},n),l=()=>{globalThis.clearTimeout(c),LP.delete(o)&&HP();let e=Error(`Aborted`);e.name=`AbortError`,a(e)};r?.addEventListener(`abort`,l,{once:!0}),LP.set(o,{timeoutId:c,resolve:t=>{r?.removeEventListener(`abort`,l),e(t)},reject:e=>{r?.removeEventListener(`abort`,l),a(e)}}),s.postMessage({id:o,type:`render`,content:i,displayMode:t})})}function KP(e,t=!0,n){UP(PP(e),t,n)}function qP(e=2e3,t){return LP.size<VP?Promise.resolve():new Promise((n,r)=>{let i=!1,a=null,o=()=>{i||(i=!0,a&&clearTimeout(a),BP.delete(o),n())};if(BP.add(o),a=setTimeout(()=>{if(i)return;i=!0,BP.delete(o);let e=Error(`Wait for worker slot timed out`);e.name=`WorkerBusyTimeout`,e.code=`WORKER_BUSY_TIMEOUT`,r(e)},e),queueMicrotask(()=>HP()),t){let e=()=>{if(i)return;i=!0,a&&clearTimeout(a),BP.delete(o);let e=Error(`Aborted`);e.name=`AbortError`,r(e)};t.aborted?e():t.addEventListener(`abort`,e,{once:!0})}})}var JP={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1},YP=8;async function XP(e,t=!0,n={}){if(!MP()){let e=Error(`KaTeX rendering disabled`);throw e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,e}let r=n.timeout??JP.timeout,i=n.waitTimeout??JP.waitTimeout,a=n.backoffMs??JP.backoffMs,o=n.maxRetries??JP.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),YP)):JP.maxRetries,c=0;for(;;){if(n.signal?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return await GP(e,t,r,n.signal)}catch(e){if(e?.code!==`WORKER_BUSY`||c>=s)throw e;c+=1,await qP(i,n.signal).catch(()=>{}),a>0&&await new Promise(e=>globalThis.setTimeout(e,a*c))}}}var ZP=r(`<div class="math-block markstream-nested-math-block" data-markstream-katex-managed="1"><div></div></div>`);function QP(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>_A(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>_A(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0);de(()=>{E(r)&&f(E(l),E(u),E(d))}),ce(()=>{o=!0,s+=1});async function f(e,t,n){let i=E(r);if(!i)return;let l=PP(e),u=++s;if(!l){i.textContent=``,F(a,!1);return}c||F(a,!0);let d=await p(l,n);o||u!==s||(d?(i.innerHTML=d,c=!0,F(a,!1)):n||(i.textContent=t||l,F(a,!1)))}async function p(e,t){try{return await XP(e,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)return null}let n=await NP();if(!n)return null;try{let r=n.renderToString(e,{throwOnError:t,displayMode:!0});return KP(e,!0,r),r}catch{return null}}var m=ZP(),h=W(m);let g;se(h,e=>F(r,e),()=>E(r)),n(m),H(()=>g=J(h,1,`markstream-nested-math-block__render`,null,g,{"math-rendering":E(a)})),y(e,m),x()}var $P=r(`<span class="math-inline__loading" role="status" aria-live="polite"><span class="math-inline__spinner" aria-hidden="true"></span> <span class="sr-only">Loading</span></span>`),eF=r(`<span class="math-inline-wrapper markstream-nested-math" data-display="inline" data-markstream-katex-managed="1"><span></span> <!></span>`);function tF(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>_A(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>_A(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0),f=I(()=>String(t.node?.markup||``)===`$$`);de(()=>{E(r)&&p(E(l),E(u),E(d),E(f))}),ce(()=>{o=!0,s+=1});async function p(e,t,n,i){let l=E(r);if(!l)return;let u=PP(e),d=++s;if(!u){l.textContent=``,F(a,!1);return}c||F(a,!0);let f=await m(u,i,n);o||d!==s||(f?(l.innerHTML=f,c=!0,F(a,!1)):n||(l.textContent=t||u,F(a,!1)))}async function m(e,t,n){try{return await XP(e,t,{timeout:1500,waitTimeout:0,maxRetries:0})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)return null}let r=await NP();if(!r)return null;try{let i=r.renderToString(e,{throwOnError:n,displayMode:t});return KP(e,t,i),i}catch{return null}}var g=eF(),_=W(g);let v;se(_,e=>F(r,e),()=>E(r));var b=z(_,2),S=e=>{var t=$P();y(e,t)};h(b,e=>{E(a)&&e(S)}),n(g),H(()=>v=J(_,1,`math-inline`,null,v,{"math-inline--hidden":E(a)})),y(e,g),x()}var nF=()=>ve(()=>import(`../chunks/J36u8XLO.js`),[],import.meta.url),rF=`__MARKSTREAM_ANGULAR_MERMAID__`,iF=null,aF=!1,oF=null,sF=null,cF=nF;function lF(e){return`${String(e?.securityLevel??`strict`)}|htmlLabels:${e?.flowchart?.htmlLabels===!1?`0`:`1`}`}function uF(e){if(!e)return e;let t=e?.default??e;if(t&&(typeof t.render==`function`||typeof t.parse==`function`||typeof t.initialize==`function`))return t;if(t?.mermaidAPI&&(typeof t.mermaidAPI.render==`function`||typeof t.mermaidAPI.parse==`function`)){let e=t.mermaidAPI;return{...t,render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:n=>typeof t.initialize==`function`?t.initialize(n):e.initialize?e.initialize(n):void 0}}return e?.mermaid&&typeof e.mermaid.render==`function`?e.mermaid:t}function dF(e){if(e)try{let t=e?.initialize;e.initialize=n=>{let r={suppressErrorRendering:!0,...n||{}};if(typeof t==`function`)return t.call(e,r);if(e?.mermaidAPI&&typeof e.mermaidAPI.initialize==`function`)return e.mermaidAPI.initialize(r)}}catch{}}function fF(e,t){if(!e||!t)return;let n=lF(t);if(oF!==n)try{typeof e.initialize==`function`?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),oF=n}catch{}}function pF(){try{let e=globalThis;return uF(e?.[rF]??e?.mermaid)}catch{return null}}function mF(e){try{globalThis[rF]=e}catch{}}function hF(){return typeof cF==`function`}async function gF(e){if(iF)return fF(iF,e),iF;let t=pF();if(t)return dF(t),iF=t,mF(iF),fF(iF,e),iF;if(sF){let t=await sF;return t&&fF(t,e),t}if(aF)return null;let n=cF;if(!n)return aF=!0,null;sF=(async()=>{try{let e=uF(await n());return e?(dF(e),iF=e,mF(iF),iF):(aF=!0,null)}catch{return aF=!0,null}})();try{let t=await sF;return t&&fF(t,e),t}finally{sF=null}}var _F=null,vF=new Map,yF=5,bF=`WORKER_BUSY`,xF=`MERMAID_DISABLED`;function SF(){return _F=Error(`[markstream-svelte:mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),_F.name=`WorkerInitError`,_F.code=`WORKER_INIT_ERROR`,null}function CF(e,t,n=1400){if(!hF()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=xF,Promise.reject(e)}if(_F)return Promise.reject(_F);let r=SF();if(!r)return Promise.reject(_F);if(vF.size>=yF){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=bF,e.inFlight=vF.size,e.max=yF,Promise.reject(e)}return new Promise((i,a)=>{let o=Math.random().toString(36).slice(2),s=!1,c=null,l=()=>{s||(s=!0,c!=null&&clearTimeout(c),vF.delete(o))};vF.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){vF.delete(o),a(e);return}c=setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,vF.get(o)?.reject(e)},n)})}async function wF(e,t,n=1400){return await CF(`canParse`,{code:e,theme:t},n)}async function TF(e,t,n=1400){return await CF(`findPrefix`,{code:e,theme:t},n)}var EF=r(`<div class="mermaid-toggle"><button type="button"><span class="mermaid-action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg> <span> </span></span></button> <button type="button"><span class="mermaid-action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 18l6-6l-6-6M8 6l-6 6l6 6"></path></svg> <span> </span></span></button></div>`),DF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),OF=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),kF=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),AF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><!></button>`),jF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10l5 5l5-5"></path></g></svg></button>`),MF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"></path></svg></button>`),NF=r(`<div class="mermaid-header"><div class="mermaid-header__title"><span class="icon-slot action-icon" aria-hidden="true"></span> <span class="mermaid-title__text">Mermaid</span></div> <!> <div class="mermaid-actions"><!> <!> <!> <!></div></div>`),PF=r(`<pre class="mermaid-source"><code> </code></pre>`),FF=r(`<div class="markstream-svelte-zoom-controls"><button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-zoom-reset"> </button></div>`),IF=r(`<div class="mermaid-loading"><span class="mermaid-spinner"></span> </div>`),LF=r(`<div class="mermaid-error"> </div>`),RF=r(`<!> <div class="mermaid-preview markstream-svelte-mermaid"><!></div> <!>`,1),zF=r(`<div class="mermaid-body"><!></div>`),BF=r(`<div><div class="mermaid-modal-overlay" role="dialog" aria-modal="true" tabindex="-1"><div class="mermaid-modal-panel"><div class="mermaid-modal-controls"><button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-zoom-reset"> </button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L6 18M6 6l12 12"></path></svg></button></div> <div class="mermaid-modal-body"><div class="mermaid-modal-content markstream-svelte-mermaid"></div></div></div></div></div>`),VF=r(`<div data-markstream-mermaid="1"><!> <!> <!></div>`);function HF(t,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`maxHeight`,3,`500px`),s=k(r,`estimatedPreviewHeightPx`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`workerTimeoutMs`,3,1400),m=k(r,`parseTimeoutMs`,3,1800),g=k(r,`renderTimeoutMs`,3,2500),_=k(r,`fullRenderTimeoutMs`,3,4e3),b=k(r,`renderDebounceMs`,3,300),S=k(r,`showHeader`,3,!0),C=k(r,`showModeToggle`,3,!0),w=k(r,`showCopyButton`,3,!0),T=k(r,`showExportButton`,3,!0),D=k(r,`showFullscreenButton`,3,!0),O=k(r,`showCollapseButton`,3,!0),A=k(r,`showZoomControls`,3,!0),ee=k(r,`isStrict`,3,!0),te=k(r,`enableMermaidInteractions`,3,!1),{t:N}=Aj(),P=lM(`mermaid`),L=V(!1),re=V(0),ie=V(``),R=V(``),ce=V(``),U=V(``),le=V(fe({})),G=V(``),K=V(!1),pe=V(!1),he=V(!1),ge=V(!1),_e=V(!1),ve=V(!1),ye=V(1),be=V(null),xe=V(null),Se=V(null),Ce=V(null),X=V(null),we=null,Te=I(()=>ze(_A(r.node?.code))),Ee=I(()=>typeof r.node?.loading!=`boolean`||!!r.node?.loading),De=I(()=>u()??E(Ee)),Oe=I(()=>d()??a()?.isDark??!1),ke=I(()=>E(Oe)?`dark`:`light`),Ae=I(()=>a()?.final??E(De)===!1),je=I(()=>E(De)!==!1||E(Ae)===!1),Me=I(()=>o()===`none`?null:MN(o())),Ne=I(()=>IN(MN(s())??PN(E(Te)),LN(E(be),360),E(Me)??void 0)),Pe=I(()=>[`min-height: ${E(Ne)}px`,o()&&o()!==`none`?`max-height: ${o()}`:``,`transform: scale(${E(ye)})`].filter(Boolean).join(`; `)),Fe=I(()=>!(E(De)&&!E(Te).trim())),Ie=I(()=>!(!E(U)||E(_e)));ue(()=>(F(L,!0),Re(!0),()=>{F(L,!1),F(re,E(re)+1),Le(),E(X)&&clearTimeout(E(X))})),de(()=>{E(L)&&(qe(),E(_e),E(ge),e(()=>Re()))}),de(()=>{E(L)&&E(ve)&&E(U)&&E(Se)&&te()&&e(()=>void v().then(()=>Ye(E(Se))))});function Le(){E(Ce)&&(clearTimeout(E(Ce)),F(Ce,null))}function Re(e=!1){if(!E(L)||E(_e)||E(ge))return;let t=qe();if(t===E(ie)&&E(K)||!e&&t===E(ie)&&(E(U)||E(G)||E(R)===t)||(e&&Le(),E(Ce)))return;let n=e||!E(je)?0:Math.max(0,b());F(Ce,setTimeout(()=>{F(Ce,null),Ve(e)},n),!0)}function ze(e){return e.replace(/\]::([^:])/g,`]:::$1`).replace(/:::subgraphNode$/gm,`::subgraphNode`)}function Be(e,t){return e.trimStart().startsWith(`%%{`)?e:`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n${e}`}async function Ve(e=!1){if(!E(L)||E(_e)||E(ge))return;if(!E(Te).trim()){F(U,``),F(G,``),F(ce,``),F(R,``),F(pe,!1),F(le,{},!0);return}let t=Ke(E(Te)),n=qe();if(n===E(ie)&&E(K)||!e&&n===E(ie)&&(E(U)||E(G)||E(R)===n))return;let r=ne(re);F(ie,n,!0),F(K,!0),E(je)||F(G,``);try{let e=await gF({startOnLoad:!1,securityLevel:ee()?`strict`:`loose`,suppressErrorRendering:!0,...ee()?{flowchart:{htmlLabels:!1}}:{}});if(!E(L)||r!==E(re))return;if(!e)throw Error(`Mermaid is not available.`);let i=E(Te),a=!0;if(E(je)){if(E(pe)&&t===E(ce)&&E(U)){F(G,``);return}let o=await Ue(E(Te),E(ke),e);if(!E(L)||r!==E(re))return;if(o.fullOk)i=E(Te);else if(o.prefixOk&&o.prefix&&!E(pe))i=o.prefix,a=!1;else{F(G,``),F(R,n,!0);let e=E(le)[E(ke)];e&&F(U,e,!0);return}}else await He(E(Te),E(ke),e);let o=await Je(()=>Promise.resolve(e.render(`markstream-svelte-mermaid-${r}`,Be(i,E(ke)))),a?_():g());if(!E(L)||r!==E(re))return;let s=Qk(typeof o==`string`?o:o?.svg);if(!s)throw Error(`Mermaid rendered empty SVG.`);F(U,s,!0),we=typeof o==`string`?null:o?.bindFunctions??null,F(G,``),F(R,``),a&&(F(pe,!0),F(ce,t,!0),E(le)[E(ke)]=s),te()&&typeof o!=`string`&&(await v(),E(L)&&r===E(re)&&(Ye(E(xe)),E(ve)&&Ye(E(Se))))}catch(e){r===E(re)&&(E(je)?(F(G,``),F(R,n,!0)):(F(U,``),F(G,e instanceof Error?e.message:String(e),!0)))}finally{r===E(re)&&F(K,!1)}}async function He(e,t,n){try{if(await wF(e,t,p()))return!0}catch{}let r=Be(e,t);return typeof n?.parse==`function`?(await Je(()=>Promise.resolve(n.parse(r)),m()),!0):(await Je(()=>Promise.resolve(n.render(`markstream-svelte-mermaid-parse-${E(re)}`,r)),m()),!0)}async function Ue(e,t,n){if(NN(e)===`gantt`){let r=Z(e);if(!r.trim())return{fullOk:!1,prefixOk:!1};try{return await He(r,t,n),r===e?{fullOk:!0,prefixOk:!1}:{fullOk:!1,prefixOk:!0,prefix:r}}catch{return{fullOk:!1,prefixOk:!1}}}try{return await He(e,t,n),{fullOk:!0,prefixOk:!1}}catch{}let r=Z(e);if(!r.trim()||r===e)return{fullOk:!1,prefixOk:!1};try{let n=await TF(e,t,p());n?.trim()&&(r=n)}catch{}try{return await He(r,t,n),{fullOk:!1,prefixOk:!0,prefix:r}}catch{return{fullOk:!1,prefixOk:!1}}}function We(e){let t=e.trim();return!t||t.startsWith(`%%`)||/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)?!1:t.includes(`:`)}function Ge(e){let t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){let e=t[t.length-1]?.trim();if(!e||e.startsWith(`%%`)){t.pop();continue}if(We(e))break;t.pop()}return t.some(We)?t.join(`
216
- `):``}function Z(e){if(NN(e)===`gantt`)return Ge(e);let t=e.split(`
215
+ `){let e=this.fenceScanOffset+1;this.completeFenceLine(e),this.fenceScanOffset=e;continue}this.consumeFenceCharacter(t),this.fenceScanOffset++}this.updateFenceRevealBlock()}consumeFenceCharacter(e){if(this.fenceLineState!==`normal`){if(this.fenceLineState===`opening`){this.fenceMarker==="`"&&e==="`"&&(this.fenceLineState=`normal`);return}if(this.fenceLineState===`closing`){e!==` `&&e!==` `&&(this.fenceLineState=`normal`);return}if(!this.fenceMarker){if(e===` `&&this.fenceIndent<3){this.fenceIndent++;return}if(e==="`"||e===`~`){this.fenceMarker=e,this.fenceMarkerLength=1;return}this.fenceLineState=`normal`;return}if(e===this.fenceMarker){this.fenceMarkerLength++;return}if(this.activeFenceMarker){this.fenceLineState=this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(e===` `||e===` `)?`closing`:`normal`;return}this.fenceLineState=this.fenceMarkerLength>=3?`opening`:`normal`}}completeFenceLine(e){let t=this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3;!this.activeFenceMarker&&(this.fenceLineState===`opening`||t)?(this.atomicRevealRanges.push({start:this.fenceLineStart,end:e}),this.activeFenceMarker=this.fenceMarker,this.activeFenceLength=this.fenceMarkerLength):this.activeFenceMarker&&this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(this.fenceLineState===`closing`||t)&&(this.activeFenceMarker=``,this.activeFenceLength=0),this.fenceLineStart=e,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.blockedRevealEnd=0}updateFenceRevealBlock(){this.blockedRevealEnd=!this.activeFenceMarker&&(this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&(this.fenceIndent>0||this.fenceMarkerLength>0))?this.fenceLineStart+1:0}releaseTrailingFenceCandidate(){this.scanAppendedSource(!0),this.blockedRevealEnd&&=((this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3)&&this.source.length>this.fenceLineStart&&this.atomicRevealRanges.push({start:this.fenceLineStart,end:this.source.length}),this.fenceLineState=`normal`,0)}isRevealBlocked(){return this.blockedRevealEnd!==0}getRevealableEnd(){return this.blockedRevealEnd?Math.min(this.source.length,this.blockedRevealEnd-1):this.source.length}hasRevealableChars(){return this.visible.length<this.getRevealableEnd()}takeNextRevealSlice(e){this.discardConsumedAtomicRanges();let t=this.getRevealableEnd();if(this.visible.length>=t)return{text:``,graphemeCount:0};let n=this.atomicRevealRanges[this.atomicRevealRangeIndex];if(n&&this.visible.length>=n.start&&this.visible.length<n.end)return uP(this.source,this.visible.length,n.end-this.visible.length,this.segmenter,Math.min(n.end,t));let r=n&&n.start>this.visible.length?Math.min(n.start,t):t;return uP(this.source,this.visible.length,e,this.segmenter,r)}discardConsumedAtomicRanges(){for(;this.atomicRevealRangeIndex<this.atomicRevealRanges.length&&this.atomicRevealRanges[this.atomicRevealRangeIndex].end<=this.visible.length;)this.atomicRevealRangeIndex++;this.atomicRevealRangeIndex>=64&&this.atomicRevealRangeIndex*2>=this.atomicRevealRanges.length&&(this.atomicRevealRanges.splice(0,this.atomicRevealRangeIndex),this.atomicRevealRangeIndex=0)}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||!this.hasRevealableChars())){if(typeof requestAnimationFrame!=`function`){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&=(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.rafId),0)}emit(){if(!this.destroyed)for(let e of this.listeners)e()}};function cP(e={},t){let n=new sP(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function lP(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function uP(e,t,n,r,i=e.length){let a=Math.min(e.length,Math.max(t,i));if(t>=a||n<=0)return{text:``,graphemeCount:0};if(!r){let r=t,i=0;for(;r<a&&i<n;){let t=e.charCodeAt(r),n=e.charCodeAt(r+1);r=Math.min(a,r+(t>=55296&&t<=56319&&n>=56320&&n<=57343?2:1)),i++}return{text:e.slice(t,r),graphemeCount:i}}let o=t,s=0,c=!0;for(;s<n&&o<a;){let t=e.codePointAt(o),n=t>65535?2:1;if(o+n>a||!pP(t)){c=!1;break}o+=n,s++}if(c&&o>t&&!(o<a&&e.charCodeAt(o-1)===13&&e.charCodeAt(o)===10)){let n=e.codePointAt(o),r=n!=null&&o+(n!=null&&n>65535?2:1)<=a&&pP(n);if(o>=a||r)return{text:e.slice(t,o),graphemeCount:s}}let l=a-t,u=Math.min(l,Math.max(64,n*2));for(;;){let i=u>=l,a=e.slice(t,t+u),o=0,s=0;for(let i of r.segment(a)){if(s>=n)return{text:e.slice(t,t+o),graphemeCount:s};o+=i.segment.length,s++}if(i)return{text:e.slice(t,t+o),graphemeCount:s};u=Math.min(l,u*2)}}function dP(e,t,n){return Math.min(n,Math.max(t,e))}function fP(e){return e>=11904&&e<=12329||e>=12336&&e<=12351||e>=12352&&e<=12440||e>=12443&&e<=12543||e>=12544&&e<=12799||e>=12800&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65437||e>=65440&&e<=65519||e>=127488&&e<=127743||e>=131072&&e<=196607}function pP(e){return e<=127||fP(e)}var mP=r(`<span> </span>`),hP=r(`<code class="inline-code-node"> <!></code>`);function gP(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=``,s=``,l=`markstream-svelte-text__stream-delta--a`,u=I(()=>_A(t.node?.code??t.node?.content??t.node?.raw)),d=I(()=>`${String(r()?.customId??`global`)}:${String(r()?.streamRenderVersion??0)}:${String(a()??`inline-code`)}`),f=I(()=>r()?.fade!==!1),p=I(()=>{let e=r()?.textStreamState,t=E(d)===o?s:e?.get(E(d))??``,n=nP({nextContent:E(u),previousContent:t,typewriterEnabled:E(f)});return n.appended&&(l=l.endsWith(`--a`)?`markstream-svelte-text__stream-delta--b`:`markstream-svelte-text__stream-delta--a`),o=E(d),s=E(u),e?.set(E(d),E(u)),{stableCode:n.settledContent,deltaCode:n.streamedDelta,deltaClass:l}});var m=hP(),g=W(m),_=z(g),v=e=>{var t=mP(),n=M(t,!0);H(()=>{Y(t,1,`markstream-svelte-text__stream-delta text-node-stream-delta ${E(p).deltaClass??``}`),c(n,E(p).deltaCode)}),y(e,t)};h(_,e=>{E(p).deltaCode&&e(v)}),n(m),H(()=>c(g,`${E(p).stableCode??``} `)),y(e,m),x()}function _P(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`ins`})}var vP=r(`<span class="link-loading-indicator"></span>`),yP=r(`<a><span class="link-text-wrapper"><span class="link-text"><!></span><!></span></a>`);function bP(e,t){i(t,!0);let r=I(()=>Ok({href:_A(t.node?.href)},`safe`,`a`).href??``),a=I(()=>_A(t.node?.title||E(r))),o=I(()=>gA(t.node?.children)),s=I(()=>t.showTooltip??t.context?.showTooltips??!0),u=I(()=>E(r).startsWith(`#`)&&E(r).length>1),d=I(()=>ey(E(r)));function p(e){E(s)&&E(a)&&Jj(e.currentTarget,E(a),`top`,!1,void 0,t.context?.isDark)}function m(e){if(!E(u)||typeof document>`u`)return;e.preventDefault();let t=E(r).slice(1),n=g(t);(document.getElementById(t)||(n===t?null:document.getElementById(n)))?.scrollIntoView({behavior:`smooth`,block:`start`})}function g(e){try{return decodeURIComponent(e)}catch{return e}}var _=yP();let v;var b=W(_),S=W(b),w=W(S),T=e=>{{let n=I(()=>String(t.indexKey??`link`)+`-link`);mI(e,{get nodes(){return E(o)},get context(){return t.context},get prefix(){return E(n)}})}},D=e=>{var n=C();H(e=>c(n,e),[()=>_A(t.node?.text||E(r))]),y(e,n)};h(w,e=>{E(o).length?e(T):e(D,-1)}),n(S);var O=z(S),k=e=>{var t=vP();y(e,t)};h(O,e=>{t.node?.loading&&e(k)}),n(b),n(_),H(e=>{v=Y(_,1,`link-node`,null,v,{"link-loading":e}),B(_,`href`,E(r)||void 0),B(_,`title`,E(s)?void 0:E(a)),B(_,`target`,E(d)?`_blank`:void 0),B(_,`rel`,E(d)?`noreferrer noopener`:void 0)},[()=>!!t.node?.loading]),f(`blur`,_,()=>Yj()),l(`click`,_,m),f(`focus`,_,p),f(`mouseleave`,_,()=>Yj()),f(`mouseenter`,_,p),y(e,_),x()}T([`click`]);var xP=r(`<li><!></li>`);function SP(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0);var o=xP(),s=W(o);{let e=I(()=>gA(t.node?.children)),n=I(()=>String(a()??`li`)+`-li`);mI(s,{get nodes(){return E(e)},get context(){return r()},get prefix(){return E(n)}})}n(o),y(e,o),x()}var CP=r(`<ol><!></ol>`),wP=r(`<ul><!></ul>`);function TP(e,t){i(t,!0);let r=I(()=>!!t.node?.ordered),a=I(()=>Number(t.node?.start));I(()=>E(r)?`ol`:`ul`);var o=X(),s=q(o),c=e=>{var r=CP(),i=W(r);{let e=I(()=>gA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);mI(i,{get nodes(){return E(e)},get context(){return t.context},get prefix(){return E(n)}})}n(r),H(e=>B(r,`start`,e),[()=>Number.isFinite(E(a))?E(a):void 0]),y(e,r)},l=e=>{var r=wP(),i=W(r);{let e=I(()=>gA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);mI(i,{get nodes(){return E(e)},get context(){return t.context},get prefix(){return E(n)}})}n(r),y(e,r)};h(s,e=>{E(r)?e(c):e(l,-1)}),y(e,o),x()}var EP=null,DP=!1,OP=null,kP=MP;function AP(e){let t=e?.default??e;return t&&typeof t.renderToString==`function`?t:null}function jP(){try{return AP(globalThis?.katex)}catch{return null}}function MP(){return(async()=>{let e=jP();if(e)return e;let t=await _e(()=>import(`../chunks/DecrR9TK.js`),[],import.meta.url);try{await _e(()=>import(`../chunks/Dnkino9G.js`),[],import.meta.url)}catch{}return AP(t)})()}function NP(){return typeof kP==`function`}async function PP(){let e=jP();if(e)return EP=e,EP;if(EP)return EP;if(OP)return await OP;if(DP)return null;let t=kP;if(!t)return DP=!0,null;OP=(async()=>{try{let e=await t(),n=AP(e)??e;if(n)return EP=n,EP}catch{}return DP=!0,null})();try{return await OP}finally{OP=null}}function FP(e){return e?e.replace(/·/g,`⋅`).replace(/℃/g,`°C`):``}var IP=`WORKER_BUSY`,LP=null,RP=new Map,zP=new Map,BP=200,VP=new Set,HP=5;function UP(){if(RP.size>=HP||VP.size===0)return;let e=Array.from(VP);VP.clear();for(let t of e)try{t()}catch{}}function WP(e,t,n){if(zP.set(`${t?`d`:`i`}:${e}`,n),zP.size>BP){let e=zP.keys().next().value;e&&zP.delete(e)}}function GP(){return LP=Error(`[markstream-svelte:katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),LP.name=`WorkerInitError`,LP.code=`WORKER_INIT_ERROR`,null}async function KP(e,t=!0,n=2e3,r){let i=FP(e);if(!NP()){let e=Error(`KaTeX rendering disabled`);return e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,Promise.reject(e)}if(LP)return Promise.reject(LP);let a=`${t?`d`:`i`}:${i}`,o=zP.get(a);if(o)return o;let s=GP();if(!s)return Promise.reject(LP);if(RP.size>=HP){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=IP,e.busy=!0,e.inFlight=RP.size,e.max=HP,Promise.reject(e)}return new Promise((e,a)=>{if(r?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,a(e);return}let o=Math.random().toString(36).slice(2),c=globalThis.setTimeout(()=>{RP.delete(o),UP();let e=Error(`Worker render timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,a(e)},n),l=()=>{globalThis.clearTimeout(c),RP.delete(o)&&UP();let e=Error(`Aborted`);e.name=`AbortError`,a(e)};r?.addEventListener(`abort`,l,{once:!0}),RP.set(o,{timeoutId:c,resolve:t=>{r?.removeEventListener(`abort`,l),e(t)},reject:e=>{r?.removeEventListener(`abort`,l),a(e)}}),s.postMessage({id:o,type:`render`,content:i,displayMode:t})})}function qP(e,t=!0,n){WP(FP(e),t,n)}function JP(e=2e3,t){return RP.size<HP?Promise.resolve():new Promise((n,r)=>{let i=!1,a=null,o=()=>{i||(i=!0,a&&clearTimeout(a),VP.delete(o),n())};if(VP.add(o),a=setTimeout(()=>{if(i)return;i=!0,VP.delete(o);let e=Error(`Wait for worker slot timed out`);e.name=`WorkerBusyTimeout`,e.code=`WORKER_BUSY_TIMEOUT`,r(e)},e),queueMicrotask(()=>UP()),t){let e=()=>{if(i)return;i=!0,a&&clearTimeout(a),VP.delete(o);let e=Error(`Aborted`);e.name=`AbortError`,r(e)};t.aborted?e():t.addEventListener(`abort`,e,{once:!0})}})}var YP={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1},XP=8;async function ZP(e,t=!0,n={}){if(!NP()){let e=Error(`KaTeX rendering disabled`);throw e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,e}let r=n.timeout??YP.timeout,i=n.waitTimeout??YP.waitTimeout,a=n.backoffMs??YP.backoffMs,o=n.maxRetries??YP.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),XP)):YP.maxRetries,c=0;for(;;){if(n.signal?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return await KP(e,t,r,n.signal)}catch(e){if(e?.code!==`WORKER_BUSY`||c>=s)throw e;c+=1,await JP(i,n.signal).catch(()=>{}),a>0&&await new Promise(e=>globalThis.setTimeout(e,a*c))}}}var QP=r(`<div class="math-block markstream-nested-math-block" data-markstream-katex-managed="1"><div></div></div>`);function $P(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>_A(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>_A(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0);de(()=>{E(r)&&f(E(l),E(u),E(d))}),ce(()=>{o=!0,s+=1});async function f(e,t,n){let i=E(r);if(!i)return;let l=FP(e),u=++s;if(!l){i.textContent=``,F(a,!1);return}c||F(a,!0);let d=await p(l,n);o||u!==s||(d?(i.innerHTML=d,c=!0,F(a,!1)):n||(i.textContent=t||l,F(a,!1)))}async function p(e,t){try{return await ZP(e,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)return null}let n=await PP();if(!n)return null;try{let r=n.renderToString(e,{throwOnError:t,displayMode:!0});return qP(e,!0,r),r}catch{return null}}var m=QP(),h=W(m);let g;se(h,e=>F(r,e),()=>E(r)),n(m),H(()=>g=Y(h,1,`markstream-nested-math-block__render`,null,g,{"math-rendering":E(a)})),y(e,m),x()}var eF=r(`<span class="math-inline__loading" role="status" aria-live="polite"><span class="math-inline__spinner" aria-hidden="true"></span> <span class="sr-only">Loading</span></span>`),tF=r(`<span class="math-inline-wrapper markstream-nested-math" data-display="inline" data-markstream-katex-managed="1"><span></span> <!></span>`);function nF(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>_A(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>_A(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0),f=I(()=>String(t.node?.markup||``)===`$$`);de(()=>{E(r)&&p(E(l),E(u),E(d),E(f))}),ce(()=>{o=!0,s+=1});async function p(e,t,n,i){let l=E(r);if(!l)return;let u=FP(e),d=++s;if(!u){l.textContent=``,F(a,!1);return}c||F(a,!0);let f=await m(u,i,n);o||d!==s||(f?(l.innerHTML=f,c=!0,F(a,!1)):n||(l.textContent=t||u,F(a,!1)))}async function m(e,t,n){try{return await ZP(e,t,{timeout:1500,waitTimeout:0,maxRetries:0})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)return null}let r=await PP();if(!r)return null;try{let i=r.renderToString(e,{throwOnError:n,displayMode:t});return qP(e,t,i),i}catch{return null}}var g=tF(),_=W(g);let v;se(_,e=>F(r,e),()=>E(r));var b=z(_,2),S=e=>{var t=eF();y(e,t)};h(b,e=>{E(a)&&e(S)}),n(g),H(()=>v=Y(_,1,`math-inline`,null,v,{"math-inline--hidden":E(a)})),y(e,g),x()}var rF=()=>_e(()=>import(`../chunks/J36u8XLO.js`),[],import.meta.url),iF=`__MARKSTREAM_ANGULAR_MERMAID__`,aF=null,oF=!1,sF=null,cF=null,lF=rF;function uF(e){return`${String(e?.securityLevel??`strict`)}|htmlLabels:${e?.flowchart?.htmlLabels===!1?`0`:`1`}`}function dF(e){if(!e)return e;let t=e?.default??e;if(t&&(typeof t.render==`function`||typeof t.parse==`function`||typeof t.initialize==`function`))return t;if(t?.mermaidAPI&&(typeof t.mermaidAPI.render==`function`||typeof t.mermaidAPI.parse==`function`)){let e=t.mermaidAPI;return{...t,render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:n=>typeof t.initialize==`function`?t.initialize(n):e.initialize?e.initialize(n):void 0}}return e?.mermaid&&typeof e.mermaid.render==`function`?e.mermaid:t}function fF(e){if(e)try{let t=e?.initialize;e.initialize=n=>{let r={suppressErrorRendering:!0,...n||{}};if(typeof t==`function`)return t.call(e,r);if(e?.mermaidAPI&&typeof e.mermaidAPI.initialize==`function`)return e.mermaidAPI.initialize(r)}}catch{}}function pF(e,t){if(!e||!t)return;let n=uF(t);if(sF!==n)try{typeof e.initialize==`function`?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),sF=n}catch{}}function mF(){try{let e=globalThis;return dF(e?.[iF]??e?.mermaid)}catch{return null}}function hF(e){try{globalThis[iF]=e}catch{}}function gF(){return typeof lF==`function`}async function _F(e){if(aF)return pF(aF,e),aF;let t=mF();if(t)return fF(t),aF=t,hF(aF),pF(aF,e),aF;if(cF){let t=await cF;return t&&pF(t,e),t}if(oF)return null;let n=lF;if(!n)return oF=!0,null;cF=(async()=>{try{let e=dF(await n());return e?(fF(e),aF=e,hF(aF),aF):(oF=!0,null)}catch{return oF=!0,null}})();try{let t=await cF;return t&&pF(t,e),t}finally{cF=null}}var vF=null,yF=new Map,bF=5,xF=`WORKER_BUSY`,SF=`MERMAID_DISABLED`;function CF(){return vF=Error(`[markstream-svelte:mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),vF.name=`WorkerInitError`,vF.code=`WORKER_INIT_ERROR`,null}function wF(e,t,n=1400){if(!gF()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=SF,Promise.reject(e)}if(vF)return Promise.reject(vF);let r=CF();if(!r)return Promise.reject(vF);if(yF.size>=bF){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=xF,e.inFlight=yF.size,e.max=bF,Promise.reject(e)}return new Promise((i,a)=>{let o=Math.random().toString(36).slice(2),s=!1,c=null,l=()=>{s||(s=!0,c!=null&&clearTimeout(c),yF.delete(o))};yF.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){yF.delete(o),a(e);return}c=setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,yF.get(o)?.reject(e)},n)})}async function TF(e,t,n=1400){return await wF(`canParse`,{code:e,theme:t},n)}async function EF(e,t,n=1400){return await wF(`findPrefix`,{code:e,theme:t},n)}var DF=r(`<div class="mermaid-toggle"><button type="button"><span class="mermaid-action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg> <span> </span></span></button> <button type="button"><span class="mermaid-action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 18l6-6l-6-6M8 6l-6 6l6 6"></path></svg> <span> </span></span></button></div>`),OF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),kF=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),AF=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),jF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><!></button>`),MF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10l5 5l5-5"></path></g></svg></button>`),NF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"></path></svg></button>`),PF=r(`<div class="mermaid-header"><div class="mermaid-header__title"><span class="icon-slot action-icon" aria-hidden="true"></span> <span class="mermaid-title__text">Mermaid</span></div> <!> <div class="mermaid-actions"><!> <!> <!> <!></div></div>`),FF=r(`<pre class="mermaid-source"><code> </code></pre>`),IF=r(`<div class="markstream-svelte-zoom-controls"><button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-zoom-reset"> </button></div>`),LF=r(`<div class="mermaid-loading"><span class="mermaid-spinner"></span> </div>`),RF=r(`<div class="mermaid-error"> </div>`),zF=r(`<!> <div class="mermaid-preview markstream-svelte-mermaid"><!></div> <!>`,1),BF=r(`<div class="mermaid-body"><!></div>`),VF=r(`<div><div class="mermaid-modal-overlay" role="dialog" aria-modal="true" tabindex="-1"><div class="mermaid-modal-panel"><div class="mermaid-modal-controls"><button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-zoom-reset"> </button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L6 18M6 6l12 12"></path></svg></button></div> <div class="mermaid-modal-body"><div class="mermaid-modal-content markstream-svelte-mermaid"></div></div></div></div></div>`),HF=r(`<div data-markstream-mermaid="1"><!> <!> <!></div>`);function UF(t,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`maxHeight`,3,`500px`),s=k(r,`estimatedPreviewHeightPx`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`workerTimeoutMs`,3,1400),m=k(r,`parseTimeoutMs`,3,1800),g=k(r,`renderTimeoutMs`,3,2500),_=k(r,`fullRenderTimeoutMs`,3,4e3),b=k(r,`renderDebounceMs`,3,300),S=k(r,`showHeader`,3,!0),C=k(r,`showModeToggle`,3,!0),w=k(r,`showCopyButton`,3,!0),T=k(r,`showExportButton`,3,!0),D=k(r,`showFullscreenButton`,3,!0),O=k(r,`showCollapseButton`,3,!0),A=k(r,`showZoomControls`,3,!0),ee=k(r,`isStrict`,3,!0),te=k(r,`enableMermaidInteractions`,3,!1),{t:N}=Aj(),P=uM(`mermaid`),L=V(!1),re=V(0),ie=V(``),R=V(``),ce=V(``),U=V(``),le=V(J({})),G=V(``),K=V(!1),fe=V(!1),me=V(!1),he=V(!1),ge=V(!1),_e=V(!1),ve=V(1),ye=V(null),be=V(null),xe=V(null),Z=V(null),Se=V(null),Ce=null,we=I(()=>Re(_A(r.node?.code))),Te=I(()=>typeof r.node?.loading!=`boolean`||!!r.node?.loading),Ee=I(()=>u()??E(Te)),De=I(()=>d()??a()?.isDark??!1),Oe=I(()=>E(De)?`dark`:`light`),ke=I(()=>a()?.final??E(Ee)===!1),Ae=I(()=>E(Ee)!==!1||E(ke)===!1),je=I(()=>o()===`none`?null:NN(o())),Me=I(()=>LN(NN(s())??FN(E(we)),RN(E(ye),360),E(je)??void 0)),Ne=I(()=>[`min-height: ${E(Me)}px`,o()&&o()!==`none`?`max-height: ${o()}`:``,`transform: scale(${E(ve)})`].filter(Boolean).join(`; `)),Pe=I(()=>!(E(Ee)&&!E(we).trim())),Fe=I(()=>!(!E(U)||E(ge)));ue(()=>(F(L,!0),Le(!0),()=>{F(L,!1),F(re,E(re)+1),Ie(),E(Se)&&clearTimeout(E(Se))})),de(()=>{E(L)&&(Q(),E(ge),E(he),e(()=>Le()))}),de(()=>{E(L)&&E(_e)&&E(U)&&E(xe)&&te()&&e(()=>void v().then(()=>Je(E(xe))))});function Ie(){E(Z)&&(clearTimeout(E(Z)),F(Z,null))}function Le(e=!1){if(!E(L)||E(ge)||E(he))return;let t=Q();if(t===E(ie)&&E(K)||!e&&t===E(ie)&&(E(U)||E(G)||E(R)===t)||(e&&Ie(),E(Z)))return;let n=e||!E(Ae)?0:Math.max(0,b());F(Z,setTimeout(()=>{F(Z,null),Be(e)},n),!0)}function Re(e){return e.replace(/\]::([^:])/g,`]:::$1`).replace(/:::subgraphNode$/gm,`::subgraphNode`)}function ze(e,t){return e.trimStart().startsWith(`%%{`)?e:`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n${e}`}async function Be(e=!1){if(!E(L)||E(ge)||E(he))return;if(!E(we).trim()){F(U,``),F(G,``),F(ce,``),F(R,``),F(fe,!1),F(le,{},!0);return}let t=Ke(E(we)),n=Q();if(n===E(ie)&&E(K)||!e&&n===E(ie)&&(E(U)||E(G)||E(R)===n))return;let r=ne(re);F(ie,n,!0),F(K,!0),E(Ae)||F(G,``);try{let e=await _F({startOnLoad:!1,securityLevel:ee()?`strict`:`loose`,suppressErrorRendering:!0,...ee()?{flowchart:{htmlLabels:!1}}:{}});if(!E(L)||r!==E(re))return;if(!e)throw Error(`Mermaid is not available.`);let i=E(we),a=!0;if(E(Ae)){if(E(fe)&&t===E(ce)&&E(U)){F(G,``);return}let o=await He(E(we),E(Oe),e);if(!E(L)||r!==E(re))return;if(o.fullOk)i=E(we);else if(o.prefixOk&&o.prefix&&!E(fe))i=o.prefix,a=!1;else{F(G,``),F(R,n,!0);let e=E(le)[E(Oe)];e&&F(U,e,!0);return}}else await Ve(E(we),E(Oe),e);let o=await qe(()=>Promise.resolve(e.render(`markstream-svelte-mermaid-${r}`,ze(i,E(Oe)))),a?_():g());if(!E(L)||r!==E(re))return;let s=Qk(typeof o==`string`?o:o?.svg);if(!s)throw Error(`Mermaid rendered empty SVG.`);F(U,s,!0),Ce=typeof o==`string`?null:o?.bindFunctions??null,F(G,``),F(R,``),a&&(F(fe,!0),F(ce,t,!0),E(le)[E(Oe)]=s),te()&&typeof o!=`string`&&(await v(),E(L)&&r===E(re)&&(Je(E(be)),E(_e)&&Je(E(xe))))}catch(e){r===E(re)&&(E(Ae)?(F(G,``),F(R,n,!0)):(F(U,``),F(G,e instanceof Error?e.message:String(e),!0)))}finally{r===E(re)&&F(K,!1)}}async function Ve(e,t,n){try{if(await TF(e,t,p()))return!0}catch{}let r=ze(e,t);return typeof n?.parse==`function`?(await qe(()=>Promise.resolve(n.parse(r)),m()),!0):(await qe(()=>Promise.resolve(n.render(`markstream-svelte-mermaid-parse-${E(re)}`,r)),m()),!0)}async function He(e,t,n){if(PN(e)===`gantt`){let r=Ge(e);if(!r.trim())return{fullOk:!1,prefixOk:!1};try{return await Ve(r,t,n),r===e?{fullOk:!0,prefixOk:!1}:{fullOk:!1,prefixOk:!0,prefix:r}}catch{return{fullOk:!1,prefixOk:!1}}}try{return await Ve(e,t,n),{fullOk:!0,prefixOk:!1}}catch{}let r=Ge(e);if(!r.trim()||r===e)return{fullOk:!1,prefixOk:!1};try{let n=await EF(e,t,p());n?.trim()&&(r=n)}catch{}try{return await Ve(r,t,n),{fullOk:!1,prefixOk:!0,prefix:r}}catch{return{fullOk:!1,prefixOk:!1}}}function Ue(e){let t=e.trim();return!t||t.startsWith(`%%`)||/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)?!1:t.includes(`:`)}function We(e){let t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){let e=t[t.length-1]?.trim();if(!e||e.startsWith(`%%`)){t.pop();continue}if(Ue(e))break;t.pop()}return t.some(Ue)?t.join(`
216
+ `):``}function Ge(e){if(PN(e)===`gantt`)return We(e);let t=e.split(`
217
217
  `);for(;t.length>0;){let e=(t[t.length-1]||``).trimEnd();if(!e){t.pop();continue}if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}return t.join(`
218
- `).trim()||``}function Ke(e){return e.replace(/\s+/g,``)}function qe(){return`${E(Te)}\n${E(ke)}\n${ee()}\n${te()}\n${E(Ae)}\n${E(je)}`}function Je(e,t){return!t||t<=0?e():new Promise((n,r)=>{let i=setTimeout(()=>r(Error(`Operation timed out`)),t);e().then(e=>{clearTimeout(i),n(e)}).catch(e=>{clearTimeout(i),r(e)})})}function Ye(e){if(te()&&e?.querySelector(`svg`))try{we?.(e)}catch{}}async function Xe(){await gM(E(Te)),a()?.events?.onCopy?.(E(Te)),F(he,!0),E(X)&&clearTimeout(E(X)),F(X,setTimeout(()=>{F(he,!1)},1e3),!0)}function Ze(){E(U)&&vM(E(U),`mermaid-diagram-${Date.now()}.svg`)}function Qe(e){F(_e,e===`source`),E(_e)||Ve()}function $e(){F(ye,Math.min(3,Math.round((E(ye)+.1)*10)/10),!0)}function et(){F(ye,Math.max(.5,Math.round((E(ye)-.1)*10)/10),!0)}function tt(e,t,n=`top`){let r=e.currentTarget;!r||r instanceof HTMLButtonElement&&r.disabled||Jj(r,t,n,!1,void 0,E(Oe))}function nt(e){tt(e,E(he)?N(`common.copied`)||`Copied`:N(`common.copy`)||`Copy`)}function rt(e){return document.body.appendChild(e),{destroy(){e.remove()}}}function it(){F(ve,!1)}function at(e){e.target===e.currentTarget&&it()}function ot(e){e.key===`Escape`&&it()}var st=Y(),ct=q(st),lt=e=>{var t=VF();let r;var i=W(t),a=e=>{var t=NF(),r=W(t),i=W(r);ae(i,()=>P,!0),n(i),oe(2),n(r);var a=z(r,2),o=e=>{var t=EF(),r=W(t);let i;var a=W(r),o=z(W(a),2),s=M(o,!0);n(a),n(r);var u=z(r,2);let d;var p=W(u),m=z(W(p),2),h=M(m,!0);n(p),n(u),n(t),H((e,t)=>{i=J(r,1,`mermaid-toggle-btn`,null,i,{"mermaid-toggle-btn--active":!E(_e)}),c(s,e),d=J(u,1,`mermaid-toggle-btn`,null,d,{"mermaid-toggle-btn--active":E(_e)}),c(h,t)},[()=>N(`common.preview`),()=>N(`common.source`)]),f(`blur`,r,()=>$()),l(`click`,r,()=>Qe(`preview`)),f(`focus`,r,e=>tt(e,N(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>$()),f(`mouseenter`,r,e=>tt(e,N(`common.preview`)||`Preview`)),f(`blur`,u,()=>$()),l(`click`,u,()=>Qe(`source`)),f(`focus`,u,e=>tt(e,N(`common.source`)||`Source`)),f(`mouseleave`,u,()=>$()),f(`mouseenter`,u,e=>tt(e,N(`common.source`)||`Source`)),y(e,t)};h(a,e=>{C()&&e(o)});var s=z(a,2),u=W(s),d=e=>{var t=DF(),r=W(t);let i;n(t),H(e=>{B(t,`aria-pressed`,E(ge)),B(t,`aria-label`,e),i=j(r,``,i,{rotate:E(ge)?`0deg`:`90deg`})},[()=>E(ge)?N(`common.expand`):N(`common.collapse`)]),f(`blur`,t,()=>$()),l(`click`,t,()=>F(ge,!E(ge))),f(`focus`,t,e=>tt(e,E(ge)?N(`common.expand`)||`Expand`:N(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>tt(e,E(ge)?N(`common.expand`)||`Expand`:N(`common.collapse`)||`Collapse`)),y(e,t)};h(u,e=>{O()&&e(d)});var p=z(u,2),m=e=>{var t=AF(),r=W(t),i=e=>{var t=OF();y(e,t)},a=e=>{var t=kF();y(e,t)};h(r,e=>{E(he)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(he)?N(`common.copied`):N(`common.copy`)]),f(`blur`,t,()=>$()),l(`click`,t,Xe),f(`focus`,t,nt),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,nt),y(e,t)};h(p,e=>{w()&&e(m)});var g=z(p,2),_=e=>{var t=jF();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(_e)||E(ge)},[()=>N(`common.export`)]),f(`blur`,t,()=>$()),l(`click`,t,Ze),f(`focus`,t,e=>tt(e,N(`common.export`)||`Export`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>tt(e,N(`common.export`)||`Export`)),y(e,t)};h(g,e=>{T()&&e(_)});var v=z(g,2),b=e=>{var t=MF();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(_e)||E(ge)},[()=>N(`common.open`)]),f(`blur`,t,()=>$()),l(`click`,t,()=>F(ve,!0)),f(`focus`,t,e=>tt(e,N(`common.open`)||`Open`)),f(`mouseleave`,t,()=>$()),f(`mouseenter`,t,e=>tt(e,N(`common.open`)||`Open`)),y(e,t)};h(v,e=>{D()&&e(b)}),n(s),n(t),y(e,t)};h(i,e=>{S()&&e(a)});var o=z(i,2),s=e=>{var t=zF(),r=W(t),i=e=>{var t=PF(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(Te))),y(e,t)},a=e=>{var t=RF(),r=q(t),i=e=>{var t=FF(),r=W(t),i=z(r,2),a=z(i,2),o=M(a);n(t),H((e,t,n,s)=>{B(r,`aria-label`,e),B(i,`aria-label`,t),B(a,`aria-label`,n),c(o,`${s??``}%`)},[()=>N(`common.zoomIn`),()=>N(`common.zoomOut`),()=>N(`common.resetZoom`),()=>Math.round(E(ye)*100)]),f(`blur`,r,()=>$()),l(`click`,r,$e),f(`focus`,r,e=>tt(e,N(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>$()),f(`mouseenter`,r,e=>tt(e,N(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>$()),l(`click`,i,et),f(`focus`,i,e=>tt(e,N(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>$()),f(`mouseenter`,i,e=>tt(e,N(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>$()),l(`click`,a,()=>F(ye,1)),f(`focus`,a,e=>tt(e,N(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>$()),f(`mouseenter`,a,e=>tt(e,N(`common.resetZoom`)||`Reset zoom`)),y(e,t)};h(r,e=>{A()&&e(i)});var a=z(r,2),o=W(a),s=e=>{var t=Y(),n=q(t);ae(n,()=>E(U)),y(e,t)},u=e=>{var t=PF(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(Te))),y(e,t)},d=e=>{var t=IF(),r=z(W(t));n(t),H(e=>c(r,` ${e??``}`),[()=>N(`common.preview`)]),y(e,t)};h(o,e=>{E(U)?e(s):E(G)?e(u,1):e(d,-1)}),n(a),se(a,e=>F(xe,e),()=>E(xe));var p=z(a,2),m=e=>{var t=LF(),n=M(t,!0);H(()=>c(n,E(G))),y(e,t)};h(p,e=>{E(G)&&e(m)}),H(()=>j(a,E(Pe))),y(e,t)};h(r,e=>{E(_e)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(ge)||e(s)});var u=z(o,2),d=e=>{var t=BF();let r;var i=W(t),a=W(i),o=W(a),s=W(o),u=z(s,2),d=z(u,2),f=M(d),p=z(d,2);n(o);var m=z(o,2),h=W(m);ae(h,()=>E(U),!0),n(h),se(h,e=>F(Se,e),()=>E(Se)),n(m),n(a),n(i),n(t),me(t,e=>rt?.(e)),H((e,n,i,a,o)=>{r=J(t,1,`markstream-svelte markstream-svelte-modal-root`,null,r,{dark:E(Oe)}),B(s,`aria-label`,e),B(u,`aria-label`,n),B(d,`aria-label`,i),c(f,`${a??``}%`),B(p,`aria-label`,o),j(h,`transform: scale(${E(ye)});`)},[()=>N(`common.zoomIn`),()=>N(`common.zoomOut`),()=>N(`common.resetZoom`),()=>Math.round(E(ye)*100),()=>N(`common.close`)]),l(`click`,i,at),l(`keydown`,i,ot),l(`click`,s,$e),l(`click`,u,et),l(`click`,d,()=>F(ye,1)),l(`click`,p,it),y(e,t)};h(u,e=>{E(ve)&&e(d)}),n(t),se(t,e=>F(be,e),()=>E(be)),H(()=>{r=J(t,1,`mermaid-block`,null,r,{dark:E(Oe),"is-rendering":E(De)||E(K)}),B(t,`data-markstream-mode`,E(_e)?`source`:E(Ie)?`preview`:`fallback`)}),y(e,t)};h(ct,e=>{E(Fe)&&e(lt)}),y(t,st),x()}T([`click`,`keydown`]);var UF=r(`<p class="paragraph-node"><!></p>`);function WF(e,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`indexKey`,3,void 0),s=I(()=>String(o()??`p`)),c=I(()=>TA(gA(r.node?.children)));var l=Y(),u=q(l);t(u,19,()=>E(c),(e,t)=>E(s)+`-`+t,(e,t,r)=>{var i=Y(),o=q(i),c=e=>{var i=UF(),o=W(i);{let e=I(()=>E(s)+`-`+E(r));pI(o,{get nodes(){return E(t).nodes},get context(){return a()},get prefix(){return E(e)}})}n(i),y(e,i)},l=e=>{{let n=I(()=>E(s)+`-`+E(r));fI(e,{get node(){return E(t).node},get context(){return a()},get indexKey(){return E(n)}})}};h(o,e=>{E(t).kind===`inline`?e(c):e(l,-1)}),y(e,i)}),y(e,l),x()}function GF(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=Y(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function KF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);sN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`del`})}function qF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);sN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`strong`})}function JF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);sN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sub`})}function YF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);sN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sup`})}function XF(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=Y(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var ZF=r(`<span> </span>`),QF=r(`<span> <!></span>`);function $F(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0);k(t,`typewriter`,3,void 0);let o=``,s=``,l=`markstream-svelte-text__stream-delta--a`,u=I(()=>_A(t.node?.content??t.node?.raw)),d=I(()=>!!t.node?.center),f=I(()=>String(r()?.customId??`global`)+`:`+String(r()?.streamRenderVersion??0)+`:`+String(a()??`node`)),p=I(()=>r()?.fade!==!1),m=I(()=>{let e=r()?.textStreamState,t=E(f)===o?s:e?.get(E(f))??``,n=tP({nextContent:E(u),previousContent:t,typewriterEnabled:E(p)});return n.appended&&(l=l.endsWith(`--a`)?`markstream-svelte-text__stream-delta--b`:`markstream-svelte-text__stream-delta--a`),o=E(f),s=E(u),e?.set(E(f),E(u)),{stableContent:n.settledContent,deltaContent:n.streamedDelta,deltaClass:l}});var g=QF();let _;var v=W(g,!0),b=z(v),S=e=>{var t=ZF(),n=M(t,!0);H(()=>{J(t,1,`markstream-svelte-text__stream-delta text-node-stream-delta ${E(m).deltaClass??``}`),c(n,E(m).deltaContent)}),y(e,t)};h(b,e=>{E(m).deltaContent&&e(S)}),n(g),H(()=>{B(g,`data-typewriter`,r()?.typewriter===!0?`1`:void 0),_=J(g,1,`markstream-svelte-text-node text-node`,null,_,{"markstream-svelte-text--centered":E(d)}),c(v,E(m).stableContent)}),y(e,g),x()}var eI=r(`<hr/>`);function tI(e){var t=eI();y(e,t)}function nI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=Y(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function rI(e,t){if(t?.renderCodeBlocksAsPre)return`pre`;let n=CA(e);return n===`d2`||n===`d2lang`?`d2`:n===`infographic`?`infographic`:n===`mermaid`?`mermaid`:`code`}function iI(e){return String(e?.tag||``).trim().toLowerCase()||my(e?.content)}function aI(e){let t=iI(e);return t?{...e,type:t,tag:t,content:gy(e?.content,t)}:e}function oI(e,t){let n=iI(e);return n?{...e,type:t,tag:n}:e}function sI(e,t){if(String(e?.type||``)!==`code_block`)return null;let n=rI(e,t);return n===`mermaid`?lI(t?.mermaidProps,PN(cI(e))):n===`d2`?t?.d2Props??null:n===`infographic`?lI(t?.infographicProps,FN(cI(e))):t?.codeBlockProps??null}function cI(e){return String(e?.code??``)}function lI(e,t){let n={...e||{}};return MN(n.estimatedPreviewHeightPx)??(n.estimatedPreviewHeightPx=IN(t,void 0,n.maxHeight===`none`?null:MN(n.maxHeight)??void 0)),n}function uI(e,t,n){let r=n??t?.customComponents??null,i=String(e?.type||``);if(i===`code_block`){let n=CA(e),i=n?r?.[n]:null;if(i)return i;let a=rI(e,t);if(a===`mermaid`&&r?.mermaid)return r.mermaid;if(a===`d2`&&r?.d2)return r.d2;if(a===`infographic`&&r?.infographic)return r.infographic;if(r?.code_block)return r.code_block}let a=r?.[i];if(a)return a;let o=iI(e);return o&&r?.[o]?r[o]:null}var dI=r(`<span hidden=""></span>`);function fI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),o=I(()=>String(t.node?.type||``)),s=I(()=>n()?.customComponents||Tj(n()?.customId)),c=I(()=>uI(t.node,n(),E(s))),l=I(()=>aI(t.node)),u=I(()=>sI(t.node,n())||{}),d=I(()=>rI(t.node,n())),f=I(()=>iI(t.node)),m=I(C),g=I(()=>oI(t.node,E(o))),_=I(()=>`${String(r()??`code-block`)}:${String(t.node?.language??``)}:${t.node?.diff?`diff`:`code`}`),v=I(()=>typeof n()?.codeBlockProps?.showLineNumbers==`boolean`?n().codeBlockProps.showLineNumbers:typeof n()?.codeBlockOptions?.disableLineNumbers==`boolean`&&!n().codeBlockOptions.disableLineNumbers),b=I(()=>n()?.codeBlockOptions?.overflow?`white-space: ${n().codeBlockOptions.overflow===`scroll`?`pre`:`pre-wrap`}`:void 0),S=I(()=>({type:`text`,content:String(t.node?.content??t.node?.raw??``),raw:String(t.node?.content??t.node?.raw??``)}));function C(){return E(o)!==`html_block`&&E(o)!==`html_inline`?!1:n()?.htmlPolicy===`escape`?!0:!E(f)||(n()?.customHtmlTags??[]).some(e=>String(e).toLowerCase()===E(f))||Iv.has(E(f))?!1:!hy(t.node?.content??t.node?.raw,E(f))}var w=Y(),T=q(w),D=e=>{var t=Y(),i=q(t);{let e=I(()=>n()?.customId),t=I(()=>n()?.isDark),o=I(()=>n()?.typewriter),s=I(()=>n()?.fade),d=I(()=>n()?.codeBlockOptions);a(i,()=>E(c),(i,a)=>{a(i,K({get node(){return E(l)},get context(){return n()},get ctx(){return n()},get customId(){return E(e)},get isDark(){return E(t)},get indexKey(){return r()},get typewriter(){return E(o)},get fade(){return E(s)}},()=>E(u),{get codeBlockOptions(){return E(d)}}))})}y(e,t)},O=e=>{{let i=I(()=>n()?.typewriter);$F(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get typewriter(){return E(i)}})}},A=e=>{WF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},j=e=>{vN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ee=e=>{hI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},te=e=>{wP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},M=e=>{xP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},N=e=>{XF(e,{get node(){return t.node},get context(){return n()}})},P=e=>{iN(e,{get node(){return t.node},get context(){return n()}})},F=e=>{pN(e,{get node(){return t.node},get context(){return n()}})},L=e=>{hN(e,{get node(){return t.node}})},ne=e=>{dN(e,{get node(){return t.node}})},re=e=>{bj(e,{get node(){return t.node},get context(){return n()}})},ie=e=>{_N(e,{})},R=e=>{{let i=I(()=>typeof n()?.showTooltips==`boolean`?n()?.showTooltips:void 0);yP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get showTooltip(){return E(i)}})}},ae=e=>{ON(e,{get node(){return t.node}})},oe=e=>{hP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},se=e=>{qF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},z=e=>{cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},B=e=>{KF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},V=e=>{yN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ce=e=>{gP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},H=e=>{JF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},U=e=>{YF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},W=e=>{Dj(e,{get node(){return t.node}})},le=e=>{oN(e,{get node(){return t.node}})},G=e=>{GF(e,{get node(){return t.node},get context(){return n()}})},ue=e=>{var t=Y(),i=q(t),a=e=>{$F(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{bN(e,{get node(){return E(g)},get context(){return n()}})};h(i,e=>{E(m)?e(a):e(o,-1)}),y(e,t)},de=e=>{var t=Y(),i=q(t),a=e=>{$F(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{xN(e,{get node(){return E(g)},get context(){return n()}})};h(i,e=>{E(m)?e(a):e(o,-1)}),y(e,t)},fe=e=>{nI(e,{get node(){return t.node},get context(){return n()}})},pe=e=>{tI(e,{})},me=e=>{tF(e,{get node(){return t.node}})},he=e=>{QP(e,{get node(){return t.node}})},J=e=>{var r=Y(),i=q(r),a=e=>{HF(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},o=e=>{rN(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},s=e=>{eP(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},c=e=>{hM(e,{get node(){return t.node},get showLineNumbers(){return E(v)},get style(){return E(b)}})},l=e=>{var r=Y(),i=q(r);p(i,()=>E(_),e=>{{let r=I(()=>n()?.codeBlockOptions);jM(e,K({get node(){return t.node},get context(){return n()}},()=>E(u),{get codeBlockOptions(){return E(r)}}))}}),y(e,r)};h(i,e=>{E(d)===`mermaid`?e(a):E(d)===`d2`?e(o,1):E(d)===`infographic`?e(s,2):E(d)===`pre`?e(c,3):e(l,-1)}),y(e,r)},ge=e=>{var t=dI();y(e,t)},_e=e=>{lN(e,{get node(){return t.node},get context(){return n()}})};h(T,e=>{E(c)?e(D):E(o)===`text`||E(o)===`text_special`?e(O,1):E(o)===`paragraph`?e(A,2):E(o)===`heading`?e(j,3):E(o)===`blockquote`?e(ee,4):E(o)===`list`?e(te,5):E(o)===`list_item`?e(M,6):E(o)===`table`?e(N,7):E(o)===`definition_list`?e(P,8):E(o)===`footnote`?e(F,9):E(o)===`footnote_reference`?e(L,10):E(o)===`footnote_anchor`?e(ne,11):E(o)===`admonition`?e(re,12):E(o)===`hardbreak`?e(ie,13):E(o)===`link`?e(R,14):E(o)===`image`?e(ae,15):E(o)===`inline_code`?e(oe,16):E(o)===`strong`?e(se,17):E(o)===`emphasis`?e(z,18):E(o)===`strikethrough`?e(B,19):E(o)===`highlight`?e(V,20):E(o)===`insert`?e(ce,21):E(o)===`subscript`?e(H,22):E(o)===`superscript`?e(U,23):E(o)===`checkbox`||E(o)===`checkbox_input`?e(W,24):E(o)===`emoji`?e(le,25):E(o)===`reference`?e(G,26):E(o)===`html_block`?e(ue,27):E(o)===`html_inline`?e(de,28):E(o)===`vmr_container`?e(fe,29):E(o)===`thematic_break`?e(pe,30):E(o)===`math_inline`?e(me,31):E(o)===`math_block`?e(he,32):E(o)===`code_block`?e(J,33):E(o)===`label_open`||E(o)===`label_close`?e(ge,34):e(_e,-1)}),y(e,w),x()}function pI(e,n){let r=k(n,`nodes`,19,()=>[]),i=k(n,`context`,3,void 0),a=k(n,`prefix`,3,`child`);var o=Y(),s=q(o);t(s,19,()=>r()||[],(e,t)=>a()+`-`+t,(e,t,n)=>{{let r=I(()=>a()+`-`+E(n));fI(e,{get node(){return E(t)},get context(){return i()},get indexKey(){return E(r)}})}}),y(e,o)}var mI=r(`<blockquote class="blockquote blockquote-node" dir="auto"><!></blockquote>`);function hI(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>_A(t.node?.cite));var s=mI(),c=W(s);{let e=I(()=>gA(t.node?.children)),n=I(()=>String(a()??`blockquote`)+`-blockquote`);pI(c,{get nodes(){return E(e)},get context(){return r()},get prefix(){return E(n)}})}n(s),H(()=>{B(s,`cite`,E(o)||void 0),s.dir=s.dir}),y(e,s),x()}var gI=0,_I=new WeakMap,vI={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},yI={cjs:`javascript`,cts:`typescript`,d2lang:`plaintext`,js:`javascript`,jsonc:`json`,jsx:`javascript`,md:`markdown`,mjs:`javascript`,sh:`shell`,text:`plaintext`,ts:`typescript`,tsx:`typescript`,txt:`plaintext`,vue:`html`,yml:`yaml`};async function bI(e,t={}){xI(e);let n=[],r=!1,i=()=>!r&&t.isCancelled?.call(t)!==!0,a={dispose:()=>{var t;if(!r){r=!0;for(let e=n.length-1;e>=0;--e)try{(t=n[e])==null||t.call(n)}catch{}_I.get(e)===a&&_I.delete(e)}}};return _I.set(e,a),!i()||(await DI(e,i),!i())||(await kI(e,n,t,i),!i())||t.final!==!1&&(await FI(e,n,t,i),!i()||(await II(e,n,t,i),!i())||(t.renderCodeBlocksAsPre||await LI(e,n,t,i),!i()))||!i()||(YI(e,n),!i())||JI(e,n,t),a}function xI(e){e&&_I.get(e)?.dispose()}function SI(e,t){let n=e.querySelector(t);return{sourceElement:n,source:(n?.textContent||(n?``:e.textContent)||``).trim()}}function CI(e,t){return e.querySelector(t)}function wI(e,t){return!!(CI(e,t)||e).querySelector(`.katex, .katex-display`)}function TI(e,t,n,r={}){t?t.innerHTML=n:e.innerHTML=n,e.dataset.markstreamKatex=`1`,r.renderedClass&&e.classList.add(r.renderedClass)}function EI(e,t,n={}){t&&(t.innerHTML=``),delete e.dataset.markstreamKatex,delete e.dataset.markstreamKatexSource,n.renderedClass&&e.classList.remove(n.renderedClass)}async function DI(e,t){let n=Array.from(e.querySelectorAll(`.markstream-nested-math`));for(let e of n){if(!t())return;if(e.dataset.markstreamKatexManaged===`1`)continue;let{source:n}=SI(e,`.markstream-nested-math__source`),r=CI(e,`.markstream-nested-math__render`);if(!n){EI(e,r);continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&wI(e,`.markstream-nested-math__render`)))try{TI(e,r,await OI(n,e.dataset.display===`block`)),e.dataset.markstreamKatexSource=n}catch{EI(e,r)}}let r=Array.from(e.querySelectorAll(`.markstream-nested-math-block`));for(let e of r){if(!t())return;if(e.dataset.markstreamKatexManaged===`1`)continue;let{source:n}=SI(e,`.markstream-nested-math-block__source`),r=CI(e,`.markstream-nested-math-block__render`);if(!n){EI(e,r,{renderedClass:`markstream-nested-math-block--rendered`});continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&wI(e,`.markstream-nested-math-block__render`)))try{TI(e,r,await OI(n,!0),{renderedClass:`markstream-nested-math-block--rendered`}),e.dataset.markstreamKatexSource=n}catch{EI(e,r,{renderedClass:`markstream-nested-math-block--rendered`})}}}async function OI(e,t){let n=PP(e);try{return await XP(n,t,{timeout:1500,waitTimeout:0,maxRetries:0})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)throw e}let r=await NP();if(!r)throw Error(`KaTeX renderer is not available.`);let i=r.renderToString(n,{displayMode:t,throwOnError:!1});return KP(n,t,i),i}async function kI(e,t,n,r){var i;let a=n.mermaidProps?.isStrict!==!1,o=await gF({startOnLoad:!1,securityLevel:a?`strict`:`loose`,suppressErrorRendering:!0,...a?{flowchart:{htmlLabels:!1}}:{}});if(!o||!r())return;let s=Array.from(e.querySelectorAll(`pre > code.language-mermaid`));for(let e of s){if(!r())return;let a=e.parentElement,s=(e.textContent||``).trim();if(!a||!s)continue;let c=a.cloneNode(!0),l=KI(`mermaid`,`Mermaid`,s,!0,n,{showHeader:n.mermaidProps?.showHeader!==!1});a.replaceWith(l.wrapper);try{let e=n.isDark?`dark`:`light`,a=s;if(n.final===!1)try{await jI(s,e,o,n)}catch(t){if(t?.name===`AbortError`)return;let i=await MI(s,e,n);if(!r())return;if(!i){l.wrapper.replaceWith(c);continue}a=i}let u=`markstream-svelte-mermaid-${++gI}`,d=await PI(()=>Promise.resolve(o.render(u,AI(a,e))),n.final===!1?Number(n.mermaidProps?.renderTimeoutMs??2500):Number(n.mermaidProps?.fullRenderTimeoutMs??4e3));if(!r())return;let f=typeof d==`string`?d:d?.svg;if(!f)continue;let p=Qk(f);if(!p)continue;if(l.body.innerHTML=p,l.body.classList.add(`markstream-svelte-mermaid`),l.wrapper.dataset.markstreamMermaid=`1`,n.mermaidProps?.enableMermaidInteractions===!0&&typeof d!=`string`)try{(i=d?.bindFunctions)==null||i.call(d,l.body)}catch{}t.push(()=>{l.wrapper.isConnected&&l.wrapper.replaceWith(c.cloneNode(!0))})}catch{l.wrapper.replaceWith(c)}}}function AI(e,t){return e.trimStart().startsWith(`%%{`)?e:`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n${e}`}async function jI(e,t,n,r){let i=Number(r.mermaidProps?.workerTimeoutMs??1400),a=Number(r.mermaidProps?.parseTimeoutMs??1800);try{if(await wF(e,t,i))return!0}catch(e){if(e?.name===`AbortError`)throw e}let o=AI(e,t);if(typeof n?.parse==`function`)return await PI(()=>Promise.resolve(n.parse(o)),a),!0;let s=`markstream-svelte-mermaid-parse-${++gI}`;return await PI(()=>Promise.resolve(n.render(s,o)),a),!0}async function MI(e,t,n){let r=Number(n.mermaidProps?.workerTimeoutMs??1400);try{let n=await TF(e,t,r);if(n)return n}catch(e){if(e?.name===`AbortError`)throw e}return NI(e)}function NI(e){let t=e.split(`
218
+ `).trim()||``}function Ke(e){return e.replace(/\s+/g,``)}function Q(){return`${E(we)}\n${E(Oe)}\n${ee()}\n${te()}\n${E(ke)}\n${E(Ae)}`}function qe(e,t){return!t||t<=0?e():new Promise((n,r)=>{let i=setTimeout(()=>r(Error(`Operation timed out`)),t);e().then(e=>{clearTimeout(i),n(e)}).catch(e=>{clearTimeout(i),r(e)})})}function Je(e){if(te()&&e?.querySelector(`svg`))try{Ce?.(e)}catch{}}async function Ye(){await _M(E(we)),a()?.events?.onCopy?.(E(we)),F(me,!0),E(Se)&&clearTimeout(E(Se)),F(Se,setTimeout(()=>{F(me,!1)},1e3),!0)}function Xe(){E(U)&&yM(E(U),`mermaid-diagram-${Date.now()}.svg`)}function Ze(e){F(ge,e===`source`),E(ge)||Be()}function Qe(){F(ve,Math.min(3,Math.round((E(ve)+.1)*10)/10),!0)}function $e(){F(ve,Math.max(.5,Math.round((E(ve)-.1)*10)/10),!0)}function et(e,t,n=`top`){let r=e.currentTarget;!r||r instanceof HTMLButtonElement&&r.disabled||Jj(r,t,n,!1,void 0,E(De))}function tt(e){et(e,E(me)?N(`common.copied`)||`Copied`:N(`common.copy`)||`Copy`)}function nt(e){return document.body.appendChild(e),{destroy(){e.remove()}}}function rt(){F(_e,!1)}function it(e){e.target===e.currentTarget&&rt()}function at(e){e.key===`Escape`&&rt()}var ot=X(),st=q(ot),ct=e=>{var t=HF();let r;var i=W(t),a=e=>{var t=PF(),r=W(t),i=W(r);ae(i,()=>P,!0),n(i),oe(2),n(r);var a=z(r,2),o=e=>{var t=DF(),r=W(t);let i;var a=W(r),o=z(W(a),2),s=M(o,!0);n(a),n(r);var u=z(r,2);let d;var p=W(u),m=z(W(p),2),h=M(m,!0);n(p),n(u),n(t),H((e,t)=>{i=Y(r,1,`mermaid-toggle-btn`,null,i,{"mermaid-toggle-btn--active":!E(ge)}),c(s,e),d=Y(u,1,`mermaid-toggle-btn`,null,d,{"mermaid-toggle-btn--active":E(ge)}),c(h,t)},[()=>N(`common.preview`),()=>N(`common.source`)]),f(`blur`,r,()=>Yj()),l(`click`,r,()=>Ze(`preview`)),f(`focus`,r,e=>et(e,N(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>et(e,N(`common.preview`)||`Preview`)),f(`blur`,u,()=>Yj()),l(`click`,u,()=>Ze(`source`)),f(`focus`,u,e=>et(e,N(`common.source`)||`Source`)),f(`mouseleave`,u,()=>Yj()),f(`mouseenter`,u,e=>et(e,N(`common.source`)||`Source`)),y(e,t)};h(a,e=>{C()&&e(o)});var s=z(a,2),u=W(s),d=e=>{var t=OF(),r=W(t);let i;n(t),H(e=>{B(t,`aria-pressed`,E(he)),B(t,`aria-label`,e),i=j(r,``,i,{rotate:E(he)?`0deg`:`90deg`})},[()=>E(he)?N(`common.expand`):N(`common.collapse`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(he,!E(he))),f(`focus`,t,e=>et(e,E(he)?N(`common.expand`)||`Expand`:N(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>et(e,E(he)?N(`common.expand`)||`Expand`:N(`common.collapse`)||`Collapse`)),y(e,t)};h(u,e=>{O()&&e(d)});var p=z(u,2),m=e=>{var t=jF(),r=W(t),i=e=>{var t=kF();y(e,t)},a=e=>{var t=AF();y(e,t)};h(r,e=>{E(me)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(me)?N(`common.copied`):N(`common.copy`)]),f(`blur`,t,()=>Yj()),l(`click`,t,Ye),f(`focus`,t,tt),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,tt),y(e,t)};h(p,e=>{w()&&e(m)});var g=z(p,2),_=e=>{var t=MF();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(ge)||E(he)},[()=>N(`common.export`)]),f(`blur`,t,()=>Yj()),l(`click`,t,Xe),f(`focus`,t,e=>et(e,N(`common.export`)||`Export`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>et(e,N(`common.export`)||`Export`)),y(e,t)};h(g,e=>{T()&&e(_)});var v=z(g,2),b=e=>{var t=NF();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(ge)||E(he)},[()=>N(`common.open`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(_e,!0)),f(`focus`,t,e=>et(e,N(`common.open`)||`Open`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>et(e,N(`common.open`)||`Open`)),y(e,t)};h(v,e=>{D()&&e(b)}),n(s),n(t),y(e,t)};h(i,e=>{S()&&e(a)});var o=z(i,2),s=e=>{var t=BF(),r=W(t),i=e=>{var t=FF(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(we))),y(e,t)},a=e=>{var t=zF(),r=q(t),i=e=>{var t=IF(),r=W(t),i=z(r,2),a=z(i,2),o=M(a);n(t),H((e,t,n,s)=>{B(r,`aria-label`,e),B(i,`aria-label`,t),B(a,`aria-label`,n),c(o,`${s??``}%`)},[()=>N(`common.zoomIn`),()=>N(`common.zoomOut`),()=>N(`common.resetZoom`),()=>Math.round(E(ve)*100)]),f(`blur`,r,()=>Yj()),l(`click`,r,Qe),f(`focus`,r,e=>et(e,N(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>et(e,N(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>Yj()),l(`click`,i,$e),f(`focus`,i,e=>et(e,N(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>Yj()),f(`mouseenter`,i,e=>et(e,N(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>Yj()),l(`click`,a,()=>F(ve,1)),f(`focus`,a,e=>et(e,N(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>Yj()),f(`mouseenter`,a,e=>et(e,N(`common.resetZoom`)||`Reset zoom`)),y(e,t)};h(r,e=>{A()&&e(i)});var a=z(r,2),o=W(a),s=e=>{var t=X(),n=q(t);ae(n,()=>E(U)),y(e,t)},u=e=>{var t=FF(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(we))),y(e,t)},d=e=>{var t=LF(),r=z(W(t));n(t),H(e=>c(r,` ${e??``}`),[()=>N(`common.preview`)]),y(e,t)};h(o,e=>{E(U)?e(s):E(G)?e(u,1):e(d,-1)}),n(a),se(a,e=>F(be,e),()=>E(be));var p=z(a,2),m=e=>{var t=RF(),n=M(t,!0);H(()=>c(n,E(G))),y(e,t)};h(p,e=>{E(G)&&e(m)}),H(()=>j(a,E(Ne))),y(e,t)};h(r,e=>{E(ge)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(he)||e(s)});var u=z(o,2),d=e=>{var t=VF();let r;var i=W(t),a=W(i),o=W(a),s=W(o),u=z(s,2),d=z(u,2),f=M(d),p=z(d,2);n(o);var m=z(o,2),h=W(m);ae(h,()=>E(U),!0),n(h),se(h,e=>F(xe,e),()=>E(xe)),n(m),n(a),n(i),n(t),pe(t,e=>nt?.(e)),H((e,n,i,a,o)=>{r=Y(t,1,`markstream-svelte markstream-svelte-modal-root`,null,r,{dark:E(De)}),B(s,`aria-label`,e),B(u,`aria-label`,n),B(d,`aria-label`,i),c(f,`${a??``}%`),B(p,`aria-label`,o),j(h,`transform: scale(${E(ve)});`)},[()=>N(`common.zoomIn`),()=>N(`common.zoomOut`),()=>N(`common.resetZoom`),()=>Math.round(E(ve)*100),()=>N(`common.close`)]),l(`click`,i,it),l(`keydown`,i,at),l(`click`,s,Qe),l(`click`,u,$e),l(`click`,d,()=>F(ve,1)),l(`click`,p,rt),y(e,t)};h(u,e=>{E(_e)&&e(d)}),n(t),se(t,e=>F(ye,e),()=>E(ye)),H(()=>{r=Y(t,1,`mermaid-block`,null,r,{dark:E(De),"is-rendering":E(Ee)||E(K)}),B(t,`data-markstream-mode`,E(ge)?`source`:E(Fe)?`preview`:`fallback`)}),y(e,t)};h(st,e=>{E(Pe)&&e(ct)}),y(t,ot),x()}T([`click`,`keydown`]);var WF=r(`<p class="paragraph-node"><!></p>`);function GF(e,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`indexKey`,3,void 0),s=I(()=>String(o()??`p`)),c=I(()=>TA(gA(r.node?.children)));var l=X(),u=q(l);t(u,19,()=>E(c),(e,t)=>E(s)+`-`+t,(e,t,r)=>{var i=X(),o=q(i),c=e=>{var i=WF(),o=W(i);{let e=I(()=>E(s)+`-`+E(r));mI(o,{get nodes(){return E(t).nodes},get context(){return a()},get prefix(){return E(e)}})}n(i),y(e,i)},l=e=>{{let n=I(()=>E(s)+`-`+E(r));pI(e,{get node(){return E(t).node},get context(){return a()},get indexKey(){return E(n)}})}};h(o,e=>{E(t).kind===`inline`?e(c):e(l,-1)}),y(e,i)}),y(e,l),x()}function KF(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function qF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`del`})}function JF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`strong`})}function YF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sub`})}function XF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sup`})}function ZF(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var QF=r(`<span> </span>`),$F=r(`<span> <!></span>`);function eI(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0);k(t,`typewriter`,3,void 0);let o=``,s=``,l=`markstream-svelte-text__stream-delta--a`,u=I(()=>_A(t.node?.content??t.node?.raw)),d=I(()=>!!t.node?.center),f=I(()=>String(r()?.customId??`global`)+`:`+String(r()?.streamRenderVersion??0)+`:`+String(a()??`node`)),p=I(()=>r()?.fade!==!1),m=I(()=>{let e=r()?.textStreamState,t=E(f)===o?s:e?.get(E(f))??``,n=nP({nextContent:E(u),previousContent:t,typewriterEnabled:E(p)});return n.appended&&(l=l.endsWith(`--a`)?`markstream-svelte-text__stream-delta--b`:`markstream-svelte-text__stream-delta--a`),o=E(f),s=E(u),e?.set(E(f),E(u)),{stableContent:n.settledContent,deltaContent:n.streamedDelta,deltaClass:l}});var g=$F();let _;var v=W(g,!0),b=z(v),S=e=>{var t=QF(),n=M(t,!0);H(()=>{Y(t,1,`markstream-svelte-text__stream-delta text-node-stream-delta ${E(m).deltaClass??``}`),c(n,E(m).deltaContent)}),y(e,t)};h(b,e=>{E(m).deltaContent&&e(S)}),n(g),H(()=>{B(g,`data-typewriter`,r()?.typewriter===!0?`1`:void 0),_=Y(g,1,`markstream-svelte-text-node text-node`,null,_,{"markstream-svelte-text--centered":E(d)}),c(v,E(m).stableContent)}),y(e,g),x()}var tI=r(`<hr/>`);function nI(e){var t=tI();y(e,t)}function rI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function iI(e,t){if(t?.renderCodeBlocksAsPre)return`pre`;let n=CA(e);return n===`d2`||n===`d2lang`?`d2`:n===`infographic`?`infographic`:n===`mermaid`?`mermaid`:`code`}function aI(e){return String(e?.tag||``).trim().toLowerCase()||my(e?.content)}function oI(e){let t=aI(e);return t?{...e,type:t,tag:t,content:gy(e?.content,t)}:e}function sI(e,t){let n=aI(e);return n?{...e,type:t,tag:n}:e}function cI(e,t){if(String(e?.type||``)!==`code_block`)return null;let n=iI(e,t);return n===`mermaid`?uI(t?.mermaidProps,FN(lI(e))):n===`d2`?t?.d2Props??null:n===`infographic`?uI(t?.infographicProps,IN(lI(e))):t?.codeBlockProps??null}function lI(e){return String(e?.code??``)}function uI(e,t){let n={...e||{}};return NN(n.estimatedPreviewHeightPx)??(n.estimatedPreviewHeightPx=LN(t,void 0,n.maxHeight===`none`?null:NN(n.maxHeight)??void 0)),n}function dI(e,t,n){let r=n??t?.customComponents??null,i=String(e?.type||``);if(i===`code_block`){let n=CA(e),i=n?r?.[n]:null;if(i)return i;let a=iI(e,t);if(a===`mermaid`&&r?.mermaid)return r.mermaid;if(a===`d2`&&r?.d2)return r.d2;if(a===`infographic`&&r?.infographic)return r.infographic;if(r?.code_block)return r.code_block}let a=r?.[i];if(a)return a;let o=aI(e);return o&&r?.[o]?r[o]:null}var fI=r(`<span hidden=""></span>`);function pI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),o=I(()=>String(t.node?.type||``)),s=I(()=>n()?.customComponents||Tj(n()?.customId)),c=I(()=>dI(t.node,n(),E(s))),l=I(()=>oI(t.node)),u=I(()=>cI(t.node,n())||{}),d=I(()=>iI(t.node,n())),f=I(()=>aI(t.node)),m=I(C),g=I(()=>sI(t.node,E(o))),_=I(()=>`${String(r()??`code-block`)}:${String(t.node?.language??``)}:${t.node?.diff?`diff`:`code`}`),v=I(()=>typeof n()?.codeBlockProps?.showLineNumbers==`boolean`?n().codeBlockProps.showLineNumbers:typeof n()?.codeBlockOptions?.disableLineNumbers==`boolean`&&!n().codeBlockOptions.disableLineNumbers),b=I(()=>n()?.codeBlockOptions?.overflow?`white-space: ${n().codeBlockOptions.overflow===`scroll`?`pre`:`pre-wrap`}`:void 0),S=I(()=>({type:`text`,content:String(t.node?.content??t.node?.raw??``),raw:String(t.node?.content??t.node?.raw??``)}));function C(){return E(o)!==`html_block`&&E(o)!==`html_inline`?!1:n()?.htmlPolicy===`escape`?!0:!E(f)||(n()?.customHtmlTags??[]).some(e=>String(e).toLowerCase()===E(f))||Iv.has(E(f))?!1:!hy(t.node?.content??t.node?.raw,E(f))}var w=X(),T=q(w),D=e=>{var t=X(),i=q(t);{let e=I(()=>n()?.customId),t=I(()=>n()?.isDark),o=I(()=>n()?.typewriter),s=I(()=>n()?.fade),d=I(()=>n()?.codeBlockOptions);a(i,()=>E(c),(i,a)=>{a(i,K({get node(){return E(l)},get context(){return n()},get ctx(){return n()},get customId(){return E(e)},get isDark(){return E(t)},get indexKey(){return r()},get typewriter(){return E(o)},get fade(){return E(s)}},()=>E(u),{get codeBlockOptions(){return E(d)}}))})}y(e,t)},O=e=>{{let i=I(()=>n()?.typewriter);eI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get typewriter(){return E(i)}})}},A=e=>{GF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},j=e=>{yN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ee=e=>{gI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},te=e=>{TP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},M=e=>{SP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},N=e=>{ZF(e,{get node(){return t.node},get context(){return n()}})},P=e=>{aN(e,{get node(){return t.node},get context(){return n()}})},F=e=>{mN(e,{get node(){return t.node},get context(){return n()}})},L=e=>{gN(e,{get node(){return t.node}})},ne=e=>{fN(e,{get node(){return t.node}})},re=e=>{bj(e,{get node(){return t.node},get context(){return n()}})},ie=e=>{vN(e,{})},R=e=>{{let i=I(()=>typeof n()?.showTooltips==`boolean`?n()?.showTooltips:void 0);bP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get showTooltip(){return E(i)}})}},ae=e=>{kN(e,{get node(){return t.node}})},oe=e=>{gP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},se=e=>{JF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},z=e=>{lN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},B=e=>{qF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},V=e=>{bN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ce=e=>{_P(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},H=e=>{YF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},U=e=>{XF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},W=e=>{Dj(e,{get node(){return t.node}})},le=e=>{sN(e,{get node(){return t.node}})},G=e=>{KF(e,{get node(){return t.node},get context(){return n()}})},ue=e=>{var t=X(),i=q(t),a=e=>{eI(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{xN(e,{get node(){return E(g)},get context(){return n()}})};h(i,e=>{E(m)?e(a):e(o,-1)}),y(e,t)},de=e=>{var t=X(),i=q(t),a=e=>{eI(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{SN(e,{get node(){return E(g)},get context(){return n()}})};h(i,e=>{E(m)?e(a):e(o,-1)}),y(e,t)},J=e=>{rI(e,{get node(){return t.node},get context(){return n()}})},fe=e=>{nI(e,{})},pe=e=>{nF(e,{get node(){return t.node}})},me=e=>{$P(e,{get node(){return t.node}})},Y=e=>{var r=X(),i=q(r),a=e=>{UF(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},o=e=>{iN(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},s=e=>{tP(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},c=e=>{gM(e,{get node(){return t.node},get showLineNumbers(){return E(v)},get style(){return E(b)}})},l=e=>{var r=X(),i=q(r);p(i,()=>E(_),e=>{{let r=I(()=>n()?.codeBlockOptions);MM(e,K({get node(){return t.node},get context(){return n()}},()=>E(u),{get codeBlockOptions(){return E(r)}}))}}),y(e,r)};h(i,e=>{E(d)===`mermaid`?e(a):E(d)===`d2`?e(o,1):E(d)===`infographic`?e(s,2):E(d)===`pre`?e(c,3):e(l,-1)}),y(e,r)},he=e=>{var t=fI();y(e,t)},ge=e=>{uN(e,{get node(){return t.node},get context(){return n()}})};h(T,e=>{E(c)?e(D):E(o)===`text`||E(o)===`text_special`?e(O,1):E(o)===`paragraph`?e(A,2):E(o)===`heading`?e(j,3):E(o)===`blockquote`?e(ee,4):E(o)===`list`?e(te,5):E(o)===`list_item`?e(M,6):E(o)===`table`?e(N,7):E(o)===`definition_list`?e(P,8):E(o)===`footnote`?e(F,9):E(o)===`footnote_reference`?e(L,10):E(o)===`footnote_anchor`?e(ne,11):E(o)===`admonition`?e(re,12):E(o)===`hardbreak`?e(ie,13):E(o)===`link`?e(R,14):E(o)===`image`?e(ae,15):E(o)===`inline_code`?e(oe,16):E(o)===`strong`?e(se,17):E(o)===`emphasis`?e(z,18):E(o)===`strikethrough`?e(B,19):E(o)===`highlight`?e(V,20):E(o)===`insert`?e(ce,21):E(o)===`subscript`?e(H,22):E(o)===`superscript`?e(U,23):E(o)===`checkbox`||E(o)===`checkbox_input`?e(W,24):E(o)===`emoji`?e(le,25):E(o)===`reference`?e(G,26):E(o)===`html_block`?e(ue,27):E(o)===`html_inline`?e(de,28):E(o)===`vmr_container`?e(J,29):E(o)===`thematic_break`?e(fe,30):E(o)===`math_inline`?e(pe,31):E(o)===`math_block`?e(me,32):E(o)===`code_block`?e(Y,33):E(o)===`label_open`||E(o)===`label_close`?e(he,34):e(ge,-1)}),y(e,w),x()}function mI(e,n){let r=k(n,`nodes`,19,()=>[]),i=k(n,`context`,3,void 0),a=k(n,`prefix`,3,`child`);var o=X(),s=q(o);t(s,19,()=>r()||[],(e,t)=>a()+`-`+t,(e,t,n)=>{{let r=I(()=>a()+`-`+E(n));pI(e,{get node(){return E(t)},get context(){return i()},get indexKey(){return E(r)}})}}),y(e,o)}var hI=r(`<blockquote class="blockquote blockquote-node" dir="auto"><!></blockquote>`);function gI(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>_A(t.node?.cite));var s=hI(),c=W(s);{let e=I(()=>gA(t.node?.children)),n=I(()=>String(a()??`blockquote`)+`-blockquote`);mI(c,{get nodes(){return E(e)},get context(){return r()},get prefix(){return E(n)}})}n(s),H(()=>{B(s,`cite`,E(o)||void 0),s.dir=s.dir}),y(e,s),x()}var _I=0,vI=new WeakMap,yI={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},bI={cjs:`javascript`,cts:`typescript`,d2lang:`plaintext`,js:`javascript`,jsonc:`json`,jsx:`javascript`,md:`markdown`,mjs:`javascript`,sh:`shell`,text:`plaintext`,ts:`typescript`,tsx:`typescript`,txt:`plaintext`,vue:`html`,yml:`yaml`};async function xI(e,t={}){SI(e);let n=[],r=!1,i=()=>!r&&t.isCancelled?.call(t)!==!0,a={dispose:()=>{var t;if(!r){r=!0;for(let e=n.length-1;e>=0;--e)try{(t=n[e])==null||t.call(n)}catch{}vI.get(e)===a&&vI.delete(e)}}};return vI.set(e,a),!i()||(await OI(e,i),!i())||(await AI(e,n,t,i),!i())||t.final!==!1&&(await II(e,n,t,i),!i()||(await LI(e,n,t,i),!i())||(t.renderCodeBlocksAsPre||await RI(e,n,t,i),!i()))||!i()||(XI(e,n),!i())||YI(e,n,t),a}function SI(e){e&&vI.get(e)?.dispose()}function CI(e,t){let n=e.querySelector(t);return{sourceElement:n,source:(n?.textContent||(n?``:e.textContent)||``).trim()}}function wI(e,t){return e.querySelector(t)}function TI(e,t){return!!(wI(e,t)||e).querySelector(`.katex, .katex-display`)}function EI(e,t,n,r={}){t?t.innerHTML=n:e.innerHTML=n,e.dataset.markstreamKatex=`1`,r.renderedClass&&e.classList.add(r.renderedClass)}function DI(e,t,n={}){t&&(t.innerHTML=``),delete e.dataset.markstreamKatex,delete e.dataset.markstreamKatexSource,n.renderedClass&&e.classList.remove(n.renderedClass)}async function OI(e,t){let n=Array.from(e.querySelectorAll(`.markstream-nested-math`));for(let e of n){if(!t())return;if(e.dataset.markstreamKatexManaged===`1`)continue;let{source:n}=CI(e,`.markstream-nested-math__source`),r=wI(e,`.markstream-nested-math__render`);if(!n){DI(e,r);continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&TI(e,`.markstream-nested-math__render`)))try{EI(e,r,await kI(n,e.dataset.display===`block`)),e.dataset.markstreamKatexSource=n}catch{DI(e,r)}}let r=Array.from(e.querySelectorAll(`.markstream-nested-math-block`));for(let e of r){if(!t())return;if(e.dataset.markstreamKatexManaged===`1`)continue;let{source:n}=CI(e,`.markstream-nested-math-block__source`),r=wI(e,`.markstream-nested-math-block__render`);if(!n){DI(e,r,{renderedClass:`markstream-nested-math-block--rendered`});continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&TI(e,`.markstream-nested-math-block__render`)))try{EI(e,r,await kI(n,!0),{renderedClass:`markstream-nested-math-block--rendered`}),e.dataset.markstreamKatexSource=n}catch{DI(e,r,{renderedClass:`markstream-nested-math-block--rendered`})}}}async function kI(e,t){let n=FP(e);try{return await ZP(n,t,{timeout:1500,waitTimeout:0,maxRetries:0})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)throw e}let r=await PP();if(!r)throw Error(`KaTeX renderer is not available.`);let i=r.renderToString(n,{displayMode:t,throwOnError:!1});return qP(n,t,i),i}async function AI(e,t,n,r){var i;let a=n.mermaidProps?.isStrict!==!1,o=await _F({startOnLoad:!1,securityLevel:a?`strict`:`loose`,suppressErrorRendering:!0,...a?{flowchart:{htmlLabels:!1}}:{}});if(!o||!r())return;let s=Array.from(e.querySelectorAll(`pre > code.language-mermaid`));for(let e of s){if(!r())return;let a=e.parentElement,s=(e.textContent||``).trim();if(!a||!s)continue;let c=a.cloneNode(!0),l=qI(`mermaid`,`Mermaid`,s,!0,n,{showHeader:n.mermaidProps?.showHeader!==!1});a.replaceWith(l.wrapper);try{let e=n.isDark?`dark`:`light`,a=s;if(n.final===!1)try{await MI(s,e,o,n)}catch(t){if(t?.name===`AbortError`)return;let i=await NI(s,e,n);if(!r())return;if(!i){l.wrapper.replaceWith(c);continue}a=i}let u=`markstream-svelte-mermaid-${++_I}`,d=await FI(()=>Promise.resolve(o.render(u,jI(a,e))),n.final===!1?Number(n.mermaidProps?.renderTimeoutMs??2500):Number(n.mermaidProps?.fullRenderTimeoutMs??4e3));if(!r())return;let f=typeof d==`string`?d:d?.svg;if(!f)continue;let p=Qk(f);if(!p)continue;if(l.body.innerHTML=p,l.body.classList.add(`markstream-svelte-mermaid`),l.wrapper.dataset.markstreamMermaid=`1`,n.mermaidProps?.enableMermaidInteractions===!0&&typeof d!=`string`)try{(i=d?.bindFunctions)==null||i.call(d,l.body)}catch{}t.push(()=>{l.wrapper.isConnected&&l.wrapper.replaceWith(c.cloneNode(!0))})}catch{l.wrapper.replaceWith(c)}}}function jI(e,t){return e.trimStart().startsWith(`%%{`)?e:`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n${e}`}async function MI(e,t,n,r){let i=Number(r.mermaidProps?.workerTimeoutMs??1400),a=Number(r.mermaidProps?.parseTimeoutMs??1800);try{if(await TF(e,t,i))return!0}catch(e){if(e?.name===`AbortError`)throw e}let o=jI(e,t);if(typeof n?.parse==`function`)return await FI(()=>Promise.resolve(n.parse(o)),a),!0;let s=`markstream-svelte-mermaid-parse-${++_I}`;return await FI(()=>Promise.resolve(n.render(s,o)),a),!0}async function NI(e,t,n){let r=Number(n.mermaidProps?.workerTimeoutMs??1400);try{let n=await EF(e,t,r);if(n)return n}catch(e){if(e?.name===`AbortError`)throw e}return PI(e)}function PI(e){let t=e.split(`
219
219
  `);for(;t.length>0;){let e=t[t.length-1].trimEnd();if(!e){t.pop();continue}if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}return t.join(`
220
- `)}function PI(e,t){return!t||t<=0?e():new Promise((n,r)=>{let i=!1,a=globalThis.setTimeout(()=>{i||(i=!0,r(Error(`Operation timed out`)))},t);e().then(e=>{i||(i=!0,clearTimeout(a),n(e))}).catch(e=>{i||(i=!0,clearTimeout(a),r(e))})})}async function FI(e,t,n,r){let i=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"] > code.language-infographic`));if(!i.length)return;let a=await jN();if(a&&r())for(let e of i){if(!r())return;let i=e.parentElement,o=e.textContent||``;if(!i||!o.trim())continue;let s=i.cloneNode(!0),c=KI(`infographic`,`Infographic`,o,!0,n,{showHeader:n.infographicProps?.showHeader!==!1});c.body.style.minHeight=`320px`,c.body.style.height=`360px`,i.replaceWith(c.wrapper);try{let e=new a({container:c.body,width:`100%`,height:`100%`});e.render(o);let n=null;typeof window<`u`&&typeof window.requestAnimationFrame==`function`&&(n=window.requestAnimationFrame(()=>{let e=c.body.scrollHeight;e>0&&(c.body.style.height=`${Math.min(Math.max(e,260),720)}px`)})),t.push(()=>{var t;n!=null&&typeof window<`u`&&window.cancelAnimationFrame(n),(t=e.destroy)==null||t.call(e),c.wrapper.isConnected&&c.wrapper.replaceWith(s.cloneNode(!0))}),c.wrapper.dataset.markstreamInfographic=`1`}catch{c.wrapper.replaceWith(s)}}}async function II(e,t,n,r){let i=await LM();if(!i||!r())return;let a=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"] > code.language-d2, pre[data-markstream-code-block="1"] > code.language-d2lang`));for(let e of a){if(!r())return;let a=e.parentElement,o=e.textContent||``;if(!a||!o.trim())continue;let s=a.cloneNode(!0),c=KI(`d2`,`D2`,o,!0,n,{showHeader:n.d2Props?.showHeader!==!1});a.replaceWith(c.wrapper);try{let e=RI(i);if(!e||typeof e.compile!=`function`||typeof e.render!=`function`)throw TypeError(`D2 instance is missing compile/render methods.`);let a=await e.compile(o),l=a?.diagram??a,u=a?.renderOptions??a?.options??{},d=n.d2ThemeId??u.themeID,f=n.d2DarkThemeId??u.darkThemeID,p={...u};if(p.themeID=n.isDark&&f!=null?f:d,p.darkThemeID=null,p.darkThemeOverrides=null,n.isDark){let e=u.themeOverrides&&typeof u.themeOverrides==`object`?u.themeOverrides:null;p.themeOverrides={...vI,...e||{}}}let m=await e.render(l,p);if(!r())return;let h=UM(WM(m));if(!h)throw Error(`D2 render returned empty output.`);c.body.innerHTML=h,c.wrapper.dataset.markstreamD2=`1`,t.push(()=>{c.wrapper.isConnected&&c.wrapper.replaceWith(s.cloneNode(!0))})}catch{c.wrapper.replaceWith(s)}}}async function LI(e,t,n,r){let i=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"]`)),a=n.codeBlockOptions?.overflow===`scroll`?`pre`:`pre-wrap`,o=n.codeBlockOptions?.maxHeight;for(let e of i){let t=e.querySelector(`code`);if(!t)continue;let n=zI(e,t).trim().toLowerCase();n!==`mermaid`&&n!==`infographic`&&n!==`d2`&&n!==`d2lang`&&(e.style.whiteSpace=a,typeof o==`number`&&(e.style.maxHeight=`${o}px`,e.style.overflow=`auto`))}let s=await Lj();if(s&&typeof s.createCodeBlockRuntime==`function`&&r())for(let e of i){if(!r())return;let i=e.querySelector(`code`);if(!i)continue;let a=zI(e,i),c=a.trim().toLowerCase();if(c===`mermaid`||c===`infographic`||c===`d2`||c===`d2lang`)continue;let l=i.textContent||``,u=e.dataset.markstreamDiff===`1`,d=GI(e.dataset.markstreamOriginal),f=GI(e.dataset.markstreamUpdated),p=BI(a),m=KI(`code`,u?`Diff / ${p}`:`Code / ${p}`,l,!1,n,{showHeader:n.codeBlockProps?.showHeader!==!1});m.body.classList.add(`markstream-svelte-enhanced-block__body--code`);let h=VI(u&&f||l,u);m.body.style.minHeight=`${typeof o==`number`?Math.min(h,o):h}px`,typeof o==`number`&&(m.body.style.maxHeight=`${o}px`,m.body.style.overflow=`auto`);let g=e.cloneNode(!0),_=null,v=!1,y=()=>{var e;if(!v){v=!0;try{(e=_?.cleanupEditor)==null||e.call(_)}catch{}m.wrapper.parentNode&&m.wrapper.replaceWith(g.cloneNode(!0))}};e.replaceWith(m.wrapper);let b={...n.codeBlockOptions??{}};for(let e of[`maxHeight`,`padding`,`tabSize`,`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete b[e];let x=b.parseDiffOptions&&typeof b.parseDiffOptions==`object`?b.parseDiffOptions:{},S=u?{diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,...b,parseDiffOptions:{context:2,...x}}:b,C=n.codeBlockProps?.theme,w=[n.codeBlockProps?.darkTheme??n.codeBlockProps?.themes?.[0]??n.codeBlockDarkTheme??n.themes?.[0]??`vitesse-dark`,n.codeBlockProps?.lightTheme??n.codeBlockProps?.themes?.[1]??n.codeBlockLightTheme??n.themes?.[1]??`vitesse-light`],T=typeof C==`string`?C:C&&typeof C==`object`?n.isDark?C.dark:C.light:n.isDark?n.codeBlockProps?.darkTheme??n.codeBlockProps?.themes?.[0]??n.codeBlockDarkTheme??n.themes?.[0]??`vitesse-dark`:n.codeBlockProps?.lightTheme??n.codeBlockProps?.themes?.[1]??n.codeBlockLightTheme??n.themes?.[1]??`vitesse-light`,E=typeof S.unsafeCSS==`string`?S.unsafeCSS:``,D=n.codeBlockProps?.showLineNumbers??n.codeBlockOptions?.disableLineNumbers!==!0,O=()=>{m.body.style.setProperty(`--diffs-tab-size`,String(n.codeBlockOptions?.tabSize??4)),typeof n.codeBlockOptions?.padding==`number`?m.body.style.setProperty(`--diffs-gap-block`,`${n.codeBlockOptions.padding}px`):m.body.style.removeProperty(`--diffs-gap-block`)};O(),_=s.createCodeBlockRuntime({overflow:`wrap`,...S,themes:w,theme:T,themeType:n.isDark?`dark`:`light`,disableLineNumbers:!D,MAX_HEIGHT:n.codeBlockOptions?.maxHeight??500,fontSize:n.codeBlockOptions?.fontSize??13,lineHeight:n.codeBlockOptions?.lineHeight,fontFamily:n.codeBlockOptions?.fontFamily,unsafeCSS:`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }
221
- ${E}`.trim(),disableFileHeader:!0,stream:!1,onThemeChange:O}),t.push(y);try{if(u&&typeof _.createDiffEditor==`function`?await _.createDiffEditor(m.body,d,f||l,p):await _.createEditor?.call(_,m.body,l,p),!r()){y();return}if(await _.setTheme?.call(_,T),!r()){y();return}if(await WI(),!r()){y();return}if(!HI(m.body,l))throw Error(`Code editor rendered no visible code content.`);m.wrapper.dataset.markstreamEnhanced=`1`,u&&(m.wrapper.dataset.markstreamEnhancedDiff=`1`)}catch{y()}}}function RI(e){if(typeof e==`function`){let t=new e;if(t&&typeof t.compile==`function`)return t;if(typeof e.compile==`function`)return e}return e?.D2&&typeof e.D2==`function`?new e.D2:typeof e?.compile==`function`?e:null}function zI(e,t){let n=e.dataset.markstreamLanguage?.trim();if(n)return n;let r=Array.from(t.classList).find(e=>e.startsWith(`language-`));return r?r.slice(9):`plaintext`}function BI(e){let t=e.trim().toLowerCase();return yI[t]||t||`plaintext`}function VI(e,t){let n=Math.max(1,e.split(`
222
- `).length);return Math.min(520,(t?180:96)+n*(t?20:18))}function HI(e,t){let n=e.querySelector([`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`));if(!n)return!1;let r=n.getBoundingClientRect();if(r.width<=0||r.height<=0)return!1;let i=t.split(`
223
- `).find(e=>e.trim())?.trim();if(!i)return!0;let a=UI(e.textContent||``),o=UI(i);return a.includes(o)}function UI(e){return e.replace(/\s+/g,``)}async function WI(){typeof window>`u`||typeof window.requestAnimationFrame!=`function`||await new Promise(e=>window.requestAnimationFrame(()=>e()))}function GI(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`base64`).toString(`utf8`);if(typeof globalThis.atob==`function`&&typeof TextDecoder<`u`){let t=globalThis.atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder().decode(n)}return``}function KI(e,t,n,r,i,a={}){let o=document.createElement(`div`);if(o.className=`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--${e}`,a.showHeader!==!1){let e=document.createElement(`div`);e.className=`markstream-svelte-enhanced-block__header`;let r=document.createElement(`span`);r.className=`markstream-svelte-enhanced-block__badge`,r.textContent=t,e.appendChild(r),e.appendChild(qI(n,i)),o.appendChild(e)}let s=document.createElement(`div`);if(s.className=`markstream-svelte-enhanced-block__body`,o.appendChild(s),r){let e=document.createElement(`details`);e.className=`markstream-svelte-enhanced-block__details`;let t=document.createElement(`summary`);t.textContent=`Source`,e.appendChild(t);let r=document.createElement(`pre`);r.className=`markstream-svelte-enhanced-block__source`;let i=document.createElement(`code`);i.textContent=n,r.appendChild(i),e.appendChild(r),o.appendChild(e)}return{wrapper:o,body:s}}function qI(e,t){let n=document.createElement(`div`);n.className=`markstream-svelte-enhanced-block__actions`;let r=document.createElement(`button`);return r.type=`button`,r.className=`markstream-svelte-enhanced-block__action`,r.textContent=`Copy`,t.showTooltips!==!1&&(r.title=`Copy source`),r.addEventListener(`click`,()=>{var n;XI(e),(n=t.onCopy)==null||n.call(t,e)}),n.appendChild(r),n}function JI(e,t,n){if(n.showTooltips===!1)return;let r=Array.from(e.querySelectorAll(`[data-markstream-tooltip], [title]`));if(r.length!==0)for(let e of r){if(e.matches(`.footnote-link, .footnote-anchor`))continue;let r=e.getAttribute(`title`),i=(e.dataset.markstreamTooltip||r||``).trim();if(!i)continue;r!=null&&e.removeAttribute(`title`);let a=()=>Jj(e,i,`top`,!1,void 0,n.isDark),o=()=>$();e.addEventListener(`mouseenter`,a),e.addEventListener(`focus`,a),e.addEventListener(`mouseleave`,o),e.addEventListener(`blur`,o),t.push(()=>{let t=e.getAttribute(`aria-describedby`)!=null;e.removeEventListener(`mouseenter`,a),e.removeEventListener(`focus`,a),e.removeEventListener(`mouseleave`,o),e.removeEventListener(`blur`,o),t&&$(!0),r!=null&&e.getAttribute(`title`)==null&&e.setAttribute(`title`,r)})}}function YI(e,t){let n=Array.from(e.querySelectorAll(`.footnote-reference .footnote-link[href^="#"]`));for(let e of n){let n=t=>{let n=e.getAttribute(`href`);n&&(t.preventDefault(),document.getElementById(n.slice(1))?.scrollIntoView({behavior:`smooth`,block:`start`}))};e.addEventListener(`click`,n),t.push(()=>e.removeEventListener(`click`,n))}}async function XI(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}}catch{}if(typeof document>`u`)return;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch{}finally{t.remove()}}function ZI(e={}){let t=typeof e==`function`?e():e,n=V(``),r=V(``),i=V(!1),a=V(0),o=V(!1),s=V(!1),c=sP(t),l=()=>{let e=c.getSnapshot();F(n,e.source,!0),F(r,e.visible,!0),F(i,e.done,!0),F(a,e.pendingChars,!0),F(o,e.caughtUp,!0),F(s,e.final,!0)},u=c.subscribe(l);return l(),ce(()=>{u(),c.destroy()}),{get source(){return E(n)},get visible(){return E(r)},get done(){return E(i)},get caughtUp(){return E(o)},get final(){return E(s)},get pendingChars(){return E(a)},enqueue:e=>c.enqueue(e),finish:e=>c.finish(e),flush:()=>c.flush(),reset:e=>c.reset(e),pause:()=>c.pause(),resume:()=>c.resume()}}var QI=`markstreamSmoothStreaming`,$I=r(`<div class="node-slot"><div><!></div></div>`),eL=r(`<span class="typewriter-cursor" aria-hidden="true"></span>`),tL=r(`<div><!> <!></div>`);function nL(e,r){i(r,!0);let a=k(r,`content`,3,``),o=k(r,`nodes`,3,null),s=k(r,`final`,3,void 0),c=k(r,`parseOptions`,3,void 0),u=k(r,`customMarkdownIt`,3,void 0),d=k(r,`debugPerformance`,3,!1),f=k(r,`customHtmlTags`,3,void 0),p=k(r,`htmlPolicy`,3,`safe`),m=k(r,`viewportPriority`,3,!0),g=k(r,`codeBlockStream`,3,!0),_=k(r,`codeBlockDarkTheme`,3,void 0),b=k(r,`codeBlockLightTheme`,3,void 0),S=k(r,`renderCodeBlocksAsPre`,3,!1),C=k(r,`codeBlockMinWidth`,3,void 0),w=k(r,`codeBlockMaxWidth`,3,void 0),T=k(r,`codeBlockOptions`,3,void 0),D=k(r,`codeBlockProps`,3,void 0),O=k(r,`mermaidProps`,3,void 0),A=k(r,`d2Props`,3,void 0),j=k(r,`infographicProps`,3,void 0),te=k(r,`customComponents`,3,void 0),M=k(r,`showTooltips`,3,!0),N=k(r,`themes`,3,void 0),P=k(r,`isDark`,3,!1),L=k(r,`customId`,3,void 0),ne=k(r,`indexKey`,3,void 0),ie=k(r,`typewriter`,3,!1),R=k(r,`fade`,3,!0),ae=k(r,`batchRendering`,3,!0),oe=k(r,`initialRenderBatchSize`,3,40),U=k(r,`renderBatchSize`,3,80),le=k(r,`renderBatchDelay`,3,16),G=k(r,`renderBatchBudgetMs`,3,6),K=k(r,`renderBatchIdleTimeoutMs`,3,120),q=k(r,`deferNodesUntilVisible`,3,!0),fe=k(r,`maxLiveNodes`,3,320),pe=k(r,`liveNodeBuffer`,3,60),me=k(r,`allowHtml`,3,!0),ge=k(r,`smoothStreaming`,3,`auto`),Y=k(r,`smoothStreamingOptions`,3,void 0),_e=k(r,`className`,3,``),ve=k(r,`onCopy`,3,void 0),ye=k(r,`onHandleArtifactClick`,3,void 0),be=k(r,`onClick`,3,void 0),xe=k(r,`onMouseover`,3,void 0),Se=k(r,`onMouseout`,3,void 0),Ce=V(null),X=V(0),we=V(0),Te=V(void 0),Ee=V(void 0),De=0,Oe=null,ke=V(0),Ae=null,je=null,Me=null,Ne=0,Pe=new Map,Fe=V(!1),Ie=ZI(()=>Y()),Le=I(()=>ge()===!0||E(Fe)),Re=I(()=>Array.isArray(o())),ze=ee(QI),Be=I(()=>ge()===!1||E(Re)||ge()!==!0&&ze?.()?!1:ge()===!0||ie()===!0||(fe()??0)<=0),Ve=I(()=>E(Le)&&E(Be));he(QI,()=>E(Ve));let He=I(()=>E(Ve)?Ie.visible:a()??``),Ue=I(()=>a()??``),We=I(()=>E(Re)||Ie.source===E(Ue)),Ge=I(()=>{let e=c()??{};return s()??e.final}),Z=I(()=>E(Ve)&&E(Ge)!=null?!!(E(Ge)&&E(We)&&Ie.caughtUp):E(Ge));ue(()=>{F(Fe,!0)}),de(()=>{let e=a()??``;if(E(Re)){Ie.reset(``);return}if(!E(Ve)){Ie.reset(e),E(Ge)&&Ie.finish({flush:!0});return}let t=Ie.source;e?e===t||(e.startsWith(t)?Ie.enqueue(e.slice(t.length)):Ie.reset(e)):Ie.reset(``),E(Ge)&&Ie.finish()});let Ke=I(()=>({content:E(He),nodes:o(),final:E(Z),parseOptions:c(),customMarkdownIt:u(),debugPerformance:d(),customHtmlTags:f(),htmlPolicy:p(),viewportPriority:m(),codeBlockStream:g(),codeBlockDarkTheme:_(),codeBlockLightTheme:b(),renderCodeBlocksAsPre:S(),codeBlockMinWidth:C(),codeBlockMaxWidth:w(),codeBlockOptions:T(),codeBlockProps:D(),mermaidProps:O(),d2Props:A(),infographicProps:j(),customComponents:te(),showTooltips:M(),themes:N(),isDark:P(),customId:L(),indexKey:ne(),typewriter:ie(),fade:R(),batchRendering:ae(),initialRenderBatchSize:oe(),renderBatchSize:U(),renderBatchDelay:le(),renderBatchBudgetMs:G(),renderBatchIdleTimeoutMs:K(),deferNodesUntilVisible:q(),maxLiveNodes:fe(),liveNodeBuffer:pe(),allowHtml:me(),smoothStreaming:ge(),smoothStreamingOptions:Y()}));re(()=>{(E(Te)!==E(He)||E(Ee)!==o())&&(F(we,E(we)+1),F(Te,E(He),!0),F(Ee,o()))});let qe=I(()=>{let e=d()&&typeof performance<`u`?performance.now():0,t=hA(E(Ke));return d()&&typeof console<`u`&&typeof performance<`u`&&console.info(`[markstream-svelte][perf] parse(sync)`,{ms:Math.round(performance.now()-e),nodes:t.length,contentLength:E(He)?.length??0}),t}),Je=I(()=>{E(X);let e=Tj(L()),t=te()?{...e,...te()}:e;return mA({...E(Ke),customComponents:t},{onCopy:ve(),onHandleArtifactClick:ye()},Pe,E(we))});de(()=>{E(qe).length,ae(),oe(),U(),le(),G(),K(),E(Z),E(ke),Ze()});let Ye=I(()=>E(qe).slice(0,Math.min(E(ke),E(qe).length)));de(()=>{E(Ce),E(Z),E(qe),E(Ye),P(),S(),T(),D(),_(),b(),N(),O(),A(),j(),M(),ve(),et()}),ue(()=>wj(()=>{F(X,E(X)+1)})),ce(()=>{De+=1,$e(),Oe?.dispose(),Oe=null,xI(E(Ce)),dt()});function Xe(e,t){let n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):t}function Ze(){let e=E(qe).length,t=Math.min(e,Xe(oe(),40));if(!(E(Z)!==!1&&ae()!==!1&&e>t)){$e(),E(ke)!==e&&F(ke,e,!0);return}(E(ke)<=0||E(ke)>e||E(ke)<t)&&F(ke,t,!0),Qe()}function Qe(){if(E(ke)>=E(qe).length||Ae||je!=null||Me!=null)return;let e=++Ne,t=Math.max(0,Number(le())||0),n=t=>{if(Ae=null,je=null,Me=null,e!==Ne)return;let n=Xe(U(),80),r=Math.max(2,Xe(G(),6)),i=E(ke);do if(i=Math.min(E(qe).length,i+n),!t||(typeof t.timeRemaining==`function`?t.timeRemaining():0)<=r*.5)break;while(i<E(qe).length);i!==E(ke)&&F(ke,i,!0)},r=typeof window<`u`?window.requestIdleCallback:void 0;if(r){Me=r(n,{timeout:Math.max(0,Number(K())||120)});return}if(typeof window<`u`&&typeof window.requestAnimationFrame==`function`){je=window.requestAnimationFrame(()=>{je=null,t>0?Ae=setTimeout(n,t):n()});return}Ae=setTimeout(n,t)}function $e(){Ne+=1,Ae&&=(clearTimeout(Ae),null),je!=null&&typeof window<`u`&&(window.cancelAnimationFrame(je),je=null);let e=typeof window<`u`?window.cancelIdleCallback:void 0;Me!=null&&(e?.(Me),Me=null)}async function et(){if(!E(Ce)||typeof window>`u`)return;let e=typeof E(Z)==`boolean`?E(Z):!tt(E(qe));if(!e){De+=1,Oe?.dispose(),Oe=null;return}let t=++De;if(await v(),t!==De||!E(Ce))return;Oe?.dispose();let n=await bI(E(Ce),{final:e,isDark:P(),renderCodeBlocksAsPre:S(),codeBlockOptions:T(),codeBlockProps:D(),codeBlockDarkTheme:_(),codeBlockLightTheme:b(),themes:N(),mermaidProps:O(),d2Props:A(),infographicProps:j(),showTooltips:M(),onCopy:ve(),isCancelled:()=>t!==De});if(t!==De){n.dispose();return}Oe=n}function tt(e){for(let t of e)if(t?.loading===!0||tt(t?.children||[])||tt(t?.items||[]))return!0;return!1}let nt=V(null),rt=V(!1),it,at=0,ot=new Set([`code_block`,`admonition`,`table`,`math_block`,`html_block`,`image`]);function st(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return typeof t==`string`&&ot.has(t)}function ct(){let e=E(qe)[E(qe).length-1];return!st(e)}function lt(e){if(!e||typeof e!=`object`)return 0;let t=e,n=t.raw??t.content??t.code;if(typeof n==`string`)return n.length;let r=t.children;if(Array.isArray(r))return r.reduce((e,t)=>e+lt(t),0);let i=t.items;return Array.isArray(i)?i.reduce((e,t)=>e+lt(t),0):0}function ut(){return o()?.length?o().reduce((e,t)=>e+lt(t),0):(a()??``).length}function dt(){it&&=(clearTimeout(it),void 0)}function ft(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.textContent??``).trim())return NodeFilter.FILTER_REJECT;let t=e.parentElement;return!t||t.closest(`.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),n=null,r=t.nextNode();for(;r;)n=r,r=t.nextNode();return n}function pt(){if(typeof window>`u`||!E(rt)||!E(Ce)||!E(nt))return;let e=E(Ce),t=E(nt),n=ft(e),r=e.getBoundingClientRect(),i=0,a=0,o=20;if(n?.textContent){let t=document.createRange(),s=n.textContent.length;t.setStart(n,Math.max(0,s-1)),t.setEnd(n,s);let c=typeof t.getClientRects==`function`?t.getClientRects():void 0,l=c?.[c.length-1]??n.parentElement?.getBoundingClientRect();l&&(i=l.right-r.left+e.scrollLeft,a=l.top-r.top+e.scrollTop,o=l.height||o),t.detach()}t.style.transform=`translate(${Math.max(0,i)}px, ${Math.max(0,a)}px)`,t.style.height=`${o}px`}de(()=>{if(E(He),o(),ie(),E(qe).length,E(Z),typeof window>`u`||E(Re))return;if(E(Z)){F(rt,!1),dt();return}let e=ut(),t=ct();if(ie()===!1||!t||e<=at){(ie()===!1||!t)&&F(rt,!1),at=e;return}at=e,F(rt,!0),dt(),v().then(()=>{pt()}),it=setTimeout(()=>{F(rt,!1)},3e3)}),de(()=>{E(rt)&&v().then(()=>{pt()})});function mt(e){e.target?.closest(`[data-node-index]`)&&xe()?.(e)}function ht(e){e.target?.closest(`[data-node-index]`)&&Se()?.(e)}var gt=tL();let _t;var vt=W(gt);t(vt,19,()=>E(Ye),(e,t)=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+t,(e,t,r)=>{var i=$I(),a=W(i);let o;var s=W(a);{let e=I(()=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+E(r));fI(s,{get node(){return E(t)},get context(){return E(Je)},get indexKey(){return E(e)}})}n(a),n(i),H((e,n)=>{B(i,`data-node-index`,E(r)),B(i,`data-node-type`,E(t)?.type),o=J(a,1,`node-content`,null,o,{"fade-node":e,"typewriter-node":n}),B(a,`data-node-index`,E(r))},[()=>R()!==!1&&String(E(t)?.type||``)!==`code_block`,()=>R()!==!1&&String(E(t)?.type||``)!==`code_block`]),y(e,i)});var yt=z(vt,2),bt=e=>{var t=eL();se(t,e=>F(nt,e),()=>E(nt)),y(e,t)};h(yt,e=>{E(rt)&&e(bt)}),n(gt),se(gt,e=>F(Ce,e),()=>E(Ce)),H(()=>{_t=J(gt,1,`markstream-svelte markdown-renderer ${_e()??``}`,null,_t,{dark:P()}),B(gt,`data-custom-id`,L())}),l(`click`,gt,function(...e){be()?.apply(this,e)}),l(`mouseover`,gt,mt),l(`mouseout`,gt,ht),y(e,gt),x()}T([`click`,`mouseover`,`mouseout`]);var rL=r(`<button type="button"><span class="flex items-center gap-1 text-xs font-medium"> </span> <span class="mt-0.5 block text-[10px] leading-snug text-muted-foreground"> </span></button>`),iL=r(`<div class="flex h-full flex-col items-center justify-center gap-3 text-center"><p class="max-w-[280px] text-xs text-muted-foreground">Pick a way to work with your skill library:</p> <div class="w-full max-w-[300px] space-y-1.5"></div></div>`),aL=r(`<div class="flow-item flex h-6 items-center gap-2 text-xs uppercase tracking-wide text-muted-foreground"><span class="h-px flex-1 bg-border"></span> <span class="h-px flex-1 bg-border"></span></div>`),oL=r(`<span class="turn-pill"> </span>`),sL=r(`<div class="flow-item flex h-5 items-center gap-1.5"><!></div>`),cL=r(`<div class="flow-item flex h-6 items-center gap-2 text-xs text-muted-foreground" role="separator"><span class="h-px flex-1 bg-border"></span> <span class="rounded bg-muted px-1 text-[10px] uppercase">mode</span> <span class="h-px flex-1 bg-border"></span></div>`),lL=r(`<div class="flow-item px-1 text-[11px] text-muted-foreground"> </div>`),uL=r(`<div class="flow-item flex h-6 items-center gap-2 px-3 text-[10px] text-muted-foreground" role="note"><span class="h-px flex-1 bg-border"></span> <span class="rounded bg-muted px-1 text-[10px] uppercase">compact</span> <span class="truncate"> </span> <span class="h-px flex-1 bg-border"></span></div>`),dL=r(`<img alt="" class="h-16 w-16 rounded-xl border border-border object-cover"/>`),fL=r(`<div class="mb-1 flex flex-wrap justify-end gap-1"></div>`),pL=r(`<span class="flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px]"><!> <span class="max-w-40 truncate"> </span></span>`),mL=r(`<div class="bubble-user max-h-40 overflow-y-auto px-3.5 py-2 text-[13px] leading-5 whitespace-pre-wrap"> </div>`),hL=r(`<div class="flow-item group/msg ml-auto max-w-[85%]"><!> <!> <!> <div role="toolbar" aria-label="Message actions"><button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Copy" aria-label="Copy message"><!></button> <button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Edit &amp; resend — resends as a new message, keeps history" aria-label="Edit and resend — resends as a new message, keeps history"><!></button> <button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50" title="Resend — keeps history" aria-label="Resend message — keeps history"><!></button></div></div>`),gL=r(`<div class="mt-1 max-h-48 overflow-y-auto rounded-md px-2 pb-1 text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground"> </div>`),_L=r(`<div class="flow-item"><!> <!></div>`),vL=r(`<div class="flow-item group/msg max-w-full"><div class="ms-md msg-body max-w-full [&amp;_a]:text-primary svelte-1fhja6f"><!></div> <div role="toolbar" aria-label="Message actions"><button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Copy" aria-label="Copy message"><!></button></div></div>`),yL=r(`<div class="flow-item"><!></div>`),bL=r(`<div class="flow-item flex h-6 items-center" role="status"><span class="sweep rounded-md px-1 text-xs text-muted-foreground"> </span></div>`),xL=r(`<!> <!>`,1),SL=r(`<button type="button" class="absolute top-3 right-3 z-10 flex h-7 w-7 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-md transition-colors hover:text-foreground" title="Back to bottom" aria-label="Back to bottom"><!></button>`),CL=r(`<div class="relative min-h-0 flex-1"><div class="h-full overflow-y-auto px-4 py-3"><!></div> <!></div>`);function wL(e,r){i(r,!0);let a=V(null),o=V(fe({})),s=V(null),u=V(!1),d=0;de(()=>{Re.items.length,Re.status;let e=E(a);if(!e)return;let t=()=>{let t=d-e.scrollTop-e.clientHeight<160;d=e.scrollHeight,(t||e.scrollHeight-e.scrollTop-e.clientHeight<160)&&(e.scrollTop=e.scrollHeight),F(u,e.scrollHeight-e.scrollTop-e.clientHeight>200)};t();let n=new ResizeObserver(t);for(let t of e.children)n.observe(t);return()=>n.disconnect()});let p=V(0);de(()=>{if(Re.status!==`running`){F(p,0);return}let e=()=>{let e=Re.turnStartedAt?Date.parse(Re.turnStartedAt):NaN;F(p,Number.isFinite(e)?Math.max(0,(Date.now()-e)/1e3):0,!0)};e();let t=setInterval(e,1e3);return()=>clearInterval(t)});async function m(e,t){try{await navigator.clipboard.writeText(e),F(s,t,!0),setTimeout(()=>{E(s)===t&&F(s,null)},1e3)}catch{Mn(`Copy failed — clipboard unavailable.`)}}function g(e){Ce(e),document.querySelector(`aside[aria-label="Agent panel"] textarea`)?.focus()}function _(e){Re.sending||Le(e)}let v=I(()=>{for(let e=Re.items.length-1;e>=0;e--){let t=Re.items[e];if(t?.kind===`user`)return t.seq}return null}),b=I(()=>{for(let e=Re.items.length-1;e>=0;e--){let t=Re.items[e];if(t?.kind===`assistant`)return t.seq}return null});function S(e,t){let n=e.trim();if(n.length===0)return``;let r=n.split(`
224
- `).filter(e=>e.trim().length>0);if(r.length===0)return``;let i=t?r[r.length-1]:r[0];return i.length>96?`${i.slice(0,96)}…`:i}function C(e){return _t.find(t=>t.id===e)?.label??e}function w(e){return[e.usage?`↑ ${Wl(e.usage.inputTokens)}`:``,e.usage?`↓ ${Wl(e.usage.outputTokens)}`:``,e.elapsedMs===void 0?``:Gl(e.elapsedMs)].filter(e=>e.length>0)}function T(e){F(o,{...E(o),[e]:!(E(o)[e]??!1)},!0)}function D(){let e=E(a);e&&(e.scrollTop=e.scrollHeight)}var O=CL(),k=W(O),A=W(k),j=e=>{var r=iL(),i=z(W(r),2);t(i,21,()=>_t,e=>e.id,(e,t)=>{var r=rL(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0);n(r),H(()=>{J(r,1,`w-full rounded-md border p-2 text-left transition-colors ${Re.pendingMode===E(t).id?`border-primary/60 bg-primary/5`:`border-border hover:border-primary/50 hover:bg-primary/5`}`),B(r,`aria-pressed`,Re.pendingMode===E(t).id),r.disabled=Re.sending,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>Re.pendingMode=E(t).id),y(e,r)}),n(i),n(r),y(e,r)},ee=e=>{var r=xL(),i=q(r);t(i,17,()=>Re.items,e=>e.seq,(e,r)=>{var i=Y(),a=q(i),u=e=>{var t=aL(),i=z(W(t));oe(),n(t),H(()=>c(i,` ${E(r).label??`Turn`??``} `)),y(e,t)},d=e=>{var t=sL(),i=W(t),a=e=>{var t=oL(),n=M(t,!0);H(e=>c(n,e),[()=>w(E(r)).join(` · `)]),y(e,t)},o=I(()=>w(E(r)).length>0),s=e=>{var t=oL(),n=M(t,!0);H(()=>c(n,E(r).reason)),y(e,t)};h(i,e=>{E(o)?e(a):e(s,-1)}),n(t),H(()=>B(t,`title`,E(r).reason)),y(e,t)},f=e=>{var t=cL(),i=z(W(t),3);oe(),n(t),H((e,n,r)=>{B(t,`aria-label`,e),c(i,` ${n??``} → ${r??``} `)},[()=>`Mode switched from ${C(E(r).from)} to ${C(E(r).to)}`,()=>C(E(r).from),()=>C(E(r).to)]),y(e,t)},p=e=>{var t=lL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)},x=e=>{var t=uL(),i=z(W(t),4),a=M(i,!0);oe(2),n(t),H(()=>c(a,E(r).text)),y(e,t)},D=e=>{var i=hL(),a=W(i),o=e=>{var i=fL();t(i,21,()=>E(r).images,ie,(e,t)=>{var n=dL();H(()=>B(n,`src`,E(t))),y(e,n)}),n(i),y(e,i)};h(a,e=>{E(r).images&&E(r).images.length>0&&e(o)});var u=z(a,2),d=e=>{var i=fL();t(i,21,()=>E(r).files,ie,(e,t)=>{var i=pL(),a=W(i),o=e=>{Uc(e,{class:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`})},s=I(()=>E(r).imageChipNames?.includes(E(t))),l=e=>{Vc(e,{class:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`})};h(a,e=>{E(s)?e(o):e(l,-1)});var u=z(a,2),d=M(u,!0);n(i),H(()=>c(d,E(t))),y(e,i)}),n(i),y(e,i)};h(u,e=>{E(r).files&&E(r).files.length>0&&e(d)});var f=z(u,2),p=e=>{var t=mL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)};h(f,e=>{E(r).text.length>0&&e(p)});var b=z(f,2),x=W(b),S=W(x),C=e=>{Hs(e,{class:`h-3.5 w-3.5 text-primary`})},w=e=>{zc(e,{class:`h-3.5 w-3.5`})};h(S,e=>{E(s)===E(r).seq?e(C):e(w,-1)}),n(x);var T=z(x,2),D=W(T);qe(D,{class:`h-3.5 w-3.5`}),n(T);var O=z(T,2),k=W(O);Wn(k,{class:`h-3.5 w-3.5`}),n(O),n(b),n(i),H(()=>{J(b,1,`mt-0.5 flex h-5 justify-end gap-0.5 transition-opacity ${E(r).seq===E(v)?`opacity-100`:`opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100`}`),O.disabled=Re.sending}),l(`click`,x,()=>void m(E(r).text,E(r).seq)),l(`click`,T,()=>g(E(r).text)),l(`click`,O,()=>_(E(r).text)),y(e,i)},O=e=>{var t=_L(),i=W(t);{let e=I(()=>S(E(r).text,E(r).streaming)),t=I(()=>E(r).streaming?!0:E(o)[E(r).seq]??!1);sl(i,{get icon(){return Gn},title:`Thinking`,get summary(){return E(e)},get open(){return E(t)},get running(){return E(r).streaming},onToggle:()=>T(E(r).seq)})}var a=z(i,2),s=e=>{var t=gL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)};h(a,e=>{(E(r).streaming||E(o)[E(r).seq])&&e(s)}),n(t),y(e,t)},k=e=>{var t=vL(),i=W(t),a=W(i);{let e=I(()=>!E(r).streaming);nL(a,{get content(){return E(r).text},htmlPolicy:`escape`,get final(){return E(e)}})}n(i);var o=z(i,2),c=W(o),u=W(c),d=e=>{Hs(e,{class:`h-3.5 w-3.5 text-primary`})},f=e=>{zc(e,{class:`h-3.5 w-3.5`})};h(u,e=>{E(s)===E(r).seq?e(d):e(f,-1)}),n(c),n(o),n(t),H(()=>J(o,1,`mt-0.5 flex h-5 gap-0.5 transition-opacity ${E(r).seq===E(b)?`opacity-100`:`opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100`}`)),l(`click`,c,()=>void m(E(r).text,E(r).seq)),y(e,t)},A=e=>{{let t=I(()=>E(r).phase===`calling`&&Re.status===`running`);Ul(e,{get toolName(){return E(r).toolName},get argsText(){return E(r).argsText},get result(){return E(r).result},get phase(){return E(r).phase},get running(){return E(t)},get startedAt(){return E(r).startedAt},get endedAt(){return E(r).endedAt}})}},j=e=>{var t=yL();el(W(t),{get seq(){return E(r).seq},get questions(){return E(r).questions},get resolved(){return E(r).resolved}}),n(t),y(e,t)};h(a,e=>{E(r).kind===`turn`?e(u):E(r).kind===`turn-end`?e(d,1):E(r).kind===`mode`?e(f,2):E(r).kind===`status`?e(p,3):E(r).kind===`note`?e(x,4):E(r).kind===`user`?e(D,5):E(r).kind===`reasoning`?e(O,6):E(r).kind===`assistant`?e(k,7):E(r).kind===`tool`?e(A,8):E(r).kind===`approval`&&e(j,9)}),y(e,i)});var a=z(i,2),u=e=>{var t=bL(),r=W(t),i=M(r);n(t),H(e=>c(i,`Working${e??``}`),[()=>E(p)>=15?` · ${Math.floor(E(p))}s`:``]),y(e,t)};h(a,e=>{Re.status===`running`&&e(u)}),y(e,r)};h(A,e=>{Re.sessionId?e(ee,-1):e(j)}),n(k),se(k,e=>F(a,e),()=>E(a));var te=z(k,2),N=e=>{var t=SL();Gc(W(t),{class:`h-3.5 w-3.5`}),n(t),l(`click`,t,D),y(e,t)};h(te,e=>{E(u)&&Re.sessionId&&e(N)}),n(O),f(`scroll`,k,e=>{let t=e.currentTarget;F(u,t.scrollHeight-t.scrollTop-t.clientHeight>200)}),y(e,O),x()}T([`click`]);var TL=r(`<li><span aria-hidden="true"></span> <span class="min-w-0 break-words"> </span></li>`),EL=r(`<ul class="mt-1 max-h-40 space-y-0.5 overflow-y-auto rounded-lg border border-border bg-card px-2 py-1.5 shadow-sm"></ul>`),DL=r(`<div class="mx-3 mb-1.5 shrink-0"><button type="button" class="disclosure-row disclosure-row-tall w-full rounded-lg border border-border bg-card px-2 shadow-sm" aria-label="Tasks"><span class="flex items-center justify-center text-muted-foreground" aria-hidden="true"><!></span> <span class="truncate text-left font-medium text-foreground">Tasks</span> <span class="text-center text-muted-foreground/70" aria-hidden="true">·</span> <span class="disclosure-summary tabular-nums"> </span> <!></button> <!></div>`);function OL(e,r){let i=V(!1),a=I(()=>{let e=0,t=0,n=0;for(let i of r.todos)i.status===`completed`?e+=1:i.status===`in_progress`?t+=1:n+=1;return{done:e,active:t,pending:n}});var o=DL(),s=W(o),u=W(s),d=W(u);Bn(d,{class:`h-3.5 w-3.5`}),n(u);var f=z(u,6),p=M(f),m=z(f,2);qn(m,{class:`disclosure-chevron h-3.5 w-3.5 shrink-0 text-muted-foreground`}),n(s);var g=z(s,2),_=e=>{var i=EL();t(i,21,()=>r.todos,ie,(e,t)=>{var r=TL(),i=W(r),a=z(i,2),o=M(a,!0);n(r),H(()=>{J(r,1,`flex items-start gap-1.5 text-xs ${E(t).status===`completed`?`text-muted-foreground line-through`:``}`),J(i,1,`mt-[3px] h-3 w-3 shrink-0 rounded-full border-2 ${E(t).status===`completed`?`border-primary bg-primary/20`:E(t).status===`in_progress`?`border-primary`:`border-muted-foreground/50`}`),c(o,E(t).content)}),y(e,r)}),n(i),y(e,i)};h(g,e=>{E(i)&&e(_)}),n(o),H(()=>{B(s,`data-open`,E(i)),B(s,`aria-expanded`,E(i)),c(p,`done ${E(a).done??``} · active ${E(a).active??``} · pending ${E(a).pending??``}`)}),l(`click`,s,()=>F(i,!E(i))),y(e,o)}T([`click`]);function kL(e){let t=0;for(let n of e)t=(t*31+n.charCodeAt(0))%360;return t}function AL(e){return`hsl(${kL(e)} 55% 45%)`}var jL=`sc-letter-avatar`;function ML(e){return e.includes(jL)}function NL(e,t){return e.iconSuppressed===!0?null:e.icon??t?.icon??null}function PL(e,t){return e.iconLetter!==void 0&&e.iconLetter.length>0?e.iconLetter:(t||e.provider).slice(0,1).toUpperCase()}function FL(e){return e.iconColor??AL(e.provider)}var IL={svg:`image/svg+xml`,png:`image/png`,webp:`image/webp`};function LL(e,t){let n=e.indexOf(`,`);return!e.startsWith(`data:`)||n<0?null:`data:${t};base64,${e.slice(n+1)}`}var RL=new Set([`$$slots`,`$$events`,`$$legacy`]);function zL(e,t){let n=U(t,RL),r=[[`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`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M12 12v6`}],[`path`,{d:`m15 15-3-3-3 3`}]];be(e,K({name:`file-up`},()=>n,{get iconNode(){return r}}))}var BL=new Set([`$$slots`,`$$events`,`$$legacy`]);function VL(e,t){let n=U(t,BL),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];be(e,K({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var HL=new Set([`$$slots`,`$$events`,`$$legacy`]);function UL(e,t){let n=U(t,HL),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];be(e,K({name:`square`},()=>n,{get iconNode(){return r}}))}var WL=new Set([`$$slots`,`$$events`,`$$legacy`]);function GL(e,t){let n=U(t,WL),r=[[`path`,{d:`m6 9 6 6 6-6`}]];be(e,K({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var KL=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function qL(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=U(t,KL);var o=Y(),s=q(o);a(s,()=>os,(e,t)=>{t(e,K(()=>r,{get open(){return n()},set open(e){n(e)}}))}),y(e,o),x()}var JL=new Set([`$$slots`,`$$events`,`$$legacy`]);function YL(e,t){let n=U(t,JL);var r=Y(),i=q(r);a(i,()=>Lt,(e,t)=>{t(e,K(()=>n))}),y(e,r)}var XL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`sideOffset`,`align`,`portalProps`,`class`]);function ZL(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`sideOffset`,3,4),o=k(t,`align`,3,`start`),s=U(t,XL);YL(e,K(()=>t.portalProps,{children:(e,i)=>{var c=Y(),l=q(c);{let e=I(()=>Fn(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 w-(--bits-dropdown-menu-anchor-width) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden`,t.class));a(l,()=>ls,(t,i)=>{i(t,K({"data-slot":`dropdown-menu-content`,get sideOffset(){return r()},get align(){return o()},get class(){return E(e)}},()=>s,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,c)},$$slots:{default:!0}})),x()}var QL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function $L(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,QL);var o=Y(),s=q(o);a(s,()=>$o,(e,t)=>{t(e,K({"data-slot":`dropdown-menu-group`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var eR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`variant`]);function tR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`variant`,3,`default`),o=U(t,eR);var s=Y(),c=q(s);{let e=I(()=>Fn(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed data-inset:pl-7.5 [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,t.class));a(c,()=>Xo,(i,a)=>{a(i,K({"data-slot":`dropdown-menu-item`,get"data-inset"(){return t.inset},get"data-variant"(){return r()},get class(){return E(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,s),x()}var nR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`children`]),rR=r(`<div><!></div>`);function iR(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,nR);var o=rR();P(o,e=>({"data-slot":`dropdown-menu-label`,"data-inset":t.inset,class:e,...a}),[()=>Fn(`text-muted-foreground px-2 py-1.5 text-xs data-inset:pl-7.5 data-[inset]:pl-8`,t.class)]);var s=W(o);_(s,()=>t.children??R),n(o),se(o,e=>r(e),()=>r()),y(e,o),x()}var aR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function oR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,aR);var o=Y(),s=q(o);{let e=I(()=>Fn(`bg-border/50 -mx-1 my-1 h-px`,t.class));a(s,()=>as,(t,i)=>{i(t,K({"data-slot":`dropdown-menu-separator`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var sR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function cR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,sR);var o=Y(),s=q(o);a(s,()=>fs,(e,t)=>{t(e,K({"data-slot":`dropdown-menu-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var lR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`]);function uR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,lR);var o=Y(),s=q(o);{let e=I(()=>Fn(`px-2 py-1.5 text-sm font-semibold data-[inset]:ps-8`,t.class));a(s,()=>ns,(i,a)=>{a(i,K({"data-slot":`dropdown-menu-group-heading`,get"data-inset"(){return t.inset},get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var dR=fe({open:!1,section:`general`});function fR(e=`general`){dR.section=e,dR.open=!0}function pR(e){if(!e)return null;let{provider:t,model:n}=e.settings.model,r=e.settings.modelRoutes.find(e=>e.provider===t);return r?r.models.find(e=>e.id===n)?.contextWindow??null:null}var mR=r(`<div class="flex items-center justify-between"><span>Used</span> <span> </span></div> <div class="mt-0.5 flex items-center justify-between text-muted-foreground"><span>Last turn</span> <span class="tabular-nums"> </span></div> <div class="mt-0.5 flex items-center justify-between text-muted-foreground"><span>Capacity</span> <span class="tabular-nums"> </span></div>`,1),hR=r(`<div class="text-muted-foreground">No turns yet.</div>`),gR=r(`<div role="dialog" aria-label="Context usage details" class="absolute right-0 bottom-full z-20 mb-1.5 w-56 rounded-lg border border-border bg-popover p-2.5 text-xs shadow-md"><div class="mb-1.5 text-[11px] font-medium text-muted-foreground">Context</div> <!> <button type="button" class="mt-2 w-full rounded-md border border-border px-2 py-1 text-[11px] transition-colors hover:bg-muted disabled:opacity-50" title="Compact the conversation history (kernel /compact)">compact</button></div>`),_R=r(`<div class="relative"><button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50" aria-label="Context usage"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke-width="2.5" class="stroke-muted-foreground/40"></circle><circle cx="7" cy="7" r="5" fill="none" stroke-width="2.5" stroke-linecap="round" transform="rotate(-90 7 7)"></circle></svg></button> <!></div>`);function vR(e,t){i(t,!0);let r=V(!1),a=V(null),o=I(()=>Re.lastUsage),s=I(()=>pR(Z.view)),u=I(()=>E(s)??131072),d=I(()=>E(o)?Math.min(1,Math.max(0,E(o).inputTokens/E(u))):0),p=I(()=>Math.round(E(d)*100)),m=I(()=>E(p)>=75),g=2*Math.PI*5,_=I(()=>`${(E(d)*g).toFixed(2)} ${g.toFixed(2)}`),v=I(()=>E(o)?`${E(p)}% of context used · last turn ${Wl(E(o).inputTokens)} in / ${Wl(E(o).outputTokens)} out`:`No turns yet — context usage appears after the first turn`);function S(){Re.sending||Re.status===`running`||(F(r,!1),Le(`/compact`))}function C(e){E(r)&&E(a)!==null&&e.target instanceof Node&&!E(a).contains(e.target)&&F(r,!1)}var w=_R();f(`pointerdown`,A,C);var T=W(w),D=W(T),O=z(W(D));n(D),n(T);var k=z(T,2),j=e=>{var t=gR(),r=z(W(t),2),i=e=>{var t=mR(),r=q(t),i=z(W(r),2),a=M(i);n(r);var l=z(r,2),d=z(W(l),2),f=M(d);n(l);var h=z(l,2),g=z(W(h),2),_=M(g);n(h),H((e,t,n)=>{J(i,1,`tabular-nums ${E(m)?`text-amber-600 dark:text-amber-400`:``}`),c(a,`${E(p)??``}%`),c(f,`↑ ${e??``} · ↓ ${t??``}`),c(_,`${n??``}${E(s)===null?` · assumed 128k`:``}`)},[()=>Wl(E(o).inputTokens),()=>Wl(E(o).outputTokens),()=>Wl(E(u))]),y(e,t)},a=e=>{var t=hR();y(e,t)};h(r,e=>{E(o)?e(i):e(a,-1)});var d=z(r,2);n(t),H(()=>d.disabled=Re.sending||Re.status===`running`||!Re.sessionId),l(`click`,d,S),y(e,t)};h(k,e=>{E(r)&&e(j)}),n(w),se(w,e=>F(a,e),()=>E(a)),H(()=>{B(T,`title`,E(v)),B(T,`aria-expanded`,E(r)),T.disabled=!Re.sessionId,J(O,0,b(E(m)?`stroke-amber-500`:`stroke-primary`)),B(O,`stroke-dasharray`,E(_))}),l(`click`,T,()=>F(r,!E(r))),y(e,w),x()}T([`click`]);var yR=r(`<div class="px-2.5 pt-1 text-[10px] text-muted-foreground" data-menu-source="true"> </div>`),bR=r(`<li class="cursor-default px-2.5 py-1.5 text-[11px] text-muted-foreground"> </li>`),xR=r(`<span class="truncate text-muted-foreground"> </span>`),SR=r(`<li><button type="button"><span class="shrink-0 font-medium"> </span> <!></button></li>`),CR=r(`<ul class="absolute bottom-full left-3 z-20 mb-1.5 w-72 overflow-hidden rounded-lg border border-border bg-popover py-1 shadow-md"><!> <!></ul>`);function wR(e,r){i(r,!0);let a=V(null),o=V(0),s=I(()=>r.text.startsWith(r.trigger)?r.text.split(`
225
- `,1)[0]??``:``),u=I(()=>E(s).length>0?r.entries.filter(e=>e.value.startsWith(E(s))):[]),d=I(()=>r.entries.length===0&&r.emptyMessage!==void 0),f=I(()=>E(s).length>0&&r.caretOnFirstLine&&E(a)!==r.text&&(E(u).length>0||E(d))),p=I(()=>Math.min(E(o),Math.max(0,E(u).length-1)));function m(e){e.preventDefault(),e.stopPropagation()}function g(e){if(!E(f))return!1;if(e.key===`Escape`)return m(e),F(a,r.text,!0),!0;if(E(u).length===0)return e.key===`Enter`&&(m(e),!0);if(e.key===`ArrowDown`)return m(e),F(o,(E(p)+1)%E(u).length),!0;if(e.key===`ArrowUp`)return m(e),F(o,(E(p)-1+E(u).length)%E(u).length),!0;if(e.key===`Enter`){m(e);let t=E(u)[E(p)];return t&&r.onSelect(t.value),!0}return!1}var _={handleKeydown:g},v=Y(),b=q(v),S=e=>{var i=CR(),a=W(i),o=e=>{var t=yR(),n=M(t,!0);H(()=>c(n,r.sourceLabel)),y(e,t)};h(a,e=>{r.sourceLabel&&e(o)});var s=z(a,2),d=e=>{var t=bR(),n=M(t,!0);H(()=>c(n,r.emptyMessage)),y(e,t)},f=e=>{var i=Y(),a=q(i);t(a,19,()=>E(u),e=>e.value,(e,t,i)=>{var a=SR(),o=W(a),s=W(o),u=M(s,!0),d=z(s,2),f=e=>{var n=xR(),r=M(n,!0);H(()=>c(r,E(t).description)),y(e,n)};h(d,e=>{E(t).description&&e(f)}),n(o),n(a),H(()=>{J(o,1,`flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-[11px] ${E(i)===E(p)?`bg-accent text-accent-foreground`:`text-foreground`} hover:bg-accent/50`),B(o,`aria-current`,E(i)===E(p)?`true`:void 0),c(u,E(t).value)}),l(`click`,o,()=>r.onSelect(E(t).value)),y(e,a)}),y(e,i)};h(s,e=>{E(u).length===0?e(d):e(f,-1)}),n(i),H(()=>{B(i,`data-slot`,r.dataSlot),B(i,`aria-label`,r.menuLabel)}),y(e,i)};return h(b,e=>{E(f)&&e(S)}),y(e,v),x(_)}T([`click`]);var TR=[{command:`/compact`,description:`Summarize the transcript to reclaim context`}];function ER(e,t){i(t,!0);let n=TR.map(e=>({value:e.command,...e.description.length>0?{description:e.description}:{}})),r=V(null);function a(e){return E(r)?.handleKeydown(e)??!1}var o={handleKeydown:a};return se(wR(e,{trigger:`/`,get entries(){return n},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},menuLabel:`Slash commands`,dataSlot:`slash-menu`,get onSelect(){return t.onExecute}}),e=>F(r,e,!0),()=>E(r)),x(o)}function DR(e,t){i(t,!0);let n=I(()=>At.skills.map(e=>({value:`$${e.name}`,...e.description.length>0?{description:e.description}:{}}))),r=I(()=>At.target?`from provider: ${At.target.providerId}`:`Open a Workspace provider to load skills`),a=V(null);function o(e){return E(a)?.handleKeydown(e)??!1}var s={handleKeydown:o};return se(wR(e,{trigger:`$`,get entries(){return E(n)},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},menuLabel:`Skill references`,get sourceLabel(){return E(r)},dataSlot:`skill-menu`,emptyMessage:`No skills in the current workspace`,get onSelect(){return t.onInsert}}),e=>F(a,e,!0),()=>E(a)),x(s)}var OR=null;function kR(){if(OR!==null)return OR;let e=St();return e?(OR=e.agent.models.catalog({}).then(e=>Object.fromEntries(e.providers.map(e=>[e.provider,e.label]))).catch(()=>(OR=null,{})),OR):Promise.resolve({})}var AR=r(`<img class="h-full w-full object-cover"/>`),jR=r(`<div class="flex h-full w-full items-center justify-center bg-muted/40"><!></div>`),MR=r(`<div class="group relative h-14 w-14 overflow-hidden rounded-lg border border-border"><!> <button type="button" class="absolute top-0.5 right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-background/80 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:text-destructive" aria-label="Remove attachment"><!></button></div>`),NR=r(`<span class="flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px]"> <button type="button" class="text-muted-foreground hover:text-destructive">×</button></span>`),PR=r(`<div class="flex flex-wrap gap-1.5 px-3 pt-3" aria-label="Pending attachments"><!> <!></div>`),FR=r(`<span class="truncate"> </span> <!>`,1),IR=r(`<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center"><!></span> <span class="truncate"> </span>`,1),LR=r(`<!> <!>`,1),RR=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-primary"></span>`),zR=r(`<span class="truncate"> </span> <!> <!>`,1),BR=r(`<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span> <span class="truncate"> </span>`,1),VR=r(`<!> <!> <!>`,1),HR=r(`<div class="relative mx-3 mb-3 flex shrink-0 flex-col rounded-[22px] border border-border bg-card shadow-sm"><!> <!> <!> <textarea class="msg-body max-h-40 w-full resize-none border-0 bg-transparent px-3.5 py-2.5 outline-none focus:outline-none focus-visible:ring-0 placeholder:text-muted-foreground disabled:opacity-50" aria-label="Message"></textarea> <div class="flex h-11 items-center gap-1 px-2.5"><!> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground disabled:opacity-50" title="Attach images (paste or pick, ≤4 MiB each)" aria-label="Attach images (paste or pick, ≤4 MiB each)"><!></button> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground disabled:opacity-50" title="Attach files (text inlined, binary as refs, ≤512 KiB each)" aria-label="Attach files (text inlined, binary as refs, ≤512 KiB each)"><!></button> <div class="flex-1"></div> <!> <!> <button type="button"><!></button></div></div>`);function UR(e,r){i(r,!0);let o=V(null),s=V(null),u=V(null),d=V(!0);de(()=>{X.text;let e=E(o);e&&(e.style.height=`auto`,e.style.height=`${Math.min(160,Math.max(44,e.scrollHeight))}px`)}),de(()=>{X.text,F(d,p(),!0)});function p(){return!X.text.slice(0,E(o)?.selectionStart??0).includes(`
226
- `)}let m=I(()=>Re.status===`running`),g=I(()=>X.text.trim().length>0||X.images.length>0||X.files.length>0),_=I(()=>X.editing!==null),v=I(()=>E(_)?`Edit your message — sending will resend it as a new message`:`Message the agent…`),b=I(()=>E(m)&&!E(g)?`stop`:E(m)?`wait`:`send`),S=I(()=>Re.sessionId?Re.mode:Re.pendingMode),w=I(()=>_t.find(e=>e.id===E(S))?.label),T=I(()=>{let e=Z.view;if(!e)return null;let t=e.settings.model,n=!e.settings.modelRoutes.some(e=>e.provider===t.provider);return{label:`${t.provider} · ${t.model}`,effort:t.reasoningEffort,dangling:n}}),D=V(fe({})),k=V(!1),A=V(!1);de(()=>{kR().then(e=>F(D,e,!0))});let ee=I(()=>{let e=Z.view;if(!e)return[];let t=e.settings.model;return e.settings.modelRoutes.map(e=>{let n=e.models.map(e=>e.id);t.provider===e.provider&&!n.includes(t.model)&&n.unshift(t.model);let r=E(D)[e.provider]??e.provider;return{provider:e.provider,label:r,letter:e.iconLetter??r.slice(0,1).toUpperCase(),color:e.iconColor??`hsl(${kL(e.provider)} 55% 45%)`,models:n}})});function te(e,t){let n=Z.view;return n!==null&&n.settings.model.provider===e&&n.settings.model.model===t}async function P(e,t){let n=Z.view?.settings.model.reasoningEffort,r=await ke({model:{provider:e,model:t,...n!==void 0&&n.length>0?{reasoningEffort:n}:{}}});if(r){if(r.outcome===`rejected`){Mn(`${r.code}: ${r.detail}`);return}if(r.outcome===`error`){Mn(r.message);return}Mn(`Active model → ${e} · ${t}`)}}function L(){let e=X.text.trim();(e.length!==0||X.images.length!==0||X.files.length!==0)&&(Re.sending||Le(e,X.images,X.files))}let ne=V(!1);async function re(e){if(!E(ne)){F(ne,!0);try{let t=await Ge(e);if(t===null||t.paths.length===0)return;let n=t.paths.map(e=>({path:e,name:e.split(/[\\/]/).filter(Boolean).pop()??e}));e===`image`?Ae(n):Xe(n)}finally{F(ne,!1)}}}function R(e){if(!Re.sessionId){Re.pendingMode=e;return}Qe(e)}function ae(e){Re.sending||(X.text=``,X.images=[],X.files=[],De(),Le(e))}function ce(e){let t=E(o),n=Math.min(t?.selectionStart??X.text.length,X.text.length);X.text=`${e} ${X.text.slice(n)}`;let r=Math.min(e.length+1,X.text.length);requestAnimationFrame(()=>{t?.setSelectionRange(r,r),F(d,p(),!0)})}function U(e){E(s)?.handleKeydown(e)||E(u)?.handleKeydown(e)||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())}function le(){F(d,p(),!0)}function G(e){let t=[...e.clipboardData?.files??[]].filter(e=>e.type.startsWith(`image/`));t.length>0&&(e.preventDefault(),Se(t))}var ue=HR(),K=W(ue);se(ER(K,{get text(){return X.text},get caretOnFirstLine(){return E(d)},onExecute:ae}),e=>F(s,e,!0),()=>E(s));var pe=z(K,2);se(DR(pe,{get text(){return X.text},get caretOnFirstLine(){return E(d)},onInsert:ce}),e=>F(u,e,!0),()=>E(u));var me=z(pe,2),he=e=>{var r=PR(),i=W(r);t(i,17,()=>X.images,ie,(e,t,r)=>{var i=MR(),a=W(i),o=e=>{var n=AR();H(()=>{B(n,`src`,E(t).preview),B(n,`alt`,E(t).name??`image`)}),y(e,n)},s=e=>{var r=jR();Uc(W(r),{class:`h-5 w-5 text-muted-foreground`,"aria-hidden":`true`}),n(r),H(()=>B(r,`title`,E(t).path??E(t).name??`image`)),y(e,r)};h(a,e=>{E(t).preview?e(o):e(s,-1)});var c=z(a,2),u=W(c);Ln(u,{class:`h-2.5 w-2.5`}),n(c),n(i),l(`click`,c,()=>X.images=X.images.filter((e,t)=>t!==r)),y(e,i)});var a=z(i,2);t(a,17,()=>X.files,ie,(e,t,r)=>{var i=NR(),a=W(i),o=z(a);n(i),H(()=>{c(a,`📄 ${E(t).name??``} `),B(o,`aria-label`,`Remove file ${E(t).name??``}`)}),l(`click`,o,()=>X.files=X.files.filter((e,t)=>t!==r)),y(e,i)}),n(r),y(e,r)};h(me,e=>{(X.files.length>0||X.images.length>0)&&e(he)});var ge=z(me,2);O(ge),B(ge,`rows`,1),B(ge,`maxlength`,2e4),se(ge,e=>F(o,e),()=>E(o));var _e=z(ge,2),ve=W(_e);a(ve,()=>qL,(e,r)=>{r(e,{get open(){return E(A)},set open(e){F(A,e,!0)},children:(e,r)=>{var i=LR(),o=q(i);{let e=I(()=>E(m)?`Switch after the current turn ends`:Re.sessionId?`Switch this session's mode`:`Pick the mode for your next session`);a(o,()=>cR,(t,n)=>{n(t,{class:`flex h-7 max-w-[130px] items-center gap-1.5 rounded-full border border-border px-2.5 text-[11px] text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,get title(){return E(e)},"aria-label":`Session mode`,get disabled(){return E(m)},onkeydown:e=>{e.key===`Escape`&&E(A)&&(e.stopPropagation(),F(A,!1))},children:(e,t)=>{var n=FR(),r=q(n),i=M(r,!0);GL(z(r,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(w)??`Mode`)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2),l=e=>{var r=Y(),i=q(r);a(i,()=>ZL,(e,r)=>{r(e,{align:`start`,class:`max-h-72 w-44 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(A,!1))},children:(e,r)=>{var i=Y(),o=q(i);t(o,17,()=>_t,e=>e.id,(e,t)=>{var r=Y(),i=q(r);{let e=I(()=>E(S)===E(t).id?`true`:void 0);a(i,()=>tR,(r,i)=>{i(r,{get"data-mode-active"(){return E(e)},class:`gap-1.5`,onclick:()=>R(E(t).id),children:(e,r)=>{var i=IR(),a=q(i),o=W(a),s=e=>{Hs(e,{class:`h-3 w-3`,"aria-hidden":`true`})};h(o,e=>{E(S)===E(t).id&&e(s)}),n(a);var l=z(a,2),u=M(l,!0);H(()=>c(u,E(t).label)),y(e,i)},$$slots:{default:!0}})})}y(e,r)}),y(e,i)},$$slots:{default:!0}})}),y(e,r)};h(s,e=>{E(A)&&e(l)}),y(e,i)},$$slots:{default:!0}})});var ye=z(ve,2);Uc(W(ye),{class:`h-4 w-4`}),n(ye);var be=z(ye,2);zL(W(be),{class:`h-4 w-4`}),n(be);var xe=z(be,4),Ce=e=>{var r=Y(),i=q(r);a(i,()=>qL,(e,r)=>{r(e,{get open(){return E(k)},set open(e){F(k,e,!0)},children:(e,r)=>{var i=LR(),o=q(i);{let e=I(()=>E(T).dangling?`border-amber-500/60 text-amber-600 dark:text-amber-400`:`border-border text-muted-foreground hover:text-foreground`),t=I(()=>E(m)?`Switch after the current turn ends`:`Switch the active model — route configuration lives in Settings → Model`);a(o,()=>cR,(n,r)=>{r(n,{get class(){return`flex h-7 max-w-[150px] items-center gap-1.5 rounded-full border px-2.5 text-[11px] transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${E(e)??``}`},get title(){return E(t)},"aria-label":`Switch active model`,get disabled(){return E(m)},onkeydown:e=>{e.key===`Escape`&&E(k)&&(e.stopPropagation(),F(k,!1))},children:(e,t)=>{var n=zR(),r=q(n),i=M(r,!0),a=z(r,2),o=e=>{var t=RR();H(()=>B(t,`title`,`Reasoning effort: ${E(T).effort}`)),y(e,t)};h(a,e=>{E(T).effort&&e(o)}),GL(z(a,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(T).label)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2);a(s,()=>ZL,(e,r)=>{r(e,{align:`end`,class:`max-h-72 w-56 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(k,!1))},children:(e,r)=>{var i=VR(),o=q(i),s=e=>{var t=LR(),n=q(t);a(n,()=>iR,(e,t)=>{t(e,{"data-dangling":`true`,class:`px-2 py-1.5 text-[10px] font-medium text-amber-600 dark:text-amber-400`,children:(e,t)=>{oe();var n=C();H(()=>c(n,`${E(T).label??``} — outside Routes`)),y(e,n)},$$slots:{default:!0}})});var r=z(n,2);a(r,()=>oR,(e,t)=>{t(e,{})}),y(e,t)};h(o,e=>{E(T).dangling&&e(s)});var l=z(o,2);t(l,17,()=>E(ee),e=>e.provider,(e,r)=>{var i=LR(),o=q(i);a(o,()=>$L,(e,i)=>{i(e,{children:(e,i)=>{var o=LR(),s=q(o);a(s,()=>uR,(e,t)=>{t(e,{class:`flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium`,children:(e,t)=>{var n=BR(),i=q(n),a=M(i,!0),o=z(i,2),s=M(o,!0);H(()=>{j(i,`background: ${E(r).color??``}`),c(a,E(r).letter),c(s,E(r).label)}),y(e,n)},$$slots:{default:!0}})});var l=z(s,2);t(l,16,()=>E(r).models,e=>e,(e,t)=>{var i=Y(),o=q(i);{let e=I(()=>te(E(r).provider,t)?`true`:void 0);a(o,()=>tR,(i,a)=>{a(i,{get"data-model-active"(){return E(e)},class:`gap-1.5`,onclick:()=>void P(E(r).provider,t),children:(e,i)=>{var a=IR(),o=q(a),s=W(o),l=e=>{Hs(e,{class:`h-3 w-3`,"aria-hidden":`true`})},u=I(()=>te(E(r).provider,t));h(s,e=>{E(u)&&e(l)}),n(o);var d=z(o,2),f=M(d,!0);H(()=>c(f,t)),y(e,a)},$$slots:{default:!0}})})}y(e,i)}),y(e,o)},$$slots:{default:!0}})});var s=z(o,2);a(s,()=>oR,(e,t)=>{t(e,{})}),y(e,i)});var u=z(l,2);a(u,()=>tR,(e,t)=>{t(e,{onclick:()=>fR(`model`),children:(e,t)=>{oe();var n=C(`Open settings →`);y(e,n)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,r)};h(xe,e=>{E(T)&&e(Ce)});var we=z(xe,2);vR(we,{});var Te=z(we,2),Ee=W(Te),Oe=e=>{UL(e,{class:`h-3 w-3`})},je=e=>{VL(e,{class:`h-4 w-4`})};h(Ee,e=>{E(b)===`stop`?e(Oe):e(je,-1)}),n(Te),n(_e),n(ue),H(()=>{B(ge,`placeholder`,E(v)),J(Te,1,`relative flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-full transition-colors after:absolute after:-inset-0.5 after:content-[''] ${E(b)===`stop`?`bg-destructive text-white hover:bg-destructive/90`:E(b)===`wait`?`bg-muted text-muted-foreground`:`bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50`}`),B(Te,`aria-label`,E(b)===`stop`?`Cancel current activity`:`Send message`),B(Te,`title`,E(b)===`stop`?`Cancel current activity`:E(b)===`wait`?`Wait for the current turn`:`Send (Enter)`),Te.disabled=E(b)!==`stop`&&(!E(g)||Re.sending)}),l(`keydown`,ge,U),l(`keyup`,ge,le),l(`click`,ge,le),f(`select`,ge,le),f(`paste`,ge,G),N(ge,()=>X.text,e=>X.text=e),l(`click`,ye,()=>void re(`image`)),l(`click`,be,()=>void re(`file`)),l(`click`,Te,()=>E(b)===`stop`?void Ne():L()),y(e,ue),x()}T([`click`,`keydown`,`keyup`]);var WR=r(`<div class="border-t border-destructive/30 bg-destructive/8 px-3 py-1.5 text-xs text-destructive" role="alert"> </div>`),GR=r(`<div class="mx-3 mb-1.5 flex h-7 shrink-0 items-center justify-between gap-2 rounded-lg bg-amber-500/10 px-2.5 text-[11px] text-amber-700 dark:text-amber-400" role="status"><span class="truncate">Editing — resending keeps your full history (append-only)</span> <button type="button" class="shrink-0 rounded p-0.5 text-amber-700/80 hover:text-amber-700 dark:text-amber-400/80 dark:hover:text-amber-400" title="Cancel edit" aria-label="Cancel edit"><!></button></div>`),KR=r(`<aside aria-label="Agent panel"><div class="absolute inset-y-0 left-0 z-10 hidden w-1.5 cursor-col-resize touch-none select-none hover:bg-primary/30 min-[720px]:block" role="separator" aria-orientation="vertical" aria-label="Resize agent panel"></div> <!> <!> <!> <!> <!> <!></aside>`);function qR(e,t){i(t,!0),de(()=>{Ue.open&&Z.view===null&&!Z.loading&&Fe()}),de(()=>{if(Ue.seedPrompt){let e=Ue.seedPrompt;Ue.seedPrompt=null,X.text.length===0&&(X.text=e)}});let r=V(!1),a=0,o=0;function s(e){if(e.button!==0)return;F(r,!0),a=e.clientX,o=Ue.width;let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId),document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`}function u(){E(r)&&(F(r,!1),document.body.style.userSelect=``,document.body.style.cursor=``)}var d=KR();f(`keydown`,A,e=>{e.key===`Escape`&&Ue.open&&!document.querySelector(`[role='dialog']`)&&je(!1)}),f(`pointermove`,A,e=>{E(r)&&Ye(o+(a-e.clientX))}),f(`pointerup`,A,u),f(`pointercancel`,A,u);var p=W(d),m=z(p,2);Lc(m,{});var g=z(m,2);wL(g,{});var _=z(g,2),v=e=>{var t=WR(),n=M(t,!0);H(()=>c(n,Re.promptError??Re.error)),y(e,t)};h(_,e=>{(Re.promptError??Re.error)&&e(v)});var b=z(_,2),S=e=>{OL(e,{get todos(){return Re.todos}})};h(b,e=>{Re.sessionId&&Re.todos.length>0&&e(S)});var C=z(b,2),w=e=>{var t=GR(),r=z(W(t),2),i=W(r);Ln(i,{class:`h-3 w-3`}),n(r),n(t),l(`click`,r,()=>{X.editing!==null&&(X.text=``),X.editing=null}),y(e,t)};h(C,e=>{X.editing!==null&&e(w)}),UR(z(C,2),{}),n(d),H(()=>{J(d,1,`relative flex h-full w-full flex-col bg-background min-[720px]:w-(--agent-panel-width) min-[720px]:overflow-hidden duration-150 ease-in-out ${E(r)?``:`min-[720px]:transition-[width,border-color] max-[720px]:transition-[transform,visibility]`} ${Ue.open?`border-l border-border`:`border-l-0 max-[720px]:translate-x-full max-[720px]:invisible`}`),j(d,`--agent-panel-width: ${(Ue.open?Ue.width:0)??``}px`)}),f(`dragover`,d,e=>e.preventDefault()),f(`drop`,d,function(...e){Be?.apply(this,e)}),l(`pointerdown`,p,s),y(e,d),x()}T([`pointerdown`,`click`]);var JR=new Set([`$$slots`,`$$events`,`$$legacy`]);function YR(e,t){let n=U(t,JR),r=[[`path`,{d:`M14 17H5`}],[`path`,{d:`M19 7h-9`}],[`circle`,{cx:`17`,cy:`17`,r:`3`}],[`circle`,{cx:`7`,cy:`7`,r:`3`}]];be(e,K({name:`settings-2`},()=>n,{get iconNode(){return r}}))}var XR=new Set([`$$slots`,`$$events`,`$$legacy`]);function ZR(e,t){let n=U(t,XR),r=[[`path`,{d:`M12 20v2`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M17 20v2`}],[`path`,{d:`M17 2v2`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M2 17h2`}],[`path`,{d:`M2 7h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`M20 17h2`}],[`path`,{d:`M20 7h2`}],[`path`,{d:`M7 20v2`}],[`path`,{d:`M7 2v2`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`}]];be(e,K({name:`cpu`},()=>n,{get iconNode(){return r}}))}var QR=new Set([`$$slots`,`$$events`,`$$legacy`]);function $R(e,t){let n=U(t,QR),r=[[`path`,{d:`M12 8V4H8`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}],[`path`,{d:`M2 14h2`}],[`path`,{d:`M20 14h2`}],[`path`,{d:`M15 13v2`}],[`path`,{d:`M9 13v2`}]];be(e,K({name:`bot`},()=>n,{get iconNode(){return r}}))}var ez=r(`<button><span class="flex items-center gap-1 font-medium"> </span> <span class="mt-0.5 block text-[10px] leading-snug text-muted-foreground"> </span></button>`),tz=r(`<button> </button>`),nz=r(`<section class="space-y-1.5" aria-label="Default mode"><span class="text-[11px] font-medium text-muted-foreground">Default mode</span> <div class="grid grid-cols-2 gap-1.5"></div></section> <section class="space-y-1.5" aria-label="Behavior"><span class="text-[11px] font-medium text-muted-foreground">Behavior</span> <div class="space-y-1"><span class="text-[10px] text-muted-foreground">LLM preset</span> <div class="flex gap-1.5"></div></div> <div class="space-y-1"><span class="text-[10px] text-muted-foreground">Approval policy</span> <div class="flex gap-1.5"></div></div></section>`,1),rz=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),iz=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground">Agent settings unavailable <!></div>`),az=r(`<div class="text-xs text-destructive" role="alert"> </div>`),oz=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">Agent</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Defaults for new sessions; the panel header switches an existing session's mode.</p></div> <!> <!></div>`);function sz(e,r){i(r,!0);let a=V(null),o=[`deterministic`,`live`],s=[`ask`,`never`],u=I(()=>Z.view);async function d(e){let t=await ke(e);t&&(t.outcome===`rejected`?F(a,`${t.code}: ${t.detail}`):t.outcome===`error`?F(a,t.message,!0):F(a,null))}var f=oz(),p=z(W(f),2),m=e=>{var r=nz(),i=q(r),a=z(W(i),2);t(a,21,()=>_t,e=>e.id,(e,t)=>{var r=ez(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0);n(r),H(()=>{J(r,1,`rounded-md border p-2 text-left transition-colors ${E(u).settings.defaultMode===E(t).id?`border-primary bg-primary/10`:`border-border hover:bg-muted`}`),B(r,`aria-pressed`,E(u).settings.defaultMode===E(t).id),r.disabled=Z.updating,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>void d({defaultMode:E(t).id})),y(e,r)}),n(a),n(i);var f=z(i,2),p=z(W(f),2),m=z(W(p),2);t(m,20,()=>o,e=>e,(e,t)=>{var n=tz(),r=M(n,!0);H(()=>{J(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(u).settings.preset===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(u).settings.preset===t),n.disabled=Z.updating,c(r,t)}),l(`click`,n,()=>void d({preset:t})),y(e,n)}),n(m),n(p);var h=z(p,2),g=z(W(h),2);t(g,20,()=>s,e=>e,(e,t)=>{var n=tz(),r=M(n,!0);H(()=>{J(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(u).settings.permissions.approvalPolicy===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(u).settings.permissions.approvalPolicy===t),n.disabled=Z.updating,c(r,t)}),l(`click`,n,()=>void d({permissions:{approvalPolicy:t}})),y(e,n)}),n(g),n(h),n(f),y(e,r)},g=e=>{var t=rz();y(e,t)},_=e=>{var t=iz(),r=z(W(t));An(r,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void Fe(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),y(e,t)};h(p,e=>{E(u)?e(m):Z.loading?e(g,1):e(_,-1)});var v=z(p,2),b=e=>{var t=az(),n=M(t,!0);H(()=>c(n,E(a))),y(e,t)};h(v,e=>{E(a)&&e(b)}),n(f),y(e,f),x()}T([`click`]);var cz=new Set([`$$slots`,`$$events`,`$$legacy`]);function lz(e,t){let n=U(t,cz),r=[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`}],[`path`,{d:`m2 22 3-3`}],[`path`,{d:`M7.5 13.5 10 11`}],[`path`,{d:`M10.5 16.5 13 14`}],[`path`,{d:`m18 3-4 4h6l-4 4`}]];be(e,K({name:`plug-zap`},()=>n,{get iconNode(){return r}}))}var uz=new Set([`$$slots`,`$$events`,`$$legacy`]);function dz(e,t){let n=U(t,uz),r=[[`path`,{d:`M12 22v-5`}],[`path`,{d:`M15 8V2`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`}],[`path`,{d:`M9 8V2`}]];be(e,K({name:`plug`},()=>n,{get iconNode(){return r}}))}var fz=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),pz=r(`<p class="text-[10px] text-muted-foreground">The panel reconnects automatically; keep the daemon running via the tray or the <code class="rounded bg-muted px-1 font-mono">skill-creator start</code> command.</p>`),mz=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">General</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Shell-level state of this Skill Creator instance.</p></div> <section class="space-y-1.5" aria-label="Daemon connection"><span class="text-[11px] font-medium text-muted-foreground">Daemon connection</span> <div class="flex items-center gap-2 rounded-md border border-border bg-background/60 p-2.5"><!> <span> </span></div> <!></section></div>`);function hz(e,t){i(t,!0);let r=I(()=>{switch(wt.status){case`connected`:return`Connected`;case`connecting`:return`Connecting…`;case`disconnected`:return`Disconnected`;default:return`Idle`}});var a=mz(),o=z(W(a),2),s=z(W(o),2),l=W(s),u=e=>{lz(e,{class:`h-4 w-4 text-primary`})},d=e=>{{let t=I(()=>wt.status===`disconnected`?`text-destructive`:`text-muted-foreground`);dz(e,{get class(){return`h-4 w-4 ${E(t)??``}`}})}};h(l,e=>{wt.status===`connected`?e(u):e(d,-1)});var f=z(l,2),p=M(f,!0);n(s);var m=z(s,2),g=e=>{var t=fz(),n=M(t,!0);H(()=>c(n,wt.error)),y(e,t)},_=e=>{var t=pz();y(e,t)};h(m,e=>{wt.status===`disconnected`?e(g):e(_,-1)}),n(o),n(a),H(()=>{J(f,1,`text-xs ${wt.status===`connected`?`text-primary`:wt.status===`disconnected`?`text-destructive`:`text-muted-foreground`}`),c(p,E(r))}),y(e,a),x()}var gz=new Set([`$$slots`,`$$events`,`$$legacy`]);function _z(e,t){let n=U(t,gz),r=[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`}],[`path`,{d:`m2 2 20 20`}]];be(e,K({name:`eye-off`},()=>n,{get iconNode(){return r}}))}var vz=new Set([`$$slots`,`$$events`,`$$legacy`]);function yz(e,t){let n=U(t,vz),r=[[`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`}],[`path`,{d:`m15 5 4 4`}]];be(e,K({name:`pencil`},()=>n,{get iconNode(){return r}}))}var bz=new Set([`$$slots`,`$$events`,`$$legacy`]);function xz(e,t){let n=U(t,bz),r=[[`path`,{d:`M12 3v12`}],[`path`,{d:`m17 8-5-5-5 5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}]];be(e,K({name:`upload`},()=>n,{get iconNode(){return r}}))}var Sz=r(`<img alt=""/>`),Cz=r(`<span class="flex h-5 w-5 items-center justify-center rounded text-[10px] font-semibold text-white" aria-hidden="true"> </span>`),wz=r(`<span class="flex h-12 w-12 shrink-0 items-center justify-center rounded-md text-base font-semibold text-white" aria-hidden="true"> </span>`),Tz=r(`<button type="button"><span class="flex h-4 w-4 items-center justify-center rounded" aria-hidden="true"><img alt="" class="h-3.5 w-3.5 object-contain dark:invert"/></span></button>`),Ez=r(`<p class="text-[9px] text-muted-foreground">Duplicate catalog icons are merged; hover shows sharing providers.</p>`),Dz=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground">Icon</span> <div class="grid grid-cols-7 place-items-center gap-1"><button type="button" title="No icon — letter avatar with the color below (suppresses the catalog icon)" aria-label="No icon (letter avatar)"><span class="flex h-4 w-4 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span></button> <!></div> <!></div>`),Oz=r(`<button type="button" title="No icon — letter avatar with the color below" aria-label="No icon (letter avatar)"><span class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span> No icon — use the letter avatar</button>`),kz=r(`<button type="button"><span class="h-4 w-4 rounded" aria-hidden="true"></span></button>`),Az=r(`<span class="text-[9px] text-destructive" role="alert">invalid hex</span>`),jz=r(`<div class="space-y-1 border-t border-border pt-1.5"><span class="text-[10px] font-medium text-muted-foreground">Avatar color</span> <div class="flex flex-wrap items-center gap-1"><button type="button" title="Auto — deterministic hue from the route name" aria-label="Auto avatar color"><span class="flex h-4 w-4 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span></button> <!></div> <div class="flex items-center gap-1"><input aria-label="Avatar color hex" placeholder="#3b82f6"/> <!></div></div>`),Mz=r(`<div class="space-y-1 border-t border-border pt-1.5"><span class="text-[10px] font-medium text-muted-foreground">Letter</span> <div class="flex items-center gap-1.5"><input class="h-6 w-12 rounded border border-border bg-background px-1.5 text-center text-[11px] font-semibold uppercase outline-none focus:border-primary/60" aria-label="Avatar letter" maxlength="2"/> <button type="button" class="rounded px-1.5 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" title="Reset to the first letter of the display name">Reset</button></div></div>`),Nz=r(`<div class="absolute left-0 top-[calc(100%+4px)] z-30 w-[280px] space-y-2 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-md" role="dialog" aria-label="Route icon and avatar choices"><div class="flex items-center gap-2"><!> <div class="min-w-0"><p class="truncate text-xs font-medium"> </p> <p class="text-[10px] text-muted-foreground"> </p></div></div> <!> <div class="flex items-center justify-between gap-2 border-t border-border pt-1.5"><span class="text-[10px] text-muted-foreground">Custom image · ≤64 KiB</span> <button type="button" class="flex h-6 items-center gap-1 rounded px-1.5 text-[10px] hover:bg-muted"><!> Upload</button></div> <input type="file" accept=".svg,.png,.webp" class="hidden" aria-label="Upload custom icon"/> <!> <!></div>`),Pz=r(`<div class="relative shrink-0"><button type="button" aria-label="Change route icon"><!> <span class="absolute bottom-0 right-0 hidden bg-background p-px text-foreground group-hover:block" aria-hidden="true"><!></span></button> <!></div>`);function Fz(e,r){i(r,!0);let a=k(r,`icon`,3,null),o=k(r,`label`,3,``),s=k(r,`catalogIcons`,19,()=>[]),u=k(r,`disabled`,3,!1),d=[`#ef4444`,`#f59e0b`,`#10b981`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#f43f5e`,`#64748b`],p=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,m=V(!1),g=V(null),_=V(null),v=V(``),b=V(``),S=V(!1);de(()=>{F(v,r.letter,!0)});let C=I(()=>{let e=new Map;for(let t of s()){let n=e.get(t.icon);n?n.providers.push(t.provider):e.set(t.icon,{icon:t.icon,providers:[t.provider]})}let t=[...e.values()];return t.sort((e,t)=>+!e.providers.includes(r.provider)-!t.providers.includes(r.provider)||e.providers[0].localeCompare(t.providers[0])),t}),w=I(()=>s().some(e=>e.provider===r.provider));function T(e){u()||(r.onPick(e),F(m,!1))}function D(){if(r.onLetter===void 0||u())return;let e=E(v).trim();if(e.length===0||e===r.letter){F(v,r.letter,!0);return}r.onLetter(e.slice(0,2))}function O(){r.onLetter===void 0||u()||(r.onLetter(void 0),F(v,r.letter,!0))}function ee(){if(r.onColor===void 0||u())return;let e=E(b).trim();if(e.length===0){F(S,!1);return}if(!p.test(e)){F(S,!0);return}F(S,!1),F(b,``),r.onColor(e.toLowerCase())}function te(e){let t=e.currentTarget;if(!(t instanceof HTMLInputElement))return;let n=t.files?.[0];if(t.value=``,!n)return;let r=n.name.split(`.`).pop()?.toLowerCase()??``,i=IL[r]??``;if(i.length===0){Mn(`Unsupported icon type “${n.type||r||n.name}” — use .svg, .png or .webp.`);return}let a=new FileReader;a.onerror=()=>{Mn(`Could not read “${n.name}” — try another file.`)},a.onload=()=>{let e=typeof a.result==`string`?a.result:``;if(e.length===0){Mn(`Could not read “${n.name}” — try another file.`);return}let t=e.startsWith(`data:${i}`)?e:LL(e,i);if(t===null){Mn(`Could not read “${n.name}” as an image.`);return}if(t.length>65536){Mn(`Icon too large — pick an image under 64 KiB.`);return}T(t)},a.readAsDataURL(n)}var P=Pz();f(`keydown`,A,e=>{E(m)&&e.key===`Escape`&&F(m,!1)}),f(`pointerdown`,A,e=>{E(m)&&E(g)&&!E(g).contains(e.target)&&F(m,!1)});var L=W(P),ne=W(L),re=e=>{var t=Sz();H(e=>{B(t,`src`,a()),J(t,1,`h-5 w-5 object-contain ${e??``}`)},[()=>ML(a())?``:`dark:invert`]),y(e,t)},ie=e=>{var t=Cz(),n=M(t,!0);H(()=>{j(t,`background: ${r.color??``}`),c(n,r.letter)}),y(e,t)};h(ne,e=>{a()?e(re):e(ie,-1)});var R=z(ne,2);yz(W(R),{class:`h-2.5 w-2.5`}),n(R),n(L);var ae=z(L,2),ce=e=>{var i=Nz(),s=W(i),p=W(s),g=e=>{var t=Sz();H(e=>{B(t,`src`,a()),J(t,1,`h-12 w-12 shrink-0 object-contain ${e??``}`)},[()=>ML(a())?``:`dark:invert`]),y(e,t)},x=e=>{var t=wz(),n=M(t,!0);H(()=>{j(t,`background: ${r.color??``}`),c(n,r.letter)}),y(e,t)};h(p,e=>{a()?e(g):e(x,-1)});var k=z(p,2),A=W(k),P=M(A,!0),I=z(A,2),L=M(I,!0);n(k),n(s);var ne=z(s,2),re=e=>{var i=Dz(),o=z(W(i),2),s=W(o),u=W(s),d=M(u,!0);n(s);var f=z(s,2);t(f,17,()=>E(C),e=>e.icon,(e,t)=>{var i=Tz(),o=W(i),s=M(o);n(i),H((e,n)=>{J(i,1,`flex h-6 w-6 items-center justify-center rounded ${a()===E(t).icon?`border border-primary/60 bg-primary/5`:`hover:bg-muted`}`),B(i,`title`,e),B(i,`aria-label`,`Use icon shared by ${n??``}`),j(o,`background: color-mix(in srgb, ${r.color??``} 18%, transparent)`),B(s,`src`,E(t).icon)},[()=>E(t).providers.join(`, `),()=>E(t).providers.length>1?E(t).providers.join(`, `):E(t).providers[0]]),l(`click`,i,()=>T(E(t).icon)),y(e,i)}),n(o);var p=z(o,2),g=e=>{var t=Ez();y(e,t)};h(p,e=>{E(w)&&e(g)}),n(i),H(e=>{J(s,1,`flex h-6 w-6 items-center justify-center rounded border ${a()===null?`border-primary/50 bg-primary/5`:`border-border hover:bg-muted`}`),j(u,`background: ${r.color??``}`),c(d,e)},[()=>r.letter.slice(0,1)]),l(`click`,s,()=>{if(r.onSuppress!==void 0){r.onSuppress(),F(m,!1);return}T(void 0)}),y(e,i)},ie=e=>{var t=Oz(),i=W(t),o=M(i,!0);oe(),n(t),H(e=>{J(t,1,`flex w-full items-center gap-2 rounded px-1 py-0.5 text-[10px] transition-colors hover:bg-muted ${a()===null?`text-primary`:`text-muted-foreground`}`),j(i,`background: ${r.color??``}`),c(o,e)},[()=>r.letter.slice(0,1)]),l(`click`,t,()=>T(void 0)),y(e,t)};h(ne,e=>{E(C).length>0?e(re):e(ie,-1)});var R=z(ne,2),ae=z(W(R),2);xz(W(ae),{class:`h-3 w-3`}),oe(),n(ae),n(R);var V=z(R,2);se(V,e=>F(_,e),()=>E(_));var ce=z(V,2),U=e=>{var i=jz(),a=z(W(i),2),o=W(a),s=W(o),p=M(s,!0);n(o);var m=z(o,2);t(m,16,()=>d,e=>e,(e,t)=>{var n=kz(),i=M(n);H(e=>{J(n,1,`flex h-6 w-6 items-center justify-center rounded border ${e??``}`),B(n,`title`,t),B(n,`aria-label`,`Avatar color ${t??``}`),j(i,`background: ${t??``}`)},[()=>r.color.toLowerCase()===t?`border-primary/60 bg-primary/5`:`border-border hover:bg-muted`]),l(`click`,n,()=>r.onColor?.(t)),y(e,n)}),n(a);var g=z(a,2),_=W(g);le(_);var v=z(_,2),x=e=>{var t=Az();y(e,t)};h(v,e=>{E(S)&&e(x)}),n(g),n(i),H((e,t,n)=>{J(o,1,`flex h-6 w-6 items-center justify-center rounded border ${e??``}`),j(s,`background: ${t??``}`),c(p,n),J(_,1,`h-6 w-24 rounded border bg-background px-1.5 font-mono text-[10px] outline-none focus:border-primary/60 ${E(S)?`border-destructive`:`border-border`}`),_.disabled=u()},[()=>r.color===AL(r.provider)?`border-primary/50 bg-primary/5`:`border-border hover:bg-muted`,()=>AL(r.provider),()=>r.letter.slice(0,1)]),l(`click`,o,()=>r.onColor?.(void 0)),f(`blur`,_,()=>ee()),l(`keydown`,_,e=>{e.key===`Enter`&&ee()}),N(_,()=>E(b),e=>F(b,e)),y(e,i)};h(ce,e=>{r.onColor!==void 0&&e(U)});var G=z(ce,2),ue=e=>{var t=Mz(),r=z(W(t),2),i=W(r);le(i);var a=z(i,2);n(r),n(t),H(()=>i.disabled=u()),f(`blur`,i,()=>D()),l(`keydown`,i,e=>{e.key===`Enter`&&D()}),N(i,()=>E(v),e=>F(v,e)),l(`click`,a,O),y(e,t)};h(G,e=>{r.onLetter!==void 0&&e(ue)}),n(i),H(e=>{c(P,o()||r.provider),c(L,e)},[()=>a()?ML(a())?`Legacy letter avatar`:`Icon override`:`Letter avatar`]),l(`click`,ae,()=>E(_)?.click()),l(`change`,V,te),y(e,i)};h(ae,e=>{E(m)&&e(ce)}),n(P),se(P,e=>F(g,e),()=>E(g)),H(()=>{J(L,1,`group relative flex h-7 w-7 items-center justify-center overflow-hidden rounded-md border border-border bg-background transition-colors hover:border-primary/50 ${u()?`pointer-events-none opacity-50`:``}`),B(L,`aria-expanded`,E(m)),L.disabled=u()}),l(`click`,L,()=>F(m,!E(m))),y(e,P),x()}T([`click`,`change`,`keydown`]);var Iz=r(`<span class="flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[10px]"> <button type="button" class="rounded px-0.5 text-muted-foreground hover:text-destructive">×</button></span>`),Lz=r(`<span class="shrink-0 rounded bg-primary/10 px-1 text-[9px] text-primary">vision</span>`),Rz=r(`<li><button role="option"><span class="min-w-0 flex-1 truncate"> <span class="text-muted-foreground"> </span></span> <!></button></li>`),zz=r(`<ul class="absolute z-10 mt-1 max-h-44 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-xs shadow-md" role="listbox" aria-label="Model suggestions"></ul>`),Bz=r(`<div class="relative"><div class="flex min-h-8 flex-wrap items-center gap-1 rounded-md border border-border bg-background px-1.5 py-1 text-xs focus-within:border-primary/60" role="group" aria-label="Model ids"><input class="order-last h-6 min-w-24 flex-1 bg-transparent text-xs outline-none"/> <!></div> <!></div>`);function Vz(e,r){i(r,!0);let a=k(r,`placeholder`,3,`Add model…`),o=k(r,`disabled`,3,!1),s=V(``),u=V(!1),d=V(0),p=I(()=>{let e=E(s).trim().toLowerCase(),t=r.candidates.filter(e=>!r.selected.includes(e.id));return e.length===0?t.slice(0,8):t.filter(t=>t.id.toLowerCase().includes(e)||(t.name??``).toLowerCase().includes(e)).slice(0,8)});function m(e){let t=e.trim();if(t.length===0||r.selected.includes(t)){F(s,``);return}r.onchange([...r.selected,t]),F(s,``),F(u,!1)}function g(e){r.onchange(r.selected.filter(t=>t!==e))}function _(e){if(e.key===`Escape`){F(u,!1);return}if(e.key===`ArrowDown`&&E(p).length>0){e.preventDefault(),F(u,!0),F(d,Math.min(E(d)+1,E(p).length-1),!0);return}if(e.key===`ArrowUp`&&E(p).length>0){e.preventDefault(),F(d,Math.max(E(d)-1,0),!0);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),E(u)&&E(p)[E(d)]&&E(s).trim().length>0?m(E(p)[E(d)].id):E(s).trim().length>0&&m(E(s));return}e.key===`Backspace`&&E(s).length===0&&r.selected.length>0&&r.onchange(r.selected.slice(0,-1))}var v=Bz(),b=W(v),S=W(b);le(S);var C=z(S,2);t(C,16,()=>r.selected,e=>e,(e,t)=>{var r=Iz(),i=W(r),a=z(i);n(r),H(()=>{c(i,`${t??``} `),B(a,`aria-label`,`Remove ${t??``}`),a.disabled=o()}),l(`click`,a,()=>g(t)),y(e,r)}),n(b);var w=z(b,2),T=e=>{var r=zz();t(r,23,()=>E(p),e=>e.id,(e,t,r)=>{var i=Rz(),a=W(i),o=W(a),s=W(o),u=z(s),p=M(u);n(o);var g=z(o,2),_=e=>{var t=Lz();y(e,t)};h(g,e=>{E(t).image&&e(_)}),n(a),n(i),H(()=>{J(a,1,`flex w-full items-center gap-2 rounded px-1.5 py-1 text-left ${E(r)===E(d)?`bg-accent`:``} hover:bg-accent`),B(a,`aria-selected`,E(r)===E(d)),c(s,`${E(t).name??E(t).id??``} `),c(p,`(${E(t).id??``})`)}),l(`mousedown`,a,e=>e.preventDefault()),l(`click`,a,()=>m(E(t).id)),f(`focus`,a,()=>F(d,E(r),!0)),y(e,i)}),n(r),y(e,r)};h(w,e=>{E(u)&&E(p).length>0&&e(T)}),n(v),H(()=>{B(S,`placeholder`,a()),S.disabled=o()}),l(`keydown`,S,_),f(`focus`,S,()=>{F(u,!0),F(d,0)}),l(`input`,S,()=>{F(u,!0),F(d,0)}),f(`blur`,S,()=>setTimeout(()=>F(u,!1),120)),N(S,()=>E(s),e=>F(s,e)),y(e,v),x()}T([`keydown`,`input`,`click`,`mousedown`]);function Hz(e){return e.split(/[-_]+/).filter(e=>e.length>0).map(e=>/^[a-z]{1,3}$/.test(e)?e.toUpperCase():e.slice(0,1).toUpperCase()+e.slice(1)).join(` `)}function Uz(e){if(!Number.isSafeInteger(e)||e<=0)return String(e);if(e%1048576==0)return`${e/1048576}M`;if(e>=1024){let t=e/1024;return`${Number.isInteger(t)?t.toString():t.toFixed(1)}k`}return String(e)}function Wz(e){return e.includes(`/`)||e.includes(`@`)}function Gz(e){return{id:e.id,...e.name===void 0?{}:{name:e.name},image:e.image,...e.contextWindow===void 0?{}:{contextWindow:e.contextWindow},...e.supportsReasoningEffort===void 0?{}:{supportsReasoningEffort:e.supportsReasoningEffort},...e.inputTypes===void 0?{}:{inputTypes:[...e.inputTypes]},...e.maxOutputTokens===void 0?{}:{maxOutputTokens:e.maxOutputTokens},...e.effortTiers===void 0?{}:{effortTiers:[...e.effortTiers]}}}var Kz=(e,t)=>e.id<t.id?-1:+(e.id>t.id);function qz(e,t=``){let n=new Map,r=new Map;for(let i of e?.providers??[]){let e=i.provider===t;for(let t of i.models)if(e)n.has(t.id)||n.set(t.id,Gz(t)),r.delete(t.id);else if(!n.has(t.id)&&!r.has(t.id)){if(Wz(t.id))continue;r.set(t.id,Gz(t))}}return[...n.values()].sort(Kz).concat([...r.values()].sort(Kz))}var Jz=[`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Yz=[`low`,`high`,`max`],Xz=`Catalog marks this model as not supporting reasoning effort`;function Zz(e,t){if(t?.supportsReasoningEffort===!1)return{candidates:[],hint:Xz};let n=new Set(Jz);for(let e of t?.effortTiers??[]){let t=e.trim();t.length>0&&n.add(t)}for(let t of e)for(let e of t.efforts??[]){let t=e.trim();t.length>0&&n.add(t)}return{candidates:[...n].sort((e,t)=>e<t?-1:+(e>t)),hint:null}}function Qz(e){return{id:e.id,...e.name===void 0?{}:{name:e.name},...e.contextWindow===void 0?{}:{contextWindow:e.contextWindow},...e.maxOutputTokens===void 0?{}:{maxOutputTokens:e.maxOutputTokens},inputTypes:e.inputTypes??(e.image?[`text`,`image`]:[`text`]),outputTypes:[`text`],efforts:[...Yz]}}var $z=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500" title="Unsaved changes" aria-label="Unsaved changes"></span>`),eB=r(`<span data-header-status="true"><!></span>`),tB=r(`<option> </option>`),nB=r(`<p class="text-[10px] text-muted-foreground" role="note"> </p>`),rB=r(`<p class="text-[10px] text-destructive" role="alert">Invalid token value — use numbers, or shorthand like 253k / 0.5M.</p>`),iB=r(`<button type="button"> </button>`),aB=r(`<div class="grid grid-cols-2 gap-1.5"><label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Model id</span> <!> <datalist></datalist></label> <label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Name</span> <!></label></div> <div class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">Efforts</span> <!> <!></div> <div class="grid grid-cols-2 gap-1.5"><label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Context window</span> <!></label> <label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Max output tokens</span> <!></label></div> <!> <div class="flex flex-wrap items-center justify-between gap-2"><div class="flex flex-wrap items-center gap-1"><span class="text-[10px] text-muted-foreground">Inputs:</span> <span class="rounded bg-primary px-1.5 py-0.5 text-[10px] font-medium text-primary-foreground" title="Text is always required" data-input-chip="text">text</span> <!></div> <div class="flex items-center gap-1"><span class="text-[10px] text-muted-foreground">Outputs:</span> <span class="rounded bg-primary px-1.5 py-0.5 text-[10px] font-medium text-primary-foreground" title="Text output is always required" data-output-chip="text">text</span> <button type="button" title="Image output (image-generation models)" data-output-chip="image">image</button></div></div> <div class="flex items-center justify-between gap-2 border-t border-border pt-1.5"><span data-form-status="true"><!></span> <span class="flex shrink-0 items-center gap-1.5"><!> <!></span></div>`,1),oB=r(`<div class="space-y-1.5 rounded-md border border-border p-2"><div class="flex items-center justify-between gap-2"><div class="flex min-w-0 flex-1 items-center gap-1.5"><!> <span class="min-w-0 truncate text-xs font-medium" data-header-name="true"> </span> <!></div> <div class="flex shrink-0 items-center"><button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button> <button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button> <button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-destructive disabled:pointer-events-none disabled:opacity-50" title="Remove model"><!></button></div></div> <!></div>`);function sB(e,r){i(r,!0);let a=k(r,`routeModels`,19,()=>[]),o=k(r,`provider`,3,``),s=k(r,`formKey`,3,``),u=k(r,`disabled`,3,!1),d=k(r,`dirty`,3,!1),f=k(r,`initialExpanded`,3,!1),p=I(()=>s().trim().length>0),m=[`image`,`video`,`pdf`],g=`model-id-candidates-${crypto.randomUUID()}`,_=V(fe(r.model.id)),v=V(fe(r.model.name??Hz(r.model.id))),b=V(fe(r.model.contextWindow===void 0?``:Uz(r.model.contextWindow))),S=V(fe(r.model.maxOutputTokens===void 0?``:Uz(r.model.maxOutputTokens))),w=V(!1),T=V(!1),D=V(fe((r.model.outputTypes??[]).includes(`image`))),O=V(!1),A=V(!1),j=V(!1),ee=V(!1),te=V(!1),N=V(!1),P=V(null),L=V(fe(r.model.id)),ne=V(``),re=V(fe(f())),ie=I(()=>E(_).trim().length>0),R=I(()=>E(ie)&&!E(ee)&&!E(te)),ae=I(()=>new Set(r.model.inputTypes??[`text`])),se=I(()=>r.candidates.find(e=>e.id===E(_).trim())??null),ce=I(()=>Zz(a(),E(se))),U=I(()=>E(ne).trim()),le=I(()=>r.model.name??(r.model.id.length>0?Hz(r.model.id):`New model`)),G=I(()=>u()||!E(ie)||E(N)||r.api.length===0||r.baseURL.length===0||!E(p)&&!r.apiKeyConfigured&&E(U).length===0);de(()=>{r.onvalidity(E(R))});function ue(e){r.onchange({...r.model,...e})}function K(e){F(_,e,!0);let t=e.trim(),n=r.candidates.find(e=>e.id===t),i={id:t};n===void 0?(F(L,null),E(w)||(F(v,Hz(t),!0),r.model.name!==void 0&&(i.name=void 0)),!E(O)&&r.model.contextWindow!==void 0&&(F(b,``),i.contextWindow=void 0),!E(A)&&r.model.maxOutputTokens!==void 0&&(F(S,``),i.maxOutputTokens=void 0),!E(T)&&r.model.inputTypes!==void 0&&(i.inputTypes=void 0),!E(D)&&r.model.outputTypes!==void 0&&(i.outputTypes=void 0)):(t!==E(L)&&(F(w,!1),F(O,!1),F(A,!1),F(T,!1),F(D,!1),F(j,!1),F(L,t,!0)),E(w)||(F(v,n.name??Hz(n.id),!0),i.name=E(v)),E(O)||(n.contextWindow===void 0?r.model.contextWindow!==void 0&&(F(b,``),i.contextWindow=void 0):(F(b,Uz(n.contextWindow),!0),i.contextWindow=n.contextWindow)),E(A)||(n.maxOutputTokens===void 0?r.model.maxOutputTokens!==void 0&&(F(S,``),i.maxOutputTokens=void 0):(F(S,Uz(n.maxOutputTokens),!0),i.maxOutputTokens=n.maxOutputTokens)),E(T)||(i.inputTypes=n.inputTypes??(n.image?[`text`,`image`]:[`text`])),E(D)||(i.outputTypes=[`text`]),!E(j)&&r.model.efforts===void 0&&(i.efforts=[...Yz])),ue(i)}function pe(e){F(v,e,!0),F(w,!0),ue(e.trim().length>0?{name:e.trim()}:{name:void 0})}function me(e){let t=E(e===`contextWindow`?b:S).trim(),n=t=>{F(e===`contextWindow`?ee:te,t,!0)};if(t.length===0){n(!1),ue(e===`contextWindow`?{contextWindow:void 0}:{maxOutputTokens:void 0});return}let r=vt(t);if(r===null){n(!0);return}n(!1),e===`contextWindow`?(F(b,Uz(r),!0),F(O,!0)):(F(S,Uz(r),!0),F(A,!0)),ue(e===`contextWindow`?{contextWindow:r}:{maxOutputTokens:r})}function he(e){F(T,!0);let t=new Set(E(ae));t.has(e)?t.delete(e):t.add(e),t.add(`text`),ue({inputTypes:[`text`,...m.filter(e=>t.has(e))]})}let ge=I(()=>new Set(r.model.outputTypes??[`text`]));function Y(e){F(D,!0);let t=new Set(E(ge));t.has(e)?t.delete(e):t.add(e),t.add(`text`),ue({outputTypes:[`text`,`image`].filter(e=>t.has(e))})}async function _e(){if(E(N)||!E(ie)||!E(p)&&!r.apiKeyConfigured&&E(U).length===0)return;let e=E(p)?s().trim():r.apiKeyConfigured?null:E(U);F(N,!0),F(P,null);let t=await Ze({api:r.api,baseURL:r.baseURL,modelId:E(_).trim(),...e===null?o().length>0?{provider:o()}:{}:{apiKey:e}});F(N,!1),t!==null&&F(P,t,!0)}var ve=oB(),ye=W(ve),be=W(ye),xe=W(be),Se=e=>{var t=$z();y(e,t)};h(xe,e=>{d()&&e(Se)});var Ce=z(xe,2),X=M(Ce,!0),we=z(Ce,2),Te=e=>{var t=eB(),r=W(t),i=e=>{var t=C(`testing…`);y(e,t)},a=e=>{var t=C();H(()=>c(t,`ok · ${E(P).latencyMs??``} ms`)),y(e,t)},o=e=>{var t=C();H(()=>c(t,`failed · ${E(P).detail??``}`)),y(e,t)};h(r,e=>{E(N)?e(i):E(P)?.outcome===`ok`?e(a,1):E(P)?.outcome===`failed`&&e(o,2)}),n(t),H(()=>J(t,1,`min-w-0 shrink-0 truncate text-[10px] ${E(P)?.outcome===`ok`?`text-primary`:E(P)?.outcome===`failed`?`text-destructive`:`text-muted-foreground`}`)),y(e,t)};h(we,e=>{E(re)||e(Te)}),n(be);var Ee=z(be,2),De=W(Ee);lz(W(De),{class:`h-4 w-4`,"aria-hidden":`true`}),n(De);var Oe=z(De,2);yz(W(Oe),{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe);var ke=z(Oe,2),Ae=W(ke);Cn(Ae,{class:`h-4 w-4`,"aria-hidden":`true`}),n(ke),n(Ee),n(ye);var je=z(ye,2),Me=e=>{var i=aB(),a=q(i),o=W(a),s=z(W(o),2);zn(s,{class:`h-8 font-mono text-xs`,"aria-label":`Model id`,placeholder:`glm-5.3-flash`,get list(){return g},get disabled(){return u()},oninput:e=>K(e.currentTarget.value),get value(){return E(_)},set value(e){F(_,e,!0)}});var d=z(s,2);t(d,21,()=>r.candidates.slice(0,200),e=>e.id,(e,t)=>{var n=tB(),r=M(n,!0),i={};H(()=>{c(r,E(t).name??``),i!==(i=E(t).id)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(d),n(o);var f=z(o,2),x=z(W(f),2);{let e=I(()=>Hz(E(_).trim()||r.model.id));zn(x,{class:`h-8 text-xs`,"aria-label":`Model name`,get placeholder(){return E(e)},get disabled(){return u()},oninput:e=>pe(e.currentTarget.value),get value(){return E(v)},set value(e){F(v,e,!0)}})}n(f),n(a);var w=z(a,2),T=z(W(w),2);{let e=I(()=>r.model.efforts??[]),t=I(()=>E(ce).candidates.map(e=>({id:e})));Vz(T,{get selected(){return E(e)},get candidates(){return E(t)},placeholder:`Add effort (e.g. low)…`,get disabled(){return u()},onchange:e=>{F(j,!0),ue(e.length>0?{efforts:e}:{efforts:void 0})}})}var D=z(T,2),O=e=>{var t=nB(),n=M(t,!0);H(()=>c(n,E(ce).hint)),y(e,t)};h(D,e=>{E(ce).hint!==null&&e(O)}),n(w);var k=z(w,2),A=W(k),L=z(W(A),2);{let e=I(()=>E(ee)?`border-destructive focus-visible:ring-destructive`:``);zn(L,{get class(){return`h-8 text-xs ${E(e)??``}`},"aria-label":`Context window (tokens)`,placeholder:`200k / 0.5M / 131072`,get disabled(){return u()},onblur:()=>me(`contextWindow`),onkeydown:e=>{e.key===`Enter`&&me(`contextWindow`)},get value(){return E(b)},set value(e){F(b,e,!0)}})}n(A);var re=z(A,2),ie=z(W(re),2);{let e=I(()=>E(te)?`border-destructive focus-visible:ring-destructive`:``);zn(ie,{get class(){return`h-8 text-xs ${E(e)??``}`},"aria-label":`Max output tokens`,placeholder:`32k / 131072`,get disabled(){return u()},onblur:()=>me(`maxOutputTokens`),onkeydown:e=>{e.key===`Enter`&&me(`maxOutputTokens`)},get value(){return E(S)},set value(e){F(S,e,!0)}})}n(re),n(k);var R=z(k,2),se=e=>{var t=rB();y(e,t)};h(R,e=>{(E(ee)||E(te))&&e(se)});var V=z(R,2),U=W(V),le=z(W(U),4);t(le,16,()=>m,e=>e,(e,t)=>{var n=iB(),r=M(n,!0);H((e,i)=>{J(n,1,`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${e??``}`),B(n,`aria-pressed`,i),n.disabled=u(),c(r,t)},[()=>E(ae).has(t)?`border-primary bg-primary text-primary-foreground`:`border-border bg-background text-muted-foreground hover:bg-muted`,()=>E(ae).has(t)]),l(`click`,n,()=>he(t)),y(e,n)}),n(U);var de=z(U,2),fe=z(W(de),4);n(de),n(V);var ve=z(V,2),ye=W(ve),be=W(ye),xe=e=>{var t=C();H(()=>c(t,`ok · ${E(P).latencyMs??``} ms`)),y(e,t)},Se=e=>{var t=C();H(()=>c(t,`failed · ${E(P).detail??``}`)),y(e,t)},Ce=e=>{var t=C(`Probing with the route key above (saved on add).`);y(e,t)},X=e=>{var t=C(`No saved key for this route — paste one to test (never stored).`);y(e,t)},we=e=>{var t=C(`Probe this endpoint with a minimal request.`);y(e,t)};h(be,e=>{E(P)?.outcome===`ok`?e(xe):E(P)?.outcome===`failed`?e(Se,1):E(p)?e(Ce,2):r.apiKeyConfigured?e(we,-1):e(X,3)}),n(ye);var Te=z(ye,2),Ee=W(Te),De=e=>{zn(e,{type:`password`,class:`h-6 w-44 font-mono text-[10px]`,"aria-label":`API key (test only)`,placeholder:`API key (test only)`,autocomplete:`off`,get disabled(){return u()},get value(){return E(ne)},set value(e){F(ne,e,!0)}})};h(Ee,e=>{!r.apiKeyConfigured&&!E(p)&&e(De)});var Oe=z(Ee,2);{let e=I(()=>E(p)?`Send a minimal probe with the route key above (saved on add)`:r.apiKeyConfigured?`Send a minimal probe request`:`Send a minimal probe with the pasted key (not saved)`);An(Oe,{size:`sm`,variant:`outline`,class:`h-6 shrink-0 px-2 text-[10px]`,get disabled(){return E(G)},get title(){return E(e)},onclick:()=>void _e(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(N)?`Testing…`:`Test connection`)),y(e,n)},$$slots:{default:!0}})}n(Te),n(ve),H((e,t)=>{B(d,`id`,g),J(fe,1,`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${e??``}`),B(fe,`aria-pressed`,t),fe.disabled=u(),J(ye,1,`min-w-0 truncate text-[10px] ${E(P)?.outcome===`ok`?`text-primary`:E(P)?.outcome===`failed`?`text-destructive`:`text-muted-foreground`}`)},[()=>E(ge).has(`image`)?`border-primary bg-primary text-primary-foreground`:`border-border bg-background text-muted-foreground hover:bg-muted`,()=>E(ge).has(`image`)]),l(`click`,fe,()=>Y(`image`)),y(e,i)};h(je,e=>{E(re)&&e(Me)}),n(ve),H(()=>{B(ve,`aria-label`,`Model ${r.model.id??``}`),B(Ce,`title`,r.model.id),c(X,E(le)),B(De,`aria-label`,`Test connection for ${(r.model.id||`new model`)??``}`),B(De,`title`,E(p)?`Send a minimal probe with the route key (saved on add)`:r.apiKeyConfigured?`Send a minimal probe request`:`Expand and paste a key to test (not saved)`),De.disabled=E(G),B(Oe,`aria-label`,`Edit model ${(r.model.id||`new model`)??``}`),B(Oe,`title`,E(re)?`Collapse model form`:`Edit model fields`),Oe.disabled=u(),B(ke,`aria-label`,`Remove model ${r.model.id??``}`),ke.disabled=u()}),l(`click`,De,()=>void _e()),l(`click`,Oe,()=>F(re,!E(re))),l(`click`,ke,()=>r.onremove()),y(e,ve),x()}T([`click`]);var cB=/^(.*)-(\d+)$/;function lB(e,t){let n=new Set(t.map(e=>e.provider));if(!n.has(e))return e;let r=1;for(let t of n){if(t===e)continue;let n=cB.exec(t);if(n===null||n[1]!==e)continue;let i=Number(n[2]);Number.isInteger(i)&&i>r&&(r=i)}return`${e}-${r+1}`}function uB(e){let t=cB.exec(e);if(t===null)return null;let n=Number(t[2]);return!Number.isInteger(n)||n<2?null:{base:t[1],n}}function dB(e,t){let n=uB(e.provider);if(n!==null){let e=t?.providers.find(e=>e.provider===n.base);if(e)return`${e.label} (${n.n-1})`}return t?.providers.find(t=>t.provider===e.provider)?.label??e.provider}var fB=`skill-creator.providerPresets.v1`,pB=ut({provider:dt().min(1),label:dt().min(1),api:dt().min(1).optional(),baseURL:dt().min(1),models:ct(dt().min(1)).min(1),icon:dt().min(1).optional(),iconLetter:dt().min(1).max(2).optional(),iconColor:dt().min(1).optional(),iconSuppressed:Ot().optional()}),mB=fe({list:[]});function hB(){if(typeof localStorage>`u`)return[];let e=null;try{e=localStorage.getItem(fB)}catch{return[]}if(e===null)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=pB.safeParse(e);t.success&&n.push(t.data)}return n}function gB(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(fB,JSON.stringify(e))}catch{}}function _B(){return mB.list=hB(),mB.list}function vB(e){let t=mB.list.filter(t=>t.provider!==e);mB.list=t,gB(t)}var yB=r(`<p class="text-xs text-destructive" role="alert"> </p>`),bB=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),xB=r(`<p class="py-3 text-center text-[10px] text-muted-foreground"> </p>`),SB=r(`<img alt="" class="h-7 w-7 shrink-0 rounded-md bg-background object-contain p-0.5 dark:invert"/>`),CB=r(`<span class="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[11px] font-semibold text-white" aria-hidden="true"> </span>`),wB=r(`<div class="group relative"><button type="button" class="flex w-full items-center gap-2 rounded-md border border-border p-2 text-left transition-colors hover:border-primary/50 hover:bg-primary/5"><!> <span class="min-w-0 flex-1"><span class="block truncate text-xs font-medium"> </span> <span class="block truncate text-[10px] text-muted-foreground"> </span></span> <span class="mr-0.5 shrink-0 rounded bg-muted px-1 text-[9px] text-muted-foreground"> </span></button> <button type="button" class="absolute right-1 top-1 hidden rounded bg-popover/80 p-0.5 text-muted-foreground hover:text-destructive group-hover:block">×</button></div>`),TB=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground">Your presets</span> <div class="grid grid-cols-1 gap-1.5 min-[520px]:grid-cols-2"></div></div>`),EB=r(`<span class="rounded bg-primary/10 px-1 text-[9px] text-primary"> </span>`),DB=r(`<button type="button" class="flex w-full items-center gap-2 rounded-md border border-border p-2 text-left transition-colors hover:border-primary/50 hover:bg-primary/5"><!> <span class="min-w-0 flex-1"><span class="block truncate text-xs font-medium"> </span> <span class="block truncate text-[10px] text-muted-foreground"> </span></span> <span class="mr-0.5 flex shrink-0 items-center gap-1"><!> <span class="rounded bg-muted px-1 text-[9px] text-muted-foreground"> </span></span></button>`),OB=r(`<p class="col-span-full py-3 text-center text-[10px] text-muted-foreground"> </p>`),kB=r(`<div class="max-h-[52vh] space-y-2 overflow-y-auto pr-1"><!> <div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground"> </span> <div class="grid grid-cols-1 gap-1.5 min-[520px]:grid-cols-2"><!> <!></div></div></div>`),AB=r(`<div class="space-y-2"><div class="flex items-center gap-2"><!> <!> <!></div> <!> <!></div>`),jB=r(`<p class="text-[10px] text-amber-700" role="alert"> </p>`),MB=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs a name.</p>`),NB=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs an http(s) base URL.</p>`),PB=r(`<option> </option>`),FB=r(`<p class="rounded-md border border-dashed p-2 text-center text-[10px] text-muted-foreground">No models yet — add one to enable the route.</p>`),IB=r(`<div class="space-y-3"><div class="flex items-center gap-2"><!> <label class="min-w-0 flex-1 space-y-0.5"><span class="text-[10px] text-muted-foreground">Route name</span> <!></label></div> <!> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">Base URL</span> <!></label> <!> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API protocol</span> <select class="h-8 w-full rounded-md border border-border bg-background px-2 text-xs" aria-label="API protocol"></select></label> <div class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API key</span> <div class="relative"><!> <button type="button" class="absolute right-1.5 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-2.5 after:content-[''] hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button></div></div> <div class="space-y-1.5"><div class="flex items-center justify-between"><span class="text-[10px] font-medium text-muted-foreground">Models</span> <!></div> <!> <div class="space-y-1.5"></div></div> <!> <div class="flex items-center justify-between border-t border-border pt-2"><!> <!></div></div>`);function LB(e,r){i(r,!0);let a=k(r,`seed`,3,null),o=`anthropic-messages`,s=V(fe(r.initialMode)),u=V(``),d=V(fe(a()?.provider??``)),f=V(void 0),p=V(void 0),m=V(void 0),g=V(void 0),_=V(``),v=V(``),b=V(!1),S=I(()=>E(v).trim()),w=V(o),T=V(fe(a()?.models?a().models.map(e=>_e(e)):[])),O=V(fe(a()?.models?a().models.map(()=>!0):[])),A=V(!1),ee=V(!1),te=V(null),N=I(()=>Z.view),P=I(()=>E(N)?.settings.modelRoutes??[]),L=I(()=>(r.catalog?.providers??[]).flatMap(e=>e.icon?[{provider:e.provider,icon:e.icon}]:[])),ne=I(()=>E(d).trim()),re=I(()=>qz(r.catalog,uB(E(ne))?.base??E(ne))),R=I(()=>dB({provider:E(ne)},r.catalog)),ae=I(()=>PL({provider:E(ne),iconLetter:E(m)},E(R))),se=I(()=>E(p)??AL(E(ne)||`route`)),ce=I(()=>{if(E(g)===!0)return null;if(E(f)!==void 0)return E(f);let e=uB(E(ne))?.base??E(ne);return r.catalog?.providers.find(t=>t.provider===e)?.icon??null}),U=I(()=>[...E(P).flatMap(e=>e.models),...E(T)]),le=I(()=>E(ne).length>0&&E(P).some(e=>e.provider===E(ne))),G=I(()=>/^https?:\/\//.test(E(_).trim())),ue=I(()=>E(O).length===E(T).length&&E(O).every(e=>e)),K=I(()=>E(ne).length>0&&!E(le)&&E(G)&&E(T).length>0&&E(ue)&&!Z.updating),me=I(()=>E(N)?.providers.some(e=>e.provider===E(ne)&&e.configured)??!1),he=I(()=>{let e=E(u).trim().toLowerCase(),t=r.catalog?.providers??[];return e.length===0?t:t.filter(t=>t.label.toLowerCase().includes(e)||t.provider.toLowerCase().includes(e)||t.baseURL.toLowerCase().includes(e))}),J=I(()=>{let e=E(u).trim().toLowerCase();return e.length===0?mB.list:mB.list.filter(t=>t.label.toLowerCase().includes(e)||t.provider.toLowerCase().includes(e)||t.baseURL.toLowerCase().includes(e))});function ge(e){return E(P).filter(t=>t.provider===e||uB(t.provider)?.base===e).length}function _e(e){let t=uB(a()?.provider??``)?.base??a()?.provider??``,n=r.catalog?.providers.find(e=>e.provider===t)?.models.find(t=>t.id===e);return n===void 0?{id:e,efforts:[...Yz]}:Qz(n)}_B(),de(()=>{E(s)});function ve(){F(d,``),F(f,void 0),F(p,void 0),F(m,void 0),F(g,void 0),F(_,``),F(w,o),F(T,[],!0),F(O,[],!0),F(s,`form`),F(A,!1),F(ee,!1),F(te,null)}async function ye(e){let t=await ke({modelRoutes:[...E(P),e]});if(t){if(t.outcome===`rejected`){F(te,`${t.code}: ${t.detail}`);return}if(t.outcome===`error`){F(te,t.message,!0);return}r.onadded(e.provider)}}async function be(e){Z.updating||await ye({provider:lB(e.provider,E(P)),baseURL:e.baseURL,api:e.api,models:[...e.models].sort((e,t)=>Number(t.image)-Number(e.image)).slice(0,4).map(e=>Qz(e)),...e.icon?{icon:e.icon}:{}})}async function xe(e){Z.updating||await ye({provider:lB(e.provider,E(P)),baseURL:e.baseURL,api:e.api??o,models:e.models.map(e=>({id:e,efforts:[...Yz]})),...e.icon?{icon:e.icon}:{},...e.iconColor?{iconColor:e.iconColor}:{},...e.iconLetter?{iconLetter:e.iconLetter}:{},...e.iconSuppressed?{iconSuppressed:!0}:{}})}function Se(e,t){F(T,E(T).map((n,r)=>r===e?t:n),!0)}function Ce(e,t){E(O)[e]!==t&&F(O,E(O).map((n,r)=>r===e?t:n),!0)}function X(e){F(T,E(T).filter((t,n)=>n!==e),!0),F(O,E(O).filter((t,n)=>n!==e),!0)}function we(){F(T,[...E(T),{id:``,efforts:[...Yz]}],!0),F(O,[...E(O),!1],!0)}async function Te(){if(E(K)){if(E(S).length>0){let e=await Ie(E(ne),E(S));if(e==null||e.outcome===`rejected`){F(te,e==null?`Could not save the API key — connection unavailable. The route was not created.`:`${e.code}: ${e.detail}`,!0);return}}await ye({provider:E(ne),baseURL:E(_).trim(),api:E(w),models:E(T).map(e=>({...e})),...E(f)?{icon:E(f)}:{},...E(p)?{iconColor:E(p)}:{},...E(m)?{iconLetter:E(m)}:{},...E(g)?{iconSuppressed:!0}:{}})}}var Ee=Y(),De=q(Ee),Oe=e=>{var i=AB(),a=W(i),o=W(a);zn(o,{class:`h-8 flex-1 text-xs`,"aria-label":`Search providers`,placeholder:`Search providers…`,ref:null,get value(){return E(u)},set value(e){F(u,e,!0)}});var s=z(o,2),d=e=>{An(e,{size:`sm`,variant:`ghost`,class:`h-8 shrink-0 px-2 text-[11px]`,onclick:()=>r.onclose?.(),children:(e,t)=>{oe();var n=C(`Cancel`);y(e,n)},$$slots:{default:!0}})};h(s,e=>{E(P).length===0&&r.onclose&&e(d)});var f=z(s,2);An(f,{size:`sm`,variant:`ghost`,class:`h-8 shrink-0 px-2 text-[11px]`,onclick:ve,children:(e,t)=>{oe();var n=C(`Start from scratch →`);y(e,n)},$$slots:{default:!0}}),n(a);var p=z(a,2),m=e=>{var t=yB(),n=M(t,!0);H(()=>c(n,E(te))),y(e,t)};h(p,e=>{E(te)&&e(m)});var g=z(p,2),_=e=>{var t=bB(),n=M(t,!0);H(()=>c(n,r.catalogError)),y(e,t)},v=e=>{var t=xB(),n=M(t,!0);H(()=>c(n,r.catalogLoading?`Loading catalog…`:`Catalog unavailable.`)),y(e,t)},b=e=>{var i=kB(),a=W(i),o=e=>{var r=TB(),i=z(W(r),2);t(i,21,()=>E(J),e=>e.provider,(e,t)=>{var r=wB(),i=W(r),a=W(i),o=e=>{var n=SB();H(()=>B(n,`src`,E(t).icon)),y(e,n)},s=e=>{var n=CB(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>E(t).iconColor??AL(E(t).provider),()=>PL({provider:E(t).provider,iconLetter:E(t).iconLetter},E(t).label)]),y(e,n)};h(a,e=>{E(t).icon?e(o):e(s,-1)});var u=z(a,2),d=W(u),f=M(d,!0),p=z(d,2),m=M(p,!0);n(u);var g=z(u,2),_=M(g,!0);n(i);var v=z(i,2);n(r),H(e=>{B(i,`title`,E(t).baseURL),i.disabled=Z.updating,c(f,E(t).label),c(m,e),B(g,`title`,`${E(t).models.length??``} saved models`),c(_,E(t).models.length),B(v,`aria-label`,`Delete preset ${E(t).label??``}`)},[()=>E(t).baseURL.replace(/^https?:\/\//,``)]),l(`click`,i,()=>void xe(E(t))),l(`click`,v,()=>vB(E(t).provider)),y(e,r)}),n(i),n(r),y(e,r)};h(a,e=>{E(J).length>0&&e(o)});var s=z(a,2),d=W(s),f=M(d),p=z(d,2),m=W(p);t(m,17,()=>E(he),e=>e.provider,(e,t)=>{let r=I(()=>ge(E(t).provider)),i=I(()=>E(r)>0?`${E(t).baseURL} · ${E(t).api} · ${E(r)} copies added — click to add another`:`${E(t).baseURL} · ${E(t).api}`);var a=DB(),o=W(a),s=e=>{var n=SB();H(()=>B(n,`src`,E(t).icon)),y(e,n)},u=e=>{var n=CB(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>AL(E(t).provider),()=>E(t).label.slice(0,1).toUpperCase()]),y(e,n)};h(o,e=>{E(t).icon?e(s):e(u,-1)});var d=z(o,2),f=W(d),p=M(f,!0),m=z(f,2),g=M(m,!0);n(d);var _=z(d,2),v=W(_),b=e=>{var t=EB(),n=M(t);H(()=>{B(t,`title`,`${E(r)??``} cop${E(r)===1?`y`:`ies`} of this provider already added — you can add another`),c(n,`Added ✓${E(r)>1?` ×${E(r)}`:``}`)}),y(e,t)};h(v,e=>{E(r)>0&&e(b)});var x=z(v,2),S=M(x,!0);n(_),n(a),H(e=>{B(a,`title`,E(i)),a.disabled=Z.updating,c(p,E(t).label),c(g,e),B(x,`title`,`${E(t).models.length??``} models in catalog`),c(S,E(t).models.length)},[()=>E(t).baseURL.replace(/^https?:\/\//,``)]),l(`click`,a,()=>void be(E(t))),y(e,a)});var g=z(m,2),_=e=>{var t=OB(),n=M(t);H(()=>c(n,`No providers match “${E(u)??``}”.`)),y(e,t)};h(g,e=>{E(he).length===0&&e(_)}),n(p),n(s),n(i),H(()=>c(f,`Catalog (${r.catalog.providers.length??``} providers, from models.dev)`)),y(e,i)};h(g,e=>{r.catalogError?e(_):r.catalog===null?e(v,1):e(b,-1)}),n(i),y(e,i)},Ae=e=>{var r=IB(),i=W(r),a=W(i);{let e=I(()=>E(ne)||`route`);Fz(a,{get icon(){return E(ce)},get letter(){return E(ae)},get color(){return E(se)},get provider(){return E(e)},get label(){return E(R)},get catalogIcons(){return E(L)},get disabled(){return Z.updating},onPick:e=>{F(f,e,!0),F(g,void 0)},onSuppress:()=>F(g,!0),onColor:e=>F(p,e,!0),onLetter:e=>F(m,e,!0)})}var o=z(a,2),u=z(W(o),2);zn(u,{class:`h-8 text-xs`,"aria-label":`Route name`,placeholder:`my-provider`,get disabled(){return Z.updating},onblur:()=>F(ee,!0),get value(){return E(d)},set value(e){F(d,e,!0)}}),n(o),n(i);var x=z(i,2),O=e=>{var t=jB(),n=M(t);H(()=>c(n,`Route “${E(ne)??``}” already exists.`)),y(e,t)},k=e=>{var t=MB();y(e,t)};h(x,e=>{E(le)?e(O):E(ee)&&E(ne).length===0&&e(k,1)});var j=z(x,2),N=z(W(j),2);zn(N,{class:`h-8 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Z.updating},onblur:()=>F(A,!0),get value(){return E(_)},set value(e){F(_,e,!0)}}),n(j);var P=z(j,2),V=e=>{var t=NB();y(e,t)};h(P,e=>{E(A)&&!E(G)&&e(V)});var ue=z(P,2),de=z(W(ue),2);t(de,20,()=>Ct,e=>e,(e,t)=>{var n=PB(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(de),pe(de),n(ue);var q=z(ue,2),fe=z(W(q),2),he=W(fe);{let e=I(()=>E(b)?`text`:`password`),t=I(()=>E(me)?`stored — this key overrides for add & test`:`API key`);zn(he,{class:`h-8 pr-9 text-xs`,get type(){return E(e)},autocomplete:`off`,"aria-label":`API key`,get placeholder(){return E(t)},get disabled(){return Z.updating},get value(){return E(v)},set value(e){F(v,e,!0)}})}var J=z(he,2),ge=W(J),Y=e=>{_z(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},_e=e=>{Jn(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(ge,e=>{E(b)?e(Y):e(_e,-1)}),n(J),n(fe),n(q);var ve=z(q,2),ye=W(ve),be=z(W(ye),2);An(be,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Z.updating},onclick:we,children:(e,t)=>{oe();var n=C(`+ Add model`);y(e,n)},$$slots:{default:!0}}),n(ye);var xe=z(ye,2),Ee=e=>{var t=FB();y(e,t)};h(xe,e=>{E(T).length===0&&e(Ee)});var De=z(xe,2);t(De,21,()=>E(T),ie,(e,t,n)=>{{let r=I(()=>E(_).trim()),i=I(()=>E(t).id===``);sB(e,{get model(){return E(t)},get candidates(){return E(re)},get routeModels(){return E(U)},get api(){return E(w)},get baseURL(){return E(r)},get provider(){return E(ne)},get apiKeyConfigured(){return E(me)},get formKey(){return E(S)},get disabled(){return Z.updating},get initialExpanded(){return E(i)},onchange:e=>Se(n,e),onremove:()=>X(n),onvalidity:e=>Ce(n,e)})}}),n(De),n(ve);var Oe=z(ve,2),ke=e=>{var t=yB(),n=M(t,!0);H(()=>c(n,E(te))),y(e,t)};h(Oe,e=>{E(te)&&e(ke)});var Ae=z(Oe,2),je=W(Ae);An(je,{size:`sm`,variant:`ghost`,class:`h-7 px-2 text-xs`,onclick:()=>F(s,`pick`),children:(e,t)=>{oe();var n=C(`Back`);y(e,n)},$$slots:{default:!0}});var Me=z(je,2);{let e=I(()=>!E(K));An(Me,{size:`sm`,class:`h-7 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void Te(),children:(e,t)=>{oe();var n=C(`Create route`);y(e,n)},$$slots:{default:!0}})}n(Ae),n(r),H(()=>{de.disabled=Z.updating,B(J,`aria-label`,E(b)?`Hide API key`:`Show API key`),B(J,`aria-pressed`,E(b)),B(J,`title`,E(b)?`Hide API key`:`Show API key`),J.disabled=Z.updating}),D(de,()=>E(w),e=>F(w,e)),l(`mousedown`,J,e=>e.preventDefault()),l(`click`,J,()=>F(b,!E(b))),y(e,r)};h(De,e=>{E(s)===`pick`?e(Oe):e(Ae,-1)}),y(e,Ee),x()}T([`click`,`mousedown`]);var RB=r(`<option> </option>`),zB=r(`<p class="text-[11px] font-medium text-primary"> </p>`),BB=r(`<span class="text-[10px] text-amber-700">A route needs at least one model id.</span>`),VB=r(`<div><!></div>`),HB=r(`<p class="text-xs text-destructive" role="alert"> </p>`),UB=r(`<div class="space-y-3"><div class="flex items-start gap-2"><!> <div class="flex min-w-0 flex-1 items-center justify-between gap-2.5" data-route-titlebar="true"><div class="min-w-0"><p class="truncate text-sm font-semibold"> </p> <p class="mt-0.5 truncate text-[10px] text-muted-foreground"> </p></div> <div class="flex shrink-0 items-center gap-2.5"><button type="button" class="relative flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors after:absolute after:-inset-2 after:content-[''] hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none disabled:opacity-50" aria-label="Remove route" title="Remove route"><!></button> <!></div></div></div> <section class="space-y-1.5 rounded-md border border-border p-2" aria-label="Endpoint"><span class="text-[11px] font-medium text-muted-foreground">Endpoint</span> <div class="flex gap-1.5"><!></div> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API protocol</span> <select class="h-8 w-full rounded-md border border-border bg-background px-2 text-xs" aria-label="API protocol"></select></label></section> <section class="space-y-1.5 rounded-md border border-border p-2" aria-label="Credential"><!> <div class="flex gap-1.5"><div class="relative min-w-0 flex-1"><!> <button type="button" class="absolute right-1.5 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-2.5 after:content-[''] hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button></div> <!></div> <span class="text-[10px] text-muted-foreground">Stored locally (0600), shown as typed (password-masked), applies on blur/Enter.</span></section> <section class="space-y-1.5" aria-label="Models"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Models</span> <div class="flex items-center gap-1.5"><!> <!></div></div> <div class="space-y-1.5"></div></section> <!></div>`);function WB(e,r){i(r,!0);let a=k(r,`autoFocusCredential`,3,!1),o=`anthropic-messages`,s=I(()=>Z.view),u=I(()=>E(s)?.settings.modelRoutes??[]),d=I(()=>E(u).flatMap(e=>e.models.map(e=>({id:e.id,efforts:e.efforts})))),f=I(()=>r.catalog?.providers.find(e=>e.provider===r.route.provider)),p=I(()=>(r.catalog?.providers??[]).flatMap(e=>e.icon?[{provider:e.provider,icon:e.icon}]:[])),m=I(()=>qz(r.catalog,uB(r.route.provider)?.base??r.route.provider)),g=I(()=>NL(r.route,E(f))),_=I(()=>dB(r.route,r.catalog)),b=I(()=>PL(r.route,E(_))),S=I(()=>FL(r.route)),w=I(()=>E(s)?.providers.some(e=>e.provider===r.route.provider&&e.configured)??!1),T=V(fe(r.route.baseURL)),O=V(fe(r.route.api??E(f)?.api??o)),A=V(fe(r.route.models.map(e=>({...e})))),j=V(fe(r.route.models.map(()=>!0))),ee=I(()=>E(s)?.providers.find(e=>e.provider===r.route.provider)?.apiKey??null),te=V(fe(E(ee)??``)),N=V(!1),P=V(fe(a())),L=V(null),ne=V(null),re=V(!1),R=null,ae=[],ce=I(()=>E(T).trim()!==r.route.baseURL||E(O)!==(r.route.api??E(f)?.api??o)),U=I(()=>JSON.stringify(E(A))!==JSON.stringify(r.route.models)),le=I(()=>E(j).every(e=>e)),G=I(()=>!(E(ce)||E(U))||!E(le)||E(A).length===0||Z.updating);de(()=>{a()&&E(L)!==null&&(E(L).focus(),r.onCredentialFocused?.())}),de(()=>()=>{R!==null&&clearTimeout(R)});async function ue(e){if(E(s)===null)return!1;let t=await ke({modelRoutes:E(u).map(t=>t.provider===r.route.provider?e:t)});return t?t.outcome===`rejected`?(F(ne,`${t.code}: ${t.detail}`),!1):t.outcome===`error`?(F(ne,t.message,!0),!1):(F(ne,null),!0):!1}async function K(e){await ue({...r.route,...e})}async function q(){let e=E(T).trim();if(!/^https?:\/\//.test(e)){F(ne,`Custom route needs an http(s) base URL.`);return}await ue({...r.route,baseURL:e,api:E(O),models:E(A).map(e=>({...e}))})&&(F(re,!0),R!==null&&clearTimeout(R),R=setTimeout(()=>F(re,!1),1500))}function me(e,t){F(A,E(A).map((n,r)=>r===e?t:n),!0)}function he(e,t){E(j)[e]!==t&&F(j,E(j).map((n,r)=>r===e?t:n),!0)}function J(e){F(A,E(A).filter((t,n)=>n!==e),!0),F(j,E(j).filter((t,n)=>n!==e),!0)}function ge(e){let t=E(A)[e],n=r.route.models[e];return t===void 0||n===void 0||JSON.stringify(t)!==JSON.stringify(n)}async function Y(){F(A,[...E(A),{id:``,efforts:[...Yz]}],!0),F(j,[...E(j),!1],!0),await v(),ae[ae.length-1]?.scrollIntoView({block:`nearest`,behavior:`smooth`})}async function _e(){let e=E(te).trim();if(e.length===0)return;let t=await Ie(r.route.provider,e);if(t){if(t.outcome===`rejected`){F(ne,`${t.code}: ${t.detail}`);return}F(ne,null),F(P,!1)}}async function ve(){await Je(r.route.provider),F(te,``)}var ye=UB(),be=W(ye),xe=W(be);Fz(xe,{get icon(){return E(g)},get letter(){return E(b)},get color(){return E(S)},get provider(){return r.route.provider},get label(){return E(_)},get catalogIcons(){return E(p)},get disabled(){return Z.updating},onPick:e=>void K({icon:e,iconSuppressed:!1}),onSuppress:()=>void K({icon:void 0,iconSuppressed:!0}),onColor:e=>void K({iconColor:e}),onLetter:e=>void K({iconLetter:e})});var Se=z(xe,2),Ce=W(Se),X=W(Ce),we=M(X,!0),Te=z(X,2),Ee=M(Te);n(Ce);var De=z(Ce,2),Oe=W(De),Ae=W(Oe);Cn(Ae,{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe);var je=z(Oe,2);An(je,{size:`sm`,class:`relative h-9 px-3 text-xs after:absolute after:-top-1 after:-bottom-1 after:left-0 after:right-0 after:content-['']`,"data-route-save":`true`,get disabled(){return E(G)},onclick:()=>void q(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(re)?`Saved ✓`:`Save`)),y(e,n)},$$slots:{default:!0}}),n(De),n(Se),n(be);var Me=z(be,2),Ne=z(W(Me),2),Pe=W(Ne);zn(Pe,{class:`h-8 flex-1 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Z.updating},get value(){return E(T)},set value(e){F(T,e,!0)}}),n(Ne);var Fe=z(Ne,2),Le=z(W(Fe),2);t(Le,20,()=>Ct,e=>e,(e,t)=>{var n=RB(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(Le),pe(Le),n(Fe),n(Me);var Re=z(Me,2),ze=W(Re),Be=e=>{var t=zB(),n=M(t);H(()=>c(n,`Route “${r.route.provider??``}” added — paste its API key to finish connecting.`)),y(e,t)};h(ze,e=>{E(P)&&e(Be)});var Ve=z(ze,2),He=W(Ve),Ue=W(He);{let e=I(()=>E(N)?`text`:`password`);zn(Ue,{class:`h-8 pr-9 font-mono text-xs`,get type(){return E(e)},autocomplete:`off`,"aria-label":`API key`,placeholder:`API key`,get disabled(){return Z.updating},onblur:()=>void _e(),onkeydown:e=>{e.key===`Enter`&&(e.preventDefault(),_e())},get ref(){return E(L)},set ref(e){F(L,e,!0)},get value(){return E(te)},set value(e){F(te,e,!0)}})}var We=z(Ue,2),Ge=W(We),Ke=e=>{_z(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},qe=e=>{Jn(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(Ge,e=>{E(N)?e(Ke):e(qe,-1)}),n(We),n(He);var Ye=z(He,2),Xe=e=>{An(e,{size:`sm`,variant:`outline`,class:`relative h-9 px-2.5 text-xs after:absolute after:-top-1 after:-bottom-1 after:left-0 after:right-0 after:content-['']`,get disabled(){return Z.updating},onclick:()=>void ve(),children:(e,t)=>{oe();var n=C(`Clear`);y(e,n)},$$slots:{default:!0}})};h(Ye,e=>{E(w)&&e(Xe)}),n(Ve),oe(2),n(Re);var Ze=z(Re,2),Qe=W(Ze),$e=z(W(Qe),2),et=W($e),tt=e=>{var t=BB();y(e,t)};h(et,e=>{E(A).length===0&&e(tt)});var nt=z(et,2);An(nt,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Z.updating},onclick:()=>void Y(),children:(e,t)=>{oe();var n=C(`+ Add model`);y(e,n)},$$slots:{default:!0}}),n($e),n(Qe);var rt=z(Qe,2);t(rt,21,()=>E(A),ie,(e,t,i)=>{var a=VB(),o=W(a);{let e=I(()=>E(T).trim()),n=I(()=>ge(i)),a=I(()=>E(t).id===``);sB(o,{get model(){return E(t)},get candidates(){return E(m)},get routeModels(){return E(d)},get api(){return E(O)},get baseURL(){return E(e)},get provider(){return r.route.provider},get apiKeyConfigured(){return E(w)},get disabled(){return Z.updating},get dirty(){return E(n)},get initialExpanded(){return E(a)},onchange:e=>me(i,e),onremove:()=>J(i),onvalidity:e=>he(i,e)})}n(a),se(a,(e,t)=>ae[t]=e,e=>ae?.[e],()=>[i]),y(e,a)}),n(rt),n(Ze);var it=z(Ze,2),at=e=>{var t=HB(),n=M(t,!0);H(()=>c(n,E(ne))),y(e,t)};h(it,e=>{E(ne)&&e(at)}),n(ye),H(e=>{B(X,`title`,`${E(_)??``} (${r.route.provider??``}) — route name keys the credential mapping; duplicate this route to rename it.`),c(we,E(_)),B(Te,`title`,r.route.baseURL),c(Ee,`${r.route.provider??``} · ${e??``} · ${r.route.models.length??``}
227
- ${r.route.models.length===1?`model`:`models`}`),Oe.disabled=Z.updating,Le.disabled=Z.updating,B(We,`aria-label`,E(N)?`Hide API key`:`Show API key`),B(We,`aria-pressed`,E(N)),B(We,`title`,E(N)?`Hide API key`:`Show API key`),We.disabled=Z.updating},[()=>r.route.baseURL.replace(/^https?:\/\//,``)]),l(`click`,Oe,()=>r.onremove?.()),D(Le,()=>E(O),e=>F(O,e)),l(`mousedown`,We,e=>e.preventDefault()),l(`click`,We,()=>F(N,!E(N))),y(e,ye),x()}T([`click`,`mousedown`]);var GB=r(`<button type="button" class="mt-0.5 shrink-0 rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] text-amber-700 transition-colors hover:bg-amber-500/25">active outside tabs</button>`),KB=r(`<p class="text-[10px] text-amber-700"> </p>`),qB=r(`<span class="absolute -right-1 -top-0.5 h-1 w-1 rounded-full bg-amber-500" title="API key missing"></span>`),JB=r(`<span class="relative inline-flex shrink-0"><span class="flex h-4 w-4 items-center justify-center rounded" aria-hidden="true"><img alt=""/></span> <!></span>`),YB=r(`<span class="relative inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> <!></span>`),XB=r(`<span class="rounded bg-primary/10 px-1 py-px text-[9px] font-medium leading-tight text-primary" title="Active model's route">active</span>`),ZB=r(`<button type="button" role="tab"><!> <span class="max-w-[120px] truncate"> </span> <!></button>`),QB=r(`<span class="pointer-events-none absolute inset-y-0 left-0 w-2 bg-gradient-to-r from-background to-transparent" aria-hidden="true"></span>`),$B=r(`<span class="pointer-events-none absolute inset-y-0 right-0 w-2 bg-gradient-to-l from-background to-transparent" aria-hidden="true"></span>`),eV=r(`<div class="flex flex-col items-center gap-2.5 rounded-md border border-dashed p-6 text-center"><p class="text-xs font-medium">Add your first model route</p> <p class="max-w-[320px] text-[10px] leading-snug text-muted-foreground">Pick a provider from the catalog (models.dev mirror) with its models, or point at any
228
- custom OpenAI/Anthropic-compatible endpoint.</p> <div class="mt-1 flex gap-2"><!> <!></div></div>`),tV=r(`<div class="flex items-stretch gap-1 border-b border-border"><div class="relative min-w-0 flex-1"><div class="tab-scroll flex h-9 items-stretch overflow-x-auto svelte-1bhnjqt" role="tablist" aria-label="Model routes"></div> <!> <!></div> <button type="button">+ New</button></div> <div class="min-h-0 flex-1 overflow-y-auto pr-0.5"><!></div>`,1),nV=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),rV=r(`<div class="text-xs text-muted-foreground">Model settings unavailable</div>`),iV=r(`<div class="text-xs text-destructive" role="alert"> </div>`),aV=r(`<div class="flex h-full min-h-0 flex-col space-y-3"><div class="flex items-start justify-between gap-2"><div><h3 class="text-sm font-medium">Model</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Changes apply immediately to your agent sessions — no restart needed.</p></div> <!></div> <!> <!> <!> <!></div> <!>`,1);function oV(e,r){i(r,!0);let a=V(null),o=V(!1),s=V(`pick`),u=V(null),d=V(0),m=V(null),g=V(null),_=V(!1),b=V(!1),S=V(null),w=V(null),T=V(null),D=V(!1),O=Et(mt),k=I(()=>Z.view),A=I(()=>E(k)?.settings.modelRoutes??[]),ee=I(()=>E(A).find(e=>e.provider===E(a))),te=I(()=>E(k)!==null&&!E(A).some(e=>e.provider===E(k).settings.model.provider));de(()=>{E(o)||(E(a)!==null&&!E(A).some(e=>e.provider===E(a))&&F(a,null),E(a)===null&&E(A).length>0&&F(a,E(A)[0].provider,!0))}),de(()=>{E(w)===null&&E(T)===null&&!E(D)&&N()});async function N(){let e=O.issue();F(D,!0);try{let t=St();if(!t){F(T,`daemon not connected`);return}let n=await t.agent.models.catalog({});if(!e.isCurrent())return;F(w,n,!0),F(T,null)}catch(t){if(!e.isCurrent())return;F(T,t instanceof Error?t.message:String(t),!0)}finally{e.isCurrent()&&F(D,!1)}}async function P(e){let t=await ke(e);return t?t.outcome===`rejected`?(F(S,`${t.code}: ${t.detail}`),!1):t.outcome===`error`?(F(S,t.message,!0),!1):(F(S,null),!0):!1}function L(e,t=null){F(u,t,!0),F(s,e,!0),F(d,E(d)+1),F(o,!0),F(a,null)}async function ne(e){F(o,!1),F(a,e,!0),F(m,e,!0),await v(),le[e]?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})}function re(){E(k)&&L(`form`,{provider:E(k).settings.model.provider,models:[E(k).settings.model.model]})}function ie(e){e&&(F(g,e,!0),F(_,!0))}async function R(){let e=E(g);if(e===null)return;F(b,!0);let t=await P({modelRoutes:E(A).filter(t=>t.provider!==e)});F(b,!1),t&&(F(_,!1),F(g,null))}let ae=V(null),ce=V(!1),U=V(!1),le=fe({});function G(){let e=E(ae);if(!e){F(ce,!1),F(U,!1);return}F(ce,e.scrollLeft>0),F(U,e.scrollLeft+e.clientWidth<e.scrollWidth-1)}de(()=>{let e=E(ae);if(!e)return;let t=t=>{Math.abs(t.deltaY)<=Math.abs(t.deltaX)||(e.scrollLeft+=t.deltaY,t.preventDefault())};e.addEventListener(`wheel`,t,{passive:!1});let n=new ResizeObserver(()=>G());return n.observe(e),G(),()=>{e.removeEventListener(`wheel`,t),n.disconnect()}}),de(()=>{E(A).length,E(w),G()});function ue(e,t){if(E(A).length!==0){if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=(t+(e.key===`ArrowLeft`?-1:1)+E(A).length)%E(A).length;le[E(A)[n].provider]?.focus()}else e.key===`Delete`&&(e.preventDefault(),ie(E(A)[t]?.provider))}}var K=aV(),pe=q(K),me=W(pe),he=z(W(me),2),ge=e=>{var t=GB();H(()=>B(t,`title`,`The active model (${E(k).settings.model.provider??``}) rides an env-provided route with no tab — click to add it as a route.`)),l(`click`,t,re),y(e,t)};h(he,e=>{E(te)&&E(k)&&e(ge)}),n(me);var _e=z(me,2),ve=e=>{var t=KB(),n=M(t);H(()=>c(n,`${E(k).settings.model.provider??``} · ${E(k).settings.model.model??``} (outside Routes) — env-provided; add
229
- it as a route to manage it here.`)),y(e,t)};h(_e,e=>{E(te)&&E(k)&&e(ve)});var ye=z(_e,2),be=e=>{var r=tV(),i=q(r),g=W(i),_=W(g);t(_,23,()=>E(A),e=>e.provider,(e,t,r)=>{let i=I(()=>E(w)?.providers.find(e=>e.provider===E(t).provider)),s=I(()=>NL(E(t),E(i))),u=I(()=>dB(E(t),E(w))),d=I(()=>PL(E(t),E(u))),f=I(()=>E(k).providers.some(e=>e.provider===E(t).provider&&e.configured)),p=I(()=>E(k).settings.model.provider===E(t).provider);var m=ZB(),g=W(m),_=e=>{var r=JB(),i=W(r),a=M(i),o=z(i,2),c=e=>{var t=qB();y(e,t)};h(o,e=>{E(f)||e(c)}),n(r),H((e,t)=>{j(i,`background: color-mix(in srgb, ${e??``} 18%, transparent)`),B(a,`src`,E(s)),J(a,1,`h-3.5 w-3.5 object-contain ${t??``}`)},[()=>FL(E(t)),()=>ML(E(s))?``:`dark:invert`]),y(e,r)},v=e=>{var r=YB(),i=W(r),a=z(i),o=e=>{var t=qB();y(e,t)};h(a,e=>{E(f)||e(o)}),n(r),H(e=>{j(r,`background: ${e??``}`),c(i,`${E(d)??``} `)},[()=>FL(E(t))]),y(e,r)};h(g,e=>{E(s)?e(_):e(v,-1)});var b=z(g,2),x=M(b,!0),S=z(b,2),C=e=>{var t=XB();y(e,t)};h(S,e=>{E(p)&&e(C)}),n(m),se(m,(e,t)=>le[t.provider]=e,e=>le?.[e.provider],()=>[E(t)]),H(()=>{B(m,`aria-selected`,!E(o)&&E(a)===E(t).provider),J(m,1,`relative flex h-9 shrink-0 items-center gap-1.5 px-2 text-xs font-medium transition-colors hover:bg-muted/50 ${!E(o)&&E(a)===E(t).provider?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),B(m,`title`,`${E(u)??``} (${E(t).provider??``})${E(p)?` · active route`:``}`),c(x,E(u))}),l(`click`,m,()=>{F(a,E(t).provider,!0),F(o,!1)}),l(`keydown`,m,e=>ue(e,E(r))),y(e,m)}),n(_),se(_,e=>F(ae,e),()=>E(ae));var v=z(_,2),b=e=>{var t=QB();y(e,t)};h(v,e=>{E(ce)&&e(b)});var x=z(v,2),S=e=>{var t=$B();y(e,t)};h(x,e=>{E(U)&&e(S)}),n(g);var O=z(g,2);n(i);var te=z(i,2),N=W(te),P=e=>{var t=Y(),n=q(t);p(n,()=>E(d),e=>{LB(e,{get catalog(){return E(w)},get catalogError(){return E(T)},get catalogLoading(){return E(D)},get initialMode(){return E(s)},get seed(){return E(u)},onadded:ne,onclose:()=>F(o,!1)})}),y(e,t)},re=e=>{var t=Y(),n=q(t);p(n,()=>E(ee).provider,e=>{{let t=I(()=>E(m)===E(ee).provider);WB(e,{get route(){return E(ee)},get catalog(){return E(w)},get autoFocusCredential(){return E(t)},onCredentialFocused:()=>F(m,null),onremove:()=>ie(E(ee)?.provider)})}}),y(e,t)},R=e=>{var t=eV(),r=z(W(t),4),i=W(r);An(i,{size:`sm`,variant:`outline`,class:`h-8 px-3 text-xs`,onclick:()=>L(`pick`),children:(e,t)=>{oe();var n=C(`Browse providers`);y(e,n)},$$slots:{default:!0}});var a=z(i,2);An(a,{size:`sm`,class:`h-8 px-3 text-xs`,onclick:()=>L(`form`),children:(e,t)=>{oe();var n=C(`Custom endpoint`);y(e,n)},$$slots:{default:!0}}),n(r),n(t),y(e,t)};h(N,e=>{E(o)?e(P):E(ee)?e(re,1):e(R,-1)}),n(te),H(()=>J(O,1,`h-7 shrink-0 self-center rounded px-2 text-[11px] font-medium transition-colors ${E(o)?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`)),f(`scroll`,_,G),l(`click`,O,()=>E(A).length===0?L(`form`):L(`pick`)),y(e,r)},xe=e=>{var t=nV();y(e,t)},Se=e=>{var t=rV();y(e,t)};h(ye,e=>{E(k)?e(be):Z.loading?e(xe,1):e(Se,-1)});var Ce=z(ye,2),X=e=>{var t=iV(),n=M(t,!0);H(()=>c(n,Z.error)),y(e,t)};h(Ce,e=>{Z.error&&e(X)});var we=z(Ce,2),Te=e=>{var t=iV(),n=M(t,!0);H(()=>c(n,E(S))),y(e,t)};h(we,e=>{E(S)&&e(Te)}),n(pe);var Ee=z(pe,2);{let e=I(()=>E(g)??``);_n(Ee,{title:`Remove route`,get description(){return`Remove the “${E(e)??``}” route? Its stored key is kept; if it held the active model, that reference is left outside Routes.`},get busy(){return E(b)},onConfirm:()=>void R(),get open(){return E(_)},set open(e){F(_,e,!0)}})}y(e,K),x()}T([`click`,`keydown`]);var sV=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),cV=r(`<p class="text-[10px] text-primary" role="status"> </p>`),lV=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),uV=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground"><span class="text-destructive" role="alert"> </span> <!></div>`),dV=r(`<p class="rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground">No sessions yet. Sessions you start from the agent panel are listed here and can be reviewed
230
- or removed individually.</p>`),fV=r(`<span class="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground" title="Kernel/steward session without a product transcript — managed by the kernel, not deletable here">kernel-only</span>`),pV=r(`<li class="flex items-center gap-2 rounded-md border border-border bg-background/60 px-2.5 py-1.5"><span class="min-w-0 flex-1 truncate text-xs"> </span> <span class="shrink-0 text-[10px] tabular-nums text-muted-foreground"> </span> <span class="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground"> </span> <span> </span> <!> <!></li>`),mV=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground"> </span> <ul class="space-y-1"></ul></div>`),hV=r(`<div class="text-xs text-destructive" role="alert"> </div>`),gV=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">Sessions</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Manage agent panel sessions and transcript retention.</p></div> <section class="space-y-1.5" aria-label="Cleanup policy"><span class="text-[11px] font-medium text-muted-foreground">Cleanup policy</span> <div class="flex items-end gap-1.5"><label class="flex-1 space-y-1"><span class="block text-[10px] text-muted-foreground">Delete transcripts older than (days)</span> <!></label> <!></div> <p class="text-[10px] text-muted-foreground">Sessions older than this are cleaned automatically when the daemon starts (default 30 days).
231
- Kernel-side session logs are not touched.</p> <!></section> <section class="space-y-1.5" aria-label="Session list"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Session list</span> <!></div> <!> <!></section> <!></div> <!>`,1);function _V(e,r){i(r,!0);let a=V(30),o=V(!1),s=V(!1),l=V(null),u=V(null),d=V(null),f=V(!1),p=V(!1),g=V(null),_=V(!1),v=!1;de(()=>{v||(v=!0,Pe())}),de(()=>{let e=Z.view?.settings.session.sessionCleanupDays;e!==void 0&&!E(o)&&F(a,e,!0)});let b=I(()=>{let e=[...Me.sessions].sort((e,t)=>e.createdAt<t.createdAt?1:-1),t=new Map;for(let n of e){let e=S(n.createdAt),r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.entries()]});function S(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown date`:`${String(t.getFullYear()).padStart(4,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function w(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function T(e){return _t.find(t=>t.id===e)?.label??e}function D(){let e=Number(E(a));return!Number.isInteger(e)||e<1||e>365?null:e}async function O(){let e=D();if(e===null){F(l,`Retention must be a whole number of days between 1 and 365.`);return}F(l,null),F(s,!0);try{let t=await ke({session:{sessionCleanupDays:e}});if(!t)return;t.outcome===`rejected`?F(u,`${t.code}: ${t.detail}`):t.outcome===`error`?F(u,t.message,!0):(F(u,null),F(o,!1))}finally{F(s,!1)}}async function k(){let e=D();if(e===null){F(l,`Retention must be a whole number of days between 1 and 365.`);return}F(l,null),F(f,!0),F(d,null);try{let t=await Ve({beforeDays:e});if(!t)return;if(`error`in t){F(u,t.error,!0);return}F(u,null),F(d,`Deleted ${t.deleted} session${t.deleted===1?``:`s`} · kept ${t.kept}`)}finally{F(f,!1)}}function A(e){F(g,e,!0),F(p,!0)}async function j(){let e=E(g);if(e){F(_,!0);try{let t=await Ve({sessionIds:[e.sessionId]});if(!t)return;if(`error`in t){F(u,t.error,!0);return}F(u,null),t.deleted===0&&F(u,`Session ${e.sessionId} was not removed (running or already gone).`),F(p,!1)}finally{F(_,!1)}}}var ee=gV(),te=q(ee),N=z(W(te),2),P=z(W(N),2),L=W(P),ne=z(W(L),2);zn(ne,{type:`number`,min:1,max:365,step:1,oninput:()=>F(o,!0),get disabled(){return E(s)},"aria-label":`Session retention days`,get value(){return E(a)},set value(e){F(a,e,!0)}}),n(L);var re=z(L,2);{let e=I(()=>E(s)||!E(o)||D()===null);An(re,{size:`sm`,class:`h-8 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void O(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(s)?`Saving…`:`Save`)),y(e,n)},$$slots:{default:!0}})}n(P);var ie=z(P,4),R=e=>{var t=sV(),n=M(t,!0);H(()=>c(n,E(l))),y(e,t)};h(ie,e=>{E(l)&&e(R)}),n(N);var ae=z(N,2),se=W(ae),ce=z(W(se),2);{let e=I(()=>E(f)||D()===null);An(ce,{size:`sm`,variant:`outline`,class:`h-7 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void k(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(f)?`Cleaning…`:`Clean now`)),y(e,n)},$$slots:{default:!0}})}n(se);var U=z(se,2),le=e=>{var t=cV(),n=M(t,!0);H(()=>c(n,E(d))),y(e,t)};h(U,e=>{E(d)&&e(le)});var G=z(U,2),ue=e=>{var t=lV();y(e,t)},K=e=>{var t=uV(),r=W(t),i=M(r,!0),a=z(r,2);An(a,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void Pe(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),H(()=>c(i,Me.error)),y(e,t)},fe=e=>{var t=dV();y(e,t)},pe=e=>{var r=Y(),i=q(r);t(i,17,()=>E(b),([e,t])=>e,(e,r)=>{var i=I(()=>m(E(r),2));let a=()=>E(i)[0],o=()=>E(i)[1];var s=mV(),l=W(s),u=M(l,!0),d=z(l,2);t(d,21,o,e=>e.sessionId,(e,t)=>{var r=pV(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0),l=z(o,2),u=M(l,!0),d=z(l,2),f=M(d,!0),p=z(d,2),m=e=>{var t=fV();y(e,t)};h(p,e=>{E(t).hasTranscript===!1&&e(m)});var g=z(p,2);{let e=I(()=>E(t).title||E(t).sessionId),n=I(()=>E(t).status===`running`?`Running sessions cannot be deleted`:E(t).hasTranscript===!1?`Kernel-only session — nothing to clean in the product layer`:`Delete session`),r=I(()=>E(t).status===`running`||E(t).hasTranscript===!1||E(_));An(g,{size:`icon`,variant:`ghost`,class:`h-6 w-6 shrink-0`,get"aria-label"(){return`Delete session ${E(e)??``}`},get title(){return E(n)},get disabled(){return E(r)},onclick:()=>A(E(t)),children:(e,t)=>{Cn(e,{class:`h-3.5 w-3.5`})},$$slots:{default:!0}})}n(r),H((e,n)=>{B(i,`title`,E(t).title||E(t).sessionId),c(a,E(t).title||`Untitled session`),c(s,e),c(u,n),J(d,1,`shrink-0 text-[10px] ${E(t).status===`running`?`text-primary`:`text-muted-foreground`}`),c(f,E(t).status)},[()=>w(E(t).createdAt),()=>T(E(t).mode)]),y(e,r)}),n(d),n(s),H(()=>c(u,a())),y(e,s)}),y(e,r)};h(G,e=>{Me.loading&&!Me.loaded?e(ue):Me.error?e(K,1):E(b).length===0?e(fe,2):e(pe,-1)}),n(ae);var me=z(ae,2),he=e=>{var t=hV(),n=M(t,!0);H(()=>c(n,E(u))),y(e,t)};h(me,e=>{E(u)&&e(he)}),n(te);var ge=z(te,2);{let e=I(()=>E(g)?.title||(E(g)?.sessionId??``));_n(ge,{title:`Delete session`,get description(){return`Delete the transcript of “${E(e)??``}”? This cannot be undone.`},get busy(){return E(_)},onConfirm:()=>void j(),get open(){return E(p)},set open(e){F(p,e,!0)}})}y(e,ee),x()}var vV=r(`<button><!> </button>`),yV=r(`<div class="flex h-full min-h-0 flex-col -m-4 p-4"><!></div>`),bV=r(`<div class="flex min-h-0 flex-col border-r border-border bg-muted/30"><!> <nav class="flex flex-col gap-0.5 p-2" aria-label="Settings sections"></nav></div> <div class="min-w-0 overflow-y-auto p-4"><!></div>`,1);function xV(e,r){i(r,!0);let o=[{id:`general`,label:`General`,icon:YR},{id:`model`,label:`Model`,icon:ZR},{id:`agent`,label:`Agent`,icon:$R},{id:`sessions`,label:`Sessions`,icon:Kn}],s=V(!1);de(()=>{dR.open=E(s)}),de(()=>{dR.open&&F(s,!0)}),de(()=>{E(s)&&Fe()});var u=Y(),d=q(u);a(d,()=>Sn,(e,r)=>{r(e,{get open(){return E(s)},set open(e){F(s,e,!0)},children:(e,r)=>{var i=Y(),s=q(i);a(s,()=>fn,(e,r)=>{r(e,{class:`grid h-[min(560px,85vh)] grid-cols-[176px_1fr] gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:(e,r)=>{var i=bV(),s=q(i),u=W(s);a(u,()=>vn,(e,t)=>{t(e,{class:`px-3 pt-2.5 pb-2 text-xs font-medium text-foreground`,children:(e,t)=>{oe();var n=C(`Settings`);y(e,n)},$$slots:{default:!0}})});var d=z(u,2);t(d,21,()=>o,e=>e.id,(e,t)=>{let r=I(()=>E(t).icon);var i=vV(),o=W(i);a(o,()=>E(r),(e,t)=>{t(e,{class:`h-3.5 w-3.5`})});var s=z(o);n(i),H(()=>{J(i,1,`flex h-8 items-center gap-2 rounded-md px-2 text-xs transition-colors ${dR.section===E(t).id?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`),B(i,`aria-current`,dR.section===E(t).id?`true`:void 0),c(s,` ${E(t).label??``}`)}),l(`click`,i,()=>dR.section=E(t).id),y(e,i)}),n(d),n(s);var f=z(s,2),p=W(f),m=e=>{hz(e,{})},g=e=>{var t=yV();oV(W(t),{}),n(t),y(e,t)},_=e=>{_V(e,{})},v=e=>{sz(e,{})};h(p,e=>{dR.section===`general`?e(m):dR.section===`model`?e(g,1):dR.section===`sessions`?e(_,2):e(v,-1)}),n(f),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,u),x()}T([`click`]);var SV=r(`<link rel="icon" href="/icons/monochrome-mini.png" type="image/png"/> <link rel="apple-touch-icon" href="/icons/monochrome-mini.png"/>`,1),CV=r(`<span class="px-1 text-xs font-medium text-muted-foreground">Skill Creator</span>`),wV=r(`<button class="no-drag flex h-6 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground max-[720px]:h-11 max-[720px]:w-11" aria-label="Open command palette" aria-keyshortcuts="Meta+K" title="Command palette (Cmd+K)"><!></button> <button class="no-drag flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground max-[720px]:h-11 max-[720px]:w-11" aria-label="Reload app" title="Reload"><!></button> <button aria-label="Toggle agent panel" title="Agent panel"><!></button>`,1),TV=r(`<div class="flex min-h-8 items-center border-y border-destructive/30 bg-destructive/8 px-3 text-xs text-destructive" role="status"> </div>`),EV=r(`<button><!></button>`),DV=r(`<div class="relative flex h-screen w-screen flex-col overflow-hidden bg-background text-foreground"><!> <!> <div class="flex min-h-0 flex-1"><nav class="flex w-14 shrink-0 flex-col items-center gap-1 border-r border-border bg-muted/30 py-3"><!> <div class="my-1 h-px w-8 bg-border"></div> <button class="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" title="Import workspace" aria-label="Import workspace"><!></button> <button title="Settings" aria-label="Settings"><!></button></nav> <main class="min-w-0 flex-1 overflow-hidden"><!> <!></main> <div><!></div></div></div>`),OV=r(`<!> <!> <!> <!> <!>`,1);function kV(e,r){i(r,!0),ue(()=>(gt(),ye.url.pathname===`/`&&_e(`/workspaces`,{replaceState:!0}),rt({navigate(e,t){t===`REPLACE`?_e(e,{replaceState:!0,keepFocus:!0,noScroll:!0}):_e(e)}}),xt(),yt));let o=I(()=>ye.url.pathname);de(()=>{E(o).startsWith(`/creator`)?Dc(Ec):Dc(Tc)});let s=I(()=>wt.status===`connected`);de(()=>{E(s)&&Mt()});let u=I(()=>et.list()),d=I(()=>nt(ye.url.pathname)?.app??null);function f(e){_e(`/${e}`)}var p=OV();S(`12qhfyh`,e=>{var t=SV();oe(2),y(e,t)});var m=q(p);Cc(m,{children:(e,i)=>{var o=DV(),s=W(o);nr(s,{variant:`main`,left:e=>{var t=CV();y(e,t)},right:e=>{var t=wV(),r=q(t);kc(W(r),{class:`h-3.5 w-3.5`}),n(r);var i=z(r,2),a=W(i);Wn(a,{class:`h-3.5 w-3.5`}),n(i);var o=z(i,2),s=W(o);xe(s,{class:`h-3.5 w-3.5`}),n(o),H(()=>{J(o,1,`no-drag flex h-6 w-6 items-center justify-center rounded transition-colors ${Ue.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`} max-[720px]:h-11 max-[720px]:w-11`),B(o,`aria-pressed`,Ue.open)}),l(`pointerdown`,r,e=>e.stopPropagation()),l(`click`,r,()=>globalThis.dispatchEvent(new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0}))),l(`pointerdown`,i,e=>e.stopPropagation()),l(`click`,i,()=>globalThis.location.reload()),l(`pointerdown`,o,e=>e.stopPropagation()),l(`click`,o,()=>je(!Ue.open)),y(e,t)},$$slots:{left:!0,right:!0}});var p=z(s,2),m=e=>{var t=TV(),n=M(t,!0);H(()=>c(n,wt.error)),y(e,t)};h(p,e=>{wt.status===`disconnected`&&e(m)});var g=z(p,2),v=W(g),b=W(v);t(b,17,()=>E(u),e=>e.id,(e,t)=>{let r=I(()=>E(t).icon);var i=EV(),o=W(i);a(o,()=>E(r),(e,t)=>{t(e,{class:`h-5 w-5`})}),n(i),H(()=>{J(i,1,`flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-muted ${E(d)===E(t).id?`bg-primary/10 text-primary`:`text-muted-foreground`}`),B(i,`title`,E(t).name),B(i,`aria-label`,E(t).name),B(i,`aria-current`,E(d)===E(t).id?`page`:void 0)}),l(`click`,i,()=>f(E(t).id)),y(e,i)});var x=z(b,4),S=W(x);ze(S,{class:`h-5 w-5`}),n(x);var C=z(x,2);jc(W(C),{class:`h-5 w-5`}),n(C),n(v);var w=z(v,2),T=W(w);at(T,{});var D=z(T,2);_(D,()=>r.children??R),n(w);var O=z(w,2);qR(W(O),{}),n(O),n(g),n(o),H(()=>{J(C,1,`mt-auto flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-muted ${dR.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`}`),B(C,`aria-pressed`,dR.open),J(O,1,`agent-panel-layer shrink-0 max-[720px]:absolute max-[720px]:inset-0 max-[720px]:z-40 ${Ue.open?``:`pointer-events-none`}`)}),l(`click`,x,()=>Oe()),l(`click`,C,()=>fR()),y(e,o)},$$slots:{default:!0}});var g=z(m,2);As(g,{});var v=z(g,2);xV(v,{});var b=z(v,2);_c(b,{}),xc(z(b,2),{}),y(e,p),x()}T([`pointerdown`,`click`]);export{kV as component,Yn as universal};
220
+ `)}function FI(e,t){return!t||t<=0?e():new Promise((n,r)=>{let i=!1,a=globalThis.setTimeout(()=>{i||(i=!0,r(Error(`Operation timed out`)))},t);e().then(e=>{i||(i=!0,clearTimeout(a),n(e))}).catch(e=>{i||(i=!0,clearTimeout(a),r(e))})})}async function II(e,t,n,r){let i=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"] > code.language-infographic`));if(!i.length)return;let a=await MN();if(a&&r())for(let e of i){if(!r())return;let i=e.parentElement,o=e.textContent||``;if(!i||!o.trim())continue;let s=i.cloneNode(!0),c=qI(`infographic`,`Infographic`,o,!0,n,{showHeader:n.infographicProps?.showHeader!==!1});c.body.style.minHeight=`320px`,c.body.style.height=`360px`,i.replaceWith(c.wrapper);try{let e=new a({container:c.body,width:`100%`,height:`100%`});e.render(o);let n=null;typeof window<`u`&&typeof window.requestAnimationFrame==`function`&&(n=window.requestAnimationFrame(()=>{let e=c.body.scrollHeight;e>0&&(c.body.style.height=`${Math.min(Math.max(e,260),720)}px`)})),t.push(()=>{var t;n!=null&&typeof window<`u`&&window.cancelAnimationFrame(n),(t=e.destroy)==null||t.call(e),c.wrapper.isConnected&&c.wrapper.replaceWith(s.cloneNode(!0))}),c.wrapper.dataset.markstreamInfographic=`1`}catch{c.wrapper.replaceWith(s)}}}async function LI(e,t,n,r){let i=await RM();if(!i||!r())return;let a=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"] > code.language-d2, pre[data-markstream-code-block="1"] > code.language-d2lang`));for(let e of a){if(!r())return;let a=e.parentElement,o=e.textContent||``;if(!a||!o.trim())continue;let s=a.cloneNode(!0),c=qI(`d2`,`D2`,o,!0,n,{showHeader:n.d2Props?.showHeader!==!1});a.replaceWith(c.wrapper);try{let e=zI(i);if(!e||typeof e.compile!=`function`||typeof e.render!=`function`)throw TypeError(`D2 instance is missing compile/render methods.`);let a=await e.compile(o),l=a?.diagram??a,u=a?.renderOptions??a?.options??{},d=n.d2ThemeId??u.themeID,f=n.d2DarkThemeId??u.darkThemeID,p={...u};if(p.themeID=n.isDark&&f!=null?f:d,p.darkThemeID=null,p.darkThemeOverrides=null,n.isDark){let e=u.themeOverrides&&typeof u.themeOverrides==`object`?u.themeOverrides:null;p.themeOverrides={...yI,...e||{}}}let m=await e.render(l,p);if(!r())return;let h=WM(GM(m));if(!h)throw Error(`D2 render returned empty output.`);c.body.innerHTML=h,c.wrapper.dataset.markstreamD2=`1`,t.push(()=>{c.wrapper.isConnected&&c.wrapper.replaceWith(s.cloneNode(!0))})}catch{c.wrapper.replaceWith(s)}}}async function RI(e,t,n,r){let i=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"]`)),a=n.codeBlockOptions?.overflow===`scroll`?`pre`:`pre-wrap`,o=n.codeBlockOptions?.maxHeight;for(let e of i){let t=e.querySelector(`code`);if(!t)continue;let n=BI(e,t).trim().toLowerCase();n!==`mermaid`&&n!==`infographic`&&n!==`d2`&&n!==`d2lang`&&(e.style.whiteSpace=a,typeof o==`number`&&(e.style.maxHeight=`${o}px`,e.style.overflow=`auto`))}let s=await Lj();if(s&&typeof s.createCodeBlockRuntime==`function`&&r())for(let e of i){if(!r())return;let i=e.querySelector(`code`);if(!i)continue;let a=BI(e,i),c=a.trim().toLowerCase();if(c===`mermaid`||c===`infographic`||c===`d2`||c===`d2lang`)continue;let l=i.textContent||``,u=e.dataset.markstreamDiff===`1`,d=KI(e.dataset.markstreamOriginal),f=KI(e.dataset.markstreamUpdated),p=VI(a),m=qI(`code`,u?`Diff / ${p}`:`Code / ${p}`,l,!1,n,{showHeader:n.codeBlockProps?.showHeader!==!1});m.body.classList.add(`markstream-svelte-enhanced-block__body--code`);let h=HI(u&&f||l,u);m.body.style.minHeight=`${typeof o==`number`?Math.min(h,o):h}px`,typeof o==`number`&&(m.body.style.maxHeight=`${o}px`,m.body.style.overflow=`auto`);let g=e.cloneNode(!0),_=null,v=!1,y=()=>{var e;if(!v){v=!0;try{(e=_?.cleanupEditor)==null||e.call(_)}catch{}m.wrapper.parentNode&&m.wrapper.replaceWith(g.cloneNode(!0))}};e.replaceWith(m.wrapper);let b={...n.codeBlockOptions??{}};for(let e of[`maxHeight`,`padding`,`tabSize`,`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete b[e];let x=b.parseDiffOptions&&typeof b.parseDiffOptions==`object`?b.parseDiffOptions:{},S=u?{diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,...b,parseDiffOptions:{context:2,...x}}:b,C=n.codeBlockProps?.theme,w=[n.codeBlockProps?.darkTheme??n.codeBlockProps?.themes?.[0]??n.codeBlockDarkTheme??n.themes?.[0]??`vitesse-dark`,n.codeBlockProps?.lightTheme??n.codeBlockProps?.themes?.[1]??n.codeBlockLightTheme??n.themes?.[1]??`vitesse-light`],T=typeof C==`string`?C:C&&typeof C==`object`?n.isDark?C.dark:C.light:n.isDark?n.codeBlockProps?.darkTheme??n.codeBlockProps?.themes?.[0]??n.codeBlockDarkTheme??n.themes?.[0]??`vitesse-dark`:n.codeBlockProps?.lightTheme??n.codeBlockProps?.themes?.[1]??n.codeBlockLightTheme??n.themes?.[1]??`vitesse-light`,E=typeof S.unsafeCSS==`string`?S.unsafeCSS:``,D=n.codeBlockProps?.showLineNumbers??n.codeBlockOptions?.disableLineNumbers!==!0,O=()=>{m.body.style.setProperty(`--diffs-tab-size`,String(n.codeBlockOptions?.tabSize??4)),typeof n.codeBlockOptions?.padding==`number`?m.body.style.setProperty(`--diffs-gap-block`,`${n.codeBlockOptions.padding}px`):m.body.style.removeProperty(`--diffs-gap-block`)};O(),_=s.createCodeBlockRuntime({overflow:`wrap`,...S,themes:w,theme:T,themeType:n.isDark?`dark`:`light`,disableLineNumbers:!D,MAX_HEIGHT:n.codeBlockOptions?.maxHeight??500,fontSize:n.codeBlockOptions?.fontSize??13,lineHeight:n.codeBlockOptions?.lineHeight,fontFamily:n.codeBlockOptions?.fontFamily,unsafeCSS:`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }
221
+ ${E}`.trim(),disableFileHeader:!0,stream:!1,onThemeChange:O}),t.push(y);try{if(u&&typeof _.createDiffEditor==`function`?await _.createDiffEditor(m.body,d,f||l,p):await _.createEditor?.call(_,m.body,l,p),!r()){y();return}if(await _.setTheme?.call(_,T),!r()){y();return}if(await GI(),!r()){y();return}if(!UI(m.body,l))throw Error(`Code editor rendered no visible code content.`);m.wrapper.dataset.markstreamEnhanced=`1`,u&&(m.wrapper.dataset.markstreamEnhancedDiff=`1`)}catch{y()}}}function zI(e){if(typeof e==`function`){let t=new e;if(t&&typeof t.compile==`function`)return t;if(typeof e.compile==`function`)return e}return e?.D2&&typeof e.D2==`function`?new e.D2:typeof e?.compile==`function`?e:null}function BI(e,t){let n=e.dataset.markstreamLanguage?.trim();if(n)return n;let r=Array.from(t.classList).find(e=>e.startsWith(`language-`));return r?r.slice(9):`plaintext`}function VI(e){let t=e.trim().toLowerCase();return bI[t]||t||`plaintext`}function HI(e,t){let n=Math.max(1,e.split(`
222
+ `).length);return Math.min(520,(t?180:96)+n*(t?20:18))}function UI(e,t){let n=e.querySelector([`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`));if(!n)return!1;let r=n.getBoundingClientRect();if(r.width<=0||r.height<=0)return!1;let i=t.split(`
223
+ `).find(e=>e.trim())?.trim();if(!i)return!0;let a=WI(e.textContent||``),o=WI(i);return a.includes(o)}function WI(e){return e.replace(/\s+/g,``)}async function GI(){typeof window>`u`||typeof window.requestAnimationFrame!=`function`||await new Promise(e=>window.requestAnimationFrame(()=>e()))}function KI(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`base64`).toString(`utf8`);if(typeof globalThis.atob==`function`&&typeof TextDecoder<`u`){let t=globalThis.atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder().decode(n)}return``}function qI(e,t,n,r,i,a={}){let o=document.createElement(`div`);if(o.className=`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--${e}`,a.showHeader!==!1){let e=document.createElement(`div`);e.className=`markstream-svelte-enhanced-block__header`;let r=document.createElement(`span`);r.className=`markstream-svelte-enhanced-block__badge`,r.textContent=t,e.appendChild(r),e.appendChild(JI(n,i)),o.appendChild(e)}let s=document.createElement(`div`);if(s.className=`markstream-svelte-enhanced-block__body`,o.appendChild(s),r){let e=document.createElement(`details`);e.className=`markstream-svelte-enhanced-block__details`;let t=document.createElement(`summary`);t.textContent=`Source`,e.appendChild(t);let r=document.createElement(`pre`);r.className=`markstream-svelte-enhanced-block__source`;let i=document.createElement(`code`);i.textContent=n,r.appendChild(i),e.appendChild(r),o.appendChild(e)}return{wrapper:o,body:s}}function JI(e,t){let n=document.createElement(`div`);n.className=`markstream-svelte-enhanced-block__actions`;let r=document.createElement(`button`);return r.type=`button`,r.className=`markstream-svelte-enhanced-block__action`,r.textContent=`Copy`,t.showTooltips!==!1&&(r.title=`Copy source`),r.addEventListener(`click`,()=>{var n;ZI(e),(n=t.onCopy)==null||n.call(t,e)}),n.appendChild(r),n}function YI(e,t,n){if(n.showTooltips===!1)return;let r=Array.from(e.querySelectorAll(`[data-markstream-tooltip], [title]`));if(r.length!==0)for(let e of r){if(e.matches(`.footnote-link, .footnote-anchor`))continue;let r=e.getAttribute(`title`),i=(e.dataset.markstreamTooltip||r||``).trim();if(!i)continue;r!=null&&e.removeAttribute(`title`);let a=()=>Jj(e,i,`top`,!1,void 0,n.isDark),o=()=>Yj();e.addEventListener(`mouseenter`,a),e.addEventListener(`focus`,a),e.addEventListener(`mouseleave`,o),e.addEventListener(`blur`,o),t.push(()=>{let t=e.getAttribute(`aria-describedby`)!=null;e.removeEventListener(`mouseenter`,a),e.removeEventListener(`focus`,a),e.removeEventListener(`mouseleave`,o),e.removeEventListener(`blur`,o),t&&Yj(!0),r!=null&&e.getAttribute(`title`)==null&&e.setAttribute(`title`,r)})}}function XI(e,t){let n=Array.from(e.querySelectorAll(`.footnote-reference .footnote-link[href^="#"]`));for(let e of n){let n=t=>{let n=e.getAttribute(`href`);n&&(t.preventDefault(),document.getElementById(n.slice(1))?.scrollIntoView({behavior:`smooth`,block:`start`}))};e.addEventListener(`click`,n),t.push(()=>e.removeEventListener(`click`,n))}}async function ZI(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}}catch{}if(typeof document>`u`)return;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch{}finally{t.remove()}}function QI(e={}){let t=typeof e==`function`?e():e,n=V(``),r=V(``),i=V(!1),a=V(0),o=V(!1),s=V(!1),c=cP(t),l=()=>{let e=c.getSnapshot();F(n,e.source,!0),F(r,e.visible,!0),F(i,e.done,!0),F(a,e.pendingChars,!0),F(o,e.caughtUp,!0),F(s,e.final,!0)},u=c.subscribe(l);return l(),ce(()=>{u(),c.destroy()}),{get source(){return E(n)},get visible(){return E(r)},get done(){return E(i)},get caughtUp(){return E(o)},get final(){return E(s)},get pendingChars(){return E(a)},enqueue:e=>c.enqueue(e),finish:e=>c.finish(e),flush:()=>c.flush(),reset:e=>c.reset(e),pause:()=>c.pause(),resume:()=>c.resume()}}var $I=`markstreamSmoothStreaming`,eL=r(`<div class="node-slot"><div><!></div></div>`),tL=r(`<span class="typewriter-cursor" aria-hidden="true"></span>`),nL=r(`<div><!> <!></div>`);function rL(e,r){i(r,!0);let a=k(r,`content`,3,``),o=k(r,`nodes`,3,null),s=k(r,`final`,3,void 0),c=k(r,`parseOptions`,3,void 0),u=k(r,`customMarkdownIt`,3,void 0),d=k(r,`debugPerformance`,3,!1),f=k(r,`customHtmlTags`,3,void 0),p=k(r,`htmlPolicy`,3,`safe`),m=k(r,`viewportPriority`,3,!0),g=k(r,`codeBlockStream`,3,!0),_=k(r,`codeBlockDarkTheme`,3,void 0),b=k(r,`codeBlockLightTheme`,3,void 0),S=k(r,`renderCodeBlocksAsPre`,3,!1),C=k(r,`codeBlockMinWidth`,3,void 0),w=k(r,`codeBlockMaxWidth`,3,void 0),T=k(r,`codeBlockOptions`,3,void 0),D=k(r,`codeBlockProps`,3,void 0),O=k(r,`mermaidProps`,3,void 0),A=k(r,`d2Props`,3,void 0),j=k(r,`infographicProps`,3,void 0),te=k(r,`customComponents`,3,void 0),M=k(r,`showTooltips`,3,!0),N=k(r,`themes`,3,void 0),P=k(r,`isDark`,3,!1),L=k(r,`customId`,3,void 0),ne=k(r,`indexKey`,3,void 0),ie=k(r,`typewriter`,3,!1),R=k(r,`fade`,3,!0),ae=k(r,`batchRendering`,3,!0),oe=k(r,`initialRenderBatchSize`,3,40),U=k(r,`renderBatchSize`,3,80),le=k(r,`renderBatchDelay`,3,16),G=k(r,`renderBatchBudgetMs`,3,6),K=k(r,`renderBatchIdleTimeoutMs`,3,120),q=k(r,`deferNodesUntilVisible`,3,!0),J=k(r,`maxLiveNodes`,3,320),fe=k(r,`liveNodeBuffer`,3,60),pe=k(r,`allowHtml`,3,!0),he=k(r,`smoothStreaming`,3,`auto`),X=k(r,`smoothStreamingOptions`,3,void 0),ge=k(r,`className`,3,``),_e=k(r,`onCopy`,3,void 0),ve=k(r,`onHandleArtifactClick`,3,void 0),ye=k(r,`onClick`,3,void 0),be=k(r,`onMouseover`,3,void 0),xe=k(r,`onMouseout`,3,void 0),Z=V(null),Se=V(0),Ce=V(0),we=V(void 0),Te=V(void 0),Ee=0,De=null,Oe=V(0),ke=null,Ae=null,je=null,Me=0,Ne=new Map,Pe=V(!1),Fe=QI(()=>X()),Ie=I(()=>he()===!0||E(Pe)),Le=I(()=>Array.isArray(o())),Re=ee($I),ze=I(()=>he()===!1||E(Le)||he()!==!0&&Re?.()?!1:he()===!0||ie()===!0||(J()??0)<=0),Be=I(()=>E(Ie)&&E(ze));me($I,()=>E(Be));let Ve=I(()=>E(Be)?Fe.visible:a()??``),He=I(()=>a()??``),Ue=I(()=>E(Le)||Fe.source===E(He)),We=I(()=>{let e=c()??{};return s()??e.final}),Ge=I(()=>E(Be)&&E(We)!=null?!!(E(We)&&E(Ue)&&Fe.caughtUp):E(We));ue(()=>{F(Pe,!0)}),de(()=>{let e=a()??``;if(E(Le)){Fe.reset(``);return}if(!E(Be)){Fe.reset(e),E(We)&&Fe.finish({flush:!0});return}let t=Fe.source;e?e===t||(e.startsWith(t)?Fe.enqueue(e.slice(t.length)):Fe.reset(e)):Fe.reset(``),E(We)&&Fe.finish()});let Ke=I(()=>({content:E(Ve),nodes:o(),final:E(Ge),parseOptions:c(),customMarkdownIt:u(),debugPerformance:d(),customHtmlTags:f(),htmlPolicy:p(),viewportPriority:m(),codeBlockStream:g(),codeBlockDarkTheme:_(),codeBlockLightTheme:b(),renderCodeBlocksAsPre:S(),codeBlockMinWidth:C(),codeBlockMaxWidth:w(),codeBlockOptions:T(),codeBlockProps:D(),mermaidProps:O(),d2Props:A(),infographicProps:j(),customComponents:te(),showTooltips:M(),themes:N(),isDark:P(),customId:L(),indexKey:ne(),typewriter:ie(),fade:R(),batchRendering:ae(),initialRenderBatchSize:oe(),renderBatchSize:U(),renderBatchDelay:le(),renderBatchBudgetMs:G(),renderBatchIdleTimeoutMs:K(),deferNodesUntilVisible:q(),maxLiveNodes:J(),liveNodeBuffer:fe(),allowHtml:pe(),smoothStreaming:he(),smoothStreamingOptions:X()}));re(()=>{(E(we)!==E(Ve)||E(Te)!==o())&&(F(Ce,E(Ce)+1),F(we,E(Ve),!0),F(Te,o()))});let Q=I(()=>{let e=d()&&typeof performance<`u`?performance.now():0,t=hA(E(Ke));return d()&&typeof console<`u`&&typeof performance<`u`&&console.info(`[markstream-svelte][perf] parse(sync)`,{ms:Math.round(performance.now()-e),nodes:t.length,contentLength:E(Ve)?.length??0}),t}),qe=I(()=>{E(Se);let e=Tj(L()),t=te()?{...e,...te()}:e;return mA({...E(Ke),customComponents:t},{onCopy:_e(),onHandleArtifactClick:ve()},Ne,E(Ce))});de(()=>{E(Q).length,ae(),oe(),U(),le(),G(),K(),E(Ge),E(Oe),Xe()});let Je=I(()=>E(Q).slice(0,Math.min(E(Oe),E(Q).length)));de(()=>{E(Z),E(Ge),E(Q),E(Je),P(),S(),T(),D(),_(),b(),N(),O(),A(),j(),M(),_e(),$e()}),ue(()=>wj(()=>{F(Se,E(Se)+1)})),ce(()=>{Ee+=1,Qe(),De?.dispose(),De=null,SI(E(Z)),ut()});function Ye(e,t){let n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):t}function Xe(){let e=E(Q).length,t=Math.min(e,Ye(oe(),40));if(!(E(Ge)!==!1&&ae()!==!1&&e>t)){Qe(),E(Oe)!==e&&F(Oe,e,!0);return}(E(Oe)<=0||E(Oe)>e||E(Oe)<t)&&F(Oe,t,!0),Ze()}function Ze(){if(E(Oe)>=E(Q).length||ke||Ae!=null||je!=null)return;let e=++Me,t=Math.max(0,Number(le())||0),n=t=>{if(ke=null,Ae=null,je=null,e!==Me)return;let n=Ye(U(),80),r=Math.max(2,Ye(G(),6)),i=E(Oe);do if(i=Math.min(E(Q).length,i+n),!t||(typeof t.timeRemaining==`function`?t.timeRemaining():0)<=r*.5)break;while(i<E(Q).length);i!==E(Oe)&&F(Oe,i,!0)},r=typeof window<`u`?window.requestIdleCallback:void 0;if(r){je=r(n,{timeout:Math.max(0,Number(K())||120)});return}if(typeof window<`u`&&typeof window.requestAnimationFrame==`function`){Ae=window.requestAnimationFrame(()=>{Ae=null,t>0?ke=setTimeout(n,t):n()});return}ke=setTimeout(n,t)}function Qe(){Me+=1,ke&&=(clearTimeout(ke),null),Ae!=null&&typeof window<`u`&&(window.cancelAnimationFrame(Ae),Ae=null);let e=typeof window<`u`?window.cancelIdleCallback:void 0;je!=null&&(e?.(je),je=null)}async function $e(){if(!E(Z)||typeof window>`u`)return;let e=typeof E(Ge)==`boolean`?E(Ge):!et(E(Q));if(!e){Ee+=1,De?.dispose(),De=null;return}let t=++Ee;if(await v(),t!==Ee||!E(Z))return;De?.dispose();let n=await xI(E(Z),{final:e,isDark:P(),renderCodeBlocksAsPre:S(),codeBlockOptions:T(),codeBlockProps:D(),codeBlockDarkTheme:_(),codeBlockLightTheme:b(),themes:N(),mermaidProps:O(),d2Props:A(),infographicProps:j(),showTooltips:M(),onCopy:_e(),isCancelled:()=>t!==Ee});if(t!==Ee){n.dispose();return}De=n}function et(e){for(let t of e)if(t?.loading===!0||et(t?.children||[])||et(t?.items||[]))return!0;return!1}let tt=V(null),nt=V(!1),rt,it=0,at=new Set([`code_block`,`admonition`,`table`,`math_block`,`html_block`,`image`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return typeof t==`string`&&at.has(t)}function st(){let e=E(Q)[E(Q).length-1];return!ot(e)}function ct(e){if(!e||typeof e!=`object`)return 0;let t=e,n=t.raw??t.content??t.code;if(typeof n==`string`)return n.length;let r=t.children;if(Array.isArray(r))return r.reduce((e,t)=>e+ct(t),0);let i=t.items;return Array.isArray(i)?i.reduce((e,t)=>e+ct(t),0):0}function lt(){return o()?.length?o().reduce((e,t)=>e+ct(t),0):(a()??``).length}function ut(){rt&&=(clearTimeout(rt),void 0)}function dt(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.textContent??``).trim())return NodeFilter.FILTER_REJECT;let t=e.parentElement;return!t||t.closest(`.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),n=null,r=t.nextNode();for(;r;)n=r,r=t.nextNode();return n}function ft(){if(typeof window>`u`||!E(nt)||!E(Z)||!E(tt))return;let e=E(Z),t=E(tt),n=dt(e),r=e.getBoundingClientRect(),i=0,a=0,o=20;if(n?.textContent){let t=document.createRange(),s=n.textContent.length;t.setStart(n,Math.max(0,s-1)),t.setEnd(n,s);let c=typeof t.getClientRects==`function`?t.getClientRects():void 0,l=c?.[c.length-1]??n.parentElement?.getBoundingClientRect();l&&(i=l.right-r.left+e.scrollLeft,a=l.top-r.top+e.scrollTop,o=l.height||o),t.detach()}t.style.transform=`translate(${Math.max(0,i)}px, ${Math.max(0,a)}px)`,t.style.height=`${o}px`}de(()=>{if(E(Ve),o(),ie(),E(Q).length,E(Ge),typeof window>`u`||E(Le))return;if(E(Ge)){F(nt,!1),ut();return}let e=lt(),t=st();if(ie()===!1||!t||e<=it){(ie()===!1||!t)&&F(nt,!1),it=e;return}it=e,F(nt,!0),ut(),v().then(()=>{ft()}),rt=setTimeout(()=>{F(nt,!1)},3e3)}),de(()=>{E(nt)&&v().then(()=>{ft()})});function pt(e){e.target?.closest(`[data-node-index]`)&&be()?.(e)}function mt(e){e.target?.closest(`[data-node-index]`)&&xe()?.(e)}var ht=nL();let gt;var _t=W(ht);t(_t,19,()=>E(Je),(e,t)=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+t,(e,t,r)=>{var i=eL(),a=W(i);let o;var s=W(a);{let e=I(()=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+E(r));pI(s,{get node(){return E(t)},get context(){return E(qe)},get indexKey(){return E(e)}})}n(a),n(i),H((e,n)=>{B(i,`data-node-index`,E(r)),B(i,`data-node-type`,E(t)?.type),o=Y(a,1,`node-content`,null,o,{"fade-node":e,"typewriter-node":n}),B(a,`data-node-index`,E(r))},[()=>R()!==!1&&String(E(t)?.type||``)!==`code_block`,()=>R()!==!1&&String(E(t)?.type||``)!==`code_block`]),y(e,i)});var vt=z(_t,2),yt=e=>{var t=tL();se(t,e=>F(tt,e),()=>E(tt)),y(e,t)};h(vt,e=>{E(nt)&&e(yt)}),n(ht),se(ht,e=>F(Z,e),()=>E(Z)),H(()=>{gt=Y(ht,1,`markstream-svelte markdown-renderer ${ge()??``}`,null,gt,{dark:P()}),B(ht,`data-custom-id`,L())}),l(`click`,ht,function(...e){ye()?.apply(this,e)}),l(`mouseover`,ht,pt),l(`mouseout`,ht,mt),y(e,ht),x()}T([`click`,`mouseover`,`mouseout`]);var iL=r(`<button type="button"><span class="flex items-center gap-1 text-xs font-medium"> </span> <span class="mt-0.5 block text-[10px] leading-snug text-muted-foreground"> </span></button>`),aL=r(`<div class="flex h-full flex-col items-center justify-center gap-3 text-center"><p class="max-w-[280px] text-xs text-muted-foreground">Pick a way to work with your skill library:</p> <div class="w-full max-w-[300px] space-y-1.5"></div></div>`),oL=r(`<div class="flow-item flex h-6 items-center gap-2 text-xs uppercase tracking-wide text-muted-foreground"><span class="h-px flex-1 bg-border"></span> <span class="h-px flex-1 bg-border"></span></div>`),sL=r(`<span class="turn-pill"> </span>`),cL=r(`<div class="flow-item flex h-5 items-center gap-1.5"><!></div>`),lL=r(`<div class="flow-item flex h-6 items-center gap-2 text-xs text-muted-foreground" role="separator"><span class="h-px flex-1 bg-border"></span> <span class="rounded bg-muted px-1 text-[10px] uppercase">mode</span> <span class="h-px flex-1 bg-border"></span></div>`),uL=r(`<div class="flow-item px-1 text-[11px] text-muted-foreground"> </div>`),dL=r(`<div class="flow-item flex h-6 items-center gap-2 px-3 text-[10px] text-muted-foreground" role="note"><span class="h-px flex-1 bg-border"></span> <span class="rounded bg-muted px-1 text-[10px] uppercase">compact</span> <span class="truncate"> </span> <span class="h-px flex-1 bg-border"></span></div>`),fL=r(`<img alt="" class="h-16 w-16 rounded-xl border border-border object-cover"/>`),pL=r(`<div class="mb-1 flex flex-wrap justify-end gap-1"></div>`),mL=r(`<span class="flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px]"><!> <span class="max-w-40 truncate"> </span></span>`),hL=r(`<div class="bubble-user max-h-40 overflow-y-auto px-3.5 py-2 text-[13px] leading-5 whitespace-pre-wrap"> </div>`),gL=r(`<div class="flow-item group/msg ml-auto max-w-[85%]"><!> <!> <!> <div role="toolbar" aria-label="Message actions"><button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Copy" aria-label="Copy message"><!></button> <button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Edit &amp; resend — resends as a new message, keeps history" aria-label="Edit and resend — resends as a new message, keeps history"><!></button> <button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50" title="Resend — keeps history" aria-label="Resend message — keeps history"><!></button></div></div>`),_L=r(`<div class="mt-1 max-h-48 overflow-y-auto rounded-md px-2 pb-1 text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground"> </div>`),vL=r(`<div class="flow-item"><!> <!></div>`),yL=r(`<div class="flow-item group/msg max-w-full"><div class="ms-md msg-body max-w-full [&amp;_a]:text-primary svelte-1fhja6f"><!></div> <div role="toolbar" aria-label="Message actions"><button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Copy" aria-label="Copy message"><!></button></div></div>`),bL=r(`<div class="flow-item"><!></div>`),xL=r(`<div class="flow-item flex h-6 items-center" role="status"><span class="sweep rounded-md px-1 text-xs text-muted-foreground"> </span></div>`),SL=r(`<!> <!>`,1),CL=r(`<button type="button" class="absolute top-3 right-3 z-10 flex h-7 w-7 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-md transition-colors hover:text-foreground" title="Back to bottom" aria-label="Back to bottom"><!></button>`),wL=r(`<div class="relative min-h-0 flex-1"><div class="h-full overflow-y-auto px-4 py-3"><!></div> <!></div>`);function TL(e,r){i(r,!0);let a=V(null),o=V(J({})),s=V(null),u=V(!1),d=0;de(()=>{ze.items.length,ze.status;let e=E(a);if(!e)return;let t=()=>{let t=d-e.scrollTop-e.clientHeight<160;d=e.scrollHeight,(t||e.scrollHeight-e.scrollTop-e.clientHeight<160)&&(e.scrollTop=e.scrollHeight),F(u,e.scrollHeight-e.scrollTop-e.clientHeight>200)};t();let n=new ResizeObserver(t);for(let t of e.children)n.observe(t);return()=>n.disconnect()});let p=V(0);de(()=>{if(ze.status!==`running`){F(p,0);return}let e=()=>{let e=ze.turnStartedAt?Date.parse(ze.turnStartedAt):NaN;F(p,Number.isFinite(e)?Math.max(0,(Date.now()-e)/1e3):0,!0)};e();let t=setInterval(e,1e3);return()=>clearInterval(t)});async function m(e,t){try{await navigator.clipboard.writeText(e),F(s,t,!0),setTimeout(()=>{E(s)===t&&F(s,null)},1e3)}catch{Mn(`Copy failed — clipboard unavailable.`)}}function g(e){De(e),document.querySelector(`aside[aria-label="Agent panel"] textarea`)?.focus()}function _(e){ze.sending||Le(e)}let v=I(()=>{for(let e=ze.items.length-1;e>=0;e--){let t=ze.items[e];if(t?.kind===`user`)return t.seq}return null}),b=I(()=>{for(let e=ze.items.length-1;e>=0;e--){let t=ze.items[e];if(t?.kind===`assistant`)return t.seq}return null});function S(e,t){let n=e.trim();if(n.length===0)return``;let r=n.split(`
224
+ `).filter(e=>e.trim().length>0);if(r.length===0)return``;let i=t?r[r.length-1]:r[0];return i.length>96?`${i.slice(0,96)}…`:i}function C(e){return _t.find(t=>t.id===e)?.label??e}function w(e){return[e.usage?`↑ ${Wl(e.usage.inputTokens)}`:``,e.usage?`↓ ${Wl(e.usage.outputTokens)}`:``,e.elapsedMs===void 0?``:Gl(e.elapsedMs)].filter(e=>e.length>0)}function T(e){F(o,{...E(o),[e]:!(E(o)[e]??!1)},!0)}function D(){let e=E(a);e&&(e.scrollTop=e.scrollHeight)}var O=wL(),k=W(O),A=W(k),j=e=>{var r=aL(),i=z(W(r),2);t(i,21,()=>_t,e=>e.id,(e,t)=>{var r=iL(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0);n(r),H(()=>{Y(r,1,`w-full rounded-md border p-2 text-left transition-colors ${ze.pendingMode===E(t).id?`border-primary/60 bg-primary/5`:`border-border hover:border-primary/50 hover:bg-primary/5`}`),B(r,`aria-pressed`,ze.pendingMode===E(t).id),r.disabled=ze.sending,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>ze.pendingMode=E(t).id),y(e,r)}),n(i),n(r),y(e,r)},ee=e=>{var r=SL(),i=q(r);t(i,17,()=>ze.items,e=>e.seq,(e,r)=>{var i=X(),a=q(i),u=e=>{var t=oL(),i=z(W(t));oe(),n(t),H(()=>c(i,` ${E(r).label??`Turn`??``} `)),y(e,t)},d=e=>{var t=cL(),i=W(t),a=e=>{var t=sL(),n=M(t,!0);H(e=>c(n,e),[()=>w(E(r)).join(` · `)]),y(e,t)},o=I(()=>w(E(r)).length>0),s=e=>{var t=sL(),n=M(t,!0);H(()=>c(n,E(r).reason)),y(e,t)};h(i,e=>{E(o)?e(a):e(s,-1)}),n(t),H(()=>B(t,`title`,E(r).reason)),y(e,t)},f=e=>{var t=lL(),i=z(W(t),3);oe(),n(t),H((e,n,r)=>{B(t,`aria-label`,e),c(i,` ${n??``} → ${r??``} `)},[()=>`Mode switched from ${C(E(r).from)} to ${C(E(r).to)}`,()=>C(E(r).from),()=>C(E(r).to)]),y(e,t)},p=e=>{var t=uL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)},x=e=>{var t=dL(),i=z(W(t),4),a=M(i,!0);oe(2),n(t),H(()=>c(a,E(r).text)),y(e,t)},D=e=>{var i=gL(),a=W(i),o=e=>{var i=pL();t(i,21,()=>E(r).images,ie,(e,t)=>{var n=fL();H(()=>B(n,`src`,E(t))),y(e,n)}),n(i),y(e,i)};h(a,e=>{E(r).images&&E(r).images.length>0&&e(o)});var u=z(a,2),d=e=>{var i=pL();t(i,21,()=>E(r).files,ie,(e,t)=>{var i=mL(),a=W(i),o=e=>{Uc(e,{class:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`})},s=I(()=>E(r).imageChipNames?.includes(E(t))),l=e=>{Vc(e,{class:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`})};h(a,e=>{E(s)?e(o):e(l,-1)});var u=z(a,2),d=M(u,!0);n(i),H(()=>c(d,E(t))),y(e,i)}),n(i),y(e,i)};h(u,e=>{E(r).files&&E(r).files.length>0&&e(d)});var f=z(u,2),p=e=>{var t=hL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)};h(f,e=>{E(r).text.length>0&&e(p)});var b=z(f,2),x=W(b),S=W(x),C=e=>{Hs(e,{class:`h-3.5 w-3.5 text-primary`})},w=e=>{zc(e,{class:`h-3.5 w-3.5`})};h(S,e=>{E(s)===E(r).seq?e(C):e(w,-1)}),n(x);var T=z(x,2),D=W(T);Je(D,{class:`h-3.5 w-3.5`}),n(T);var O=z(T,2),k=W(O);Wn(k,{class:`h-3.5 w-3.5`}),n(O),n(b),n(i),H(()=>{Y(b,1,`mt-0.5 flex h-5 justify-end gap-0.5 transition-opacity ${E(r).seq===E(v)?`opacity-100`:`opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100`}`),O.disabled=ze.sending}),l(`click`,x,()=>void m(E(r).text,E(r).seq)),l(`click`,T,()=>g(E(r).text)),l(`click`,O,()=>_(E(r).text)),y(e,i)},O=e=>{var t=vL(),i=W(t);{let e=I(()=>S(E(r).text,E(r).streaming)),t=I(()=>E(r).streaming?!0:E(o)[E(r).seq]??!1);sl(i,{get icon(){return Gn},title:`Thinking`,get summary(){return E(e)},get open(){return E(t)},get running(){return E(r).streaming},onToggle:()=>T(E(r).seq)})}var a=z(i,2),s=e=>{var t=_L(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)};h(a,e=>{(E(r).streaming||E(o)[E(r).seq])&&e(s)}),n(t),y(e,t)},k=e=>{var t=yL(),i=W(t),a=W(i);{let e=I(()=>!E(r).streaming);rL(a,{get content(){return E(r).text},htmlPolicy:`escape`,get final(){return E(e)}})}n(i);var o=z(i,2),c=W(o),u=W(c),d=e=>{Hs(e,{class:`h-3.5 w-3.5 text-primary`})},f=e=>{zc(e,{class:`h-3.5 w-3.5`})};h(u,e=>{E(s)===E(r).seq?e(d):e(f,-1)}),n(c),n(o),n(t),H(()=>Y(o,1,`mt-0.5 flex h-5 gap-0.5 transition-opacity ${E(r).seq===E(b)?`opacity-100`:`opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100`}`)),l(`click`,c,()=>void m(E(r).text,E(r).seq)),y(e,t)},A=e=>{{let t=I(()=>E(r).phase===`calling`&&ze.status===`running`);Ul(e,{get toolName(){return E(r).toolName},get argsText(){return E(r).argsText},get result(){return E(r).result},get phase(){return E(r).phase},get running(){return E(t)},get startedAt(){return E(r).startedAt},get endedAt(){return E(r).endedAt}})}},j=e=>{var t=bL();el(W(t),{get seq(){return E(r).seq},get questions(){return E(r).questions},get resolved(){return E(r).resolved}}),n(t),y(e,t)};h(a,e=>{E(r).kind===`turn`?e(u):E(r).kind===`turn-end`?e(d,1):E(r).kind===`mode`?e(f,2):E(r).kind===`status`?e(p,3):E(r).kind===`note`?e(x,4):E(r).kind===`user`?e(D,5):E(r).kind===`reasoning`?e(O,6):E(r).kind===`assistant`?e(k,7):E(r).kind===`tool`?e(A,8):E(r).kind===`approval`&&e(j,9)}),y(e,i)});var a=z(i,2),u=e=>{var t=xL(),r=W(t),i=M(r);n(t),H(e=>c(i,`Working${e??``}`),[()=>E(p)>=15?` · ${Math.floor(E(p))}s`:``]),y(e,t)};h(a,e=>{ze.status===`running`&&e(u)}),y(e,r)};h(A,e=>{ze.sessionId?e(ee,-1):e(j)}),n(k),se(k,e=>F(a,e),()=>E(a));var te=z(k,2),N=e=>{var t=CL();Gc(W(t),{class:`h-3.5 w-3.5`}),n(t),l(`click`,t,D),y(e,t)};h(te,e=>{E(u)&&ze.sessionId&&e(N)}),n(O),f(`scroll`,k,e=>{let t=e.currentTarget;F(u,t.scrollHeight-t.scrollTop-t.clientHeight>200)}),y(e,O),x()}T([`click`]);var EL=r(`<li><span aria-hidden="true"></span> <span class="min-w-0 break-words"> </span></li>`),DL=r(`<ul class="mt-1 max-h-40 space-y-0.5 overflow-y-auto rounded-lg border border-border bg-card px-2 py-1.5 shadow-sm"></ul>`),OL=r(`<div class="mx-3 mb-1.5 shrink-0"><button type="button" class="disclosure-row disclosure-row-tall w-full rounded-lg border border-border bg-card px-2 shadow-sm" aria-label="Tasks"><span class="flex items-center justify-center text-muted-foreground" aria-hidden="true"><!></span> <span class="truncate text-left font-medium text-foreground">Tasks</span> <span class="text-center text-muted-foreground/70" aria-hidden="true">·</span> <span class="disclosure-summary tabular-nums"> </span> <!></button> <!></div>`);function kL(e,r){let i=V(!1),a=I(()=>{let e=0,t=0,n=0;for(let i of r.todos)i.status===`completed`?e+=1:i.status===`in_progress`?t+=1:n+=1;return{done:e,active:t,pending:n}});var o=OL(),s=W(o),u=W(s),d=W(u);Bn(d,{class:`h-3.5 w-3.5`}),n(u);var f=z(u,6),p=M(f),m=z(f,2);qn(m,{class:`disclosure-chevron h-3.5 w-3.5 shrink-0 text-muted-foreground`}),n(s);var g=z(s,2),_=e=>{var i=DL();t(i,21,()=>r.todos,ie,(e,t)=>{var r=EL(),i=W(r),a=z(i,2),o=M(a,!0);n(r),H(()=>{Y(r,1,`flex items-start gap-1.5 text-xs ${E(t).status===`completed`?`text-muted-foreground line-through`:``}`),Y(i,1,`mt-[3px] h-3 w-3 shrink-0 rounded-full border-2 ${E(t).status===`completed`?`border-primary bg-primary/20`:E(t).status===`in_progress`?`border-primary`:`border-muted-foreground/50`}`),c(o,E(t).content)}),y(e,r)}),n(i),y(e,i)};h(g,e=>{E(i)&&e(_)}),n(o),H(()=>{B(s,`data-open`,E(i)),B(s,`aria-expanded`,E(i)),c(p,`done ${E(a).done??``} · active ${E(a).active??``} · pending ${E(a).pending??``}`)}),l(`click`,s,()=>F(i,!E(i))),y(e,o)}T([`click`]);function AL(e){let t=0;for(let n of e)t=(t*31+n.charCodeAt(0))%360;return t}function jL(e){return`hsl(${AL(e)} 55% 45%)`}var ML=`sc-letter-avatar`;function NL(e){return e.includes(ML)}function PL(e,t){return e.iconSuppressed===!0?null:e.icon??t?.icon??null}function FL(e,t){return e.iconLetter!==void 0&&e.iconLetter.length>0?e.iconLetter:(t||e.provider).slice(0,1).toUpperCase()}function IL(e){return e.iconColor??jL(e.provider)}var LL={svg:`image/svg+xml`,png:`image/png`,webp:`image/webp`};function RL(e,t){let n=e.indexOf(`,`);return!e.startsWith(`data:`)||n<0?null:`data:${t};base64,${e.slice(n+1)}`}var zL=new Set([`$$slots`,`$$events`,`$$legacy`]);function BL(e,t){let n=U(t,zL),r=[[`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`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M12 12v6`}],[`path`,{d:`m15 15-3-3-3 3`}]];ye(e,K({name:`file-up`},()=>n,{get iconNode(){return r}}))}var VL=new Set([`$$slots`,`$$events`,`$$legacy`]);function HL(e,t){let n=U(t,VL),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];ye(e,K({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var UL=new Set([`$$slots`,`$$events`,`$$legacy`]);function WL(e,t){let n=U(t,UL),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];ye(e,K({name:`square`},()=>n,{get iconNode(){return r}}))}var GL=new Set([`$$slots`,`$$events`,`$$legacy`]);function KL(e,t){let n=U(t,GL),r=[[`path`,{d:`m6 9 6 6 6-6`}]];ye(e,K({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var qL=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function JL(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=U(t,qL);var o=X(),s=q(o);a(s,()=>os,(e,t)=>{t(e,K(()=>r,{get open(){return n()},set open(e){n(e)}}))}),y(e,o),x()}var YL=new Set([`$$slots`,`$$events`,`$$legacy`]);function XL(e,t){let n=U(t,YL);var r=X(),i=q(r);a(i,()=>Lt,(e,t)=>{t(e,K(()=>n))}),y(e,r)}var ZL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`sideOffset`,`align`,`portalProps`,`class`]);function QL(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`sideOffset`,3,4),o=k(t,`align`,3,`start`),s=U(t,ZL);XL(e,K(()=>t.portalProps,{children:(e,i)=>{var c=X(),l=q(c);{let e=I(()=>Fn(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 w-(--bits-dropdown-menu-anchor-width) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden`,t.class));a(l,()=>ls,(t,i)=>{i(t,K({"data-slot":`dropdown-menu-content`,get sideOffset(){return r()},get align(){return o()},get class(){return E(e)}},()=>s,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,c)},$$slots:{default:!0}})),x()}var $L=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function eR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,$L);var o=X(),s=q(o);a(s,()=>$o,(e,t)=>{t(e,K({"data-slot":`dropdown-menu-group`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var tR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`variant`]);function nR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`variant`,3,`default`),o=U(t,tR);var s=X(),c=q(s);{let e=I(()=>Fn(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed data-inset:pl-7.5 [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,t.class));a(c,()=>Xo,(i,a)=>{a(i,K({"data-slot":`dropdown-menu-item`,get"data-inset"(){return t.inset},get"data-variant"(){return r()},get class(){return E(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,s),x()}var rR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`children`]),iR=r(`<div><!></div>`);function aR(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,rR);var o=iR();P(o,e=>({"data-slot":`dropdown-menu-label`,"data-inset":t.inset,class:e,...a}),[()=>Fn(`text-muted-foreground px-2 py-1.5 text-xs data-inset:pl-7.5 data-[inset]:pl-8`,t.class)]);var s=W(o);_(s,()=>t.children??R),n(o),se(o,e=>r(e),()=>r()),y(e,o),x()}var oR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function sR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,oR);var o=X(),s=q(o);{let e=I(()=>Fn(`bg-border/50 -mx-1 my-1 h-px`,t.class));a(s,()=>as,(t,i)=>{i(t,K({"data-slot":`dropdown-menu-separator`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var cR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function lR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,cR);var o=X(),s=q(o);a(s,()=>fs,(e,t)=>{t(e,K({"data-slot":`dropdown-menu-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var uR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`]);function dR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,uR);var o=X(),s=q(o);{let e=I(()=>Fn(`px-2 py-1.5 text-sm font-semibold data-[inset]:ps-8`,t.class));a(s,()=>ns,(i,a)=>{a(i,K({"data-slot":`dropdown-menu-group-heading`,get"data-inset"(){return t.inset},get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var fR=J({open:!1,section:`general`});function pR(e=`general`){fR.section=e,fR.open=!0}function mR(e){if(!e)return null;let{provider:t,model:n}=e.settings.model,r=e.settings.modelRoutes.find(e=>e.provider===t);return r?r.models.find(e=>e.id===n)?.contextWindow??null:null}var hR=r(`<div class="flex items-center justify-between"><span>Used</span> <span> </span></div> <div class="mt-0.5 flex items-center justify-between text-muted-foreground"><span>Last turn</span> <span class="tabular-nums"> </span></div> <div class="mt-0.5 flex items-center justify-between text-muted-foreground"><span>Capacity</span> <span class="tabular-nums"> </span></div>`,1),gR=r(`<div class="text-muted-foreground">No turns yet.</div>`),_R=r(`<div role="dialog" aria-label="Context usage details" class="absolute right-0 bottom-full z-20 mb-1.5 w-56 rounded-lg border border-border bg-popover p-2.5 text-xs shadow-md"><div class="mb-1.5 text-[11px] font-medium text-muted-foreground">Context</div> <!> <button type="button" class="mt-2 w-full rounded-md border border-border px-2 py-1 text-[11px] transition-colors hover:bg-muted disabled:opacity-50" title="Compact the conversation history (kernel /compact)">compact</button></div>`),vR=r(`<div class="relative"><button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50" aria-label="Context usage"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke-width="2.5" class="stroke-muted-foreground/40"></circle><circle cx="7" cy="7" r="5" fill="none" stroke-width="2.5" stroke-linecap="round" transform="rotate(-90 7 7)"></circle></svg></button> <!></div>`);function yR(e,t){i(t,!0);let r=V(!1),a=V(null),o=I(()=>ze.lastUsage),s=I(()=>mR(Q.view)),u=I(()=>E(s)??131072),d=I(()=>E(o)?Math.min(1,Math.max(0,E(o).inputTokens/E(u))):0),p=I(()=>Math.round(E(d)*100)),m=I(()=>E(p)>=75),g=2*Math.PI*5,_=I(()=>`${(E(d)*g).toFixed(2)} ${g.toFixed(2)}`),v=I(()=>E(o)?`${E(p)}% of context used · last turn ${Wl(E(o).inputTokens)} in / ${Wl(E(o).outputTokens)} out`:`No turns yet — context usage appears after the first turn`);function S(){ze.sending||ze.status===`running`||(F(r,!1),Le(`/compact`))}function C(e){E(r)&&E(a)!==null&&e.target instanceof Node&&!E(a).contains(e.target)&&F(r,!1)}var w=vR();f(`pointerdown`,A,C);var T=W(w),D=W(T),O=z(W(D));n(D),n(T);var k=z(T,2),j=e=>{var t=_R(),r=z(W(t),2),i=e=>{var t=hR(),r=q(t),i=z(W(r),2),a=M(i);n(r);var l=z(r,2),d=z(W(l),2),f=M(d);n(l);var h=z(l,2),g=z(W(h),2),_=M(g);n(h),H((e,t,n)=>{Y(i,1,`tabular-nums ${E(m)?`text-amber-600 dark:text-amber-400`:``}`),c(a,`${E(p)??``}%`),c(f,`↑ ${e??``} · ↓ ${t??``}`),c(_,`${n??``}${E(s)===null?` · assumed 128k`:``}`)},[()=>Wl(E(o).inputTokens),()=>Wl(E(o).outputTokens),()=>Wl(E(u))]),y(e,t)},a=e=>{var t=gR();y(e,t)};h(r,e=>{E(o)?e(i):e(a,-1)});var d=z(r,2);n(t),H(()=>d.disabled=ze.sending||ze.status===`running`||!ze.sessionId),l(`click`,d,S),y(e,t)};h(k,e=>{E(r)&&e(j)}),n(w),se(w,e=>F(a,e),()=>E(a)),H(()=>{B(T,`title`,E(v)),B(T,`aria-expanded`,E(r)),T.disabled=!ze.sessionId,Y(O,0,b(E(m)?`stroke-amber-500`:`stroke-primary`)),B(O,`stroke-dasharray`,E(_))}),l(`click`,T,()=>F(r,!E(r))),y(e,w),x()}T([`click`]);var bR=r(`<div class="px-2.5 pt-1 text-[10px] text-muted-foreground" data-menu-source="true"> </div>`),xR=r(`<li class="cursor-default px-2.5 py-1.5 text-[11px] text-muted-foreground"> </li>`),SR=r(`<span class="truncate text-muted-foreground"> </span>`),CR=r(`<li><button type="button"><span class="shrink-0 font-medium"> </span> <!></button></li>`),wR=r(`<ul class="absolute bottom-full left-3 z-20 mb-1.5 w-72 overflow-hidden rounded-lg border border-border bg-popover py-1 shadow-md"><!> <!></ul>`);function TR(e,r){i(r,!0);let a=V(null),o=V(0),s=I(()=>r.text.startsWith(r.trigger)?r.text.split(`
225
+ `,1)[0]??``:``),u=I(()=>E(s).length>0?r.entries.filter(e=>e.value.startsWith(E(s))):[]),d=I(()=>r.entries.length===0&&r.emptyMessage!==void 0),f=I(()=>E(s).length>0&&r.caretOnFirstLine&&E(a)!==r.text&&(E(u).length>0||E(d))),p=I(()=>Math.min(E(o),Math.max(0,E(u).length-1)));function m(e){e.preventDefault(),e.stopPropagation()}function g(e){if(!E(f))return!1;if(e.key===`Escape`)return m(e),F(a,r.text,!0),!0;if(E(u).length===0)return e.key===`Enter`&&(m(e),!0);if(e.key===`ArrowDown`)return m(e),F(o,(E(p)+1)%E(u).length),!0;if(e.key===`ArrowUp`)return m(e),F(o,(E(p)-1+E(u).length)%E(u).length),!0;if(e.key===`Enter`){m(e);let t=E(u)[E(p)];return t&&r.onSelect(t.value),!0}return!1}var _={handleKeydown:g},v=X(),b=q(v),S=e=>{var i=wR(),a=W(i),o=e=>{var t=bR(),n=M(t,!0);H(()=>c(n,r.sourceLabel)),y(e,t)};h(a,e=>{r.sourceLabel&&e(o)});var s=z(a,2),d=e=>{var t=xR(),n=M(t,!0);H(()=>c(n,r.emptyMessage)),y(e,t)},f=e=>{var i=X(),a=q(i);t(a,19,()=>E(u),e=>e.value,(e,t,i)=>{var a=CR(),o=W(a),s=W(o),u=M(s,!0),d=z(s,2),f=e=>{var n=SR(),r=M(n,!0);H(()=>c(r,E(t).description)),y(e,n)};h(d,e=>{E(t).description&&e(f)}),n(o),n(a),H(()=>{Y(o,1,`flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-[11px] ${E(i)===E(p)?`bg-accent text-accent-foreground`:`text-foreground`} hover:bg-accent/50`),B(o,`aria-current`,E(i)===E(p)?`true`:void 0),c(u,E(t).value)}),l(`click`,o,()=>r.onSelect(E(t).value)),y(e,a)}),y(e,i)};h(s,e=>{E(u).length===0?e(d):e(f,-1)}),n(i),H(()=>{B(i,`data-slot`,r.dataSlot),B(i,`aria-label`,r.menuLabel)}),y(e,i)};return h(b,e=>{E(f)&&e(S)}),y(e,v),x(_)}T([`click`]);var ER=[{command:`/compact`,description:`Summarize the transcript to reclaim context`}];function DR(e,t){i(t,!0);let n=ER.map(e=>({value:e.command,...e.description.length>0?{description:e.description}:{}})),r=V(null);function a(e){return E(r)?.handleKeydown(e)??!1}var o={handleKeydown:a};return se(TR(e,{trigger:`/`,get entries(){return n},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},menuLabel:`Slash commands`,dataSlot:`slash-menu`,get onSelect(){return t.onExecute}}),e=>F(r,e,!0),()=>E(r)),x(o)}function OR(e,t){i(t,!0);let n=I(()=>At.skills.map(e=>({value:`$${e.name}`,...e.description.length>0?{description:e.description}:{}}))),r=I(()=>At.target?`from provider: ${At.target.providerId}`:`Open a Workspace provider to load skills`),a=V(null);function o(e){return E(a)?.handleKeydown(e)??!1}var s={handleKeydown:o};return se(TR(e,{trigger:`$`,get entries(){return E(n)},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},menuLabel:`Skill references`,get sourceLabel(){return E(r)},dataSlot:`skill-menu`,emptyMessage:`No skills in the current workspace`,get onSelect(){return t.onInsert}}),e=>F(a,e,!0),()=>E(a)),x(s)}var kR=null;function AR(){if(kR!==null)return kR;let e=St();return e?(kR=e.agent.models.catalog({}).then(e=>Object.fromEntries(e.providers.map(e=>[e.provider,e.label]))).catch(()=>(kR=null,{})),kR):Promise.resolve({})}var jR=r(`<img class="h-full w-full object-cover"/>`),MR=r(`<div class="flex h-full w-full items-center justify-center bg-muted/40"><!></div>`),NR=r(`<div class="group relative h-14 w-14 overflow-hidden rounded-lg border border-border"><!> <button type="button" class="absolute top-0.5 right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-background/80 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:text-destructive" aria-label="Remove attachment"><!></button></div>`),PR=r(`<span class="flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px]"> <button type="button" class="text-muted-foreground hover:text-destructive">×</button></span>`),FR=r(`<div class="flex flex-wrap gap-1.5 px-3 pt-3" aria-label="Pending attachments"><!> <!></div>`),IR=r(`<span class="truncate"> </span> <!>`,1),LR=r(`<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center"><!></span> <span class="truncate"> </span>`,1),RR=r(`<!> <!>`,1),zR=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-primary"></span>`),BR=r(`<span class="truncate"> </span> <!> <!>`,1),VR=r(`<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span> <span class="truncate"> </span>`,1),HR=r(`<!> <!> <!>`,1),UR=r(`<div class="relative mx-3 mb-3 flex shrink-0 flex-col rounded-[22px] border border-border bg-card shadow-sm"><!> <!> <!> <textarea class="msg-body max-h-40 w-full resize-none border-0 bg-transparent px-3.5 py-2.5 outline-none focus:outline-none focus-visible:ring-0 placeholder:text-muted-foreground disabled:opacity-50" aria-label="Message"></textarea> <div class="flex h-11 items-center gap-1 px-2.5"><!> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground disabled:opacity-50" title="Attach images (paste or pick, ≤4 MiB each)" aria-label="Attach images (paste or pick, ≤4 MiB each)"><!></button> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground disabled:opacity-50" title="Attach files (text inlined, binary as refs, ≤512 KiB each)" aria-label="Attach files (text inlined, binary as refs, ≤512 KiB each)"><!></button> <div class="flex-1"></div> <!> <!> <button type="button"><!></button></div></div>`);function WR(e,r){i(r,!0);let o=V(null),s=V(null),u=V(null),d=V(!0);de(()=>{Z.text;let e=E(o);e&&(e.style.height=`auto`,e.style.height=`${Math.min(160,Math.max(44,e.scrollHeight))}px`)}),de(()=>{Z.text,F(d,p(),!0)});function p(){return!Z.text.slice(0,E(o)?.selectionStart??0).includes(`
226
+ `)}let m=I(()=>ze.status===`running`),g=I(()=>Z.text.trim().length>0||Z.images.length>0||Z.files.length>0),_=I(()=>Z.editing!==null),v=I(()=>E(_)?`Edit your message — sending will resend it as a new message`:`Message the agent…`),b=I(()=>E(m)&&!E(g)?`stop`:E(m)?`wait`:`send`),S=I(()=>ze.sessionId?ze.mode:ze.pendingMode),w=I(()=>_t.find(e=>e.id===E(S))?.label),T=I(()=>{let e=Q.view;if(!e)return null;let t=e.settings.model,n=!e.settings.modelRoutes.some(e=>e.provider===t.provider);return{label:`${t.provider} · ${t.model}`,effort:t.reasoningEffort,dangling:n}}),D=V(J({})),k=V(!1),A=V(!1);de(()=>{AR().then(e=>F(D,e,!0))});let ee=I(()=>{let e=Q.view;if(!e)return[];let t=e.settings.model;return e.settings.modelRoutes.map(e=>{let n=e.models.map(e=>e.id);t.provider===e.provider&&!n.includes(t.model)&&n.unshift(t.model);let r=E(D)[e.provider]??e.provider;return{provider:e.provider,label:r,letter:e.iconLetter??r.slice(0,1).toUpperCase(),color:e.iconColor??`hsl(${AL(e.provider)} 55% 45%)`,models:n}})});function te(e,t){let n=Q.view;return n!==null&&n.settings.model.provider===e&&n.settings.model.model===t}async function P(e,t){let n=Q.view?.settings.model.reasoningEffort,r=await xe({model:{provider:e,model:t,...n!==void 0&&n.length>0?{reasoningEffort:n}:{}}});if(r){if(r.outcome===`rejected`){Mn(`${r.code}: ${r.detail}`);return}if(r.outcome===`error`){Mn(r.message);return}Mn(`Active model → ${e} · ${t}`)}}function L(){let e=Z.text.trim();(e.length!==0||Z.images.length!==0||Z.files.length!==0)&&(ze.sending||Le(e,Z.images,Z.files))}let ne=V(!1);async function re(e){if(!E(ne)){F(ne,!0);try{let t=await Ue(e);if(t===null||t.paths.length===0)return;let n=t.paths.map(e=>({path:e,name:e.split(/[\\/]/).filter(Boolean).pop()??e}));e===`image`?(Se(n),Fe(n)):Ae(n)}finally{F(ne,!1)}}}function R(e){if(!ze.sessionId){ze.pendingMode=e;return}Ne(e)}function ae(e){ze.sending||(Z.text=``,Z.images=[],Z.files=[],Ve(),Le(e))}function ce(e){let t=E(o),n=Math.min(t?.selectionStart??Z.text.length,Z.text.length);Z.text=`${e} ${Z.text.slice(n)}`;let r=Math.min(e.length+1,Z.text.length);requestAnimationFrame(()=>{t?.setSelectionRange(r,r),F(d,p(),!0)})}function U(e){E(s)?.handleKeydown(e)||E(u)?.handleKeydown(e)||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())}function le(){F(d,p(),!0)}function G(e){let t=[...e.clipboardData?.files??[]].filter(e=>e.type.startsWith(`image/`));t.length>0&&(e.preventDefault(),Ze(t))}var ue=UR(),K=W(ue);se(DR(K,{get text(){return Z.text},get caretOnFirstLine(){return E(d)},onExecute:ae}),e=>F(s,e,!0),()=>E(s));var fe=z(K,2);se(OR(fe,{get text(){return Z.text},get caretOnFirstLine(){return E(d)},onInsert:ce}),e=>F(u,e,!0),()=>E(u));var pe=z(fe,2),me=e=>{var r=FR(),i=W(r);t(i,17,()=>Z.images,ie,(e,t,r)=>{var i=NR(),a=W(i),o=e=>{var n=jR();H(()=>{B(n,`src`,E(t).preview),B(n,`alt`,E(t).name??`image`)}),y(e,n)},s=e=>{var r=MR();Uc(W(r),{class:`h-5 w-5 text-muted-foreground`,"aria-hidden":`true`}),n(r),H(()=>B(r,`title`,E(t).path??E(t).name??`image`)),y(e,r)};h(a,e=>{E(t).preview?e(o):e(s,-1)});var c=z(a,2),u=W(c);Ln(u,{class:`h-2.5 w-2.5`}),n(c),n(i),l(`click`,c,()=>Z.images=Z.images.filter((e,t)=>t!==r)),y(e,i)});var a=z(i,2);t(a,17,()=>Z.files,ie,(e,t,r)=>{var i=PR(),a=W(i),o=z(a);n(i),H(()=>{c(a,`📄 ${E(t).name??``} `),B(o,`aria-label`,`Remove file ${E(t).name??``}`)}),l(`click`,o,()=>Z.files=Z.files.filter((e,t)=>t!==r)),y(e,i)}),n(r),y(e,r)};h(pe,e=>{(Z.files.length>0||Z.images.length>0)&&e(me)});var he=z(pe,2);O(he),B(he,`rows`,1),B(he,`maxlength`,2e4),se(he,e=>F(o,e),()=>E(o));var ge=z(he,2),_e=W(ge);a(_e,()=>JL,(e,r)=>{r(e,{get open(){return E(A)},set open(e){F(A,e,!0)},children:(e,r)=>{var i=RR(),o=q(i);{let e=I(()=>E(m)?`Switch after the current turn ends`:ze.sessionId?`Switch this session's mode`:`Pick the mode for your next session`);a(o,()=>lR,(t,n)=>{n(t,{class:`flex h-7 max-w-[130px] items-center gap-1.5 rounded-full border border-border px-2.5 text-[11px] text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,get title(){return E(e)},"aria-label":`Session mode`,get disabled(){return E(m)},onkeydown:e=>{e.key===`Escape`&&E(A)&&(e.stopPropagation(),F(A,!1))},children:(e,t)=>{var n=IR(),r=q(n),i=M(r,!0);KL(z(r,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(w)??`Mode`)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2),l=e=>{var r=X(),i=q(r);a(i,()=>QL,(e,r)=>{r(e,{align:`start`,class:`max-h-72 w-44 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(A,!1))},children:(e,r)=>{var i=X(),o=q(i);t(o,17,()=>_t,e=>e.id,(e,t)=>{var r=X(),i=q(r);{let e=I(()=>E(S)===E(t).id?`true`:void 0);a(i,()=>nR,(r,i)=>{i(r,{get"data-mode-active"(){return E(e)},class:`gap-1.5`,onclick:()=>R(E(t).id),children:(e,r)=>{var i=LR(),a=q(i),o=W(a),s=e=>{Hs(e,{class:`h-3 w-3`,"aria-hidden":`true`})};h(o,e=>{E(S)===E(t).id&&e(s)}),n(a);var l=z(a,2),u=M(l,!0);H(()=>c(u,E(t).label)),y(e,i)},$$slots:{default:!0}})})}y(e,r)}),y(e,i)},$$slots:{default:!0}})}),y(e,r)};h(s,e=>{E(A)&&e(l)}),y(e,i)},$$slots:{default:!0}})});var ve=z(_e,2);Uc(W(ve),{class:`h-4 w-4`}),n(ve);var ye=z(ve,2);BL(W(ye),{class:`h-4 w-4`}),n(ye);var be=z(ye,4),Ce=e=>{var r=X(),i=q(r);a(i,()=>JL,(e,r)=>{r(e,{get open(){return E(k)},set open(e){F(k,e,!0)},children:(e,r)=>{var i=RR(),o=q(i);{let e=I(()=>E(T).dangling?`border-amber-500/60 text-amber-600 dark:text-amber-400`:`border-border text-muted-foreground hover:text-foreground`),t=I(()=>E(m)?`Switch after the current turn ends`:`Switch the active model — route configuration lives in Settings → Model`);a(o,()=>lR,(n,r)=>{r(n,{get class(){return`flex h-7 max-w-[150px] items-center gap-1.5 rounded-full border px-2.5 text-[11px] transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${E(e)??``}`},get title(){return E(t)},"aria-label":`Switch active model`,get disabled(){return E(m)},onkeydown:e=>{e.key===`Escape`&&E(k)&&(e.stopPropagation(),F(k,!1))},children:(e,t)=>{var n=BR(),r=q(n),i=M(r,!0),a=z(r,2),o=e=>{var t=zR();H(()=>B(t,`title`,`Reasoning effort: ${E(T).effort}`)),y(e,t)};h(a,e=>{E(T).effort&&e(o)}),KL(z(a,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(T).label)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2);a(s,()=>QL,(e,r)=>{r(e,{align:`end`,class:`max-h-72 w-56 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(k,!1))},children:(e,r)=>{var i=HR(),o=q(i),s=e=>{var t=RR(),n=q(t);a(n,()=>aR,(e,t)=>{t(e,{"data-dangling":`true`,class:`px-2 py-1.5 text-[10px] font-medium text-amber-600 dark:text-amber-400`,children:(e,t)=>{oe();var n=C();H(()=>c(n,`${E(T).label??``} — outside Routes`)),y(e,n)},$$slots:{default:!0}})});var r=z(n,2);a(r,()=>sR,(e,t)=>{t(e,{})}),y(e,t)};h(o,e=>{E(T).dangling&&e(s)});var l=z(o,2);t(l,17,()=>E(ee),e=>e.provider,(e,r)=>{var i=RR(),o=q(i);a(o,()=>eR,(e,i)=>{i(e,{children:(e,i)=>{var o=RR(),s=q(o);a(s,()=>dR,(e,t)=>{t(e,{class:`flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium`,children:(e,t)=>{var n=VR(),i=q(n),a=M(i,!0),o=z(i,2),s=M(o,!0);H(()=>{j(i,`background: ${E(r).color??``}`),c(a,E(r).letter),c(s,E(r).label)}),y(e,n)},$$slots:{default:!0}})});var l=z(s,2);t(l,16,()=>E(r).models,e=>e,(e,t)=>{var i=X(),o=q(i);{let e=I(()=>te(E(r).provider,t)?`true`:void 0);a(o,()=>nR,(i,a)=>{a(i,{get"data-model-active"(){return E(e)},class:`gap-1.5`,onclick:()=>void P(E(r).provider,t),children:(e,i)=>{var a=LR(),o=q(a),s=W(o),l=e=>{Hs(e,{class:`h-3 w-3`,"aria-hidden":`true`})},u=I(()=>te(E(r).provider,t));h(s,e=>{E(u)&&e(l)}),n(o);var d=z(o,2),f=M(d,!0);H(()=>c(f,t)),y(e,a)},$$slots:{default:!0}})})}y(e,i)}),y(e,o)},$$slots:{default:!0}})});var s=z(o,2);a(s,()=>sR,(e,t)=>{t(e,{})}),y(e,i)});var u=z(l,2);a(u,()=>nR,(e,t)=>{t(e,{onclick:()=>pR(`model`),children:(e,t)=>{oe();var n=C(`Open settings →`);y(e,n)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,r)};h(be,e=>{E(T)&&e(Ce)});var we=z(be,2);yR(we,{});var Te=z(we,2),Ee=W(Te),De=e=>{WL(e,{class:`h-3 w-3`})},Oe=e=>{HL(e,{class:`h-4 w-4`})};h(Ee,e=>{E(b)===`stop`?e(De):e(Oe,-1)}),n(Te),n(ge),n(ue),H(()=>{B(he,`placeholder`,E(v)),Y(Te,1,`relative flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-full transition-colors after:absolute after:-inset-0.5 after:content-[''] ${E(b)===`stop`?`bg-destructive text-white hover:bg-destructive/90`:E(b)===`wait`?`bg-muted text-muted-foreground`:`bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50`}`),B(Te,`aria-label`,E(b)===`stop`?`Cancel current activity`:`Send message`),B(Te,`title`,E(b)===`stop`?`Cancel current activity`:E(b)===`wait`?`Wait for the current turn`:`Send (Enter)`),Te.disabled=E(b)!==`stop`&&(!E(g)||ze.sending)}),l(`keydown`,he,U),l(`keyup`,he,le),l(`click`,he,le),f(`select`,he,le),f(`paste`,he,G),N(he,()=>Z.text,e=>Z.text=e),l(`click`,ve,()=>void re(`image`)),l(`click`,ye,()=>void re(`file`)),l(`click`,Te,()=>E(b)===`stop`?void Pe():L()),y(e,ue),x()}T([`click`,`keydown`,`keyup`]);var GR=r(`<div class="border-t border-destructive/30 bg-destructive/8 px-3 py-1.5 text-xs text-destructive" role="alert"> </div>`),KR=r(`<div class="mx-3 mb-1.5 flex h-7 shrink-0 items-center justify-between gap-2 rounded-lg bg-amber-500/10 px-2.5 text-[11px] text-amber-700 dark:text-amber-400" role="status"><span class="truncate">Editing — resending keeps your full history (append-only)</span> <button type="button" class="shrink-0 rounded p-0.5 text-amber-700/80 hover:text-amber-700 dark:text-amber-400/80 dark:hover:text-amber-400" title="Cancel edit" aria-label="Cancel edit"><!></button></div>`),qR=r(`<aside aria-label="Agent panel"><div class="absolute inset-y-0 left-0 z-10 hidden w-1.5 cursor-col-resize touch-none select-none hover:bg-primary/30 min-[720px]:block" role="separator" aria-orientation="vertical" aria-label="Resize agent panel"></div> <!> <!> <!> <!> <!> <!></aside>`);function JR(e,t){i(t,!0),de(()=>{We.open&&Q.view===null&&!Q.loading&&Ke()}),de(()=>{if(We.seedPrompt){let e=We.seedPrompt;We.seedPrompt=null,Z.text.length===0&&(Z.text=e)}});let r=V(!1),a=0,o=0;function s(e){if(e.button!==0)return;F(r,!0),a=e.clientX,o=We.width;let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId),document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`}function u(){E(r)&&(F(r,!1),document.body.style.userSelect=``,document.body.style.cursor=``)}var d=qR();f(`keydown`,A,e=>{e.key===`Escape`&&We.open&&!document.querySelector(`[role='dialog']`)&&Xe(!1)}),f(`pointermove`,A,e=>{E(r)&&Qe(o+(a-e.clientX))}),f(`pointerup`,A,u),f(`pointercancel`,A,u);var p=W(d),m=z(p,2);Lc(m,{});var g=z(m,2);TL(g,{});var _=z(g,2),v=e=>{var t=GR(),n=M(t,!0);H(()=>c(n,ze.promptError??ze.error)),y(e,t)};h(_,e=>{(ze.promptError??ze.error)&&e(v)});var b=z(_,2),S=e=>{kL(e,{get todos(){return ze.todos}})};h(b,e=>{ze.sessionId&&ze.todos.length>0&&e(S)});var C=z(b,2),w=e=>{var t=KR(),r=z(W(t),2),i=W(r);Ln(i,{class:`h-3 w-3`}),n(r),n(t),l(`click`,r,()=>{Z.editing!==null&&(Z.text=``),Z.editing=null}),y(e,t)};h(C,e=>{Z.editing!==null&&e(w)}),WR(z(C,2),{}),n(d),H(()=>{Y(d,1,`relative flex h-full w-full flex-col bg-background min-[720px]:w-(--agent-panel-width) min-[720px]:overflow-hidden duration-150 ease-in-out ${E(r)?``:`min-[720px]:transition-[width,border-color] max-[720px]:transition-[transform,visibility]`} ${We.open?`border-l border-border`:`border-l-0 max-[720px]:translate-x-full max-[720px]:invisible`}`),j(d,`--agent-panel-width: ${(We.open?We.width:0)??``}px`)}),f(`dragover`,d,e=>e.preventDefault()),f(`drop`,d,function(...e){be?.apply(this,e)}),l(`pointerdown`,p,s),y(e,d),x()}T([`pointerdown`,`click`]);var YR=new Set([`$$slots`,`$$events`,`$$legacy`]);function XR(e,t){let n=U(t,YR),r=[[`path`,{d:`M14 17H5`}],[`path`,{d:`M19 7h-9`}],[`circle`,{cx:`17`,cy:`17`,r:`3`}],[`circle`,{cx:`7`,cy:`7`,r:`3`}]];ye(e,K({name:`settings-2`},()=>n,{get iconNode(){return r}}))}var ZR=new Set([`$$slots`,`$$events`,`$$legacy`]);function QR(e,t){let n=U(t,ZR),r=[[`path`,{d:`M12 20v2`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M17 20v2`}],[`path`,{d:`M17 2v2`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M2 17h2`}],[`path`,{d:`M2 7h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`M20 17h2`}],[`path`,{d:`M20 7h2`}],[`path`,{d:`M7 20v2`}],[`path`,{d:`M7 2v2`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`}]];ye(e,K({name:`cpu`},()=>n,{get iconNode(){return r}}))}var $R=new Set([`$$slots`,`$$events`,`$$legacy`]);function ez(e,t){let n=U(t,$R),r=[[`path`,{d:`M12 8V4H8`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}],[`path`,{d:`M2 14h2`}],[`path`,{d:`M20 14h2`}],[`path`,{d:`M15 13v2`}],[`path`,{d:`M9 13v2`}]];ye(e,K({name:`bot`},()=>n,{get iconNode(){return r}}))}var tz=r(`<button><span class="flex items-center gap-1 font-medium"> </span> <span class="mt-0.5 block text-[10px] leading-snug text-muted-foreground"> </span></button>`),nz=r(`<button> </button>`),rz=r(`<section class="space-y-1.5" aria-label="Default mode"><span class="text-[11px] font-medium text-muted-foreground">Default mode</span> <div class="grid grid-cols-2 gap-1.5"></div></section> <section class="space-y-1.5" aria-label="Behavior"><span class="text-[11px] font-medium text-muted-foreground">Behavior</span> <div class="space-y-1"><span class="text-[10px] text-muted-foreground">LLM preset</span> <div class="flex gap-1.5"></div></div> <div class="space-y-1"><span class="text-[10px] text-muted-foreground">Approval policy</span> <div class="flex gap-1.5"></div></div></section>`,1),iz=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),az=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground">Agent settings unavailable <!></div>`),oz=r(`<div class="text-xs text-destructive" role="alert"> </div>`),sz=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">Agent</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Defaults for new sessions; the panel header switches an existing session's mode.</p></div> <!> <!></div>`);function cz(e,r){i(r,!0);let a=V(null),o=[`deterministic`,`live`],s=[`ask`,`never`],u=I(()=>Q.view);async function d(e){let t=await xe(e);t&&(t.outcome===`rejected`?F(a,`${t.code}: ${t.detail}`):t.outcome===`error`?F(a,t.message,!0):F(a,null))}var f=sz(),p=z(W(f),2),m=e=>{var r=rz(),i=q(r),a=z(W(i),2);t(a,21,()=>_t,e=>e.id,(e,t)=>{var r=tz(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0);n(r),H(()=>{Y(r,1,`rounded-md border p-2 text-left transition-colors ${E(u).settings.defaultMode===E(t).id?`border-primary bg-primary/10`:`border-border hover:bg-muted`}`),B(r,`aria-pressed`,E(u).settings.defaultMode===E(t).id),r.disabled=Q.updating,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>void d({defaultMode:E(t).id})),y(e,r)}),n(a),n(i);var f=z(i,2),p=z(W(f),2),m=z(W(p),2);t(m,20,()=>o,e=>e,(e,t)=>{var n=nz(),r=M(n,!0);H(()=>{Y(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(u).settings.preset===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(u).settings.preset===t),n.disabled=Q.updating,c(r,t)}),l(`click`,n,()=>void d({preset:t})),y(e,n)}),n(m),n(p);var h=z(p,2),g=z(W(h),2);t(g,20,()=>s,e=>e,(e,t)=>{var n=nz(),r=M(n,!0);H(()=>{Y(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(u).settings.permissions.approvalPolicy===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(u).settings.permissions.approvalPolicy===t),n.disabled=Q.updating,c(r,t)}),l(`click`,n,()=>void d({permissions:{approvalPolicy:t}})),y(e,n)}),n(g),n(h),n(f),y(e,r)},g=e=>{var t=iz();y(e,t)},_=e=>{var t=az(),r=z(W(t));An(r,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void Ke(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),y(e,t)};h(p,e=>{E(u)?e(m):Q.loading?e(g,1):e(_,-1)});var v=z(p,2),b=e=>{var t=oz(),n=M(t,!0);H(()=>c(n,E(a))),y(e,t)};h(v,e=>{E(a)&&e(b)}),n(f),y(e,f),x()}T([`click`]);var lz=new Set([`$$slots`,`$$events`,`$$legacy`]);function uz(e,t){let n=U(t,lz),r=[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`}],[`path`,{d:`m2 22 3-3`}],[`path`,{d:`M7.5 13.5 10 11`}],[`path`,{d:`M10.5 16.5 13 14`}],[`path`,{d:`m18 3-4 4h6l-4 4`}]];ye(e,K({name:`plug-zap`},()=>n,{get iconNode(){return r}}))}var dz=new Set([`$$slots`,`$$events`,`$$legacy`]);function fz(e,t){let n=U(t,dz),r=[[`path`,{d:`M12 22v-5`}],[`path`,{d:`M15 8V2`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`}],[`path`,{d:`M9 8V2`}]];ye(e,K({name:`plug`},()=>n,{get iconNode(){return r}}))}var pz=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),mz=r(`<p class="text-[10px] text-muted-foreground">The panel reconnects automatically; keep the daemon running via the tray or the <code class="rounded bg-muted px-1 font-mono">skill-creator start</code> command.</p>`),hz=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">General</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Shell-level state of this Skill Creator instance.</p></div> <section class="space-y-1.5" aria-label="Daemon connection"><span class="text-[11px] font-medium text-muted-foreground">Daemon connection</span> <div class="flex items-center gap-2 rounded-md border border-border bg-background/60 p-2.5"><!> <span> </span></div> <!></section></div>`);function gz(e,t){i(t,!0);let r=I(()=>{switch(wt.status){case`connected`:return`Connected`;case`connecting`:return`Connecting…`;case`disconnected`:return`Disconnected`;default:return`Idle`}});var a=hz(),o=z(W(a),2),s=z(W(o),2),l=W(s),u=e=>{uz(e,{class:`h-4 w-4 text-primary`})},d=e=>{{let t=I(()=>wt.status===`disconnected`?`text-destructive`:`text-muted-foreground`);fz(e,{get class(){return`h-4 w-4 ${E(t)??``}`}})}};h(l,e=>{wt.status===`connected`?e(u):e(d,-1)});var f=z(l,2),p=M(f,!0);n(s);var m=z(s,2),g=e=>{var t=pz(),n=M(t,!0);H(()=>c(n,wt.error)),y(e,t)},_=e=>{var t=mz();y(e,t)};h(m,e=>{wt.status===`disconnected`?e(g):e(_,-1)}),n(o),n(a),H(()=>{Y(f,1,`text-xs ${wt.status===`connected`?`text-primary`:wt.status===`disconnected`?`text-destructive`:`text-muted-foreground`}`),c(p,E(r))}),y(e,a),x()}var _z=new Set([`$$slots`,`$$events`,`$$legacy`]);function vz(e,t){let n=U(t,_z),r=[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`}],[`path`,{d:`m2 2 20 20`}]];ye(e,K({name:`eye-off`},()=>n,{get iconNode(){return r}}))}var yz=new Set([`$$slots`,`$$events`,`$$legacy`]);function bz(e,t){let n=U(t,yz),r=[[`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`}],[`path`,{d:`m15 5 4 4`}]];ye(e,K({name:`pencil`},()=>n,{get iconNode(){return r}}))}var xz=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sz(e,t){let n=U(t,xz),r=[[`path`,{d:`M12 3v12`}],[`path`,{d:`m17 8-5-5-5 5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}]];ye(e,K({name:`upload`},()=>n,{get iconNode(){return r}}))}var Cz=r(`<img alt=""/>`),wz=r(`<span class="flex h-5 w-5 items-center justify-center rounded text-[10px] font-semibold text-white" aria-hidden="true"> </span>`),Tz=r(`<span class="flex h-12 w-12 shrink-0 items-center justify-center rounded-md text-base font-semibold text-white" aria-hidden="true"> </span>`),Ez=r(`<button type="button"><span class="flex h-4 w-4 items-center justify-center rounded" aria-hidden="true"><img alt="" class="h-3.5 w-3.5 object-contain dark:invert"/></span></button>`),Dz=r(`<p class="text-[9px] text-muted-foreground">Duplicate catalog icons are merged; hover shows sharing providers.</p>`),Oz=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground">Icon</span> <div class="grid grid-cols-7 place-items-center gap-1"><button type="button" title="No icon — letter avatar with the color below (suppresses the catalog icon)" aria-label="No icon (letter avatar)"><span class="flex h-4 w-4 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span></button> <!></div> <!></div>`),kz=r(`<button type="button" title="No icon — letter avatar with the color below" aria-label="No icon (letter avatar)"><span class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span> No icon — use the letter avatar</button>`),Az=r(`<button type="button"><span class="h-4 w-4 rounded" aria-hidden="true"></span></button>`),jz=r(`<span class="text-[9px] text-destructive" role="alert">invalid hex</span>`),Mz=r(`<div class="space-y-1 border-t border-border pt-1.5"><span class="text-[10px] font-medium text-muted-foreground">Avatar color</span> <div class="flex flex-wrap items-center gap-1"><button type="button" title="Auto — deterministic hue from the route name" aria-label="Auto avatar color"><span class="flex h-4 w-4 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span></button> <!></div> <div class="flex items-center gap-1"><input aria-label="Avatar color hex" placeholder="#3b82f6"/> <!></div></div>`),Nz=r(`<div class="space-y-1 border-t border-border pt-1.5"><span class="text-[10px] font-medium text-muted-foreground">Letter</span> <div class="flex items-center gap-1.5"><input class="h-6 w-12 rounded border border-border bg-background px-1.5 text-center text-[11px] font-semibold uppercase outline-none focus:border-primary/60" aria-label="Avatar letter" maxlength="2"/> <button type="button" class="rounded px-1.5 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" title="Reset to the first letter of the display name">Reset</button></div></div>`),Pz=r(`<div class="absolute left-0 top-[calc(100%+4px)] z-30 w-[280px] space-y-2 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-md" role="dialog" aria-label="Route icon and avatar choices"><div class="flex items-center gap-2"><!> <div class="min-w-0"><p class="truncate text-xs font-medium"> </p> <p class="text-[10px] text-muted-foreground"> </p></div></div> <!> <div class="flex items-center justify-between gap-2 border-t border-border pt-1.5"><span class="text-[10px] text-muted-foreground">Custom image · ≤64 KiB</span> <button type="button" class="flex h-6 items-center gap-1 rounded px-1.5 text-[10px] hover:bg-muted"><!> Upload</button></div> <input type="file" accept=".svg,.png,.webp" class="hidden" aria-label="Upload custom icon"/> <!> <!></div>`),Fz=r(`<div class="relative shrink-0"><button type="button" aria-label="Change route icon"><!> <span class="absolute bottom-0 right-0 hidden bg-background p-px text-foreground group-hover:block" aria-hidden="true"><!></span></button> <!></div>`);function Iz(e,r){i(r,!0);let a=k(r,`icon`,3,null),o=k(r,`label`,3,``),s=k(r,`catalogIcons`,19,()=>[]),u=k(r,`disabled`,3,!1),d=[`#ef4444`,`#f59e0b`,`#10b981`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#f43f5e`,`#64748b`],p=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,m=V(!1),g=V(null),_=V(null),v=V(``),b=V(``),S=V(!1);de(()=>{F(v,r.letter,!0)});let C=I(()=>{let e=new Map;for(let t of s()){let n=e.get(t.icon);n?n.providers.push(t.provider):e.set(t.icon,{icon:t.icon,providers:[t.provider]})}let t=[...e.values()];return t.sort((e,t)=>+!e.providers.includes(r.provider)-!t.providers.includes(r.provider)||e.providers[0].localeCompare(t.providers[0])),t}),w=I(()=>s().some(e=>e.provider===r.provider));function T(e){u()||(r.onPick(e),F(m,!1))}function D(){if(r.onLetter===void 0||u())return;let e=E(v).trim();if(e.length===0||e===r.letter){F(v,r.letter,!0);return}r.onLetter(e.slice(0,2))}function O(){r.onLetter===void 0||u()||(r.onLetter(void 0),F(v,r.letter,!0))}function ee(){if(r.onColor===void 0||u())return;let e=E(b).trim();if(e.length===0){F(S,!1);return}if(!p.test(e)){F(S,!0);return}F(S,!1),F(b,``),r.onColor(e.toLowerCase())}function te(e){let t=e.currentTarget;if(!(t instanceof HTMLInputElement))return;let n=t.files?.[0];if(t.value=``,!n)return;let r=n.name.split(`.`).pop()?.toLowerCase()??``,i=LL[r]??``;if(i.length===0){Mn(`Unsupported icon type “${n.type||r||n.name}” — use .svg, .png or .webp.`);return}let a=new FileReader;a.onerror=()=>{Mn(`Could not read “${n.name}” — try another file.`)},a.onload=()=>{let e=typeof a.result==`string`?a.result:``;if(e.length===0){Mn(`Could not read “${n.name}” — try another file.`);return}let t=e.startsWith(`data:${i}`)?e:RL(e,i);if(t===null){Mn(`Could not read “${n.name}” as an image.`);return}if(t.length>65536){Mn(`Icon too large — pick an image under 64 KiB.`);return}T(t)},a.readAsDataURL(n)}var P=Fz();f(`keydown`,A,e=>{E(m)&&e.key===`Escape`&&F(m,!1)}),f(`pointerdown`,A,e=>{E(m)&&E(g)&&!E(g).contains(e.target)&&F(m,!1)});var L=W(P),ne=W(L),re=e=>{var t=Cz();H(e=>{B(t,`src`,a()),Y(t,1,`h-5 w-5 object-contain ${e??``}`)},[()=>NL(a())?``:`dark:invert`]),y(e,t)},ie=e=>{var t=wz(),n=M(t,!0);H(()=>{j(t,`background: ${r.color??``}`),c(n,r.letter)}),y(e,t)};h(ne,e=>{a()?e(re):e(ie,-1)});var R=z(ne,2);bz(W(R),{class:`h-2.5 w-2.5`}),n(R),n(L);var ae=z(L,2),ce=e=>{var i=Pz(),s=W(i),p=W(s),g=e=>{var t=Cz();H(e=>{B(t,`src`,a()),Y(t,1,`h-12 w-12 shrink-0 object-contain ${e??``}`)},[()=>NL(a())?``:`dark:invert`]),y(e,t)},x=e=>{var t=Tz(),n=M(t,!0);H(()=>{j(t,`background: ${r.color??``}`),c(n,r.letter)}),y(e,t)};h(p,e=>{a()?e(g):e(x,-1)});var k=z(p,2),A=W(k),P=M(A,!0),I=z(A,2),L=M(I,!0);n(k),n(s);var ne=z(s,2),re=e=>{var i=Oz(),o=z(W(i),2),s=W(o),u=W(s),d=M(u,!0);n(s);var f=z(s,2);t(f,17,()=>E(C),e=>e.icon,(e,t)=>{var i=Ez(),o=W(i),s=M(o);n(i),H((e,n)=>{Y(i,1,`flex h-6 w-6 items-center justify-center rounded ${a()===E(t).icon?`border border-primary/60 bg-primary/5`:`hover:bg-muted`}`),B(i,`title`,e),B(i,`aria-label`,`Use icon shared by ${n??``}`),j(o,`background: color-mix(in srgb, ${r.color??``} 18%, transparent)`),B(s,`src`,E(t).icon)},[()=>E(t).providers.join(`, `),()=>E(t).providers.length>1?E(t).providers.join(`, `):E(t).providers[0]]),l(`click`,i,()=>T(E(t).icon)),y(e,i)}),n(o);var p=z(o,2),g=e=>{var t=Dz();y(e,t)};h(p,e=>{E(w)&&e(g)}),n(i),H(e=>{Y(s,1,`flex h-6 w-6 items-center justify-center rounded border ${a()===null?`border-primary/50 bg-primary/5`:`border-border hover:bg-muted`}`),j(u,`background: ${r.color??``}`),c(d,e)},[()=>r.letter.slice(0,1)]),l(`click`,s,()=>{if(r.onSuppress!==void 0){r.onSuppress(),F(m,!1);return}T(void 0)}),y(e,i)},ie=e=>{var t=kz(),i=W(t),o=M(i,!0);oe(),n(t),H(e=>{Y(t,1,`flex w-full items-center gap-2 rounded px-1 py-0.5 text-[10px] transition-colors hover:bg-muted ${a()===null?`text-primary`:`text-muted-foreground`}`),j(i,`background: ${r.color??``}`),c(o,e)},[()=>r.letter.slice(0,1)]),l(`click`,t,()=>T(void 0)),y(e,t)};h(ne,e=>{E(C).length>0?e(re):e(ie,-1)});var R=z(ne,2),ae=z(W(R),2);Sz(W(ae),{class:`h-3 w-3`}),oe(),n(ae),n(R);var V=z(R,2);se(V,e=>F(_,e),()=>E(_));var ce=z(V,2),U=e=>{var i=Mz(),a=z(W(i),2),o=W(a),s=W(o),p=M(s,!0);n(o);var m=z(o,2);t(m,16,()=>d,e=>e,(e,t)=>{var n=Az(),i=M(n);H(e=>{Y(n,1,`flex h-6 w-6 items-center justify-center rounded border ${e??``}`),B(n,`title`,t),B(n,`aria-label`,`Avatar color ${t??``}`),j(i,`background: ${t??``}`)},[()=>r.color.toLowerCase()===t?`border-primary/60 bg-primary/5`:`border-border hover:bg-muted`]),l(`click`,n,()=>r.onColor?.(t)),y(e,n)}),n(a);var g=z(a,2),_=W(g);le(_);var v=z(_,2),x=e=>{var t=jz();y(e,t)};h(v,e=>{E(S)&&e(x)}),n(g),n(i),H((e,t,n)=>{Y(o,1,`flex h-6 w-6 items-center justify-center rounded border ${e??``}`),j(s,`background: ${t??``}`),c(p,n),Y(_,1,`h-6 w-24 rounded border bg-background px-1.5 font-mono text-[10px] outline-none focus:border-primary/60 ${E(S)?`border-destructive`:`border-border`}`),_.disabled=u()},[()=>r.color===jL(r.provider)?`border-primary/50 bg-primary/5`:`border-border hover:bg-muted`,()=>jL(r.provider),()=>r.letter.slice(0,1)]),l(`click`,o,()=>r.onColor?.(void 0)),f(`blur`,_,()=>ee()),l(`keydown`,_,e=>{e.key===`Enter`&&ee()}),N(_,()=>E(b),e=>F(b,e)),y(e,i)};h(ce,e=>{r.onColor!==void 0&&e(U)});var G=z(ce,2),ue=e=>{var t=Nz(),r=z(W(t),2),i=W(r);le(i);var a=z(i,2);n(r),n(t),H(()=>i.disabled=u()),f(`blur`,i,()=>D()),l(`keydown`,i,e=>{e.key===`Enter`&&D()}),N(i,()=>E(v),e=>F(v,e)),l(`click`,a,O),y(e,t)};h(G,e=>{r.onLetter!==void 0&&e(ue)}),n(i),H(e=>{c(P,o()||r.provider),c(L,e)},[()=>a()?NL(a())?`Legacy letter avatar`:`Icon override`:`Letter avatar`]),l(`click`,ae,()=>E(_)?.click()),l(`change`,V,te),y(e,i)};h(ae,e=>{E(m)&&e(ce)}),n(P),se(P,e=>F(g,e),()=>E(g)),H(()=>{Y(L,1,`group relative flex h-7 w-7 items-center justify-center overflow-hidden rounded-md border border-border bg-background transition-colors hover:border-primary/50 ${u()?`pointer-events-none opacity-50`:``}`),B(L,`aria-expanded`,E(m)),L.disabled=u()}),l(`click`,L,()=>F(m,!E(m))),y(e,P),x()}T([`click`,`change`,`keydown`]);var Lz=r(`<span class="flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[10px]"> <button type="button" class="rounded px-0.5 text-muted-foreground hover:text-destructive">×</button></span>`),Rz=r(`<span class="shrink-0 rounded bg-primary/10 px-1 text-[9px] text-primary">vision</span>`),zz=r(`<li><button role="option"><span class="min-w-0 flex-1 truncate"> <span class="text-muted-foreground"> </span></span> <!></button></li>`),Bz=r(`<ul class="absolute z-10 mt-1 max-h-44 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-xs shadow-md" role="listbox" aria-label="Model suggestions"></ul>`),Vz=r(`<div class="relative"><div class="flex min-h-8 flex-wrap items-center gap-1 rounded-md border border-border bg-background px-1.5 py-1 text-xs focus-within:border-primary/60" role="group" aria-label="Model ids"><input class="order-last h-6 min-w-24 flex-1 bg-transparent text-xs outline-none"/> <!></div> <!></div>`);function Hz(e,r){i(r,!0);let a=k(r,`placeholder`,3,`Add model…`),o=k(r,`disabled`,3,!1),s=V(``),u=V(!1),d=V(0),p=I(()=>{let e=E(s).trim().toLowerCase(),t=r.candidates.filter(e=>!r.selected.includes(e.id));return e.length===0?t.slice(0,8):t.filter(t=>t.id.toLowerCase().includes(e)||(t.name??``).toLowerCase().includes(e)).slice(0,8)});function m(e){let t=e.trim();if(t.length===0||r.selected.includes(t)){F(s,``);return}r.onchange([...r.selected,t]),F(s,``),F(u,!1)}function g(e){r.onchange(r.selected.filter(t=>t!==e))}function _(e){if(e.key===`Escape`){F(u,!1);return}if(e.key===`ArrowDown`&&E(p).length>0){e.preventDefault(),F(u,!0),F(d,Math.min(E(d)+1,E(p).length-1),!0);return}if(e.key===`ArrowUp`&&E(p).length>0){e.preventDefault(),F(d,Math.max(E(d)-1,0),!0);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),E(u)&&E(p)[E(d)]&&E(s).trim().length>0?m(E(p)[E(d)].id):E(s).trim().length>0&&m(E(s));return}e.key===`Backspace`&&E(s).length===0&&r.selected.length>0&&r.onchange(r.selected.slice(0,-1))}var v=Vz(),b=W(v),S=W(b);le(S);var C=z(S,2);t(C,16,()=>r.selected,e=>e,(e,t)=>{var r=Lz(),i=W(r),a=z(i);n(r),H(()=>{c(i,`${t??``} `),B(a,`aria-label`,`Remove ${t??``}`),a.disabled=o()}),l(`click`,a,()=>g(t)),y(e,r)}),n(b);var w=z(b,2),T=e=>{var r=Bz();t(r,23,()=>E(p),e=>e.id,(e,t,r)=>{var i=zz(),a=W(i),o=W(a),s=W(o),u=z(s),p=M(u);n(o);var g=z(o,2),_=e=>{var t=Rz();y(e,t)};h(g,e=>{E(t).image&&e(_)}),n(a),n(i),H(()=>{Y(a,1,`flex w-full items-center gap-2 rounded px-1.5 py-1 text-left ${E(r)===E(d)?`bg-accent`:``} hover:bg-accent`),B(a,`aria-selected`,E(r)===E(d)),c(s,`${E(t).name??E(t).id??``} `),c(p,`(${E(t).id??``})`)}),l(`mousedown`,a,e=>e.preventDefault()),l(`click`,a,()=>m(E(t).id)),f(`focus`,a,()=>F(d,E(r),!0)),y(e,i)}),n(r),y(e,r)};h(w,e=>{E(u)&&E(p).length>0&&e(T)}),n(v),H(()=>{B(S,`placeholder`,a()),S.disabled=o()}),l(`keydown`,S,_),f(`focus`,S,()=>{F(u,!0),F(d,0)}),l(`input`,S,()=>{F(u,!0),F(d,0)}),f(`blur`,S,()=>setTimeout(()=>F(u,!1),120)),N(S,()=>E(s),e=>F(s,e)),y(e,v),x()}T([`keydown`,`input`,`click`,`mousedown`]);function Uz(e){return e.split(/[-_]+/).filter(e=>e.length>0).map(e=>/^[a-z]{1,3}$/.test(e)?e.toUpperCase():e.slice(0,1).toUpperCase()+e.slice(1)).join(` `)}function Wz(e){if(!Number.isSafeInteger(e)||e<=0)return String(e);if(e%1048576==0)return`${e/1048576}M`;if(e>=1024){let t=e/1024;return`${Number.isInteger(t)?t.toString():t.toFixed(1)}k`}return String(e)}function Gz(e){return e.includes(`/`)||e.includes(`@`)}function Kz(e){return{id:e.id,...e.name===void 0?{}:{name:e.name},image:e.image,...e.contextWindow===void 0?{}:{contextWindow:e.contextWindow},...e.supportsReasoningEffort===void 0?{}:{supportsReasoningEffort:e.supportsReasoningEffort},...e.inputTypes===void 0?{}:{inputTypes:[...e.inputTypes]},...e.maxOutputTokens===void 0?{}:{maxOutputTokens:e.maxOutputTokens},...e.effortTiers===void 0?{}:{effortTiers:[...e.effortTiers]}}}var qz=(e,t)=>e.id<t.id?-1:+(e.id>t.id);function Jz(e,t=``){let n=new Map,r=new Map;for(let i of e?.providers??[]){let e=i.provider===t;for(let t of i.models)if(e)n.has(t.id)||n.set(t.id,Kz(t)),r.delete(t.id);else if(!n.has(t.id)&&!r.has(t.id)){if(Gz(t.id))continue;r.set(t.id,Kz(t))}}return[...n.values()].sort(qz).concat([...r.values()].sort(qz))}var Yz=[`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Xz=[`low`,`high`,`max`],Zz=`Catalog marks this model as not supporting reasoning effort`;function Qz(e,t){if(t?.supportsReasoningEffort===!1)return{candidates:[],hint:Zz};let n=new Set(Yz);for(let e of t?.effortTiers??[]){let t=e.trim();t.length>0&&n.add(t)}for(let t of e)for(let e of t.efforts??[]){let t=e.trim();t.length>0&&n.add(t)}return{candidates:[...n].sort((e,t)=>e<t?-1:+(e>t)),hint:null}}function $z(e){return{id:e.id,...e.name===void 0?{}:{name:e.name},...e.contextWindow===void 0?{}:{contextWindow:e.contextWindow},...e.maxOutputTokens===void 0?{}:{maxOutputTokens:e.maxOutputTokens},inputTypes:e.inputTypes??(e.image?[`text`,`image`]:[`text`]),outputTypes:[`text`],efforts:[...Xz]}}var eB=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500" title="Unsaved changes" aria-label="Unsaved changes"></span>`),tB=r(`<span data-header-status="true"><!></span>`),nB=r(`<option> </option>`),rB=r(`<p class="text-[10px] text-muted-foreground" role="note"> </p>`),iB=r(`<p class="text-[10px] text-destructive" role="alert">Invalid token value — use numbers, or shorthand like 253k / 0.5M.</p>`),aB=r(`<button type="button"> </button>`),oB=r(`<div class="grid grid-cols-2 gap-1.5"><label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Model id</span> <!> <datalist></datalist></label> <label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Name</span> <!></label></div> <div class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">Efforts</span> <!> <!></div> <div class="grid grid-cols-2 gap-1.5"><label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Context window</span> <!></label> <label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Max output tokens</span> <!></label></div> <!> <div class="flex flex-wrap items-center justify-between gap-2"><div class="flex flex-wrap items-center gap-1"><span class="text-[10px] text-muted-foreground">Inputs:</span> <span class="rounded bg-primary px-1.5 py-0.5 text-[10px] font-medium text-primary-foreground" title="Text is always required" data-input-chip="text">text</span> <!></div> <div class="flex items-center gap-1"><span class="text-[10px] text-muted-foreground">Outputs:</span> <span class="rounded bg-primary px-1.5 py-0.5 text-[10px] font-medium text-primary-foreground" title="Text output is always required" data-output-chip="text">text</span> <button type="button" title="Image output (image-generation models)" data-output-chip="image">image</button></div></div> <div class="flex items-center justify-between gap-2 border-t border-border pt-1.5"><span data-form-status="true"><!></span> <span class="flex shrink-0 items-center gap-1.5"><!> <!></span></div>`,1),sB=r(`<div class="space-y-1.5 rounded-md border border-border p-2"><div class="flex items-center justify-between gap-2"><div class="flex min-w-0 flex-1 items-center gap-1.5"><!> <span class="min-w-0 truncate text-xs font-medium" data-header-name="true"> </span> <!></div> <div class="flex shrink-0 items-center"><button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button> <button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button> <button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-destructive disabled:pointer-events-none disabled:opacity-50" title="Remove model"><!></button></div></div> <!></div>`);function cB(e,r){i(r,!0);let a=k(r,`routeModels`,19,()=>[]),o=k(r,`provider`,3,``),s=k(r,`formKey`,3,``),u=k(r,`disabled`,3,!1),d=k(r,`dirty`,3,!1),f=k(r,`initialExpanded`,3,!1),p=I(()=>s().trim().length>0),m=[`image`,`video`,`pdf`],g=`model-id-candidates-${crypto.randomUUID()}`,_=V(J(r.model.id)),v=V(J(r.model.name??Uz(r.model.id))),b=V(J(r.model.contextWindow===void 0?``:Wz(r.model.contextWindow))),S=V(J(r.model.maxOutputTokens===void 0?``:Wz(r.model.maxOutputTokens))),w=V(!1),T=V(!1),D=V(J((r.model.outputTypes??[]).includes(`image`))),O=V(!1),A=V(!1),j=V(!1),ee=V(!1),te=V(!1),N=V(!1),P=V(null),L=V(J(r.model.id)),ne=V(``),re=V(J(f())),ie=I(()=>E(_).trim().length>0),R=I(()=>E(ie)&&!E(ee)&&!E(te)),ae=I(()=>new Set(r.model.inputTypes??[`text`])),se=I(()=>r.candidates.find(e=>e.id===E(_).trim())??null),ce=I(()=>Qz(a(),E(se))),U=I(()=>E(ne).trim()),le=I(()=>r.model.name??(r.model.id.length>0?Uz(r.model.id):`New model`)),G=I(()=>u()||!E(ie)||E(N)||r.api.length===0||r.baseURL.length===0||!E(p)&&!r.apiKeyConfigured&&E(U).length===0);de(()=>{r.onvalidity(E(R))});function ue(e){r.onchange({...r.model,...e})}function K(e){F(_,e,!0);let t=e.trim(),n=r.candidates.find(e=>e.id===t),i={id:t};n===void 0?(F(L,null),E(w)||(F(v,Uz(t),!0),r.model.name!==void 0&&(i.name=void 0)),!E(O)&&r.model.contextWindow!==void 0&&(F(b,``),i.contextWindow=void 0),!E(A)&&r.model.maxOutputTokens!==void 0&&(F(S,``),i.maxOutputTokens=void 0),!E(T)&&r.model.inputTypes!==void 0&&(i.inputTypes=void 0),!E(D)&&r.model.outputTypes!==void 0&&(i.outputTypes=void 0)):(t!==E(L)&&(F(w,!1),F(O,!1),F(A,!1),F(T,!1),F(D,!1),F(j,!1),F(L,t,!0)),E(w)||(F(v,n.name??Uz(n.id),!0),i.name=E(v)),E(O)||(n.contextWindow===void 0?r.model.contextWindow!==void 0&&(F(b,``),i.contextWindow=void 0):(F(b,Wz(n.contextWindow),!0),i.contextWindow=n.contextWindow)),E(A)||(n.maxOutputTokens===void 0?r.model.maxOutputTokens!==void 0&&(F(S,``),i.maxOutputTokens=void 0):(F(S,Wz(n.maxOutputTokens),!0),i.maxOutputTokens=n.maxOutputTokens)),E(T)||(i.inputTypes=n.inputTypes??(n.image?[`text`,`image`]:[`text`])),E(D)||(i.outputTypes=[`text`]),!E(j)&&r.model.efforts===void 0&&(i.efforts=[...Xz])),ue(i)}function fe(e){F(v,e,!0),F(w,!0),ue(e.trim().length>0?{name:e.trim()}:{name:void 0})}function pe(e){let t=E(e===`contextWindow`?b:S).trim(),n=t=>{F(e===`contextWindow`?ee:te,t,!0)};if(t.length===0){n(!1),ue(e===`contextWindow`?{contextWindow:void 0}:{maxOutputTokens:void 0});return}let r=vt(t);if(r===null){n(!0);return}n(!1),e===`contextWindow`?(F(b,Wz(r),!0),F(O,!0)):(F(S,Wz(r),!0),F(A,!0)),ue(e===`contextWindow`?{contextWindow:r}:{maxOutputTokens:r})}function me(e){F(T,!0);let t=new Set(E(ae));t.has(e)?t.delete(e):t.add(e),t.add(`text`),ue({inputTypes:[`text`,...m.filter(e=>t.has(e))]})}let he=I(()=>new Set(r.model.outputTypes??[`text`]));function X(e){F(D,!0);let t=new Set(E(he));t.has(e)?t.delete(e):t.add(e),t.add(`text`),ue({outputTypes:[`text`,`image`].filter(e=>t.has(e))})}async function ge(){if(E(N)||!E(ie)||!E(p)&&!r.apiKeyConfigured&&E(U).length===0)return;let e=E(p)?s().trim():r.apiKeyConfigured?null:E(U);F(N,!0),F(P,null);let t=await ke({api:r.api,baseURL:r.baseURL,modelId:E(_).trim(),...e===null?o().length>0?{provider:o()}:{}:{apiKey:e}});F(N,!1),t!==null&&F(P,t,!0)}var _e=sB(),ve=W(_e),ye=W(ve),be=W(ye),xe=e=>{var t=eB();y(e,t)};h(be,e=>{d()&&e(xe)});var Z=z(be,2),Se=M(Z,!0),Ce=z(Z,2),we=e=>{var t=tB(),r=W(t),i=e=>{var t=C(`testing…`);y(e,t)},a=e=>{var t=C();H(()=>c(t,`ok · ${E(P).latencyMs??``} ms`)),y(e,t)},o=e=>{var t=C();H(()=>c(t,`failed · ${E(P).detail??``}`)),y(e,t)};h(r,e=>{E(N)?e(i):E(P)?.outcome===`ok`?e(a,1):E(P)?.outcome===`failed`&&e(o,2)}),n(t),H(()=>Y(t,1,`min-w-0 shrink-0 truncate text-[10px] ${E(P)?.outcome===`ok`?`text-primary`:E(P)?.outcome===`failed`?`text-destructive`:`text-muted-foreground`}`)),y(e,t)};h(Ce,e=>{E(re)||e(we)}),n(ye);var Te=z(ye,2),Ee=W(Te);uz(W(Ee),{class:`h-4 w-4`,"aria-hidden":`true`}),n(Ee);var De=z(Ee,2);bz(W(De),{class:`h-4 w-4`,"aria-hidden":`true`}),n(De);var Oe=z(De,2),Ae=W(Oe);Cn(Ae,{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe),n(Te),n(ve);var je=z(ve,2),Me=e=>{var i=oB(),a=q(i),o=W(a),s=z(W(o),2);zn(s,{class:`h-8 font-mono text-xs`,"aria-label":`Model id`,placeholder:`glm-5.3-flash`,get list(){return g},get disabled(){return u()},oninput:e=>K(e.currentTarget.value),get value(){return E(_)},set value(e){F(_,e,!0)}});var d=z(s,2);t(d,21,()=>r.candidates.slice(0,200),e=>e.id,(e,t)=>{var n=nB(),r=M(n,!0),i={};H(()=>{c(r,E(t).name??``),i!==(i=E(t).id)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(d),n(o);var f=z(o,2),x=z(W(f),2);{let e=I(()=>Uz(E(_).trim()||r.model.id));zn(x,{class:`h-8 text-xs`,"aria-label":`Model name`,get placeholder(){return E(e)},get disabled(){return u()},oninput:e=>fe(e.currentTarget.value),get value(){return E(v)},set value(e){F(v,e,!0)}})}n(f),n(a);var w=z(a,2),T=z(W(w),2);{let e=I(()=>r.model.efforts??[]),t=I(()=>E(ce).candidates.map(e=>({id:e})));Hz(T,{get selected(){return E(e)},get candidates(){return E(t)},placeholder:`Add effort (e.g. low)…`,get disabled(){return u()},onchange:e=>{F(j,!0),ue(e.length>0?{efforts:e}:{efforts:void 0})}})}var D=z(T,2),O=e=>{var t=rB(),n=M(t,!0);H(()=>c(n,E(ce).hint)),y(e,t)};h(D,e=>{E(ce).hint!==null&&e(O)}),n(w);var k=z(w,2),A=W(k),L=z(W(A),2);{let e=I(()=>E(ee)?`border-destructive focus-visible:ring-destructive`:``);zn(L,{get class(){return`h-8 text-xs ${E(e)??``}`},"aria-label":`Context window (tokens)`,placeholder:`200k / 0.5M / 131072`,get disabled(){return u()},onblur:()=>pe(`contextWindow`),onkeydown:e=>{e.key===`Enter`&&pe(`contextWindow`)},get value(){return E(b)},set value(e){F(b,e,!0)}})}n(A);var re=z(A,2),ie=z(W(re),2);{let e=I(()=>E(te)?`border-destructive focus-visible:ring-destructive`:``);zn(ie,{get class(){return`h-8 text-xs ${E(e)??``}`},"aria-label":`Max output tokens`,placeholder:`32k / 131072`,get disabled(){return u()},onblur:()=>pe(`maxOutputTokens`),onkeydown:e=>{e.key===`Enter`&&pe(`maxOutputTokens`)},get value(){return E(S)},set value(e){F(S,e,!0)}})}n(re),n(k);var R=z(k,2),se=e=>{var t=iB();y(e,t)};h(R,e=>{(E(ee)||E(te))&&e(se)});var V=z(R,2),U=W(V),le=z(W(U),4);t(le,16,()=>m,e=>e,(e,t)=>{var n=aB(),r=M(n,!0);H((e,i)=>{Y(n,1,`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${e??``}`),B(n,`aria-pressed`,i),n.disabled=u(),c(r,t)},[()=>E(ae).has(t)?`border-primary bg-primary text-primary-foreground`:`border-border bg-background text-muted-foreground hover:bg-muted`,()=>E(ae).has(t)]),l(`click`,n,()=>me(t)),y(e,n)}),n(U);var de=z(U,2),J=z(W(de),4);n(de),n(V);var _e=z(V,2),ve=W(_e),ye=W(ve),be=e=>{var t=C();H(()=>c(t,`ok · ${E(P).latencyMs??``} ms`)),y(e,t)},xe=e=>{var t=C();H(()=>c(t,`failed · ${E(P).detail??``}`)),y(e,t)},Z=e=>{var t=C(`Probing with the route key above (saved on add).`);y(e,t)},Se=e=>{var t=C(`No saved key for this route — paste one to test (never stored).`);y(e,t)},Ce=e=>{var t=C(`Probe this endpoint with a minimal request.`);y(e,t)};h(ye,e=>{E(P)?.outcome===`ok`?e(be):E(P)?.outcome===`failed`?e(xe,1):E(p)?e(Z,2):r.apiKeyConfigured?e(Ce,-1):e(Se,3)}),n(ve);var we=z(ve,2),Te=W(we),Ee=e=>{zn(e,{type:`password`,class:`h-6 w-44 font-mono text-[10px]`,"aria-label":`API key (test only)`,placeholder:`API key (test only)`,autocomplete:`off`,get disabled(){return u()},get value(){return E(ne)},set value(e){F(ne,e,!0)}})};h(Te,e=>{!r.apiKeyConfigured&&!E(p)&&e(Ee)});var De=z(Te,2);{let e=I(()=>E(p)?`Send a minimal probe with the route key above (saved on add)`:r.apiKeyConfigured?`Send a minimal probe request`:`Send a minimal probe with the pasted key (not saved)`);An(De,{size:`sm`,variant:`outline`,class:`h-6 shrink-0 px-2 text-[10px]`,get disabled(){return E(G)},get title(){return E(e)},onclick:()=>void ge(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(N)?`Testing…`:`Test connection`)),y(e,n)},$$slots:{default:!0}})}n(we),n(_e),H((e,t)=>{B(d,`id`,g),Y(J,1,`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${e??``}`),B(J,`aria-pressed`,t),J.disabled=u(),Y(ve,1,`min-w-0 truncate text-[10px] ${E(P)?.outcome===`ok`?`text-primary`:E(P)?.outcome===`failed`?`text-destructive`:`text-muted-foreground`}`)},[()=>E(he).has(`image`)?`border-primary bg-primary text-primary-foreground`:`border-border bg-background text-muted-foreground hover:bg-muted`,()=>E(he).has(`image`)]),l(`click`,J,()=>X(`image`)),y(e,i)};h(je,e=>{E(re)&&e(Me)}),n(_e),H(()=>{B(_e,`aria-label`,`Model ${r.model.id??``}`),B(Z,`title`,r.model.id),c(Se,E(le)),B(Ee,`aria-label`,`Test connection for ${(r.model.id||`new model`)??``}`),B(Ee,`title`,E(p)?`Send a minimal probe with the route key (saved on add)`:r.apiKeyConfigured?`Send a minimal probe request`:`Expand and paste a key to test (not saved)`),Ee.disabled=E(G),B(De,`aria-label`,`Edit model ${(r.model.id||`new model`)??``}`),B(De,`title`,E(re)?`Collapse model form`:`Edit model fields`),De.disabled=u(),B(Oe,`aria-label`,`Remove model ${r.model.id??``}`),Oe.disabled=u()}),l(`click`,Ee,()=>void ge()),l(`click`,De,()=>F(re,!E(re))),l(`click`,Oe,()=>r.onremove()),y(e,_e),x()}T([`click`]);var lB=/^(.*)-(\d+)$/;function uB(e,t){let n=new Set(t.map(e=>e.provider));if(!n.has(e))return e;let r=1;for(let t of n){if(t===e)continue;let n=lB.exec(t);if(n===null||n[1]!==e)continue;let i=Number(n[2]);Number.isInteger(i)&&i>r&&(r=i)}return`${e}-${r+1}`}function dB(e){let t=lB.exec(e);if(t===null)return null;let n=Number(t[2]);return!Number.isInteger(n)||n<2?null:{base:t[1],n}}function fB(e,t){let n=dB(e.provider);if(n!==null){let e=t?.providers.find(e=>e.provider===n.base);if(e)return`${e.label} (${n.n-1})`}return t?.providers.find(t=>t.provider===e.provider)?.label??e.provider}var pB=`skill-creator.providerPresets.v1`,mB=ut({provider:dt().min(1),label:dt().min(1),api:dt().min(1).optional(),baseURL:dt().min(1),models:ct(dt().min(1)).min(1),icon:dt().min(1).optional(),iconLetter:dt().min(1).max(2).optional(),iconColor:dt().min(1).optional(),iconSuppressed:Ot().optional()}),hB=J({list:[]});function gB(){if(typeof localStorage>`u`)return[];let e=null;try{e=localStorage.getItem(pB)}catch{return[]}if(e===null)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=mB.safeParse(e);t.success&&n.push(t.data)}return n}function _B(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(pB,JSON.stringify(e))}catch{}}function vB(){return hB.list=gB(),hB.list}function yB(e){let t=hB.list.filter(t=>t.provider!==e);hB.list=t,_B(t)}var bB=r(`<p class="text-xs text-destructive" role="alert"> </p>`),xB=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),SB=r(`<p class="py-3 text-center text-[10px] text-muted-foreground"> </p>`),CB=r(`<img alt="" class="h-7 w-7 shrink-0 rounded-md bg-background object-contain p-0.5 dark:invert"/>`),wB=r(`<span class="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[11px] font-semibold text-white" aria-hidden="true"> </span>`),TB=r(`<div class="group relative"><button type="button" class="flex w-full items-center gap-2 rounded-md border border-border p-2 text-left transition-colors hover:border-primary/50 hover:bg-primary/5"><!> <span class="min-w-0 flex-1"><span class="block truncate text-xs font-medium"> </span> <span class="block truncate text-[10px] text-muted-foreground"> </span></span> <span class="mr-0.5 shrink-0 rounded bg-muted px-1 text-[9px] text-muted-foreground"> </span></button> <button type="button" class="absolute right-1 top-1 hidden rounded bg-popover/80 p-0.5 text-muted-foreground hover:text-destructive group-hover:block">×</button></div>`),EB=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground">Your presets</span> <div class="grid grid-cols-1 gap-1.5 min-[520px]:grid-cols-2"></div></div>`),DB=r(`<span class="rounded bg-primary/10 px-1 text-[9px] text-primary"> </span>`),OB=r(`<button type="button" class="flex w-full items-center gap-2 rounded-md border border-border p-2 text-left transition-colors hover:border-primary/50 hover:bg-primary/5"><!> <span class="min-w-0 flex-1"><span class="block truncate text-xs font-medium"> </span> <span class="block truncate text-[10px] text-muted-foreground"> </span></span> <span class="mr-0.5 flex shrink-0 items-center gap-1"><!> <span class="rounded bg-muted px-1 text-[9px] text-muted-foreground"> </span></span></button>`),kB=r(`<p class="col-span-full py-3 text-center text-[10px] text-muted-foreground"> </p>`),AB=r(`<div class="max-h-[52vh] space-y-2 overflow-y-auto pr-1"><!> <div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground"> </span> <div class="grid grid-cols-1 gap-1.5 min-[520px]:grid-cols-2"><!> <!></div></div></div>`),jB=r(`<div class="space-y-2"><div class="flex items-center gap-2"><!> <!> <!></div> <!> <!></div>`),MB=r(`<p class="text-[10px] text-amber-700" role="alert"> </p>`),NB=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs a name.</p>`),PB=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs an http(s) base URL.</p>`),FB=r(`<option> </option>`),IB=r(`<p class="rounded-md border border-dashed p-2 text-center text-[10px] text-muted-foreground">No models yet — add one to enable the route.</p>`),LB=r(`<div class="space-y-3"><div class="flex items-center gap-2"><!> <label class="min-w-0 flex-1 space-y-0.5"><span class="text-[10px] text-muted-foreground">Route name</span> <!></label></div> <!> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">Base URL</span> <!></label> <!> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API protocol</span> <select class="h-8 w-full rounded-md border border-border bg-background px-2 text-xs" aria-label="API protocol"></select></label> <div class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API key</span> <div class="relative"><!> <button type="button" class="absolute right-1.5 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-2.5 after:content-[''] hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button></div></div> <div class="space-y-1.5"><div class="flex items-center justify-between"><span class="text-[10px] font-medium text-muted-foreground">Models</span> <!></div> <!> <div class="space-y-1.5"></div></div> <!> <div class="flex items-center justify-between border-t border-border pt-2"><!> <!></div></div>`);function RB(e,r){i(r,!0);let a=k(r,`seed`,3,null),o=`anthropic-messages`,s=V(J(r.initialMode)),u=V(``),d=V(J(a()?.provider??``)),f=V(void 0),p=V(void 0),m=V(void 0),g=V(void 0),_=V(``),v=V(``),b=V(!1),S=I(()=>E(v).trim()),w=V(o),T=V(J(a()?.models?a().models.map(e=>ge(e)):[])),O=V(J(a()?.models?a().models.map(()=>!0):[])),A=V(!1),ee=V(!1),te=V(null),N=I(()=>Q.view),P=I(()=>E(N)?.settings.modelRoutes??[]),L=I(()=>(r.catalog?.providers??[]).flatMap(e=>e.icon?[{provider:e.provider,icon:e.icon}]:[])),ne=I(()=>E(d).trim()),re=I(()=>Jz(r.catalog,dB(E(ne))?.base??E(ne))),R=I(()=>fB({provider:E(ne)},r.catalog)),ae=I(()=>FL({provider:E(ne),iconLetter:E(m)},E(R))),se=I(()=>E(p)??jL(E(ne)||`route`)),ce=I(()=>{if(E(g)===!0)return null;if(E(f)!==void 0)return E(f);let e=dB(E(ne))?.base??E(ne);return r.catalog?.providers.find(t=>t.provider===e)?.icon??null}),U=I(()=>[...E(P).flatMap(e=>e.models),...E(T)]),le=I(()=>E(ne).length>0&&E(P).some(e=>e.provider===E(ne))),G=I(()=>/^https?:\/\//.test(E(_).trim())),ue=I(()=>E(O).length===E(T).length&&E(O).every(e=>e)),K=I(()=>E(ne).length>0&&!E(le)&&E(G)&&E(T).length>0&&E(ue)&&!Q.updating),pe=I(()=>E(N)?.providers.some(e=>e.provider===E(ne)&&e.configured)??!1),me=I(()=>{let e=E(u).trim().toLowerCase(),t=r.catalog?.providers??[];return e.length===0?t:t.filter(t=>t.label.toLowerCase().includes(e)||t.provider.toLowerCase().includes(e)||t.baseURL.toLowerCase().includes(e))}),Y=I(()=>{let e=E(u).trim().toLowerCase();return e.length===0?hB.list:hB.list.filter(t=>t.label.toLowerCase().includes(e)||t.provider.toLowerCase().includes(e)||t.baseURL.toLowerCase().includes(e))});function he(e){return E(P).filter(t=>t.provider===e||dB(t.provider)?.base===e).length}function ge(e){let t=dB(a()?.provider??``)?.base??a()?.provider??``,n=r.catalog?.providers.find(e=>e.provider===t)?.models.find(t=>t.id===e);return n===void 0?{id:e,efforts:[...Xz]}:$z(n)}vB(),de(()=>{E(s)});function _e(){F(d,``),F(f,void 0),F(p,void 0),F(m,void 0),F(g,void 0),F(_,``),F(w,o),F(T,[],!0),F(O,[],!0),F(s,`form`),F(A,!1),F(ee,!1),F(te,null)}async function ve(e){let t=await xe({modelRoutes:[...E(P),e]});if(t){if(t.outcome===`rejected`){F(te,`${t.code}: ${t.detail}`);return}if(t.outcome===`error`){F(te,t.message,!0);return}r.onadded(e.provider)}}async function ye(e){Q.updating||await ve({provider:uB(e.provider,E(P)),baseURL:e.baseURL,api:e.api,models:[...e.models].sort((e,t)=>Number(t.image)-Number(e.image)).slice(0,4).map(e=>$z(e)),...e.icon?{icon:e.icon}:{}})}async function be(e){Q.updating||await ve({provider:uB(e.provider,E(P)),baseURL:e.baseURL,api:e.api??o,models:e.models.map(e=>({id:e,efforts:[...Xz]})),...e.icon?{icon:e.icon}:{},...e.iconColor?{iconColor:e.iconColor}:{},...e.iconLetter?{iconLetter:e.iconLetter}:{},...e.iconSuppressed?{iconSuppressed:!0}:{}})}function Z(e,t){F(T,E(T).map((n,r)=>r===e?t:n),!0)}function Se(e,t){E(O)[e]!==t&&F(O,E(O).map((n,r)=>r===e?t:n),!0)}function Ce(e){F(T,E(T).filter((t,n)=>n!==e),!0),F(O,E(O).filter((t,n)=>n!==e),!0)}function we(){F(T,[...E(T),{id:``,efforts:[...Xz]}],!0),F(O,[...E(O),!1],!0)}async function Te(){if(E(K)){if(E(S).length>0){let e=await je(E(ne),E(S));if(e==null||e.outcome===`rejected`){F(te,e==null?`Could not save the API key — connection unavailable. The route was not created.`:`${e.code}: ${e.detail}`,!0);return}}await ve({provider:E(ne),baseURL:E(_).trim(),api:E(w),models:E(T).map(e=>({...e})),...E(f)?{icon:E(f)}:{},...E(p)?{iconColor:E(p)}:{},...E(m)?{iconLetter:E(m)}:{},...E(g)?{iconSuppressed:!0}:{}})}}var Ee=X(),De=q(Ee),Oe=e=>{var i=jB(),a=W(i),o=W(a);zn(o,{class:`h-8 flex-1 text-xs`,"aria-label":`Search providers`,placeholder:`Search providers…`,ref:null,get value(){return E(u)},set value(e){F(u,e,!0)}});var s=z(o,2),d=e=>{An(e,{size:`sm`,variant:`ghost`,class:`h-8 shrink-0 px-2 text-[11px]`,onclick:()=>r.onclose?.(),children:(e,t)=>{oe();var n=C(`Cancel`);y(e,n)},$$slots:{default:!0}})};h(s,e=>{E(P).length===0&&r.onclose&&e(d)});var f=z(s,2);An(f,{size:`sm`,variant:`ghost`,class:`h-8 shrink-0 px-2 text-[11px]`,onclick:_e,children:(e,t)=>{oe();var n=C(`Start from scratch →`);y(e,n)},$$slots:{default:!0}}),n(a);var p=z(a,2),m=e=>{var t=bB(),n=M(t,!0);H(()=>c(n,E(te))),y(e,t)};h(p,e=>{E(te)&&e(m)});var g=z(p,2),_=e=>{var t=xB(),n=M(t,!0);H(()=>c(n,r.catalogError)),y(e,t)},v=e=>{var t=SB(),n=M(t,!0);H(()=>c(n,r.catalogLoading?`Loading catalog…`:`Catalog unavailable.`)),y(e,t)},b=e=>{var i=AB(),a=W(i),o=e=>{var r=EB(),i=z(W(r),2);t(i,21,()=>E(Y),e=>e.provider,(e,t)=>{var r=TB(),i=W(r),a=W(i),o=e=>{var n=CB();H(()=>B(n,`src`,E(t).icon)),y(e,n)},s=e=>{var n=wB(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>E(t).iconColor??jL(E(t).provider),()=>FL({provider:E(t).provider,iconLetter:E(t).iconLetter},E(t).label)]),y(e,n)};h(a,e=>{E(t).icon?e(o):e(s,-1)});var u=z(a,2),d=W(u),f=M(d,!0),p=z(d,2),m=M(p,!0);n(u);var g=z(u,2),_=M(g,!0);n(i);var v=z(i,2);n(r),H(e=>{B(i,`title`,E(t).baseURL),i.disabled=Q.updating,c(f,E(t).label),c(m,e),B(g,`title`,`${E(t).models.length??``} saved models`),c(_,E(t).models.length),B(v,`aria-label`,`Delete preset ${E(t).label??``}`)},[()=>E(t).baseURL.replace(/^https?:\/\//,``)]),l(`click`,i,()=>void be(E(t))),l(`click`,v,()=>yB(E(t).provider)),y(e,r)}),n(i),n(r),y(e,r)};h(a,e=>{E(Y).length>0&&e(o)});var s=z(a,2),d=W(s),f=M(d),p=z(d,2),m=W(p);t(m,17,()=>E(me),e=>e.provider,(e,t)=>{let r=I(()=>he(E(t).provider)),i=I(()=>E(r)>0?`${E(t).baseURL} · ${E(t).api} · ${E(r)} copies added — click to add another`:`${E(t).baseURL} · ${E(t).api}`);var a=OB(),o=W(a),s=e=>{var n=CB();H(()=>B(n,`src`,E(t).icon)),y(e,n)},u=e=>{var n=wB(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>jL(E(t).provider),()=>E(t).label.slice(0,1).toUpperCase()]),y(e,n)};h(o,e=>{E(t).icon?e(s):e(u,-1)});var d=z(o,2),f=W(d),p=M(f,!0),m=z(f,2),g=M(m,!0);n(d);var _=z(d,2),v=W(_),b=e=>{var t=DB(),n=M(t);H(()=>{B(t,`title`,`${E(r)??``} cop${E(r)===1?`y`:`ies`} of this provider already added — you can add another`),c(n,`Added ✓${E(r)>1?` ×${E(r)}`:``}`)}),y(e,t)};h(v,e=>{E(r)>0&&e(b)});var x=z(v,2),S=M(x,!0);n(_),n(a),H(e=>{B(a,`title`,E(i)),a.disabled=Q.updating,c(p,E(t).label),c(g,e),B(x,`title`,`${E(t).models.length??``} models in catalog`),c(S,E(t).models.length)},[()=>E(t).baseURL.replace(/^https?:\/\//,``)]),l(`click`,a,()=>void ye(E(t))),y(e,a)});var g=z(m,2),_=e=>{var t=kB(),n=M(t);H(()=>c(n,`No providers match “${E(u)??``}”.`)),y(e,t)};h(g,e=>{E(me).length===0&&e(_)}),n(p),n(s),n(i),H(()=>c(f,`Catalog (${r.catalog.providers.length??``} providers, from models.dev)`)),y(e,i)};h(g,e=>{r.catalogError?e(_):r.catalog===null?e(v,1):e(b,-1)}),n(i),y(e,i)},ke=e=>{var r=LB(),i=W(r),a=W(i);{let e=I(()=>E(ne)||`route`);Iz(a,{get icon(){return E(ce)},get letter(){return E(ae)},get color(){return E(se)},get provider(){return E(e)},get label(){return E(R)},get catalogIcons(){return E(L)},get disabled(){return Q.updating},onPick:e=>{F(f,e,!0),F(g,void 0)},onSuppress:()=>F(g,!0),onColor:e=>F(p,e,!0),onLetter:e=>F(m,e,!0)})}var o=z(a,2),u=z(W(o),2);zn(u,{class:`h-8 text-xs`,"aria-label":`Route name`,placeholder:`my-provider`,get disabled(){return Q.updating},onblur:()=>F(ee,!0),get value(){return E(d)},set value(e){F(d,e,!0)}}),n(o),n(i);var x=z(i,2),O=e=>{var t=MB(),n=M(t);H(()=>c(n,`Route “${E(ne)??``}” already exists.`)),y(e,t)},k=e=>{var t=NB();y(e,t)};h(x,e=>{E(le)?e(O):E(ee)&&E(ne).length===0&&e(k,1)});var j=z(x,2),N=z(W(j),2);zn(N,{class:`h-8 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Q.updating},onblur:()=>F(A,!0),get value(){return E(_)},set value(e){F(_,e,!0)}}),n(j);var P=z(j,2),V=e=>{var t=PB();y(e,t)};h(P,e=>{E(A)&&!E(G)&&e(V)});var ue=z(P,2),de=z(W(ue),2);t(de,20,()=>Ct,e=>e,(e,t)=>{var n=FB(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(de),fe(de),n(ue);var q=z(ue,2),J=z(W(q),2),me=W(J);{let e=I(()=>E(b)?`text`:`password`),t=I(()=>E(pe)?`stored — this key overrides for add & test`:`API key`);zn(me,{class:`h-8 pr-9 text-xs`,get type(){return E(e)},autocomplete:`off`,"aria-label":`API key`,get placeholder(){return E(t)},get disabled(){return Q.updating},get value(){return E(v)},set value(e){F(v,e,!0)}})}var Y=z(me,2),he=W(Y),X=e=>{vz(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},ge=e=>{Jn(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(he,e=>{E(b)?e(X):e(ge,-1)}),n(Y),n(J),n(q);var _e=z(q,2),ve=W(_e),ye=z(W(ve),2);An(ye,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Q.updating},onclick:we,children:(e,t)=>{oe();var n=C(`+ Add model`);y(e,n)},$$slots:{default:!0}}),n(ve);var be=z(ve,2),xe=e=>{var t=IB();y(e,t)};h(be,e=>{E(T).length===0&&e(xe)});var Ee=z(be,2);t(Ee,21,()=>E(T),ie,(e,t,n)=>{{let r=I(()=>E(_).trim()),i=I(()=>E(t).id===``);cB(e,{get model(){return E(t)},get candidates(){return E(re)},get routeModels(){return E(U)},get api(){return E(w)},get baseURL(){return E(r)},get provider(){return E(ne)},get apiKeyConfigured(){return E(pe)},get formKey(){return E(S)},get disabled(){return Q.updating},get initialExpanded(){return E(i)},onchange:e=>Z(n,e),onremove:()=>Ce(n),onvalidity:e=>Se(n,e)})}}),n(Ee),n(_e);var De=z(_e,2),Oe=e=>{var t=bB(),n=M(t,!0);H(()=>c(n,E(te))),y(e,t)};h(De,e=>{E(te)&&e(Oe)});var ke=z(De,2),Ae=W(ke);An(Ae,{size:`sm`,variant:`ghost`,class:`h-7 px-2 text-xs`,onclick:()=>F(s,`pick`),children:(e,t)=>{oe();var n=C(`Back`);y(e,n)},$$slots:{default:!0}});var je=z(Ae,2);{let e=I(()=>!E(K));An(je,{size:`sm`,class:`h-7 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void Te(),children:(e,t)=>{oe();var n=C(`Create route`);y(e,n)},$$slots:{default:!0}})}n(ke),n(r),H(()=>{de.disabled=Q.updating,B(Y,`aria-label`,E(b)?`Hide API key`:`Show API key`),B(Y,`aria-pressed`,E(b)),B(Y,`title`,E(b)?`Hide API key`:`Show API key`),Y.disabled=Q.updating}),D(de,()=>E(w),e=>F(w,e)),l(`mousedown`,Y,e=>e.preventDefault()),l(`click`,Y,()=>F(b,!E(b))),y(e,r)};h(De,e=>{E(s)===`pick`?e(Oe):e(ke,-1)}),y(e,Ee),x()}T([`click`,`mousedown`]);var zB=r(`<option> </option>`),BB=r(`<p class="text-[11px] font-medium text-primary"> </p>`),VB=r(`<span class="text-[10px] text-amber-700">A route needs at least one model id.</span>`),HB=r(`<div><!></div>`),UB=r(`<p class="text-xs text-destructive" role="alert"> </p>`),WB=r(`<div class="space-y-3"><div class="flex items-start gap-2"><!> <div class="flex min-w-0 flex-1 items-center justify-between gap-2.5" data-route-titlebar="true"><div class="min-w-0"><p class="truncate text-sm font-semibold"> </p> <p class="mt-0.5 truncate text-[10px] text-muted-foreground"> </p></div> <div class="flex shrink-0 items-center gap-2.5"><button type="button" class="relative flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors after:absolute after:-inset-2 after:content-[''] hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none disabled:opacity-50" aria-label="Remove route" title="Remove route"><!></button> <!></div></div></div> <section class="space-y-1.5 rounded-md border border-border p-2" aria-label="Endpoint"><span class="text-[11px] font-medium text-muted-foreground">Endpoint</span> <div class="flex gap-1.5"><!></div> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API protocol</span> <select class="h-8 w-full rounded-md border border-border bg-background px-2 text-xs" aria-label="API protocol"></select></label></section> <section class="space-y-1.5 rounded-md border border-border p-2" aria-label="Credential"><!> <div class="flex gap-1.5"><div class="relative min-w-0 flex-1"><!> <button type="button" class="absolute right-1.5 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-2.5 after:content-[''] hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button></div> <!></div> <span class="text-[10px] text-muted-foreground">Stored locally (0600), shown as typed (password-masked), applies on blur/Enter.</span></section> <section class="space-y-1.5" aria-label="Models"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Models</span> <div class="flex items-center gap-1.5"><!> <!></div></div> <div class="space-y-1.5"></div></section> <!></div>`);function GB(e,r){i(r,!0);let a=k(r,`autoFocusCredential`,3,!1),o=`anthropic-messages`,s=I(()=>Q.view),u=I(()=>E(s)?.settings.modelRoutes??[]),d=I(()=>E(u).flatMap(e=>e.models.map(e=>({id:e.id,efforts:e.efforts})))),f=I(()=>r.catalog?.providers.find(e=>e.provider===r.route.provider)),p=I(()=>(r.catalog?.providers??[]).flatMap(e=>e.icon?[{provider:e.provider,icon:e.icon}]:[])),m=I(()=>Jz(r.catalog,dB(r.route.provider)?.base??r.route.provider)),g=I(()=>PL(r.route,E(f))),_=I(()=>fB(r.route,r.catalog)),b=I(()=>FL(r.route,E(_))),S=I(()=>IL(r.route)),w=I(()=>E(s)?.providers.some(e=>e.provider===r.route.provider&&e.configured)??!1),T=V(J(r.route.baseURL)),O=V(J(r.route.api??E(f)?.api??o)),A=V(J(r.route.models.map(e=>({...e})))),j=V(J(r.route.models.map(()=>!0))),ee=I(()=>E(s)?.providers.find(e=>e.provider===r.route.provider)?.apiKey??null),te=V(J(E(ee)??``)),N=V(!1),P=V(J(a())),L=V(null),ne=V(null),re=V(!1),R=null,ae=[],ce=I(()=>E(T).trim()!==r.route.baseURL||E(O)!==(r.route.api??E(f)?.api??o)),U=I(()=>JSON.stringify(E(A))!==JSON.stringify(r.route.models)),le=I(()=>E(j).every(e=>e)),G=I(()=>!(E(ce)||E(U))||!E(le)||E(A).length===0||Q.updating);de(()=>{a()&&E(L)!==null&&(E(L).focus(),r.onCredentialFocused?.())}),de(()=>()=>{R!==null&&clearTimeout(R)});async function ue(e){if(E(s)===null)return!1;let t=await xe({modelRoutes:E(u).map(t=>t.provider===r.route.provider?e:t)});return t?t.outcome===`rejected`?(F(ne,`${t.code}: ${t.detail}`),!1):t.outcome===`error`?(F(ne,t.message,!0),!1):(F(ne,null),!0):!1}async function K(e){await ue({...r.route,...e})}async function q(){let e=E(T).trim();if(!/^https?:\/\//.test(e)){F(ne,`Custom route needs an http(s) base URL.`);return}await ue({...r.route,baseURL:e,api:E(O),models:E(A).map(e=>({...e}))})&&(F(re,!0),R!==null&&clearTimeout(R),R=setTimeout(()=>F(re,!1),1500))}function pe(e,t){F(A,E(A).map((n,r)=>r===e?t:n),!0)}function me(e,t){E(j)[e]!==t&&F(j,E(j).map((n,r)=>r===e?t:n),!0)}function Y(e){F(A,E(A).filter((t,n)=>n!==e),!0),F(j,E(j).filter((t,n)=>n!==e),!0)}function he(e){let t=E(A)[e],n=r.route.models[e];return t===void 0||n===void 0||JSON.stringify(t)!==JSON.stringify(n)}async function X(){F(A,[...E(A),{id:``,efforts:[...Xz]}],!0),F(j,[...E(j),!1],!0),await v(),ae[ae.length-1]?.scrollIntoView({block:`nearest`,behavior:`smooth`})}async function ge(){let e=E(te).trim();if(e.length===0)return;let t=await je(r.route.provider,e);if(t){if(t.outcome===`rejected`){F(ne,`${t.code}: ${t.detail}`);return}F(ne,null),F(P,!1)}}async function _e(){await Ye(r.route.provider),F(te,``)}var ve=WB(),ye=W(ve),be=W(ye);Iz(be,{get icon(){return E(g)},get letter(){return E(b)},get color(){return E(S)},get provider(){return r.route.provider},get label(){return E(_)},get catalogIcons(){return E(p)},get disabled(){return Q.updating},onPick:e=>void K({icon:e,iconSuppressed:!1}),onSuppress:()=>void K({icon:void 0,iconSuppressed:!0}),onColor:e=>void K({iconColor:e}),onLetter:e=>void K({iconLetter:e})});var Z=z(be,2),Se=W(Z),Ce=W(Se),we=M(Ce,!0),Te=z(Ce,2),Ee=M(Te);n(Se);var De=z(Se,2),Oe=W(De),ke=W(Oe);Cn(ke,{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe);var Ae=z(Oe,2);An(Ae,{size:`sm`,class:`relative h-9 px-3 text-xs after:absolute after:-top-1 after:-bottom-1 after:left-0 after:right-0 after:content-['']`,"data-route-save":`true`,get disabled(){return E(G)},onclick:()=>void q(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(re)?`Saved ✓`:`Save`)),y(e,n)},$$slots:{default:!0}}),n(De),n(Z),n(ye);var Me=z(ye,2),Ne=z(W(Me),2),Pe=W(Ne);zn(Pe,{class:`h-8 flex-1 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Q.updating},get value(){return E(T)},set value(e){F(T,e,!0)}}),n(Ne);var Fe=z(Ne,2),Ie=z(W(Fe),2);t(Ie,20,()=>Ct,e=>e,(e,t)=>{var n=zB(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(Ie),fe(Ie),n(Fe),n(Me);var Le=z(Me,2),Re=W(Le),ze=e=>{var t=BB(),n=M(t);H(()=>c(n,`Route “${r.route.provider??``}” added — paste its API key to finish connecting.`)),y(e,t)};h(Re,e=>{E(P)&&e(ze)});var Be=z(Re,2),Ve=W(Be),He=W(Ve);{let e=I(()=>E(N)?`text`:`password`);zn(He,{class:`h-8 pr-9 font-mono text-xs`,get type(){return E(e)},autocomplete:`off`,"aria-label":`API key`,placeholder:`API key`,get disabled(){return Q.updating},onblur:()=>void ge(),onkeydown:e=>{e.key===`Enter`&&(e.preventDefault(),ge())},get ref(){return E(L)},set ref(e){F(L,e,!0)},get value(){return E(te)},set value(e){F(te,e,!0)}})}var Ue=z(He,2),We=W(Ue),Ge=e=>{vz(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},Ke=e=>{Jn(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(We,e=>{E(N)?e(Ge):e(Ke,-1)}),n(Ue),n(Ve);var qe=z(Ve,2),Je=e=>{An(e,{size:`sm`,variant:`outline`,class:`relative h-9 px-2.5 text-xs after:absolute after:-top-1 after:-bottom-1 after:left-0 after:right-0 after:content-['']`,get disabled(){return Q.updating},onclick:()=>void _e(),children:(e,t)=>{oe();var n=C(`Clear`);y(e,n)},$$slots:{default:!0}})};h(qe,e=>{E(w)&&e(Je)}),n(Be),oe(2),n(Le);var Xe=z(Le,2),Ze=W(Xe),Qe=z(W(Ze),2),$e=W(Qe),et=e=>{var t=VB();y(e,t)};h($e,e=>{E(A).length===0&&e(et)});var tt=z($e,2);An(tt,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Q.updating},onclick:()=>void X(),children:(e,t)=>{oe();var n=C(`+ Add model`);y(e,n)},$$slots:{default:!0}}),n(Qe),n(Ze);var nt=z(Ze,2);t(nt,21,()=>E(A),ie,(e,t,i)=>{var a=HB(),o=W(a);{let e=I(()=>E(T).trim()),n=I(()=>he(i)),a=I(()=>E(t).id===``);cB(o,{get model(){return E(t)},get candidates(){return E(m)},get routeModels(){return E(d)},get api(){return E(O)},get baseURL(){return E(e)},get provider(){return r.route.provider},get apiKeyConfigured(){return E(w)},get disabled(){return Q.updating},get dirty(){return E(n)},get initialExpanded(){return E(a)},onchange:e=>pe(i,e),onremove:()=>Y(i),onvalidity:e=>me(i,e)})}n(a),se(a,(e,t)=>ae[t]=e,e=>ae?.[e],()=>[i]),y(e,a)}),n(nt),n(Xe);var rt=z(Xe,2),it=e=>{var t=UB(),n=M(t,!0);H(()=>c(n,E(ne))),y(e,t)};h(rt,e=>{E(ne)&&e(it)}),n(ve),H(e=>{B(Ce,`title`,`${E(_)??``} (${r.route.provider??``}) — route name keys the credential mapping; duplicate this route to rename it.`),c(we,E(_)),B(Te,`title`,r.route.baseURL),c(Ee,`${r.route.provider??``} · ${e??``} · ${r.route.models.length??``}
227
+ ${r.route.models.length===1?`model`:`models`}`),Oe.disabled=Q.updating,Ie.disabled=Q.updating,B(Ue,`aria-label`,E(N)?`Hide API key`:`Show API key`),B(Ue,`aria-pressed`,E(N)),B(Ue,`title`,E(N)?`Hide API key`:`Show API key`),Ue.disabled=Q.updating},[()=>r.route.baseURL.replace(/^https?:\/\//,``)]),l(`click`,Oe,()=>r.onremove?.()),D(Ie,()=>E(O),e=>F(O,e)),l(`mousedown`,Ue,e=>e.preventDefault()),l(`click`,Ue,()=>F(N,!E(N))),y(e,ve),x()}T([`click`,`mousedown`]);var KB=r(`<button type="button" class="mt-0.5 shrink-0 rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] text-amber-700 transition-colors hover:bg-amber-500/25">active outside tabs</button>`),qB=r(`<p class="text-[10px] text-amber-700"> </p>`),JB=r(`<span class="absolute -right-1 -top-0.5 h-1 w-1 rounded-full bg-amber-500" title="API key missing"></span>`),YB=r(`<span class="relative inline-flex shrink-0"><span class="flex h-4 w-4 items-center justify-center rounded" aria-hidden="true"><img alt=""/></span> <!></span>`),XB=r(`<span class="relative inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> <!></span>`),ZB=r(`<span class="rounded bg-primary/10 px-1 py-px text-[9px] font-medium leading-tight text-primary" title="Active model's route">active</span>`),QB=r(`<button type="button" role="tab"><!> <span class="max-w-[120px] truncate"> </span> <!></button>`),$B=r(`<span class="pointer-events-none absolute inset-y-0 left-0 w-2 bg-gradient-to-r from-background to-transparent" aria-hidden="true"></span>`),eV=r(`<span class="pointer-events-none absolute inset-y-0 right-0 w-2 bg-gradient-to-l from-background to-transparent" aria-hidden="true"></span>`),tV=r(`<div class="flex flex-col items-center gap-2.5 rounded-md border border-dashed p-6 text-center"><p class="text-xs font-medium">Add your first model route</p> <p class="max-w-[320px] text-[10px] leading-snug text-muted-foreground">Pick a provider from the catalog (models.dev mirror) with its models, or point at any
228
+ custom OpenAI/Anthropic-compatible endpoint.</p> <div class="mt-1 flex gap-2"><!> <!></div></div>`),nV=r(`<div class="flex items-stretch gap-1 border-b border-border"><div class="relative min-w-0 flex-1"><div class="tab-scroll flex h-9 items-stretch overflow-x-auto svelte-1bhnjqt" role="tablist" aria-label="Model routes"></div> <!> <!></div> <button type="button">+ New</button></div> <div class="min-h-0 flex-1 overflow-y-auto pr-0.5"><!></div>`,1),rV=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),iV=r(`<div class="text-xs text-muted-foreground">Model settings unavailable</div>`),aV=r(`<div class="text-xs text-destructive" role="alert"> </div>`),oV=r(`<div class="flex h-full min-h-0 flex-col space-y-3"><div class="flex items-start justify-between gap-2"><div><h3 class="text-sm font-medium">Model</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Changes apply immediately to your agent sessions — no restart needed.</p></div> <!></div> <!> <!> <!> <!></div> <!>`,1);function sV(e,r){i(r,!0);let a=V(null),o=V(!1),s=V(`pick`),u=V(null),d=V(0),m=V(null),g=V(null),_=V(!1),b=V(!1),S=V(null),w=V(null),T=V(null),D=V(!1),O=Et(mt),k=I(()=>Q.view),A=I(()=>E(k)?.settings.modelRoutes??[]),ee=I(()=>E(A).find(e=>e.provider===E(a))),te=I(()=>E(k)!==null&&!E(A).some(e=>e.provider===E(k).settings.model.provider));de(()=>{E(o)||(E(a)!==null&&!E(A).some(e=>e.provider===E(a))&&F(a,null),E(a)===null&&E(A).length>0&&F(a,E(A)[0].provider,!0))}),de(()=>{E(w)===null&&E(T)===null&&!E(D)&&N()});async function N(){let e=O.issue();F(D,!0);try{let t=St();if(!t){F(T,`daemon not connected`);return}let n=await t.agent.models.catalog({});if(!e.isCurrent())return;F(w,n,!0),F(T,null)}catch(t){if(!e.isCurrent())return;F(T,t instanceof Error?t.message:String(t),!0)}finally{e.isCurrent()&&F(D,!1)}}async function P(e){let t=await xe(e);return t?t.outcome===`rejected`?(F(S,`${t.code}: ${t.detail}`),!1):t.outcome===`error`?(F(S,t.message,!0),!1):(F(S,null),!0):!1}function L(e,t=null){F(u,t,!0),F(s,e,!0),F(d,E(d)+1),F(o,!0),F(a,null)}async function ne(e){F(o,!1),F(a,e,!0),F(m,e,!0),await v(),le[e]?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})}function re(){E(k)&&L(`form`,{provider:E(k).settings.model.provider,models:[E(k).settings.model.model]})}function ie(e){e&&(F(g,e,!0),F(_,!0))}async function R(){let e=E(g);if(e===null)return;F(b,!0);let t=await P({modelRoutes:E(A).filter(t=>t.provider!==e)});F(b,!1),t&&(F(_,!1),F(g,null))}let ae=V(null),ce=V(!1),U=V(!1),le=J({});function G(){let e=E(ae);if(!e){F(ce,!1),F(U,!1);return}F(ce,e.scrollLeft>0),F(U,e.scrollLeft+e.clientWidth<e.scrollWidth-1)}de(()=>{let e=E(ae);if(!e)return;let t=t=>{Math.abs(t.deltaY)<=Math.abs(t.deltaX)||(e.scrollLeft+=t.deltaY,t.preventDefault())};e.addEventListener(`wheel`,t,{passive:!1});let n=new ResizeObserver(()=>G());return n.observe(e),G(),()=>{e.removeEventListener(`wheel`,t),n.disconnect()}}),de(()=>{E(A).length,E(w),G()});function ue(e,t){if(E(A).length!==0){if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=(t+(e.key===`ArrowLeft`?-1:1)+E(A).length)%E(A).length;le[E(A)[n].provider]?.focus()}else e.key===`Delete`&&(e.preventDefault(),ie(E(A)[t]?.provider))}}var K=oV(),fe=q(K),pe=W(fe),me=z(W(pe),2),he=e=>{var t=KB();H(()=>B(t,`title`,`The active model (${E(k).settings.model.provider??``}) rides an env-provided route with no tab — click to add it as a route.`)),l(`click`,t,re),y(e,t)};h(me,e=>{E(te)&&E(k)&&e(he)}),n(pe);var ge=z(pe,2),_e=e=>{var t=qB(),n=M(t);H(()=>c(n,`${E(k).settings.model.provider??``} · ${E(k).settings.model.model??``} (outside Routes) — env-provided; add
229
+ it as a route to manage it here.`)),y(e,t)};h(ge,e=>{E(te)&&E(k)&&e(_e)});var ve=z(ge,2),ye=e=>{var r=nV(),i=q(r),g=W(i),_=W(g);t(_,23,()=>E(A),e=>e.provider,(e,t,r)=>{let i=I(()=>E(w)?.providers.find(e=>e.provider===E(t).provider)),s=I(()=>PL(E(t),E(i))),u=I(()=>fB(E(t),E(w))),d=I(()=>FL(E(t),E(u))),f=I(()=>E(k).providers.some(e=>e.provider===E(t).provider&&e.configured)),p=I(()=>E(k).settings.model.provider===E(t).provider);var m=QB(),g=W(m),_=e=>{var r=YB(),i=W(r),a=M(i),o=z(i,2),c=e=>{var t=JB();y(e,t)};h(o,e=>{E(f)||e(c)}),n(r),H((e,t)=>{j(i,`background: color-mix(in srgb, ${e??``} 18%, transparent)`),B(a,`src`,E(s)),Y(a,1,`h-3.5 w-3.5 object-contain ${t??``}`)},[()=>IL(E(t)),()=>NL(E(s))?``:`dark:invert`]),y(e,r)},v=e=>{var r=XB(),i=W(r),a=z(i),o=e=>{var t=JB();y(e,t)};h(a,e=>{E(f)||e(o)}),n(r),H(e=>{j(r,`background: ${e??``}`),c(i,`${E(d)??``} `)},[()=>IL(E(t))]),y(e,r)};h(g,e=>{E(s)?e(_):e(v,-1)});var b=z(g,2),x=M(b,!0),S=z(b,2),C=e=>{var t=ZB();y(e,t)};h(S,e=>{E(p)&&e(C)}),n(m),se(m,(e,t)=>le[t.provider]=e,e=>le?.[e.provider],()=>[E(t)]),H(()=>{B(m,`aria-selected`,!E(o)&&E(a)===E(t).provider),Y(m,1,`relative flex h-9 shrink-0 items-center gap-1.5 px-2 text-xs font-medium transition-colors hover:bg-muted/50 ${!E(o)&&E(a)===E(t).provider?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),B(m,`title`,`${E(u)??``} (${E(t).provider??``})${E(p)?` · active route`:``}`),c(x,E(u))}),l(`click`,m,()=>{F(a,E(t).provider,!0),F(o,!1)}),l(`keydown`,m,e=>ue(e,E(r))),y(e,m)}),n(_),se(_,e=>F(ae,e),()=>E(ae));var v=z(_,2),b=e=>{var t=$B();y(e,t)};h(v,e=>{E(ce)&&e(b)});var x=z(v,2),S=e=>{var t=eV();y(e,t)};h(x,e=>{E(U)&&e(S)}),n(g);var O=z(g,2);n(i);var te=z(i,2),N=W(te),P=e=>{var t=X(),n=q(t);p(n,()=>E(d),e=>{RB(e,{get catalog(){return E(w)},get catalogError(){return E(T)},get catalogLoading(){return E(D)},get initialMode(){return E(s)},get seed(){return E(u)},onadded:ne,onclose:()=>F(o,!1)})}),y(e,t)},re=e=>{var t=X(),n=q(t);p(n,()=>E(ee).provider,e=>{{let t=I(()=>E(m)===E(ee).provider);GB(e,{get route(){return E(ee)},get catalog(){return E(w)},get autoFocusCredential(){return E(t)},onCredentialFocused:()=>F(m,null),onremove:()=>ie(E(ee)?.provider)})}}),y(e,t)},R=e=>{var t=tV(),r=z(W(t),4),i=W(r);An(i,{size:`sm`,variant:`outline`,class:`h-8 px-3 text-xs`,onclick:()=>L(`pick`),children:(e,t)=>{oe();var n=C(`Browse providers`);y(e,n)},$$slots:{default:!0}});var a=z(i,2);An(a,{size:`sm`,class:`h-8 px-3 text-xs`,onclick:()=>L(`form`),children:(e,t)=>{oe();var n=C(`Custom endpoint`);y(e,n)},$$slots:{default:!0}}),n(r),n(t),y(e,t)};h(N,e=>{E(o)?e(P):E(ee)?e(re,1):e(R,-1)}),n(te),H(()=>Y(O,1,`h-7 shrink-0 self-center rounded px-2 text-[11px] font-medium transition-colors ${E(o)?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`)),f(`scroll`,_,G),l(`click`,O,()=>E(A).length===0?L(`form`):L(`pick`)),y(e,r)},be=e=>{var t=rV();y(e,t)},Z=e=>{var t=iV();y(e,t)};h(ve,e=>{E(k)?e(ye):Q.loading?e(be,1):e(Z,-1)});var Se=z(ve,2),Ce=e=>{var t=aV(),n=M(t,!0);H(()=>c(n,Q.error)),y(e,t)};h(Se,e=>{Q.error&&e(Ce)});var we=z(Se,2),Te=e=>{var t=aV(),n=M(t,!0);H(()=>c(n,E(S))),y(e,t)};h(we,e=>{E(S)&&e(Te)}),n(fe);var Ee=z(fe,2);{let e=I(()=>E(g)??``);_n(Ee,{title:`Remove route`,get description(){return`Remove the “${E(e)??``}” route? Its stored key is kept; if it held the active model, that reference is left outside Routes.`},get busy(){return E(b)},onConfirm:()=>void R(),get open(){return E(_)},set open(e){F(_,e,!0)}})}y(e,K),x()}T([`click`,`keydown`]);var cV=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),lV=r(`<p class="text-[10px] text-primary" role="status"> </p>`),uV=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),dV=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground"><span class="text-destructive" role="alert"> </span> <!></div>`),fV=r(`<p class="rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground">No sessions yet. Sessions you start from the agent panel are listed here and can be reviewed
230
+ or removed individually.</p>`),pV=r(`<span class="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground" title="Kernel/steward session without a product transcript — managed by the kernel, not deletable here">kernel-only</span>`),mV=r(`<li class="flex items-center gap-2 rounded-md border border-border bg-background/60 px-2.5 py-1.5"><span class="min-w-0 flex-1 truncate text-xs"> </span> <span class="shrink-0 text-[10px] tabular-nums text-muted-foreground"> </span> <span class="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground"> </span> <span> </span> <!> <!></li>`),hV=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground"> </span> <ul class="space-y-1"></ul></div>`),gV=r(`<div class="text-xs text-destructive" role="alert"> </div>`),_V=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">Sessions</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Manage agent panel sessions and transcript retention.</p></div> <section class="space-y-1.5" aria-label="Cleanup policy"><span class="text-[11px] font-medium text-muted-foreground">Cleanup policy</span> <div class="flex items-end gap-1.5"><label class="flex-1 space-y-1"><span class="block text-[10px] text-muted-foreground">Delete transcripts older than (days)</span> <!></label> <!></div> <p class="text-[10px] text-muted-foreground">Sessions older than this are cleaned automatically when the daemon starts (default 30 days).
231
+ Kernel-side session logs are not touched.</p> <!></section> <section class="space-y-1.5" aria-label="Session list"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Session list</span> <!></div> <!> <!></section> <!></div> <!>`,1);function vV(e,r){i(r,!0);let a=V(30),o=V(!1),s=V(!1),l=V(null),u=V(null),d=V(null),f=V(!1),p=V(!1),g=V(null),_=V(!1),v=!1;de(()=>{v||(v=!0,Ie())}),de(()=>{let e=Q.view?.settings.session.sessionCleanupDays;e!==void 0&&!E(o)&&F(a,e,!0)});let b=I(()=>{let e=[...Me.sessions].sort((e,t)=>e.createdAt<t.createdAt?1:-1),t=new Map;for(let n of e){let e=S(n.createdAt),r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.entries()]});function S(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown date`:`${String(t.getFullYear()).padStart(4,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function w(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function T(e){return _t.find(t=>t.id===e)?.label??e}function D(){let e=Number(E(a));return!Number.isInteger(e)||e<1||e>365?null:e}async function O(){let e=D();if(e===null){F(l,`Retention must be a whole number of days between 1 and 365.`);return}F(l,null),F(s,!0);try{let t=await xe({session:{sessionCleanupDays:e}});if(!t)return;t.outcome===`rejected`?F(u,`${t.code}: ${t.detail}`):t.outcome===`error`?F(u,t.message,!0):(F(u,null),F(o,!1))}finally{F(s,!1)}}async function k(){let e=D();if(e===null){F(l,`Retention must be a whole number of days between 1 and 365.`);return}F(l,null),F(f,!0),F(d,null);try{let t=await He({beforeDays:e});if(!t)return;if(`error`in t){F(u,t.error,!0);return}F(u,null),F(d,`Deleted ${t.deleted} session${t.deleted===1?``:`s`} · kept ${t.kept}`)}finally{F(f,!1)}}function A(e){F(g,e,!0),F(p,!0)}async function j(){let e=E(g);if(e){F(_,!0);try{let t=await He({sessionIds:[e.sessionId]});if(!t)return;if(`error`in t){F(u,t.error,!0);return}F(u,null),t.deleted===0&&F(u,`Session ${e.sessionId} was not removed (running or already gone).`),F(p,!1)}finally{F(_,!1)}}}var ee=_V(),te=q(ee),N=z(W(te),2),P=z(W(N),2),L=W(P),ne=z(W(L),2);zn(ne,{type:`number`,min:1,max:365,step:1,oninput:()=>F(o,!0),get disabled(){return E(s)},"aria-label":`Session retention days`,get value(){return E(a)},set value(e){F(a,e,!0)}}),n(L);var re=z(L,2);{let e=I(()=>E(s)||!E(o)||D()===null);An(re,{size:`sm`,class:`h-8 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void O(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(s)?`Saving…`:`Save`)),y(e,n)},$$slots:{default:!0}})}n(P);var ie=z(P,4),R=e=>{var t=cV(),n=M(t,!0);H(()=>c(n,E(l))),y(e,t)};h(ie,e=>{E(l)&&e(R)}),n(N);var ae=z(N,2),se=W(ae),ce=z(W(se),2);{let e=I(()=>E(f)||D()===null);An(ce,{size:`sm`,variant:`outline`,class:`h-7 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void k(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(f)?`Cleaning…`:`Clean now`)),y(e,n)},$$slots:{default:!0}})}n(se);var U=z(se,2),le=e=>{var t=lV(),n=M(t,!0);H(()=>c(n,E(d))),y(e,t)};h(U,e=>{E(d)&&e(le)});var G=z(U,2),ue=e=>{var t=uV();y(e,t)},K=e=>{var t=dV(),r=W(t),i=M(r,!0),a=z(r,2);An(a,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void Ie(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),H(()=>c(i,Me.error)),y(e,t)},J=e=>{var t=fV();y(e,t)},fe=e=>{var r=X(),i=q(r);t(i,17,()=>E(b),([e,t])=>e,(e,r)=>{var i=I(()=>m(E(r),2));let a=()=>E(i)[0],o=()=>E(i)[1];var s=hV(),l=W(s),u=M(l,!0),d=z(l,2);t(d,21,o,e=>e.sessionId,(e,t)=>{var r=mV(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0),l=z(o,2),u=M(l,!0),d=z(l,2),f=M(d,!0),p=z(d,2),m=e=>{var t=pV();y(e,t)};h(p,e=>{E(t).hasTranscript===!1&&e(m)});var g=z(p,2);{let e=I(()=>E(t).title||E(t).sessionId),n=I(()=>E(t).status===`running`?`Running sessions cannot be deleted`:E(t).hasTranscript===!1?`Kernel-only session — nothing to clean in the product layer`:`Delete session`),r=I(()=>E(t).status===`running`||E(t).hasTranscript===!1||E(_));An(g,{size:`icon`,variant:`ghost`,class:`h-6 w-6 shrink-0`,get"aria-label"(){return`Delete session ${E(e)??``}`},get title(){return E(n)},get disabled(){return E(r)},onclick:()=>A(E(t)),children:(e,t)=>{Cn(e,{class:`h-3.5 w-3.5`})},$$slots:{default:!0}})}n(r),H((e,n)=>{B(i,`title`,E(t).title||E(t).sessionId),c(a,E(t).title||`Untitled session`),c(s,e),c(u,n),Y(d,1,`shrink-0 text-[10px] ${E(t).status===`running`?`text-primary`:`text-muted-foreground`}`),c(f,E(t).status)},[()=>w(E(t).createdAt),()=>T(E(t).mode)]),y(e,r)}),n(d),n(s),H(()=>c(u,a())),y(e,s)}),y(e,r)};h(G,e=>{Me.loading&&!Me.loaded?e(ue):Me.error?e(K,1):E(b).length===0?e(J,2):e(fe,-1)}),n(ae);var pe=z(ae,2),me=e=>{var t=gV(),n=M(t,!0);H(()=>c(n,E(u))),y(e,t)};h(pe,e=>{E(u)&&e(me)}),n(te);var he=z(te,2);{let e=I(()=>E(g)?.title||(E(g)?.sessionId??``));_n(he,{title:`Delete session`,get description(){return`Delete the transcript of “${E(e)??``}”? This cannot be undone.`},get busy(){return E(_)},onConfirm:()=>void j(),get open(){return E(p)},set open(e){F(p,e,!0)}})}y(e,ee),x()}var yV=r(`<button><!> </button>`),bV=r(`<div class="flex h-full min-h-0 flex-col -m-4 p-4"><!></div>`),xV=r(`<div class="flex min-h-0 flex-col border-r border-border bg-muted/30"><!> <nav class="flex flex-col gap-0.5 p-2" aria-label="Settings sections"></nav></div> <div class="min-w-0 overflow-y-auto p-4"><!></div>`,1);function SV(e,r){i(r,!0);let o=[{id:`general`,label:`General`,icon:XR},{id:`model`,label:`Model`,icon:QR},{id:`agent`,label:`Agent`,icon:ez},{id:`sessions`,label:`Sessions`,icon:Kn}],s=V(!1);de(()=>{fR.open=E(s)}),de(()=>{fR.open&&F(s,!0)}),de(()=>{E(s)&&Ke()});var u=X(),d=q(u);a(d,()=>Sn,(e,r)=>{r(e,{get open(){return E(s)},set open(e){F(s,e,!0)},children:(e,r)=>{var i=X(),s=q(i);a(s,()=>fn,(e,r)=>{r(e,{class:`grid h-[min(560px,85vh)] grid-cols-[176px_1fr] gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:(e,r)=>{var i=xV(),s=q(i),u=W(s);a(u,()=>vn,(e,t)=>{t(e,{class:`px-3 pt-2.5 pb-2 text-xs font-medium text-foreground`,children:(e,t)=>{oe();var n=C(`Settings`);y(e,n)},$$slots:{default:!0}})});var d=z(u,2);t(d,21,()=>o,e=>e.id,(e,t)=>{let r=I(()=>E(t).icon);var i=yV(),o=W(i);a(o,()=>E(r),(e,t)=>{t(e,{class:`h-3.5 w-3.5`})});var s=z(o);n(i),H(()=>{Y(i,1,`flex h-8 items-center gap-2 rounded-md px-2 text-xs transition-colors ${fR.section===E(t).id?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`),B(i,`aria-current`,fR.section===E(t).id?`true`:void 0),c(s,` ${E(t).label??``}`)}),l(`click`,i,()=>fR.section=E(t).id),y(e,i)}),n(d),n(s);var f=z(s,2),p=W(f),m=e=>{gz(e,{})},g=e=>{var t=bV();sV(W(t),{}),n(t),y(e,t)},_=e=>{vV(e,{})},v=e=>{cz(e,{})};h(p,e=>{fR.section===`general`?e(m):fR.section===`model`?e(g,1):fR.section===`sessions`?e(_,2):e(v,-1)}),n(f),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,u),x()}T([`click`]);var CV=r(`<link rel="icon" href="/icons/monochrome-mini.png" type="image/png"/> <link rel="apple-touch-icon" href="/icons/monochrome-mini.png"/>`,1),wV=r(`<span class="px-1 text-xs font-medium text-muted-foreground">Skill Creator</span>`),TV=r(`<button class="no-drag flex h-6 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground max-[720px]:h-11 max-[720px]:w-11" aria-label="Open command palette" aria-keyshortcuts="Meta+K" title="Command palette (Cmd+K)"><!></button> <button class="no-drag flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground max-[720px]:h-11 max-[720px]:w-11" aria-label="Reload app" title="Reload"><!></button> <button aria-label="Toggle agent panel" title="Agent panel"><!></button>`,1),EV=r(`<div class="flex min-h-8 items-center border-y border-destructive/30 bg-destructive/8 px-3 text-xs text-destructive" role="status"> </div>`),DV=r(`<button><!></button>`),OV=r(`<div class="relative flex h-screen w-screen flex-col overflow-hidden bg-background text-foreground"><!> <!> <div class="flex min-h-0 flex-1"><nav class="flex w-14 shrink-0 flex-col items-center gap-1 border-r border-border bg-muted/30 py-3"><!> <div class="my-1 h-px w-8 bg-border"></div> <button class="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" title="Import workspace" aria-label="Import workspace"><!></button> <button title="Settings" aria-label="Settings"><!></button></nav> <main class="min-w-0 flex-1 overflow-hidden"><!> <!></main> <div><!></div></div></div>`),kV=r(`<!> <!> <!> <!> <!>`,1);function AV(e,r){i(r,!0),ue(()=>(gt(),ve.url.pathname===`/`&&ge(`/workspaces`,{replaceState:!0}),rt({navigate(e,t){t===`REPLACE`?ge(e,{replaceState:!0,keepFocus:!0,noScroll:!0}):ge(e)}}),xt(),yt));let o=I(()=>ve.url.pathname);de(()=>{E(o).startsWith(`/creator`)?Dc(Ec):Dc(Tc)});let s=I(()=>wt.status===`connected`);de(()=>{E(s)&&Mt()});let u=I(()=>et.list()),d=I(()=>nt(ve.url.pathname)?.app??null);function f(e){ge(`/${e}`)}var p=kV();S(`12qhfyh`,e=>{var t=CV();oe(2),y(e,t)});var m=q(p);Cc(m,{children:(e,i)=>{var o=OV(),s=W(o);nr(s,{variant:`main`,left:e=>{var t=wV();y(e,t)},right:e=>{var t=TV(),r=q(t);kc(W(r),{class:`h-3.5 w-3.5`}),n(r);var i=z(r,2),a=W(i);Wn(a,{class:`h-3.5 w-3.5`}),n(i);var o=z(i,2),s=W(o);Be(s,{class:`h-3.5 w-3.5`}),n(o),H(()=>{Y(o,1,`no-drag flex h-6 w-6 items-center justify-center rounded transition-colors ${We.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`} max-[720px]:h-11 max-[720px]:w-11`),B(o,`aria-pressed`,We.open)}),l(`pointerdown`,r,e=>e.stopPropagation()),l(`click`,r,()=>globalThis.dispatchEvent(new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0}))),l(`pointerdown`,i,e=>e.stopPropagation()),l(`click`,i,()=>globalThis.location.reload()),l(`pointerdown`,o,e=>e.stopPropagation()),l(`click`,o,()=>Xe(!We.open)),y(e,t)},$$slots:{left:!0,right:!0}});var p=z(s,2),m=e=>{var t=EV(),n=M(t,!0);H(()=>c(n,wt.error)),y(e,t)};h(p,e=>{wt.status===`disconnected`&&e(m)});var g=z(p,2),v=W(g),b=W(v);t(b,17,()=>E(u),e=>e.id,(e,t)=>{let r=I(()=>E(t).icon);var i=DV(),o=W(i);a(o,()=>E(r),(e,t)=>{t(e,{class:`h-5 w-5`})}),n(i),H(()=>{Y(i,1,`flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-muted ${E(d)===E(t).id?`bg-primary/10 text-primary`:`text-muted-foreground`}`),B(i,`title`,E(t).name),B(i,`aria-label`,E(t).name),B(i,`aria-current`,E(d)===E(t).id?`page`:void 0)}),l(`click`,i,()=>f(E(t).id)),y(e,i)});var x=z(b,4),S=W(x);Te(S,{class:`h-5 w-5`}),n(x);var C=z(x,2);jc(W(C),{class:`h-5 w-5`}),n(C),n(v);var w=z(v,2),T=W(w);at(T,{});var D=z(T,2);_(D,()=>r.children??R),n(w);var O=z(w,2);JR(W(O),{}),n(O),n(g),n(o),H(()=>{Y(C,1,`mt-auto flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-muted ${fR.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`}`),B(C,`aria-pressed`,fR.open),Y(O,1,`agent-panel-layer shrink-0 max-[720px]:absolute max-[720px]:inset-0 max-[720px]:z-40 ${We.open?``:`pointer-events-none`}`)}),l(`click`,x,()=>Ce()),l(`click`,C,()=>pR()),y(e,o)},$$slots:{default:!0}});var g=z(m,2);As(g,{});var v=z(g,2);SV(v,{});var b=z(v,2);_c(b,{}),xc(z(b,2),{}),y(e,p),x()}T([`pointerdown`,`click`]);export{AV as component,Yn as universal};