skill-creator 2.0.2 → 2.2.0

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 (62) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README-zh.md +298 -0
  3. package/README.md +121 -112
  4. package/dist/cli.js +8037 -5914
  5. package/dist/cli.js.map +4 -4
  6. package/dist/daemon.js +2921 -886
  7. package/dist/daemon.js.map +4 -4
  8. package/dist/package.json +1 -1
  9. package/dist/webui/_app/immutable/assets/0.CT0Z92yp.css +2 -0
  10. package/dist/webui/_app/immutable/assets/ProviderView.BKgtsfqs.css +1 -0
  11. package/dist/webui/_app/immutable/chunks/0k4S-8Dm.js +1 -0
  12. package/dist/webui/_app/immutable/chunks/{C36hgawG.js → BD8KMBgQ.js} +1 -1
  13. package/dist/webui/_app/immutable/chunks/{CnsFCObb.js → BLKqTz4e.js} +1 -1
  14. package/dist/webui/_app/immutable/chunks/BTdzDCtA.js +1 -0
  15. package/dist/webui/_app/immutable/chunks/{Bs27XW8_.js → BXwUnloU.js} +1 -1
  16. package/dist/webui/_app/immutable/chunks/BZOx0Qre.js +1 -0
  17. package/dist/webui/_app/immutable/chunks/{CLVPf5uP.js → BfKHhAfw.js} +1 -1
  18. package/dist/webui/_app/immutable/chunks/Bm81ovyU.js +8 -0
  19. package/dist/webui/_app/immutable/chunks/{DFx4VmvA.js → BpM7GQdD.js} +4 -4
  20. package/dist/webui/_app/immutable/chunks/{CeR4do8T.js → BpPdtmVY.js} +1 -1
  21. package/dist/webui/_app/immutable/chunks/{BEPs9Z9s.js → C4d-joyd.js} +1 -1
  22. package/dist/webui/_app/immutable/chunks/{CLM6PwBO.js → CRrxCnau.js} +1 -1
  23. package/dist/webui/_app/immutable/chunks/CUkgSGd5.js +1 -0
  24. package/dist/webui/_app/immutable/chunks/{BNZqT8Gb.js → CX1CHr5A.js} +1 -1
  25. package/dist/webui/_app/immutable/chunks/CaRy05kX.js +1 -0
  26. package/dist/webui/_app/immutable/chunks/{UeEccMjN.js → CmWHiR19.js} +1 -1
  27. package/dist/webui/_app/immutable/chunks/CokLx9SK.js +3 -0
  28. package/dist/webui/_app/immutable/chunks/D-GGMKF5.js +1 -0
  29. package/dist/webui/_app/immutable/chunks/D00gXCrF.js +2 -0
  30. package/dist/webui/_app/immutable/chunks/{BIfnT_mK.js → DAvb_BTz.js} +1 -1
  31. package/dist/webui/_app/immutable/chunks/{D68T6slS.js → DYphEAOV.js} +1 -1
  32. package/dist/webui/_app/immutable/chunks/{0umLG1IN.js → DlRJa6Rp.js} +1 -1
  33. package/dist/webui/_app/immutable/chunks/{D-V0xBeS.js → DsOfMPqr.js} +1 -1
  34. package/dist/webui/_app/immutable/chunks/DxUS3G9A.js +1 -0
  35. package/dist/webui/_app/immutable/chunks/{CQD9uzpA.js → LKyxHDTu.js} +1 -1
  36. package/dist/webui/_app/immutable/chunks/{Dl8eQ129.js → WSgbVOcX.js} +1 -1
  37. package/dist/webui/_app/immutable/chunks/{BFnZD865.js → b00Wice3.js} +2 -2
  38. package/dist/webui/_app/immutable/chunks/{Ckw1quWt.js → n3HFLfXO.js} +1 -1
  39. package/dist/webui/_app/immutable/chunks/{DUYTokm-.js → xHmEZGe9.js} +1 -1
  40. package/dist/webui/_app/immutable/chunks/{D8Der6oM.js → y5ROg0gY.js} +1 -1
  41. package/dist/webui/_app/immutable/entry/{app.CEIXmsDN.js → app.wmUVPoAL.js} +2 -2
  42. package/dist/webui/_app/immutable/entry/start.DeqHj237.js +1 -0
  43. package/dist/webui/_app/immutable/nodes/0.B1MRgs82.js +234 -0
  44. package/dist/webui/_app/immutable/nodes/{1.sVOukQaO.js → 1.DmFrzXB8.js} +1 -1
  45. package/dist/webui/_app/immutable/nodes/{2.Cpm2DXYr.js → 2.C5_mWJeB.js} +1 -1
  46. package/dist/webui/_app/version.json +1 -1
  47. package/dist/webui/index.html +27 -27
  48. package/package.json +32 -26
  49. package/dist/webui/_app/immutable/assets/0.0XN00VKF.css +0 -2
  50. package/dist/webui/_app/immutable/assets/ProviderView.DEH95hqa.css +0 -1
  51. package/dist/webui/_app/immutable/chunks/BkEnd9_Z.js +0 -1
  52. package/dist/webui/_app/immutable/chunks/CIFG41pU.js +0 -1
  53. package/dist/webui/_app/immutable/chunks/CNPsST_i.js +0 -1
  54. package/dist/webui/_app/immutable/chunks/CQhmWGDZ.js +0 -8
  55. package/dist/webui/_app/immutable/chunks/Ce6RiTD3.js +0 -2
  56. package/dist/webui/_app/immutable/chunks/Ce_bE79q.js +0 -1
  57. package/dist/webui/_app/immutable/chunks/CryWMAmp.js +0 -1
  58. package/dist/webui/_app/immutable/chunks/DbA0Nfjq.js +0 -1
  59. package/dist/webui/_app/immutable/chunks/DkjKuLZP.js +0 -3
  60. package/dist/webui/_app/immutable/chunks/DrGEPnFY.js +0 -1
  61. package/dist/webui/_app/immutable/entry/start.A-8tRY5f.js +0 -1
  62. package/dist/webui/_app/immutable/nodes/0.DtX11nez.js +0 -231
@@ -0,0 +1,234 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/D00gXCrF.js","../chunks/CmCJ0SKP.js","../chunks/BfKHhAfw.js","../chunks/xihTtKlq.js","../chunks/CaRy05kX.js","../chunks/0k4S-8Dm.js","../chunks/D-GGMKF5.js","../chunks/BpM7GQdD.js","../chunks/BTdzDCtA.js","../chunks/xHmEZGe9.js","../chunks/WSgbVOcX.js","../chunks/BZOx0Qre.js","../chunks/C4d-joyd.js","../chunks/BXwUnloU.js","../chunks/DAvb_BTz.js","../chunks/DsOfMPqr.js","../chunks/CUkgSGd5.js","../chunks/CX1CHr5A.js","../chunks/CRrxCnau.js","../assets/shell.U4CQV8re.css","../chunks/n3HFLfXO.js","../chunks/DxUS3G9A.js","../chunks/s48N5eaK.js","../chunks/y5ROg0gY.js","../assets/ProviderView.BKgtsfqs.css","../chunks/Bm81ovyU.js","../chunks/CmWHiR19.js","../chunks/BpPdtmVY.js","../chunks/BD8KMBgQ.js","../chunks/DlRJa6Rp.js","../chunks/BYNWtKcf.js","../chunks/CokLx9SK.js","../chunks/LKyxHDTu.js","../chunks/BLKqTz4e.js","../chunks/DYphEAOV.js","../chunks/b00Wice3.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 K,s as q,st as J,ut as de,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/BfKHhAfw.js";import{t as _e}from"../chunks/HclGiUj8.js";import"../chunks/xihTtKlq.js";import{t as ve}from"../chunks/CRrxCnau.js";import"../chunks/CaRy05kX.js";import{i as ye,n as be,r as xe,t as Se}from"../chunks/0k4S-8Dm.js";import{A as Ce,B as we,C as Te,D as Ee,E as De,F as Oe,G as ke,H as Ae,I as je,K as Me,L as Ne,M as Pe,N as Fe,O as Ie,P as Le,R as Re,T as ze,U as Be,V as Ve,W as He,_ as Ue,a as Z,b as We,c as Ge,d as Ke,f as qe,g as Je,h as Ye,i as Xe,j as Q,k as Ze,l as Qe,m as $e,n as et,o as tt,p as nt,q as rt,r as it,s as at,t as ot,u as st,v as ct,w as lt,x as ut,y as dt,z as ft}from"../chunks/D-GGMKF5.js";import{a as pt,c as mt,d as ht,l as gt,n as _t,o as vt,s as yt,t as bt,u as xt}from"../chunks/CX1CHr5A.js";import{A as St,C as Ct,D as wt,E as Tt,O as Et,S as Dt,T as Ot,a as kt,b as At,c as jt,f as Mt,g as Nt,i as Pt,k as Ft,n as It,o as Lt,p as Rt,r as zt,s as Bt,t as Vt,v as Ht,w as Ut,x as Wt}from"../chunks/BpM7GQdD.js";import{a as Gt,c as Kt,n as qt,o as Jt,s as Yt,u as Xt}from"../chunks/BTdzDCtA.js";import{a as Zt,n as Qt,r as $t,s as en,t as tn}from"../chunks/xHmEZGe9.js";import{A as nn,B as rn,C as an,D as on,E as sn,F as cn,G as ln,H as un,I as dn,J as $,K as fn,L as pn,M as mn,N as hn,O as gn,P as _n,R as vn,S as yn,T as bn,U as xn,V as Sn,W as Cn,Y as wn,_ as Tn,a as En,b as Dn,c as On,d as kn,f as An,g as jn,h as Mn,i as Nn,j as Pn,k as Fn,l as In,m as Ln,n as Rn,o as zn,p as Bn,q as Vn,r as Hn,s as Un,t as Wn,u as Gn,v as Kn,w as qn,x as Jn,y as Yn,z as Xn}from"../chunks/WSgbVOcX.js";import"../chunks/DZ_Kltd5.js";import{i as Zn,n as Qn,r as $n,t as er}from"../chunks/BZOx0Qre.js";import{t as tr}from"../chunks/C4d-joyd.js";import{n as nr,r as rr,t as ir}from"../chunks/n3HFLfXO.js";import{n as ar,t as or}from"../chunks/DlRJa6Rp.js";import{n as sr,t as cr}from"../chunks/DxUS3G9A.js";import{t as lr}from"../chunks/CmWHiR19.js";import{t as ur}from"../chunks/DAvb_BTz.js";import{n as dr,r as fr,t as pr}from"../chunks/LKyxHDTu.js";var mr=g({prerender:()=>!1,ssr:()=>!1,trailingSlash:()=>hr}),hr=`ignore`;yt({id:`workspaces`,name:`Workspaces`,icon:rt,activities:[mt({pattern:`/workspaces`,entry:!0,root:gt({id:`workspaces.home`,component:()=>_e(()=>import(`../chunks/D00gXCrF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url)})}),mt({pattern:`/workspaces`,root:xt({id:`workspaces.provider`,pattern:`:wsId/:providerId`,params:Tt({wsId:Wt,providerId:At}),search:Tt({q:Et().optional(),skill:Et().optional(),view:Dt([`list`,`detail`]).optional()}),component:()=>_e(()=>import(`../chunks/CUkgSGd5.js`),__vite__mapDeps([16,1,3,5,17,2,18,4,7,19,8,9,11,12,20,21,22,15,23,24]),import.meta.url)})}),mt({pattern:`/workspaces`,root:xt({id:`workspaces.intelligence`,pattern:`intelligence/:wsId/:providerId`,params:Tt({wsId:Wt,providerId:At}),search:Tt({severity:Dt([`all`,`error`,`warning`,`info`]).optional()}),component:()=>_e(()=>import(`../chunks/Bm81ovyU.js`),__vite__mapDeps([25,1,3,5,17,2,18,4,7,19,8,9,11,26,14,13,27,15,23]),import.meta.url)})})]});var gr=new Set([`$$slots`,`$$events`,`$$legacy`]);function _r(e,t){let n=U(t,gr),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,q({name:`file-pen-line`},()=>n,{get iconNode(){return r}}))}yt({id:`creator`,name:`Creator`,icon:_r,activities:[mt({pattern:`/creator`,entry:!0,root:gt({id:`creator.home`,component:()=>_e(()=>import(`../chunks/BD8KMBgQ.js`),__vite__mapDeps([28,1,2,3,4,5,8,7,9,29,30]),import.meta.url)})}),mt({pattern:`/creator`,root:xt({id:`creator.workspace`,pattern:`:mode/:wsId/:providerId`,params:Tt({mode:Dt([`edit`,`new`]),wsId:Wt,providerId:At}),search:Tt({subview:Dt([`file`,`log`,`preview`,`validate`,`test`]).optional(),template:Et().optional()}),component:()=>_e(()=>import(`../chunks/CokLx9SK.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,8,9,10,11,12,13,20,32,30,22,27]),import.meta.url),children:[xt({id:`creator.workspace.skill`,pattern:`:skillId`,params:Tt({skillId:Ht}),component:()=>_e(()=>import(`../chunks/CokLx9SK.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,8,9,10,11,12,13,20,32,30,22,27]),import.meta.url)})]})})]});var vr=new Set([`$$slots`,`$$events`,`$$legacy`]);function yr(e,t){let n=U(t,vr),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,q({name:`git-branch`},()=>n,{get iconNode(){return r}}))}yt({id:`repository`,name:`Repository`,icon:yr,activities:[mt({pattern:`/repository`,entry:!0,root:xt({id:`repository.home`,pattern:``,search:Tt({q:Et().optional()}),component:()=>_e(()=>import(`../chunks/BLKqTz4e.js`),__vite__mapDeps([33,1,2,3,4,5,17,18,7,19,10,11,12,13,34]),import.meta.url),children:[xt({id:`repository.scan`,pattern:`scan/:sourceId`,params:Tt({sourceId:Et().min(1).max(128).regex(/^[a-z0-9_-]+$/i)}),search:Tt({selected:Et().optional(),targets:Et().optional(),skill:Et().optional()}),component:()=>_e(()=>import(`../chunks/b00Wice3.js`),__vite__mapDeps([35,1,2,3,18,4,17,7,19,9,34]),import.meta.url)})]})})]});var br=r(`<div class="drag-strip no-drag shrink-0 svelte-11tvdi8" role="banner" aria-label="window titlebar"><!> <div class="flex-1"></div> <!></div>`);function xr(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=br(),m=W(p),g=e=>{var t=X(),n=J(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=J(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 Sr={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%)`};ln(Sr);function Cr(t){K(()=>e(()=>t()))}var wr=[`top`,`right`,`bottom`,`left`],Tr=Math.min,Er=Math.max,Dr=Math.round,Or=Math.floor,kr=e=>({x:e,y:e}),Ar={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function jr(e,t,n){return Er(e,Tr(t,n))}function Mr(e,t){return typeof e==`function`?e(t):e}function Nr(e){return e.split(`-`)[0]}function Pr(e){return e.split(`-`)[1]}function Fr(e){return e===`x`?`y`:`x`}function Ir(e){return e===`y`?`height`:`width`}function Lr(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Rr(e){return Fr(Lr(e))}function zr(e,t,n){n===void 0&&(n=!1);let r=Pr(e),i=Rr(e),a=Ir(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Jr(o)),[o,Jr(o)]}function Br(e){let t=Jr(e);return[Vr(e),t,Vr(t)]}function Vr(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Hr=[`left`,`right`],Ur=[`right`,`left`],Wr=[`top`,`bottom`],Gr=[`bottom`,`top`];function Kr(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ur:Hr:t?Hr:Ur;case`left`:case`right`:return t?Wr:Gr;default:return[]}}function qr(e,t,n,r){let i=Pr(e),a=Kr(Nr(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Vr)))),a}function Jr(e){let t=Nr(e);return Ar[t]+e.slice(t.length)}function Yr(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Xr(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Yr(e)}function Zr(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 Qr(e,t,n){let{reference:r,floating:i}=e,a=Lr(t),o=Rr(t),s=Ir(o),c=Nr(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=Pr(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function $r(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}=Mr(t,e),p=Xr(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Zr(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=Zr(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 ei=50,ti=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$r},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Qr(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<ei&&(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}=Qr(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ni=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}=Mr(e,t)||{};if(l==null)return{};let d=Xr(u),f={x:n,y:r},p=Rr(i),m=Ir(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=Tr(d[_],T),D=Tr(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=jr(E,k,O),j=!c.arrow&&Pr(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}}}),ri=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}=Mr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Nr(r),_=Lr(o),v=Nr(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Jr(o)]:Br(o)),x=p!==`none`;!d&&x&&b.push(...qr(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=zr(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`||_===Lr(t)||T.every(e=>Lr(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=Lr(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 ii(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ai(e){return wr.some(t=>e[t]>=0)}var oi=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Mr(e,t);switch(i){case`referenceHidden`:{let e=ii(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ai(e)}}}case`escaped`:{let e=ii(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ai(e)}}}default:return{}}}}},si=new Set([`left`,`top`]);async function ci(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Nr(n),s=Pr(n),c=Lr(n)===`y`,l=si.has(o)?-1:1,u=a&&c?-1:1,d=Mr(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 li=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 ci(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}}}}},ui=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}=Mr(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Lr(i),p=Fr(f),m=u[p],h=u[f],g=(e,t)=>jr(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}}}}}},di=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}=Mr(e,t),u={x:n,y:r},d=Lr(i),f=Fr(d),p=u[f],m=u[d],h=Mr(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=si.has(Nr(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}}}},fi=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}=Mr(e,t),c=await i.detectOverflow(t,s),l=Nr(n),u=Pr(n),d=Lr(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=Tr(p-c[m],g),y=Tr(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*Er(c.left,c.right):S=p-2*Er(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 pi(){return typeof window<`u`}function mi(e){return _i(e)?(e.nodeName||``).toLowerCase():`#document`}function hi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gi(e){return((_i(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function _i(e){return pi()?e instanceof Node||e instanceof hi(e).Node:!1}function vi(e){return pi()?e instanceof Element||e instanceof hi(e).Element:!1}function yi(e){return pi()?e instanceof HTMLElement||e instanceof hi(e).HTMLElement:!1}function bi(e){return!pi()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof hi(e).ShadowRoot}function xi(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Mi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Si(e){return/^(table|td|th)$/.test(mi(e))}function Ci(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var wi=/transform|translate|scale|rotate|perspective|filter/,Ti=/paint|layout|strict|content/,Ei=e=>!!e&&e!==`none`,Di;function Oi(e){let t=vi(e)?Mi(e):e;return Ei(t.transform)||Ei(t.translate)||Ei(t.scale)||Ei(t.rotate)||Ei(t.perspective)||!Ai()&&(Ei(t.backdropFilter)||Ei(t.filter))||wi.test(t.willChange||``)||Ti.test(t.contain||``)}function ki(e){let t=Pi(e);for(;yi(t)&&!ji(t);){if(Oi(t))return t;if(Ci(t))return null;t=Pi(t)}return null}function Ai(){return Di??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Di}function ji(e){return/^(html|body|#document)$/.test(mi(e))}function Mi(e){return hi(e).getComputedStyle(e)}function Ni(e){return vi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pi(e){if(mi(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||bi(e)&&e.host||gi(e);return bi(t)?t.host:t}function Fi(e){let t=Pi(e);return ji(t)?(e.ownerDocument||e).body:yi(t)&&xi(t)?t:Fi(t)}function Ii(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Fi(e),i=r===e.ownerDocument?.body,a=hi(r);if(i){let e=Li(a);return t.concat(a,a.visualViewport||[],xi(r)?r:[],e&&n?Ii(e):[])}return t.concat(r,Ii(r,[],n))}function Li(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ri(e){let t=Mi(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=yi(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Dr(n)!==a||Dr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function zi(e){return vi(e)?e:e.contextElement}function Bi(e){let t=zi(e);if(!yi(t))return kr(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ri(t),o=(a?Dr(n.width):n.width)/r,s=(a?Dr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Vi=kr(0);function Hi(e){let t=hi(e);return!Ai()||!t.visualViewport?Vi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ui(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===hi(e)}function Wi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=zi(e),o=kr(1);t&&(r?vi(r)&&(o=Bi(r)):o=Bi(e));let s=Ui(a,n,r)?Hi(a):kr(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=hi(a),t=vi(r)?hi(r):r,n=e,i=Li(n);for(;i&&t!==n;){let e=Bi(i),t=i.getBoundingClientRect(),r=Mi(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=hi(i),i=Li(n)}}return Zr({width:u,height:d,x:c,y:l})}function Gi(e,t){let n=Ni(e).scrollLeft;return t?t.left+n:Wi(gi(e)).left+n}function Ki(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Gi(e,n),y:n.top+t.scrollTop}}function qi(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=gi(r),s=t?Ci(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=kr(1),u=kr(0),d=yi(r);if((d||!a)&&((mi(r)!==`body`||xi(o))&&(c=Ni(r)),d)){let e=Wi(r);l=Bi(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ki(o,c):kr(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 Ji(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Yi(e){let t=Ni(e),n=e.ownerDocument.body,r=Er(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Er(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Gi(e),o=-t.scrollTop;return Mi(n).direction===`rtl`&&(a+=Er(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Xi=25;function Zi(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=hi(e),a=gi(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ai()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Gi(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<=Xi&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Qi(e,t){let n=Wi(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Bi(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function $i(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Zi(e,n,t);else if(t===`document`)r=Yi(gi(e));else if(vi(t))r=Qi(t,n);else{let n=Hi(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Zr(r)}function ea(e,t){let n=t.get(e);if(n)return n;let r=Ii(e,[],!1).filter(e=>vi(e)&&mi(e)!==`body`),i=null,a=Mi(e).position===`fixed`,o=a?Pi(e):e;for(;vi(o)&&!ji(o);){let e=Mi(o),t=Oi(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Pi(o)}return t.set(e,r),r}function ta(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ci(t)?[]:ea(t,this._c):[].concat(n),r],o=$i(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=$i(t,a[e],i);s=Er(n.top,s),c=Tr(n.right,c),l=Tr(n.bottom,l),u=Er(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function na(e){let{width:t,height:n}=Ri(e);return{width:t,height:n}}function ra(e,t,n){let r=yi(t),i=gi(t),a=n===`fixed`,o=Wi(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=kr(0);if((r||!a)&&((mi(t)!==`body`||xi(i))&&(s=Ni(t)),r)){let e=Wi(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Gi(i));let l=i&&!r&&!a?Ki(i,s):kr(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 ia(e){return Mi(e).position===`static`}function aa(e,t){if(!yi(e)||Mi(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return gi(e)===n&&(n=n.ownerDocument.body),n}function oa(e,t){let n=hi(e);if(Ci(e))return n;if(!yi(e)){let t=Pi(e);for(;t&&!ji(t);){if(vi(t)&&!ia(t))return t;t=Pi(t)}return n}let r=aa(e,t);for(;r&&Si(r)&&ia(r);)r=aa(r,t);return r&&ji(r)&&ia(r)&&!Oi(r)?n:r||ki(e)||n}var sa=async function(e){let t=this.getOffsetParent||oa,n=this.getDimensions,r=await n(e.floating);return{reference:ra(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ca(e){return Mi(e).direction===`rtl`}var la={convertOffsetParentRelativeRectToViewportRelativeRect:qi,getDocumentElement:gi,getClippingRect:ta,getOffsetParent:oa,getElementRects:sa,getClientRects:Ji,getDimensions:na,getScale:Bi,isElement:vi,isRTL:ca};function ua(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function da(e,t,n){let r=null,i,a=gi(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=Or(d),h=Or(a.clientWidth-(u+f)),g=Or(a.clientHeight-(d+p)),_=Or(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Er(0,Tr(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!ua(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=hi(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function fa(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=zi(e),u=i||a?[...l?Ii(l):[],...t?Ii(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?da(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?Wi(e):null;c&&g();function g(){let t=Wi(e);h&&!ua(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 pa=li,ma=ui,ha=ri,ga=fi,_a=oi,va=ni,ya=di,ba=(e,t,n)=>{let r=new Map,i=n??{},a={...la,...i.platform,_c:r};return ti(e,t,{...i,platform:a})};function xa(e){return typeof e==`function`?e():e}function Sa(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ca(e,t){let n=Sa(e);return Math.round(t*n)/n}function wa(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 Ta(e){let t=e.whileElementsMounted,n=I(()=>xa(e.open)??!0),r=I(()=>xa(e.middleware)),i=I(()=>xa(e.transform)??!0),a=I(()=>xa(e.placement)??`bottom`),o=I(()=>xa(e.strategy)??`absolute`),s=I(()=>xa(e.sideOffset)??0),c=I(()=>xa(e.alignOffset)??0),l=e.reference,u=V(0),d=V(0),f=wn(null),p=V(de(E(o))),m=V(de(E(a))),h=V(de({})),g=V(!1),_=!1,v=0,y=I(()=>{let e=f.current?Ca(f.current,E(u)):E(u),t=f.current?Ca(f.current,E(d)):E(d);return E(i)?{position:E(p),left:`0`,top:`0`,transform:`translate(${e}px, ${t}px)`,...f.current&&Sa(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;ba(e,t,{middleware:E(r),placement:E(a),strategy:E(o)}).then(r=>{if(i===v&&l.current===e&&f.current===t){if(Ea(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 K(()=>{t===void 0&&E(n)&&x()}),K(C),K(()=>{if(t!==void 0){if(T(),!E(n)){_=!1;return}if(!E(g)){_=!1;return}if(!_){_=!0;return}x()}}),K(w),K(()=>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 Ea(e){return e instanceof Element?!e.isConnected||e instanceof HTMLElement&&e.hidden?!0:e.getClientRects().length===0:!1}var Da={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Oa=new xn(`Floating.Root`),ka=new xn(`Floating.Content`),Aa=new xn(`Floating.Root`),ja=class e{static create(t=!1){return t?Aa.set(new e):Oa.set(new e)}anchorNode=wn(null);customAnchorNode=wn(null);triggerNode=wn(null);constructor(){K(()=>{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})}},Ma=class e{static create(t,n=!1){return n?ka.set(new e(t,Aa.get())):ka.set(new e(t,Oa.get()))}opts;root;contentRef=wn(null);wrapperRef=wn(null);arrowRef=wn(null);contentAttachment=dn(this.contentRef);wrapperAttachment=dn(this.wrapperRef);arrowAttachment=dn(this.arrowRef);arrowId=wn(In());#e=I(()=>{if(typeof this.opts.style==`string`)return fn(this.opts.style);if(!this.opts.style)return{}});#t=void 0;#n=new Sn(()=>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(sn),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(()=>[pa({mainAxis:this.opts.sideOffset.current+E(this.#i),alignmentAxis:this.opts.alignOffset.current}),this.opts.avoidCollisions.current&&ma({mainAxis:!0,crossAxis:!1,limiter:this.opts.sticky.current===`partial`?ya():void 0,...this.detectOverflowOptions}),this.opts.avoidCollisions.current&&ha({...this.detectOverflowOptions}),ga({...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&&va({element:this.arrowRef.current,padding:this.opts.arrowPadding.current}),Pa({arrowWidth:E(this.#r),arrowHeight:E(this.#i)}),this.opts.hideWhenDetached.current&&_a({strategy:`referenceHidden`,...this.detectOverflowOptions})].filter(Boolean));get middleware(){return E(this.#p)}set middleware(e){F(this.#p,e)}floating;#m=I(()=>Ia(this.floating.placement));get placedSide(){return E(this.#m)}set placedSide(e){F(this.#m,e)}#h=I(()=>La(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(()=>Da[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:ln({...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),un(()=>e.customAnchor.current,e=>{this.root.customAnchorNode.current=e}),this.floating=Ta({strategy:()=>this.opts.strategy.current,placement:()=>E(this.#a),middleware:()=>this.middleware,reference:this.root.anchorNode,whileElementsMounted:(...e)=>fa(...e,{animationFrame:this.#t?.current===`always`}),open:()=>this.opts.enabled.current,sideOffset:()=>this.opts.sideOffset.current,alignOffset:()=>this.opts.alignOffset.current}),K(()=>{this.floating.isPositioned&&this.opts.onPlaced?.current()}),un(()=>this.contentRef.current,e=>{if(!e||!this.opts.enabled.current)return;let t=pn(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)}}),K(()=>{this.floating.floating.current=this.wrapperRef.current})}},Na=class e{static create(t,n=!1){return n?new e(t,Aa.get()):new e(t,Oa.get())}opts;root;constructor(e,t){this.opts=e,this.root=t,t.triggerNode=e.virtualEl&&e.virtualEl.current?Vn(e.virtualEl.current):e.ref}};function Pa(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]=Fa(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 Fa(e){let[t,n=`center`]=e.split(`-`);return[t,n]}function Ia(e){return Fa(e)[0]}function La(e){return Fa(e)[1]}function Ra(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);ja.create(n());var r=X(),a=J(r);_(a,()=>t.children??R),y(e,r),x()}function za(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);Na.create({id:$(()=>t.id),virtualEl:$(()=>t.virtualEl),ref:t.ref},n());var r=X(),a=J(r);_(a,()=>t.children??R),y(e,r),x()}function Ba(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,In),S=k(t,`customAnchor`,3,null),C=k(t,`tooltip`,3,!1),w=Ma.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(()=>Cn(w.wrapperProps,{style:{pointerEvents:`auto`}}));var D=X(),O=J(D);_(O,()=>t.content??R,()=>({props:w.props,wrapperProps:E(T)})),y(e,D),x()}function Va(e,t){i(t,!0),ue(()=>{t.onPlaced?.()});var n=X(),r=J(n);_(r,()=>t.content??R,()=>({props:{},wrapperProps:{}})),y(e,n),x()}var Ha=new Set([`$$slots`,`$$events`,`$$legacy`,`content`,`isStatic`,`onPlaced`]);function Ua(e,t){let n=k(t,`isStatic`,3,!1),r=U(t,Ha);var i=X(),a=J(i),o=e=>{Va(e,{get content(){return t.content},get onPlaced(){return t.onPlaced}})},s=e=>{Ba(e,q({get content(){return t.content},get onPlaced(){return t.onPlaced}},()=>r))};h(a,e=>{n()?e(o):e(s,-1)}),y(e,i)}var Wa=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(`.`)),Ga=r(`<!> <!>`,1);function Ka(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,Wa),d=I(()=>t.preventScroll??!0),f=I(()=>t.strategy??(E(d)?`fixed`:`absolute`));Ua(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=Ga(),f=J(c),p=e=>{On(e,{get preventScroll(){return E(d)}})},m=e=>{On(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);kn(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;An(e,{get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,r)=>{Bn(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;Gn(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=J(a);{let e=I(()=>({props:Cn(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 qa=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 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,qa);var c=X(),l=J(c),u=e=>{Ka(e,q({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 Ya=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 Xa(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,Ya);Ka(e,q({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 Za(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Qa(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function $a(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 eo=`data-value`,to=cn({component:`command`,parts:[`root`,`list`,`input`,`separator`,`loading`,`empty`,`group`,`group-items`,`group-heading`,`item`,`viewport`,`input-label`]}),no=to.selector(`group`),ro=to.selector(`group-items`),io=to.selector(`group-heading`),ao=to.selector(`item`),oo=`${to.selector(`item`)}:not([aria-disabled="true"])`,so=new xn(`Command.Root`),co=new xn(`Command.List`),lo=new xn(`Command.Group`),uo={search:``,value:``,filtered:{count:0,items:new Map,groups:new Set}},fo=class e{static create(t){return so.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(uo);get commandState(){return E(this.#o)}set commandState(e){F(this.#o,e)}#s=V(de(uo));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,vn(()=>{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=dn(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??gs;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(ro);if(t){let n=e.parentElement===t?e:e.closest(`${ro} > *`);n&&t.appendChild(n)}else{let t=e.parentElement===n?e:e.closest(`${ro} > *`);t&&n?.appendChild(t)}}let i=t.sort((e,t)=>t[1]-e[1]);for(let e of i){let t=n?.querySelector(`${no}[${eo}="${$a(e[0])}"]`);t?.parentElement?.appendChild(t)}this.#f()}setValue(e,t){e!==this.opts.value.current&&e===``&&vn(()=>{this.key++}),this.setState(`value`,e,t),this.opts.value.current=e}#f(){vn(()=>{let e=this.getValidItems().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(eo),t=this.#t&&this.opts.disableInitialScroll.current;this.setValue(e??``,t),this.#t=!1})}#p(){vn(()=>{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(oo)).filter(e=>!!e):[]}getVisibleItems(){let e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(ao)).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(`${oo}[data-selected]`);if(t)return t}#g(){vn(()=>{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(no)?.querySelector(io))?.scrollIntoView({block:`nearest`});return}}else{let n=yn(t);if(n&&n.dataset?.value===e.dataset?.value){(e?.closest(no)?.querySelector(io))?.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(eo)??``)}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(eo)??``)}updateSelectedByGroup(e){let t=this.#h()?.closest(no),n;for(;t&&!n;)t=e>0?Za(t,no):Qa(t,no),n=t?.querySelector(oo);n?this.setValue(n.getAttribute(eo)??``):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,vn(()=>{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,vn(()=>{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&&po(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||po(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&&po(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||po(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 on:this.isGrid?this.#b(e):this.#y(e);break;case Fn: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 nn:this.isGrid?this.#T(e):this.#O(e);break;case gn:if(!this.isGrid)break;this.#O(e);break;case mn: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`,[to.root]:``,tabindex:-1,onkeydown:this.onkeydown,...this.attachment}));get props(){return E(this.#k)}set props(e){F(this.#k,e)}};function po(e){return e.getAttribute(`aria-disabled`)===`true`}var mo=class e{static create(t){return new e(t,so.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=dn(this.opts.ref),re(()=>{this.#t=!1})}#n=I(()=>({id:this.opts.id.current,role:`presentation`,[to.empty]:``,...this.attachment}));get props(){return E(this.#n)}set props(e){F(this.#n,e)}},ho=class e{static create(t){return lo.set(new e(t,so.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=dn(this.opts.ref),this.trueValue=e.value.current??e.id.current,un(()=>this.trueValue,()=>this.root.registerGroup(this.trueValue)),K(()=>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,[to.group]:``,...this.attachment}));get props(){return E(this.#r)}set props(e){F(this.#r,e)}},go=class e{static create(t){return new e(t,lo.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=dn(this.opts.ref,e=>this.group.headingNode=e)}#e=I(()=>({id:this.opts.id.current,[to[`group-heading`]]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},_o=class e{static create(t){return new e(t,lo.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=dn(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`group`,[to[`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)}},vo=class e{static create(t){return new e(t,so.get())}opts;root;attachment;#e=I(()=>{let e=this.root.viewportNode?.querySelector(`${ao}[${eo}="${$a(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=dn(this.opts.ref,e=>this.root.inputNode=e),un(()=>this.opts.ref.current,()=>{let e=this.opts.ref.current;e&&this.opts.autofocus.current&&Xn(10,()=>e.focus())}),un(()=>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`,[to.input]:``,autocomplete:`off`,autocorrect:`off`,spellcheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":_n(!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)}},yo=class e{static create(t){let n=lo.getOr(null);return new e({...t,group:n},so.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=lo.getOr(null),this.trueValue=e.value.current,this.attachment=dn(this.opts.ref),un([()=>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)}),un([()=>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(eo,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":_n(this.opts.disabled.current),"aria-selected":_n(this.isSelected),"data-disabled":hn(this.opts.disabled.current),"data-selected":hn(this.isSelected),"data-value":this.trueValue,"data-group":this.#e?.trueValue,[to.item]:``,role:`option`,onpointermove:this.onpointermove,onclick:this.onclick,...this.attachment}));get props(){return E(this.#s)}set props(e){F(this.#s,e)}},bo=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=dn(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`progressbar`,"aria-valuenow":this.opts.progress.current,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Loading...`,[to.loading]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},xo=class e{static create(t){return co.set(new e(t,so.get()))}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=dn(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`listbox`,"aria-label":this.opts.ariaLabel.current,[to.list]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},So=class e{static create(t){return new e(t,so.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=dn(this.opts.ref,e=>this.root.labelNode=e)}#e=I(()=>({id:this.opts.id.current,[to[`input-label`]]:``,for:this.opts.for?.current,style:Sr,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Co=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`]),wo=r(`<label><!></label>`);function To(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=U(t,Co),c=So.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>Cn(s,c.props));var d=wo();P(d,()=>({...E(l)}));var f=W(d);_(f,()=>t.children??R),n(d),y(e,d),x()}var Eo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`onValueChange`,`onStateChange`,`loop`,`shouldFilter`,`filter`,`label`,`vimBindings`,`disablePointerSelection`,`disableInitialScroll`,`columns`,`children`,`child`]),Do=r(`<!> <!>`,1),Oo=r(`<div><!> <!></div>`);function ko(e,t){let r=u();i(t,!0);let a=e=>{To(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,v())),y(e,n)},$$slots:{default:!0}})},o=k(t,`id`,19,()=>qn(r)),s=k(t,`ref`,15,null),l=k(t,`value`,15,``),d=k(t,`onValueChange`,3,bn),f=k(t,`onStateChange`,3,bn),p=k(t,`loop`,3,!1),m=k(t,`shouldFilter`,3,!0),g=k(t,`filter`,3,gs),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,Eo),O=fo.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(()=>Cn(D,O.props));var N={updateSelectedToIndex:A,updateSelectedByGroup:j,updateSelectedByItem:ee,getValidItems:te},F=X(),L=J(F),ne=e=>{var n=Do(),r=J(n);a(r);var i=z(r,2);_(i,()=>t.child,()=>({props:E(M)})),y(e,n)},re=e=>{var r=Oo();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 Ao=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`,`forceMount`]),jo=r(`<div><!></div>`);function Mo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=k(t,`forceMount`,3,!1),c=U(t,Ao),l=mo.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),forceMount:$(()=>s())}),d=I(()=>Cn(l.props,c));var f=X(),p=J(f),m=e=>{var r=X(),i=J(r),a=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},o=e=>{var r=jo();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 No=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`forceMount`,`children`,`child`]),Po=r(`<div><!></div>`);function Fo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`forceMount`,3,!1),l=U(t,No),d=ho.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),forceMount:$(()=>c()),value:$(()=>s())}),f=I(()=>Cn(l,d.props));var p=X(),m=J(p),g=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},v=e=>{var r=Po();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 Io=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),Lo=r(`<div><!></div>`);function Ro(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=U(t,Io),c=go.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>Cn(s,c.props));var d=X(),f=J(d),p=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=Lo();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 zo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),Bo=r(`<div><!></div>`),Vo=r(`<div style="display: contents;"><!></div>`);function Ho(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=U(t,zo),c=_o.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>Cn(s,c.props));var d=Vo(),f=W(d),p=e=>{var n=X(),r=J(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 Uo=new Set([`$$slots`,`$$events`,`$$legacy`,`value`,`autofocus`,`id`,`ref`,`child`]),Wo=r(`<input/>`);function Go(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,()=>qn(n)),s=k(t,`ref`,15,null),c=U(t,Uo),l=vo.create({id:$(()=>o()),ref:$(()=>s(),e=>s(e)),value:$(()=>r(),e=>{r(e)}),autofocus:$(()=>a()??!1)}),d=I(()=>Cn(c,l.props));var f=X(),p=J(f),m=e=>{var n=X(),r=J(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 Ko=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`disabled`,`children`,`child`,`onSelect`,`forceMount`,`keywords`]),qo=r(`<div><!></div>`),Jo=r(`<div style="display: contents;" data-item-wrapper=""><!></div>`);function Yo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`disabled`,3,!1),l=k(t,`onSelect`,3,bn),d=k(t,`forceMount`,3,!1),f=k(t,`keywords`,19,()=>[]),m=U(t,Ko),g=yo.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),value:$(()=>s()),disabled:$(()=>c()),onSelect:$(()=>l()),forceMount:$(()=>d()),keywords:$(()=>f())}),v=I(()=>Cn(m,g.props));var b=X(),S=J(b);p(S,()=>g.root.key,e=>{var r=Jo(),i=W(r),a=e=>{var r=X(),i=J(r),a=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(v)})),y(e,n)},o=e=>{var r=qo();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 Xo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`aria-label`]),Zo=r(`<div><!></div>`);function Qo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=U(t,Xo),c=xo.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),ariaLabel:$(()=>t[`aria-label`]??`Suggestions...`)}),l=I(()=>Cn(s,c.props));var d=X(),f=J(d);p(f,()=>c.root._commandState.search===``,e=>{var r=X(),i=J(r),a=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},o=e=>{var r=Zo();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 $o=new Set([`$$slots`,`$$events`,`$$legacy`,`progress`,`id`,`ref`,`children`,`child`]),es=r(`<div><!></div>`);function ts(e,t){let r=u();i(t,!0);let a=k(t,`progress`,3,0),o=k(t,`id`,19,()=>qn(r)),s=k(t,`ref`,15,null),c=U(t,$o),l=bo.create({id:$(()=>o()),ref:$(()=>s(),e=>s(e)),progress:$(()=>a())}),d=I(()=>Cn(c,l.props));var f=X(),p=J(f),m=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},g=e=>{var r=es();P(r,()=>({...E(d)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(p,e=>{t.child?e(m):e(g,-1)}),y(e,f),x()}var ns=1,rs=.9,is=.8,as=.17,os=.1,ss=.999,cs=.9999,ls=.99,us=/[\\/_+.#"@[({&]/,ds=/[\\/_+.#"@[({&]/g,fs=/[\s-]/,ps=/[\s-]/g;function ms(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ns:ls;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=ms(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ns:us.test(e.charAt(l-1))?(d*=is,p=e.slice(i,l-1).match(ds),p&&i>0&&(d*=ss**p.length)):fs.test(e.charAt(l-1))?(d*=rs,m=e.slice(i,l-1).match(ps),m&&i>0&&(d*=ss**m.length)):(d*=as,i>0&&(d*=ss**(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=cs)),(d<os&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=ms(e,t,n,r,l+1,a+2,o),f*os>d&&(d=f*os)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function hs(e){return e.toLowerCase().replace(ps,` `)}function gs(e,t,n){return e=n&&n.length>0?`${`${e} ${n?.join(` `)}`}`:e,ms(e,t,hs(e),hs(t),0,0,{})}var _s=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`onSelect`,`closeOnSelect`]),vs=r(`<div><!></div>`);function ys(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>qn(r)),s=k(t,`disabled`,3,!1),c=k(t,`onSelect`,3,bn),l=k(t,`closeOnSelect`,3,!0),d=U(t,_s),f=Kn.create({id:$(()=>o()),disabled:$(()=>s()),onSelect:$(()=>c()),ref:$(()=>a(),e=>a(e)),closeOnSelect:$(()=>l())}),p=I(()=>Cn(d,f.props));var m=X(),g=J(m),v=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(p)})),y(e,n)},b=e=>{var r=vs();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 bs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),xs=r(`<div><!></div>`);function Ss(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>qn(r)),s=U(t,bs),c=Tn.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>Cn(s,c.props));var d=X(),f=J(d),p=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=xs();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 Cs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),ws=r(`<div><!></div>`);function Ts(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>qn(r)),s=U(t,Cs),c=jn.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>Cn(s,c.props));var d=X(),f=J(d),p=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=ws();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`,`ref`,`id`,`child`,`children`]),Ds=r(`<div><!></div>`);function Os(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>qn(r)),s=U(t,Es),c=Jn.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>Cn(s,c.props));var d=X(),f=J(d),p=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=Ds();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 ks(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=k(t,`dir`,3,`ltr`),a=k(t,`onOpenChange`,3,bn),o=k(t,`onOpenChangeComplete`,3,bn),s=k(t,`_internal_variant`,3,`dropdown-menu`),c=k(t,`_internal_should_skip_exit_animation`,3,void 0),l=Dn.create({variant:$(()=>s()),dir:$(()=>r()),onClose:()=>{n(!1),a()(!1)},shouldSkipExitAnimation:()=>c()?.()??!1});Yn.create({open:$(()=>n(),e=>{n(e),a()(e)}),onOpenChangeComplete:$(()=>o())},l),Ra(e,{children:(e,n)=>{var r=X(),i=J(r);_(i,()=>t.children??R),y(e,r)},$$slots:{default:!0}}),x()}var As=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`child`,`children`,`ref`,`loop`,`onInteractOutside`,`onEscapeKeydown`,`onCloseAutoFocus`,`forceMount`,`trapFocus`,`style`]),js=r(`<div><div><!></div></div>`);function Ms(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=k(t,`loop`,3,!0),c=k(t,`onInteractOutside`,3,bn),l=k(t,`onEscapeKeydown`,3,bn),d=k(t,`onCloseAutoFocus`,3,bn),f=k(t,`forceMount`,3,!1),p=k(t,`trapFocus`,3,!1),m=U(t,As),g=Mn.create({id:$(()=>a()),loop:$(()=>s()),ref:$(()=>o(),e=>o(e)),onCloseAutoFocus:$(()=>d())}),v=I(()=>Cn(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=J(C),T=e=>{Xa(e,q(()=>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(()=>Cn(i(),{style:wa(`dropdown-menu`)},{style:t.style}));var s=X(),c=J(s),l=e=>{var n=X(),r=J(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=js();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=>{Ja(e,q(()=>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(()=>Cn(i(),{style:wa(`dropdown-menu`)},{style:t.style}));var s=X(),c=J(s),l=e=>{var n=X(),r=J(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=js();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 Ns=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`disabled`,`type`]),Ps=r(`<button><!></button>`);function Fs(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=k(t,`disabled`,3,!1),c=k(t,`type`,3,`button`),l=U(t,Ns),d=Ln.create({id:$(()=>a()),disabled:$(()=>s()??!1),ref:$(()=>o(),e=>o(e))}),f=I(()=>Cn(l,d.props,{type:c()}));za(e,{get id(){return a()},get ref(){return d.opts.ref},children:(e,r)=>{var i=X(),a=J(i),o=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},s=e=>{var r=Ps();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 Is=cn({component:`label`,parts:[`root`]}),Ls=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=dn(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}onmousedown(e){e.detail>1&&e.preventDefault()}#e=I(()=>({id:this.opts.id.current,[Is.root]:``,onmousedown:this.onmousedown,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Rs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`for`]),zs=r(`<label><!></label>`);function Bs(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>qn(r)),o=k(t,`ref`,15,null),s=U(t,Rs),c=Ls.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>Cn(s,c.props,{for:t.for}));var d=X(),f=J(d),p=e=>{var n=X(),r=J(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=zs();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),rn(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)}};cn({component:`tooltip`,parts:[`content`,`trigger`]});var Hs=new xn(`Tooltip.Provider`);new xn(`Tooltip.Root`);var Us=class e{static create(t){return Hs.set(new e(t))}opts;#e=V(!0);get isOpenDelayed(){return E(this.#e)}set isOpenDelayed(e){F(this.#e,e,!0)}isPointerInTransit=wn(!1);#t;#n=V(null);constructor(e){this.opts=e,this.#t=new Vs(()=>{this.isOpenDelayed=!0},this.opts.skipDelayDuration.current),Cr(()=>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 Ws(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);Us.create({delayDuration:$(()=>n()),disableCloseOnTriggerClick:$(()=>r()),disableHoverableContent:$(()=>a()),disabled:$(()=>o()),ignoreNonKeyboardFocus:$(()=>s()),skipDelayDuration:$(()=>c())});var l=X(),u=J(l);_(u,()=>t.children??R),y(e,l),x()}var Gs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Ks(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Gs);var o=X(),s=J(o);{let e=I(()=>Zn(`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,()=>Bs,(t,i)=>{i(t,q({"data-slot":`label`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var qs=r(`<!> Import workspace`,1),Js=r(`<!> <!>`,1),Ys=r(`<div class="rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive"> </div>`),Xs=r(`<!> Browse…`,1),Zs=r(`Display name <span class="text-muted-foreground">(optional)</span>`,1),Qs=r(`<!> Import`,1),$s=r(`<!> <!> <div class="space-y-3"><div class="space-y-1.5"><!> <div class="flex gap-2"><!> <!></div> <p class="text-xs 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 ec(e,t){i(t,!0);let r=V(!1);K(()=>{ke.open=E(r)}),K(()=>{ke.open&&F(r,!0)}),K(()=>{E(r)&&(F(o,``),F(s,``),F(u,null))});let o=V(``),s=V(``),l=V(!1),u=V(null),d=V(!0),f=V(!1);async function p(){F(f,!0);try{let e=await $t();if(!e.supported){F(d,!1);return}e.path!==null&&(F(o,e.path,!0),E(s).trim()||F(s,e.path.split(`/`).filter(Boolean).pop()??``,!0))}finally{F(f,!1)}}async function m(){if(!E(o).trim()){F(u,`A directory path is required.`);return}F(l,!0),F(u,null);try{let e=await tn(E(o).trim(),E(s).trim()||void 0);if(!e)return;F(r,!1),await ge(en(e))}catch(e){F(u,e instanceof Error?e.message:String(e),!0)}finally{F(l,!1)}}var g=X(),_=J(g);a(_,()=>Un,(e,t)=>{t(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,t)=>{var i=X(),g=J(i);a(g,()=>Nn,(e,t)=>{t(e,{class:`sm:max-w-[460px]`,children:(e,t)=>{var i=$s(),g=J(i);a(g,()=>En,(e,t)=>{t(e,{children:(e,t)=>{var n=Js(),r=J(n);a(r,()=>zn,(e,t)=>{t(e,{class:`flex items-center gap-2`,children:(e,t)=>{var n=qs(),r=J(n);ar(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>Hn,(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 _=z(g,2),v=e=>{var t=Ys(),n=M(t,!0);H(()=>c(n,E(u))),y(e,t)};h(_,e=>{E(u)&&e(v)});var b=z(_,2),x=W(b),S=W(x);Ks(S,{for:`ws-path`,children:(e,t)=>{oe();var n=C(`Directory path`);y(e,n)},$$slots:{default:!0}});var w=z(S,2),T=W(w);rr(T,{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)}});var D=z(T,2),O=e=>{{let t=I(()=>E(f)||E(l));Qn(e,{variant:`outline`,size:`sm`,class:`h-8 shrink-0 gap-1.5`,get disabled(){return E(t)},onclick:()=>void p(),children:(e,t)=>{var n=Xs(),r=J(n),i=e=>{er(e,{class:`h-3.5 w-3.5 animate-spin`})};h(r,e=>{E(f)&&e(i)}),oe(),y(e,n)},$$slots:{default:!0}})}};h(D,e=>{E(d)&&e(O)}),n(w),oe(2),n(x);var k=z(x,2),A=W(k);Ks(A,{for:`ws-label`,children:(e,t)=>{oe();var n=Zs();oe(),y(e,n)},$$slots:{default:!0}});var j=z(A,2);rr(j,{id:`ws-label`,placeholder:`My Skills`,get value(){return E(s)},set value(e){F(s,e,!0)}}),n(k);var ee=z(k,2),te=W(ee);Qn(te,{variant:`outline`,size:`sm`,onclick:()=>F(r,!1),children:(e,t)=>{oe();var n=C(`Cancel`);y(e,n)},$$slots:{default:!0}});var N=z(te,2);Qn(N,{size:`sm`,get disabled(){return E(l)},onclick:m,children:(e,t)=>{var n=Qs(),r=J(n),i=e=>{er(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(ee),n(b),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,g),x()}var tc=new Set([`$$slots`,`$$events`,`$$legacy`,`api`,`ref`,`value`,`class`]);function nc(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,tc);var c=X(),l=J(c);{let e=I(()=>Zn(`bg-popover text-popover-foreground rounded-xl p-1 flex size-full flex-col overflow-hidden`,t.class));a(l,()=>ko,(t,i)=>{se(i(t,q({"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 rc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function ic(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,rc);var o=X(),s=J(o);a(s,()=>ts,(e,t)=>{t(e,q(()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var ac=new Set([`$$slots`,`$$events`,`$$legacy`,`open`,`ref`,`value`,`title`,`description`,`showCloseButton`,`portalProps`,`children`,`class`]),oc=r(`<!> <!>`,1);function sc(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,ac);var f=X(),p=J(f);a(p,()=>Un,(e,i)=>{i(e,q(()=>d,{get open(){return n()},set open(e){n(e)},children:(e,n)=>{var i=oc(),f=J(i);a(f,()=>En,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{var n=oc(),r=J(n);a(r,()=>zn,(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,()=>Hn,(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(()=>Zn(`rounded-xl! p-0 top-1/3 translate-y-0 overflow-hidden p-0`,t.class));a(p,()=>Nn,(n,i)=>{i(n,{get class(){return E(e)},get showCloseButton(){return u()},get portalProps(){return t.portalProps},children:(e,n)=>{nc(e,q(()=>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 cc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function lc(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,cc);var o=X(),s=J(o);{let e=I(()=>Zn(`py-6 text-center text-xs/relaxed`,t.class));a(s,()=>Mo,(t,i)=>{i(t,q({"data-slot":`command-empty`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var uc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`heading`,`value`]),dc=r(`<!> <!>`,1);function fc(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,uc);var o=X(),s=J(o);{let e=I(()=>Zn(`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??`----${In()}`);a(s,()=>Fo,(o,s)=>{s(o,q({"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=dc(),i=J(r),o=e=>{var n=X(),r=J(n);a(r,()=>Ro,(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,()=>Ho,(e,n)=>{n(e,{get children(){return t.children}})}),y(e,r)},$$slots:{default:!0}}))})}y(e,o),x()}var pc=new Set([`$$slots`,`$$events`,`$$legacy`]);function mc(e,t){let n=U(t,pc),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];ye(e,q({name:`check`},()=>n,{get iconNode(){return r}}))}var hc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),gc=r(`<!> <!>`,1);function _c(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,hc);var o=X(),s=J(o);{let e=I(()=>Zn(`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,()=>Yo,(i,a)=>{a(i,q({"data-slot":`command-item`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=gc(),i=J(r);_(i,()=>t.children??R),mc(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 vc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),yc=r(`<div><!></div>`);function bc(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,vc);var o=yc();P(o,e=>({"data-slot":`input-group`,role:`group`,class:e,...a}),[()=>Zn(`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 xc=$n({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`}}),Sc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`align`]),Cc=r(`<div><!></div>`);function wc(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=k(t,`align`,3,`inline-start`),o=U(t,Sc);var s=Cc(),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}),[()=>Zn(xc({align:a()}),t.class)]);var l=W(s);_(l,()=>t.children??R),n(s),se(s,e=>r(e),()=>r()),y(e,s),x()}$n({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 Tc=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,Tc);{let i=I(()=>Zn(`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));rr(e,q({"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 Dc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`value`]),Oc=r(`<!> <!>`,1),kc=r(`<div data-slot="command-input-wrapper" class="p-1 pb-0"><!></div>`);function Ac(e,t){i(t,!0);let r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=U(t,Dc);var c=kc(),l=W(c);a(l,()=>bc,(e,n)=>{n(e,{class:`bg-input/20 dark:bg-input/30 h-8!`,children:(e,n)=>{var i=Oc(),c=J(i);{let e=(e,t)=>{let n=()=>(t?.()).props;var i=X(),s=J(i);a(s,()=>Ec,(e,t)=>{t(e,q(n,{get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}}))}),y(e,i)},n=I(()=>Zn(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,t.class));a(c,()=>Go,(t,r)=>{r(t,q({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,()=>wc,(e,t)=>{t(e,{children:(e,t)=>{sr(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 jc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Mc(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,jc);var o=X(),s=J(o);{let e=I(()=>Zn(`no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto`,t.class));a(s,()=>Qo,(t,i)=>{i(t,q({"data-slot":`command-list`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var Nc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pc(e,t){let n=U(t,Nc),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,q({name:`file-plus-corner`},()=>n,{get iconNode(){return r}}))}var Fc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ic(e,t){let n=U(t,Fc),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,q({name:`layout-grid`},()=>n,{get iconNode(){return r}}))}var Lc=r(`<!> Workspaces`,1),Rc=r(`<!> Creator`,1),zc=r(`<!> Repository`,1),Bc=r(`<!> Open search config`,1),Vc=r(`<!> <!> <!> <!>`,1),Hc=r(`<!> <span class="flex-1 truncate"> </span> <span class="text-xs tabular-nums text-muted-foreground"> </span>`,1),Uc=r(`<div class="px-2.5 py-1.5 text-xs text-muted-foreground">Type to search skills across workspaces…</div>`),Wc=r(`<div class="px-2.5 py-1.5 text-xs text-destructive"> </div>`),Gc=r(`<div class="px-2.5 py-1.5 text-xs text-muted-foreground">No matching skill.</div>`),Kc=r(`<span class="hidden min-w-0 max-w-[45%] truncate text-xs text-muted-foreground sm:block"> </span>`),qc=r(`<!> <span class="min-w-0 flex-1 truncate"> </span> <!>`,1),Jc=r(`<!> <!>`,1);function Yc(e,n){i(n,!0);let r=V(!1),o=V(``);K(()=>{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)}),K(()=>{if(!E(r))return;let e=E(o).trim();if(!e)return;let t=setTimeout(()=>void Yt(e,20),150);return()=>clearTimeout(t)}),K(()=>{E(r)||(F(o,``),Jt())});function s(e){F(r,!1),e()}let l=I(()=>E(o).trim()),u=I(()=>Kt.query===E(l)),d=I(()=>!E(u)||E(u)&&Kt.searching),f=I(()=>{if(!E(l)||!E(u)||Kt.error)return[];let e=[];for(let t of Kt.results)for(let n of t.installations)e.push({key:`${n.workspaceId}:${n.providerId}:${t.id}`,result:t,workspaceId:n.workspaceId,providerId:n.providerId,heading:qt(n.workspaceId,n.providerId)});return e}),p=I(()=>{let e=new Map;for(let t of E(f)){let n=`${t.workspaceId}/${t.providerId}`,r=e.get(n)??{scope:n,heading:t.heading,rows:[]};r.rows.push(t),e.set(n,r)}return[...e.values()]});var m=X(),g=J(m);a(g,()=>sc,(e,n)=>{n(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,n)=>{var r=Jc(),i=J(r);a(i,()=>Ac,(e,t)=>{t(e,{placeholder:`Search navigation, workspaces and skills…`,get value(){return E(o)},set value(e){F(o,e,!0)}})});var f=z(i,2);a(f,()=>Mc,(e,n)=>{n(e,{children:(e,n)=>{var r=Vc(),i=J(r),o=e=>{var t=X(),n=J(t);a(n,()=>lc,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`No matching destination.`);y(e,n)},$$slots:{default:!0}})}),y(e,t)};h(i,e=>{E(l)||e(o)});var f=z(i,2);a(f,()=>fc,(e,t)=>{t(e,{heading:`Navigate`,children:(e,t)=>{var n=Vc(),r=J(n);a(r,()=>_c,(e,t)=>{t(e,{onSelect:()=>s(()=>ge(`/workspaces`)),value:`go workspaces manage locations`,children:(e,t)=>{var n=Lc();Ic(J(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>_c,(e,t)=>{t(e,{onSelect:()=>s(()=>ge(`/creator`)),value:`go creator new skill`,children:(e,t)=>{var n=Rc();Pc(J(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var o=z(i,2);a(o,()=>_c,(e,t)=>{t(e,{onSelect:()=>s(()=>ge(`/repository`)),value:`go repository browse remote`,children:(e,t)=>{var n=zc(),r=J(n);He(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var c=z(o,2);a(c,()=>_c,(e,t)=>{t(e,{onSelect:()=>s(()=>void Gt()),value:`go search config toml`,children:(e,t)=>{var n=Bc(),r=J(n);cr(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var m=z(f,2),g=e=>{var n=X(),r=J(n);a(r,()=>fc,(e,n)=>{n(e,{heading:`Workspaces`,children:(e,n)=>{var r=X(),i=J(r);t(i,17,()=>Zt.workspaces,e=>e.id,(e,t)=>{var n=X(),r=J(n);{let e=I(()=>`workspace ${E(t).label} ${E(t).path}`);a(r,()=>_c,(n,r)=>{r(n,{get value(){return E(e)},onSelect:()=>s(()=>ge(en(E(t)))),children:(e,n)=>{var r=Hc(),i=J(r);ar(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(m,e=>{Zt.workspaces.length>0&&e(g)});var _=z(m,2),v=e=>{var t=X(),n=J(t);a(n,()=>fc,(e,t)=>{t(e,{heading:`Skills`,value:`skills`,forceMount:!0,children:(e,t)=>{var n=Uc();y(e,n)},$$slots:{default:!0}})}),y(e,t)},b=e=>{var t=X(),n=J(t);a(n,()=>fc,(e,t)=>{t(e,{heading:`Skills`,value:`skills`,forceMount:!0,children:(e,t)=>{var n=X(),r=J(n);a(r,()=>ic,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`Searching skills…`);y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})}),y(e,t)},x=e=>{var t=X(),n=J(t);a(n,()=>fc,(e,t)=>{t(e,{heading:`Skills`,value:`skills`,forceMount:!0,children:(e,t)=>{var n=Wc(),r=M(n);H(()=>c(r,`Skill search failed — ${Kt.error??``}`)),y(e,n)},$$slots:{default:!0}})}),y(e,t)},S=e=>{var t=X(),n=J(t);a(n,()=>fc,(e,t)=>{t(e,{heading:`Skills`,value:`skills`,forceMount:!0,children:(e,t)=>{var n=Gc();y(e,n)},$$slots:{default:!0}})}),y(e,t)},w=e=>{var n=X(),r=J(n);t(r,17,()=>E(p),e=>e.scope,(e,n)=>{var r=X(),i=J(r);a(i,()=>fc,(e,r)=>{r(e,{get heading(){return E(n).heading},get value(){return E(n).scope},forceMount:!0,children:(e,r)=>{var i=X(),o=J(i);t(o,17,()=>E(n).rows,e=>e.key,(e,t)=>{var n=X(),r=J(n);{let e=I(()=>`skill ${E(t).result.name} ${E(t).key}`);a(r,()=>_c,(n,r)=>{r(n,{get value(){return E(e)},forceMount:!0,onSelect:()=>s(()=>pt(`workspaces.provider`,{wsId:E(t).workspaceId,providerId:E(t).providerId},{skill:E(t).result.id,view:`detail`})),children:(e,n)=>{var r=qc(),i=J(r);lr(i,{class:`h-4 w-4 shrink-0`});var a=z(i,2),o=M(a,!0),s=z(a,2),l=e=>{var n=Kc(),r=M(n,!0);H(()=>c(r,E(t).result.description)),y(e,n)};h(s,e=>{E(t).result.description&&e(l)}),H(()=>c(o,E(t).result.name)),y(e,r)},$$slots:{default:!0}})})}y(e,n)}),y(e,i)},$$slots:{default:!0}})}),y(e,r)}),y(e,n)};h(_,e=>{E(l)?E(d)?e(b,1):E(u)&&Kt.error?e(x,2):E(p).length===0?e(S,3):e(w,-1):e(v)}),y(e,r)},$$slots:{default:!0}})}),y(e,r)},$$slots:{default:!0}})}),y(e,m),x()}var Xc=r(`<button class="text-xs font-medium text-primary hover:underline"> </button>`),Zc=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>`),Qc=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 $c(e,r){i(r,!1),te();var a=Qc();t(a,5,()=>xe,e=>e.id,(e,t)=>{var r=Zc(),i=W(r),a=M(i,!0),o=z(i,2),s=e=>{var n=Xc(),r=M(n,!0);H(()=>c(r,E(t).action.label)),l(`click`,n,()=>{E(t).action.run(),Se(E(t).id)}),y(e,n)};h(o,e=>{E(t).action&&e(s)});var u=z(o,2),d=W(u);tr(d,{class:`h-3.5 w-3.5`}),n(u),n(r),H(()=>c(a,E(t).message)),l(`click`,u,()=>Se(E(t).id)),y(e,r)}),n(a),y(e,a),x()}T([`click`]);var el=new Set([`$$slots`,`$$events`,`$$legacy`,`delayDuration`]);function tl(e,t){let n=k(t,`delayDuration`,3,0),r=U(t,el);var i=X(),o=J(i);a(o,()=>Ws,(e,t)=>{t(e,q({get delayDuration(){return n()}},()=>r))}),y(e,i)}var nl=()=>navigator.opentrayWindow??navigator.opentray?.window??void 0,rl={width:960,height:680},il={width:1100,height:760};async function al(e){let t=nl();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 ol=new Set([`$$slots`,`$$events`,`$$legacy`]);function sl(e,t){let n=U(t,ol),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,q({name:`command`},()=>n,{get iconNode(){return r}}))}var cl=new Set([`$$slots`,`$$events`,`$$legacy`]);function ll(e,t){let n=U(t,cl),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,q({name:`settings`},()=>n,{get iconNode(){return r}}))}var ul=r(`<option>New session…</option>`),dl=r(`<option>No sessions</option>`),fl=r(`<option> </option>`),pl=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>`),ml=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 hl(e,r){i(r,!0);let a=I(()=>{let e=tt.sessions.find(e=>e.sessionId===Z.sessionId);return e?`${e.title||e.sessionId} (${e.status})`:void 0});var o=ml(),s=z(W(o),2),u=W(s),d=e=>{var t=ul();t.value=t.__value=``,y(e,t)};h(u,e=>{Z.sessionId===null&&e(d)});var f=z(u),p=e=>{var t=dl();t.value=t.__value=``,y(e,t)};h(f,e=>{tt.sessions.length===0&&Z.sessionId!==null&&e(p)});var m=z(f);t(m,17,()=>tt.sessions,e=>e.sessionId,(e,t)=>{var n=fl(),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=pl(),r=W(t);or(r,{class:`h-4 w-4`}),n(t),l(`click`,t,()=>Ge()),y(e,t)};h(_,e=>{Z.sessionId&&e(v)});var b=z(_,2),S=W(b);tr(S,{class:`h-4 w-4`}),n(b),n(o),H(()=>{B(s,`title`,E(a)),g!==(g=Z.sessionId??``)&&(s.value=(s.__value=g)??``,he(s,g))}),l(`change`,s,e=>Je(e.currentTarget.value)),l(`click`,b,()=>dt(!1)),y(e,o),x()}T([`change`,`click`]);var gl=new Set([`$$slots`,`$$events`,`$$legacy`]);function _l(e,t){let n=U(t,gl),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,q({name:`copy`},()=>n,{get iconNode(){return r}}))}var vl=new Set([`$$slots`,`$$events`,`$$legacy`]);function yl(e,t){let n=U(t,vl),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,q({name:`file`},()=>n,{get iconNode(){return r}}))}var bl=new Set([`$$slots`,`$$events`,`$$legacy`]);function xl(e,t){let n=U(t,bl),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,q({name:`image`},()=>n,{get iconNode(){return r}}))}var Sl=new Set([`$$slots`,`$$events`,`$$legacy`]);function Cl(e,t){let n=U(t,Sl),r=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]];ye(e,q({name:`arrow-down`},()=>n,{get iconNode(){return r}}))}var wl=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tl(e,t){let n=U(t,wl),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,q({name:`bot`},()=>n,{get iconNode(){return r}}))}var El=r(`<div class="text-[11px] font-medium text-muted-foreground"> </div>`),Dl=r(`<div class="whitespace-pre-wrap text-[11px] text-muted-foreground"> </div>`),Ol=r(`<span class="block text-[10px] text-muted-foreground"> </span>`),kl=r(`<button> <!></button>`),Al=r(`<div class="flex flex-wrap gap-1.5"></div>`),jl=r(`<div class="mb-2 space-y-1.5"><!> <div class="whitespace-pre-wrap"> </div> <!> <!> <!></div>`),Ml=r(`<div class="flex justify-end"><!></div>`),Nl=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 Pl(e,r){i(r,!0);let a=de({}),o=de({});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(){at(r.seq,r.questions.map(e=>({id:e.id,selected:a[e.id]??[],custom:(o[e.id]??``).trim()||void 0})))}var f=Nl(),p=W(f),m=M(p,!0),g=z(p,2);t(g,17,()=>r.questions,e=>e.id,(e,i)=>{var u=jl(),d=W(u),f=e=>{var t=El(),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=Dl(),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=Al();t(o,21,()=>E(i).options,e=>e.label,(e,t)=>{var o=kl(),u=W(o),d=z(u),f=e=>{var n=Ol(),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]??``);rr(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=Ml(),r=W(t);{let e=I(()=>!u());Qn(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 Fl=new Set([`$$slots`,`$$events`,`$$legacy`]);function Il(e,t){let n=U(t,Fl),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];ye(e,q({name:`terminal`},()=>n,{get iconNode(){return r}}))}var Ll=new Set([`$$slots`,`$$events`,`$$legacy`]);function Rl(e,t){let n=U(t,Ll),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,q({name:`wrench`},()=>n,{get iconNode(){return r}}))}var zl=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-destructive" title="Tool error" aria-label="Tool error"></span>`),Bl=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 Vl(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=Bl(),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=zl();y(e,t)};h(v,e=>{u()&&e(b)}),n(m);var S=z(m,4),C=M(S,!0),w=z(S,2);fr(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 Hl=r(`<iframe sandbox="allow-scripts"></iframe>`),Ul=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground"> </div>`),Wl=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground" role="status">Loading card…</div>`),Gl=r(`<div class="my-1 overflow-hidden rounded-lg border border-border"><!></div>`);function Kl(e,t){i(t,!0);let r=V(null),a=V(!1),o=V(null),s=V(null);K(()=>{let e=t.resourceUri;F(r,null),F(a,!1),Bt().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=Gl();f(`message`,A,l);var m=W(p),g=e=>{var n=Hl();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=Ul(),r=M(n);H(()=>c(r,`Card unavailable: ${t.title??``}`)),y(e,n)},v=e=>{var t=Wl();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 ql=r(`<div class="mt-2 flex justify-end gap-1.5"><!> <!></div>`),Jl=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 Yl(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=Bt(),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),be(e===`approve`?E(o)===`executed`?`Proposal executed: ${t.capability}`:`Proposal failed: ${t.capability}`:`Proposal rejected: ${t.capability}`)}catch(e){be(e instanceof Error?e.message:String(e))}finally{F(r,!1)}}var u=Jl(),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=ql(),i=W(t);Qn(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);Qn(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 Xl=wt(Et(),St()),Zl=Ft([Et(),Tt({content:Ct(Tt({text:Et().optional()}).loose()).optional()}).loose(),wt(Et(),St())]),Ql=Tt({kind:Ot(`proposed`),proposalId:Et().min(1),capability:Et().optional(),status:Et().optional()}),$l=Tt({uiCard:Tt({resourceUri:Et().min(1),title:Et().optional()})}),eu=Tt({content:Ct(St()).optional()}),tu=Tt({text:Et().optional()}),nu=Tt({status:Et().optional()}),ru=Tt({error:Et().min(1).optional()});function iu(e){if(e===void 0||e.length===0)return null;try{let t=JSON.parse(e),n=Xl.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 au(e){if(e===void 0)return``;let t=Zl.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
+ `)}}try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function ou(e,t){if(e===void 0)return null;let n=Ql.safeParse(e);return n.success?{proposalId:n.data.proposalId,capability:n.data.capability??t,status:n.data.status??`pending`}:null}function su(e){if(e===void 0)return null;let t=[e],n=eu.safeParse(e);if(n.success&&n.data.content!==void 0)for(let e of n.data.content){let n=tu.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=$l.safeParse(t);if(n.success)return{resourceUri:n.data.uiCard.resourceUri,title:n.data.uiCard.title??`Card`}}catch{}return null}function cu(e){if(!Array.isArray(e))return null;let t=0;for(let n of e){let e=nu.safeParse(n);e.success&&e.data.status===`completed`&&(t+=1)}let n=e.length;return`${n} todo${n===1?``:`s`} · ${t} done`}function lu(e,t){let n=ru.safeParse(e);if(n.success&&n.data.error!==void 0)return(n.data.error.split(`
5
+ `,1)[0]??``).trim();let r=(t.split(`
6
+ `,1)[0]??``).trim();return r.length>80?`${r.slice(0,80)}…`:r}function uu(e){return/^\+(?![-+])/.test(e)?`bg-emerald-500/10`:/^-(?![-+])/.test(e)?`bg-rose-500/10`:``}var du=r(`<div class="mt-1 rounded-lg bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive"> </div>`),fu=r(`<span class="sweep px-1">running</span>`),pu=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>`),mu=r(`<span> </span>`),hu=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>`),gu=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>`),_u=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>`),vu=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>`),yu=r(`<div class="tool-card sweep px-2 py-1.5 text-muted-foreground">running…</div>`),bu=r(`<div class="mt-1 space-y-1"><!> <!></div>`),xu=r(`<!> <!>`,1),Su=r(`<div class="flow-item"><!> <!> <!></div>`);function Cu(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`?Il:E(l)===`file`?nr:E(l)===`image`?xl:Rl),d=I(()=>iu(r.argsText)),f=e=>typeof e==`string`?e:``;function p(e){return(e.split(`
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=cu(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(()=>au(r.result)),_=I(()=>r.phase===`error`?lu(r.result,E(g)):``),v=I(()=>ou(r.result,r.toolName)),S=I(()=>su(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=Su(),A=W(O),j=e=>{Yl(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=>{Kl(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`);Vl(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=xu(),o=J(i),s=e=>{var t=du(),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=pu(),o=W(i),s=W(o),l=M(s,!0),u=z(s,2),p=e=>{var t=fu();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=hu(),i=W(r),a=M(i,!0),o=z(i,2);t(o,21,()=>E(w),ie,(e,t,n)=>{var r=mu(),i=M(r);H(e=>{Y(r,1,e),c(i,`${E(t)??``}${n<E(w).length-1?`
9
+ `:``}`)},[()=>b(uu(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=gu(),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=bu(),i=W(t),a=e=>{var t=_u(),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=vu(),r=z(W(t),2),i=M(r,!0);n(t),H(()=>c(i,E(g))),y(e,t)},l=e=>{var t=yu();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 wu(e){return Number.isFinite(e)?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function Tu(e){return!Number.isFinite(e)||e<0?``:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}var Eu=Object.create,Du=Object.defineProperty,Ou=Object.getOwnPropertyDescriptor,ku=Object.getOwnPropertyNames,Au=Object.getPrototypeOf,ju=Object.prototype.hasOwnProperty,Mu=(e,t)=>function(){return t||(0,e[ku(e)[0]])((t={exports:{}}).exports,t),t.exports},Nu=e=>{let t={};for(var n in e)Du(t,n,{get:e[n],enumerable:!0});return t},Pu=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ku(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ju.call(e,s)&&s!==n&&Du(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Ou(t,s))||r.enumerable});return e},Fu=(e,t,n)=>(n=e==null?{}:Eu(Au(e)),Pu(t||!e||!e.__esModule?Du(n,`default`,{value:e,enumerable:!0}):n,e));function Iu(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 Lu(e,t){let n=Number(e[t].meta.id+1).toString();return e[t].meta.subId>0&&(n+=`:${e[t].meta.subId}`),`[${n}]`}function Ru(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 zu(e,t,n){return(n.xhtmlOut?`<hr class="footnotes-sep" />
10
+ `:`<hr class="footnotes-sep">
11
+ `)+`<section class="footnotes">
12
+ <ol class="footnotes-list">
13
+ `}function Bu(){return`</ol>
14
+ </section>
15
+ `}function Vu(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),`<li id="fn${a}" class="footnote-item">`}function Hu(){return`</li>
16
+ `}function Uu(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),` <a href="#fnref${a}" class="footnote-backref">\u21a9\uFE0E</a>`}function Wu(e){let t=e.helpers.parseLinkLabel,n=e.utils.isSpace;e.renderer.rules.footnote_ref=Ru,e.renderer.rules.footnote_block_open=zu,e.renderer.rules.footnote_block_close=Bu,e.renderer.rules.footnote_open=Vu,e.renderer.rules.footnote_close=Hu,e.renderer.rules.footnote_anchor=Uu,e.renderer.rules.footnote_caption=Lu,e.renderer.rules.footnote_anchor_name=Iu;function r(e,t,r,i){let a=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(a+4>o||e.src.charCodeAt(a)!==91||e.src.charCodeAt(a+1)!==94)return!1;let s;for(s=a+2;s<o;s++){if(e.src.charCodeAt(s)===32)return!1;if(e.src.charCodeAt(s)===93)break}if(s===a+2||s+1>=o||e.src.charCodeAt(++s)!==58)return!1;if(i)return!0;s++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={});let c=e.src.slice(a+2,s-2);e.env.footnotes.refs[`:${c}`]=-1;let l=new e.Token(`footnote_reference_open`,``,1);l.meta={label:c},l.level=e.level++,e.tokens.push(l);let u=e.bMarks[t],d=e.tShift[t],f=e.sCount[t],p=e.parentType,m=s,h=e.sCount[t]+s-(e.bMarks[t]+e.tShift[t]),g=h;for(;s<o;){let t=e.src.charCodeAt(s);if(n(t))t===9?g+=4-g%4:g++;else break;s++}e.tShift[t]=s-m,e.sCount[t]=g-h,e.bMarks[t]=m,e.blkIndent+=4,e.parentType=`footnote`,e.sCount[t]<e.blkIndent&&(e.sCount[t]+=e.blkIndent),e.md.block.tokenize(e,t,r,!0),e.parentType=p,e.blkIndent-=4,e.tShift[t]=d,e.sCount[t]=f,e.bMarks[t]=u;let _=new e.Token(`footnote_reference_close`,``,-1);return _.level=--e.level,e.tokens.push(_),!0}function i(e,n){let r=e.posMax,i=e.pos;if(i+2>=r||e.src.charCodeAt(i)!==94||e.src.charCodeAt(i+1)!==91)return!1;let a=i+2,o=t(e,i+1);if(o<0)return!1;if(!n){e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]);let t=e.env.footnotes.list.length,n=[];e.md.inline.parse(e.src.slice(a,o),e.md,e.env,n);let r=e.push(`footnote_ref`,``,0);r.meta={id:t},e.env.footnotes.list[t]={content:e.src.slice(a,o),tokens:n}}return e.pos=o+1,e.posMax=r,!0}function a(e,t){let n=e.posMax,r=e.pos;if(r+3>n||!e.env.footnotes||!e.env.footnotes.refs||e.src.charCodeAt(r)!==91||e.src.charCodeAt(r+1)!==94)return!1;let i;for(i=r+2;i<n;i++){if(e.src.charCodeAt(i)===32||e.src.charCodeAt(i)===10)return!1;if(e.src.charCodeAt(i)===93)break}if(i===r+2||i>=n)return!1;i++;let a=e.src.slice(r+2,i-1);if(e.env.footnotes.refs[`:${a}`]===void 0)return!1;if(!t){e.env.footnotes.list||(e.env.footnotes.list=[]);let t;e.env.footnotes.refs[`:${a}`]<0?(t=e.env.footnotes.list.length,e.env.footnotes.list[t]={label:a,count:0},e.env.footnotes.refs[`:${a}`]=t):t=e.env.footnotes.refs[`:${a}`];let n=e.env.footnotes.list[t].count;e.env.footnotes.list[t].count++;let r=e.push(`footnote_ref`,``,0);r.meta={id:t,subId:n,label:a}}return e.pos=i,e.posMax=n,!0}function o(e){let t,n,r,i=!1,a={};if(!e.env.footnotes||(e.tokens=e.tokens.filter(function(e){return e.type===`footnote_reference_open`?(i=!0,n=[],r=e.meta.label,!1):e.type===`footnote_reference_close`?(i=!1,a[`:`+r]=n,!1):(i&&n.push(e),!i)}),!e.env.footnotes.list))return;let o=e.env.footnotes.list;e.tokens.push(new e.Token(`footnote_block_open`,``,1));for(let n=0,r=o.length;n<r;n++){let r=new e.Token(`footnote_open`,``,1);if(r.meta={id:n,label:o[n].label},e.tokens.push(r),o[n].tokens){t=[];let r=new e.Token(`paragraph_open`,`p`,1);r.block=!0,t.push(r);let i=new e.Token(`inline`,``,0);i.children=o[n].tokens,i.content=o[n].content,t.push(i);let a=new e.Token(`paragraph_close`,`p`,-1);a.block=!0,t.push(a)}else o[n].label&&(t=a[`:${o[n].label}`]);t&&(e.tokens=e.tokens.concat(t));let i;i=e.tokens[e.tokens.length-1].type===`paragraph_close`?e.tokens.pop():null;let s=o[n].count>0?o[n].count:1;for(let t=0;t<s;t++){let r=new e.Token(`footnote_anchor`,``,0);r.meta={id:n,subId:t,label:o[n].label},e.tokens.push(r)}i&&e.tokens.push(i),e.tokens.push(new e.Token(`footnote_close`,``,-1))}e.tokens.push(new e.Token(`footnote_block_close`,``,-1))}e.block.ruler.before(`reference`,`footnote_def`,r,{alt:[`paragraph`,`reference`]}),e.inline.ruler.after(`image`,`footnote_inline`,i),e.inline.ruler.after(`footnote_inline`,`footnote_ref`,a),e.core.ruler.after(`inline`,`footnote_tail`,o)}function Gu(e){function t(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==43)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;if(a%2){let t=e.push(`text`,``,0);t.content=o,a--}for(let t=0;t<a;t+=2){let n=e.push(`text`,``,0);n.content=o+o,(i.can_open||i.can_close)&&e.delimiters.push({marker:r,length:0,jump:t/2,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function n(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==43||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`ins_open`,n.tag=`ins`,n.nesting=1,n.markup=`++`,n.content=``,n=e.tokens[o.token],n.type=`ins_close`,n.tag=`ins`,n.nesting=-1,n.markup=`++`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`+`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`ins_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}e.inline.ruler.before(`emphasis`,`ins`,t),e.inline.ruler2.before(`emphasis`,`ins`,function(e){let t=e.tokens_meta,r=(e.tokens_meta||[]).length;n(e,e.delimiters);for(let i=0;i<r;i++)t[i]&&t[i].delimiters&&n(e,t[i].delimiters)})}function Ku(e){function t(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==61)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;if(a%2){let t=e.push(`text`,``,0);t.content=o,a--}for(let t=0;t<a;t+=2){let n=e.push(`text`,``,0);n.content=o+o,(i.can_open||i.can_close)&&e.delimiters.push({marker:r,length:0,jump:t/2,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function n(e,t){let n=[],r=t.length;for(let i=0;i<r;i++){let r=t[i];if(r.marker!==61||r.end===-1)continue;let a=t[r.end],o=e.tokens[r.token];o.type=`mark_open`,o.tag=`mark`,o.nesting=1,o.markup=`==`,o.content=``;let s=e.tokens[a.token];s.type=`mark_close`,s.tag=`mark`,s.nesting=-1,s.markup=`==`,s.content=``,e.tokens[a.token-1].type===`text`&&e.tokens[a.token-1].content===`=`&&n.push(a.token-1)}for(;n.length;){let t=n.pop(),r=t+1;for(;r<e.tokens.length&&e.tokens[r].type===`mark_close`;)r++;if(r--,t!==r){let n=e.tokens[r];e.tokens[r]=e.tokens[t],e.tokens[t]=n}}}e.inline.ruler.before(`emphasis`,`mark`,t),e.inline.ruler2.before(`emphasis`,`mark`,function(e){let t,r=e.tokens_meta,i=(e.tokens_meta||[]).length;for(n(e,e.delimiters),t=0;t<i;t++)r[t]&&r[t].delimiters&&n(e,r[t].delimiters)})}var qu=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function Ju(e,t){let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==94||t||r+2>=n)return!1;e.pos=r+1;let i=!1;for(;e.pos<n;){if(e.src.charCodeAt(e.pos)===94){i=!0;break}e.md.inline.skipToken(e)}if(!i||r+1===e.pos)return e.pos=r,!1;let a=e.src.slice(r+1,e.pos);if(a.match(/(^|[^\\])(\\\\)*\s/))return e.pos=r,!1;e.posMax=e.pos,e.pos=r+1;let o=e.push(`sup_open`,`sup`,1);o.markup=`^`;let s=e.push(`text`,``,0);s.content=a.replace(qu,`$1`);let c=e.push(`sup_close`,`sup`,-1);return c.markup=`^`,e.pos=e.posMax+1,e.posMax=n,!0}function Yu(e){e.inline.ruler.after(`emphasis`,`sup`,Ju)}var Xu=Mu({"../../node_modules/.pnpm/markdown-it-task-checkbox@1.0.6/node_modules/markdown-it-task-checkbox/index.js":((e,t)=>{t.exports=function(e,t){t=Object.assign({},{disabled:!0,divWrap:!1,divClass:`checkbox`,idPrefix:`cbx_`,ulClass:`task-list`,liClass:`task-list-item`},t),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var o=e.tokens,s=0,c=2;c<o.length;c++)i(o,c)&&(a(o[c],s,t,e.Token),s+=1,n(o[c-2],`class`,t.liClass),n(o[r(o,c-2)],`class`,t.ulClass))})};function n(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function r(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function i(e,t){return d(e[t])&&f(e[t-1])&&p(e[t-2])&&m(e[t])}function a(e,t,n,r){var i=n.idPrefix+t;e.children[0].content=e.children[0].content.slice(3),e.children.unshift(s(i,r)),e.children.push(c(r)),e.children.unshift(o(e,i,n,r)),n.divWrap&&(e.children.unshift(l(n,r)),e.children.push(u(r)))}function o(e,t,n,r){var i=new r(`checkbox_input`,`input`,0);return i.attrs=[[`type`,`checkbox`],[`id`,t]],/^\[[xX]\][ \u00A0]/.test(e.content)===!0&&i.attrs.push([`checked`,`true`]),n.disabled===!0&&i.attrs.push([`disabled`,`true`]),i}function s(e,t){var n=new t(`label_open`,`label`,1);return n.attrs=[[`for`,e]],n}function c(e){return new e(`label_close`,`label`,-1)}function l(e,t){var n=new t(`checkbox_open`,`div`,0);return n.attrs=[[`class`,e.divClass]],n}function u(e){return new e(`checkbox_close`,`div`,-1)}function d(e){return e.type===`inline`}function f(e){return e.type===`paragraph_open`}function p(e){return e.type===`list_item_open`}function m(e){return/^\[[xX \u00A0]\][ \u00A0]/.test(e.content)}})}),Zu=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Qu(e){return e>=55296&&e<=57343||e>1114111?65533:Zu.get(e)??e}function $u(e){let t=atob(e),n=t.length&-2,r=new Uint16Array(n/2);for(let e=0,i=0;e<n;e+=2){let n=t.charCodeAt(e),a=t.charCodeAt(e+1);r[i++]=n|a<<8}return r}var ed=$u(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),td;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(td||={});var nd;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(nd||={});var rd=32;function id(e){return e>=nd.ZERO&&e<=nd.NINE}function ad(e){return e>=nd.UPPER_A&&e<=nd.UPPER_F||e>=nd.LOWER_A&&e<=nd.LOWER_F}function od(e){return e>=nd.UPPER_A&&e<=nd.UPPER_Z||e>=nd.LOWER_A&&e<=nd.LOWER_Z||id(e)}function sd(e){return e===nd.EQUALS||od(e)}var cd;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(cd||={});var ld;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(ld||={});var ud=class{decodeTree;emitCodePoint;errors;constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n}state=cd.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=ld.Strict;runConsumed=0;startEntity(e){this.decodeMode=e,this.state=cd.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case cd.EntityStart:return e.charCodeAt(t)===nd.NUM?(this.state=cd.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=cd.NamedEntity,this.stateNamedEntity(e,t));case cd.NumericStart:return this.stateNumericStart(e,t);case cd.NumericDecimal:return this.stateNumericDecimal(e,t);case cd.NumericHex:return this.stateNumericHex(e,t);case cd.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|rd)===nd.LOWER_X?(this.state=cd.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=cd.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(id(n)||ad(n)){let e=n<=nd.NINE?n-nd.ZERO:(n|rd)-nd.LOWER_A+10;this.result=this.result*16+e,this.consumed++,t++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(id(n))this.result=this.result*10+(n-nd.ZERO),this.consumed++,t++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(e,t){if(this.consumed<=t)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===nd.SEMI)this.consumed+=1;else if(this.decodeMode===ld.Strict)return 0;return this.emitCodePoint(Qu(this.result),this.consumed),this.errors&&(e!==nd.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&td.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&td.FLAG13)!==0){let a=(r&td.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&td.JUMP_TABLE;if(e.charCodeAt(t)!==n)return this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(t>=e.length)return-1;let r=this.runConsumed-1,i=n[this.treeIndex+1+(r>>1)],a=r%2==0?i&255:i>>8&255;if(e.charCodeAt(t)!==a)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),r=n[this.treeIndex],i=(r&td.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===nd.SEMI&&i!==0&&(r&td.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=fd(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===ld.Attribute&&(i===0||sd(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&td.VALUE_LENGTH)>>14,i!==0){if(a===nd.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==ld.Strict&&(r&td.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}t++,this.excess++}return-1}emitNotTerminatedNamedEntity(){let{result:e,decodeTree:t}=this,n=(t[e]&td.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,n,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~(td.VALUE_LENGTH|td.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){switch(this.state){case cd.NamedEntity:return this.result!==0&&(this.decodeMode!==ld.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case cd.NumericDecimal:return this.emitNumericEntity(0,2);case cd.NumericHex:return this.emitNumericEntity(0,3);case cd.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case cd.EntityStart:return 0}}};function dd(e){let t=``,n=new ud(e,e=>t+=String.fromCodePoint(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function fd(e,t,n,r){let i=(t&td.BRANCH_LENGTH)>>7,a=t&td.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=i+1>>1,s=0,c=i-1;for(;s<=c;){let t=s+c>>>1,i=e[n+(t>>1)]>>(t&1)*8&255;if(i<r)s=t+1;else if(i>r)c=t-1;else return e[n+o+t]}return-1}var pd=dd(ed);function md(e,t=ld.Legacy){return pd(e,t)}var hd=Fu(Xu(),1),gd={};function _d(e){let t=gd[e];if(t)return t;t=gd[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function vd(e,t){typeof t!=`string`&&(t=vd.defaultChars);let n=_d(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;t+=e<128?`��`:String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;t+=e<2048||e>=55296&&e<=57343?`���`:String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}vd.defaultChars=`;/?:@&=+$,#`,vd.componentChars=``;var yd=vd,bd={};function xd(e){let t=bd[e];if(t)return t;t=bd[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Sd(e,t,n){typeof t!=`string`&&(n=t,t=Sd.defaultChars),n===void 0&&(n=!0);let r=xd(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}Sd.defaultChars=`;/?:@&=+$,-_.!~*'()#`,Sd.componentChars=`-_.!~*'()`;var Cd=Sd;function wd(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function Td(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Ed=/^([a-z0-9.+-]+:)/i,Dd=/:[0-9]*$/,Od=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,kd=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
17
+ `,` `],Ad=[`/`,`?`,`#`],jd=255,Md=/^[+a-z0-9A-Z_-]{0,63}$/,Nd=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Pd={javascript:!0,"javascript:":!0},Fd={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Id(e,t){if(e&&e instanceof Td)return e;let n=new Td;return n.parse(e,t),n}Td.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=Od.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=Ed.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&Pd[o])&&(a=a.substr(2),this.slashes=!0)),!Pd[o]&&(i||o&&!Fd[o])){let e=-1;for(let t=0;t<Ad.length;t++)r=a.indexOf(Ad[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<kd.length;t++)r=a.indexOf(kd[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(Md)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(Md)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(Nd);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>jd&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),Fd[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},Td.prototype.parseHost=function(e){let t=Dd.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var Ld=Id,Rd=Nu({decode:()=>yd,encode:()=>Cd,format:()=>wd,parse:()=>Ld}),zd=Object.defineProperty,Bd=e=>{let t={};for(var n in e)zd(t,n,{get:e[n],enumerable:!0});return t},Vd=class{type;tag;attrs;map;nesting;level;children;content;markup;info;meta;block;hidden;constructor(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}attrIndex(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r}attrGet(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},Hd=Bd({arrayReplaceAt:()=>nf,assign:()=>Jd,countLines:()=>bf,escapeHtml:()=>gf,escapeRE:()=>vf,fromCodePoint:()=>af,has:()=>qd,isMdAsciiPunct:()=>ef,isPunctChar:()=>Zd,isPunctCode:()=>$d,isSpace:()=>Yd,isString:()=>Gd,isValidEntityCode:()=>rf,isWhiteSpace:()=>Xd,lib:()=>yf,mdurl:()=>Rd,normalizeReference:()=>tf,ucmicro:()=>Ud,unescapeAll:()=>df,unescapeMd:()=>uf}),Ud={Any:/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Cc:/[\0-\x1F\x7F-\x9F]/,Cf:/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,P:/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,S:/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,Z:/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/};function Wd(e){return Object.prototype.toString.call(e)}function Gd(e){return Wd(e)===`[object String]`}var Kd=Object.prototype.hasOwnProperty;function qd(e,t){return Kd.call(e,t)}function Jd(e,...t){return t.forEach(t=>{if(t){if(typeof t!=`object`)throw TypeError(`${String(t)}must be object`);Object.keys(t).forEach(n=>{e[n]=t[n]})}}),e}function Yd(e){return e===9||e===32}function Xd(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Zd(e){return Ud.P.test(e)||Ud.S.test(e)}var Qd=new Map;function $d(e){if(ef(e))return!0;if(e>=0&&e<128)return!1;let t=Qd.get(e);if(t!==void 0)return t;let n=Zd(String.fromCharCode(e));return Qd.set(e,n),n}function ef(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function tf(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function nf(e,t,n){return[...e.slice(0,t),...n,...e.slice(t+1)]}function rf(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function af(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var of=/\\([!"#$%&'()*+,\-\./:;<=>?@[\\\]^_`{|}~])/g,sf=RegExp(`${of.source}|&([a-z#][a-z0-9]{1,31});`,`gi`),cf=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function lf(e,t){if(t.charCodeAt(0)===35&&cf.test(t)){let n=t[1].toLowerCase()===`x`?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return rf(n)?af(n):e}let n=md(e);return n===e?e:n}function uf(e){return e.includes(`\\`)?e.replace(of,`$1`):e}function df(e){return!e.includes(`\\`)&&!e.includes(`&`)?e:e.replace(sf,(e,t,n)=>t||lf(e,n))}var ff=/[&<>"]/,pf=/[&<>"]/g,mf={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};function hf(e){return mf[e]}function gf(e){return ff.test(e)?e.replace(pf,hf):e}var _f=/[.?*+^$[\]\\(){}|-]/g;function vf(e){return e.replace(_f,`\\$&`)}var yf={mdurl:Rd,ucmicro:Ud};function bf(e){if(e.length===0)return 0;let t=0,n=-1;for(;(n=e.indexOf(`
18
+ `,n+1))!==-1;)t++;return t}var xf=/(?:^|\n)[ \t]{0,3}\[\^[^\]\n]+\]:/m,Sf=/(?:^|\n)[ \t]{0,3}\*\[[^\]\n]+\]:/m,Cf=[`references`,`footnotes`,`abbreviations`,`abbr`,`abbrs`],wf=Symbol.for(`markdown-it-ts.global-state`),Tf=Object.prototype.hasOwnProperty;function Ef(e){let t=e.length,n=0;for(;n<t;){let r=e.indexOf(`[`,n);if(r===-1)return!1;let i=0,a=r-1;for(;a>=0&&e.charCodeAt(a)!==10;){let t=e.charCodeAt(a);if(t===32||t===9){i++,a--;continue}break}if((a<0||e.charCodeAt(a)===10)&&i<=3&&e.charCodeAt(r+1)!==94){let i=r+1;if(i>=t||e.charCodeAt(i)===93){n=r+1;continue}for(;i<t;){let n=e.charCodeAt(i);if(n===93){let n=i+1;for(;n<t&&(e.charCodeAt(n)===32||e.charCodeAt(n)===9);)n++;if(n<t&&e.charCodeAt(n)===58)return!0;break}if(n===91)break;if(n===92){i+=2;continue}i++}}n=r+1}return!1}function Df(e){return e===`reference-definition`||e===`footnote-definition`||e===`abbreviation-definition`}function Of(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function kf(e){if(Array.isArray(e))return e.map(e=>kf(e));if(Of(e)){let t={};for(let n of Object.keys(e))t[n]=kf(e[n]);return t}return e}function Af(e){return Array.isArray(e)?e.map((e,t)=>String(t)):Of(e)?Object.keys(e):[]}function jf(e,t){if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!jf(e[n],t[n]))return!1;return!0}if(Of(e)||Of(t)){if(!Of(e)||!Of(t))return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Tf.call(t,r)||!jf(e[r],t[r]))return!1;return!0}return Object.is(e,t)}function Mf(e,t){if(Array.isArray(e))return e[Number(t)];if(Of(e))return e[t]}function Nf(e,t){if(Array.isArray(e)&&Array.isArray(t)){e.length=t.length;for(let n=0;n<t.length;n++)e[n]=kf(t[n]);return e}if(Of(e)&&Of(t)){for(let n of Object.keys(e))Tf.call(t,n)||delete e[n];for(let n of Object.keys(t))e[n]=kf(t[n]);return e}return kf(t)}function Pf(e,t,n){let r=n.ownedKeys??[],i=e[t];if(Of(i)||Array.isArray(i)){let a=new Set(Af(n.value));for(let e of r)n.existed&&a.has(e)?i[e]=kf(Mf(n.value,e)):delete i[e];!n.existed&&Af(i).length===0&&delete e[t];return}n.existed?e[t]=kf(n.value):delete e[t]}function Ff(e){let t=e[wf];return Df(t)?{reason:t,snapshot:{}}:t&&typeof t==`object`&&Df(t.reason)&&t.snapshot&&typeof t.snapshot==`object`?t:null}function If(e,t){Object.defineProperty(e,wf,{value:t,enumerable:!1,configurable:!0,writable:!0})}function Lf(e){return!e||!e.includes(`]:`)&&!e.includes(`*[`)?null:xf.test(e)?`footnote-definition`:Sf.test(e)?`abbreviation-definition`:Ef(e)?`reference-definition`:null}function Rf(e){return Ff(e)?.reason??null}function zf(e,t,n){if(Rf(e)&&Hf(e),!t)return n();Bf(e,t);try{let t=n();return Vf(e),t}catch(t){throw Hf(e),t}}function Bf(e,t){try{Hf(e);let n={};for(let t of Cf)n[t]=Tf.call(e,t)?{existed:!0,value:kf(e[t])}:{existed:!1};If(e,{reason:t,snapshot:n})}catch{}}function Vf(e){let t=Ff(e);if(t)for(let n of Cf){let r=t.snapshot[n];if(!r)continue;r.ownedKeys=[];let i=e[n];if(!Of(i)&&!Array.isArray(i))continue;let a=new Set(Af(r.existed?r.value:void 0));r.ownedKeys=Af(i).filter(e=>!a.has(e)||!jf(i[e],Mf(r.value,e)))}}function Hf(e){let t=Ff(e);if(t){for(let n of Cf){let r=t.snapshot[n];if(!r){delete e[n];continue}if(r.ownedKeys){Pf(e,n,r);continue}r.existed?e[n]=Nf(e[n],r.value):delete e[n]}delete e[wf]}}function Uf(e){return{area:e,attempted:!0,matched:!1,attemptMs:0,blocks:0,headings:0,paragraphs:0,lists:0,fences:0,paragraphCacheHits:0,paragraphCacheMisses:0,paragraphCacheBypasses:0,listCacheHits:0,listCacheMisses:0,fenceCacheHits:0,fenceCacheMisses:0}}var Wf=Symbol.for(`markdown-it-ts.diagnostics`);function Gf(e,t){if(e)try{let n=e[Wf];if(n&&typeof n==`object`)return n;if(!t)return;let r={};return e[Wf]=r,r}catch{return}}function Kf(e){return Gf(e,!1)}function qf(e){if(e)try{let t=e[Wf];t&&typeof t==`object`&&(delete t.strategy,delete t.chunk,delete t.unbounded,delete t.editable,delete t.stockFast)}catch{}}function Jf(e){qf(e)}function Yf(e,t){let n=Gf(e,!0);n&&(n.stockFast=t)}function Xf(e,t){let n=Gf(e,!0);n&&(n.strategy=t)}function Zf(e,t){let n=Gf(e,!0);n&&(n.chunk=t)}function Qf(e,t){let n=Gf(e,!0);n&&(n.unbounded=t)}var $f=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ep=/[\0-\x1F\x7F-\x9F]/,tp=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,np=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,rp=class{src_Any=$f.source;src_Cc=ep.source;src_Z=np.source;src_P=tp.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join(`|`);src_ZCc=[this.src_Z,this.src_Cc].join(`|`);cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}nestedPairRE(e,t,n=4){let r=this.escapeRE(e),i=this.escapeRE(t),a=`(?:(?!${this.src_ZCc}|${r}|${i}).)`,o=`${r}${a}{0,1000}${i}`;for(let e=2;e<=n;e++)o=`${r}(?:${a}|${o}){0,1000}${i}`;return o}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=RegExp(`(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])`)}get_ipv6_addr(){let e=`[0-9A-Fa-f]{1,4}`,t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=RegExp(`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`)}get_host_terminator(){return this.cache.src_host_terminator??=RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=RegExp(`(?:[/?#](?:${this.nestedPairRE(`[`,`]`)}|${this.nestedPairRE(`(`,`)`)}|${this.nestedPairRE(`{`,`}`)}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts[`---`]?`\\-(?!--(?:[^-]|$))(?:-{0,19})|`:`\\-{1,20}|`)+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=RegExp(`xn--[a-z0-9\\-]{1,59}`)}get_tld(){if(this.cache.tld)return this.cache.tld;let e=[...new Set(this.opts.tlds||[])].sort().reverse().join(`|`);return this.cache.tld=RegExp(`${e||`$#none#$`}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=RegExp(`(?:`+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=RegExp(`(?:`+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=RegExp(`(?:`+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=RegExp(`(?:`+(this.opts.fuzzyIP?this.get_ipv4_addr().source+`|`:``)+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=RegExp(``)}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=RegExp(`@${this.get_fuzzy_mail_host().source}`,`ig`)}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uff5c])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,`ig`)}get_http_validator(){return this.cache.http_validator??=RegExp(`\\/\\/`+(this.opts.urlAuth?this.get_auth().source:``)+this.get_url_host_port().source+this.get_path().source,`iy`)}get_relative_proto_validator(){return this.cache.relative_proto_validator??=RegExp((this.opts.urlAuth?this.get_auth().source:``)+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,`iy`)}get_mail_name_validator(){return this.cache.mail_name_validator??=RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,`iy`)}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join(`|`))}get_schema_search(){return this.cache.schema_search??=RegExp(`(^|(?!_)(?:[><\uff5c]|${this.src_ZPCc}))(${this.get_schema_names().source})`,`ig`)}get_schema_at_start(){return this.cache.schema_at_start??=RegExp(`^${this.get_schema_search().source}`,`i`)}},ip={validate:(e,t,n)=>{let r=n.re.get_http_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)},ap={"http:":ip,"https:":ip,"ftp:":ip,"//":{validate:function(e,t,n){let r=n.re.get_relative_proto_validator();r.lastIndex=t;let i=r.exec(e);return i?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:i[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){let r=n.re.get_mailto_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)}},op=`a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw`,sp=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`;function cp(){let e=sp.split(`|`);return op.split(`|`).forEach(t=>{let n=t.indexOf(`:`),r=t.slice(0,n);for(let i of t.slice(n+1))e.push(r+i)}),e}var lp={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:cp(),urlAuth:!1,maxLength:1e4},up=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}},dp=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:t,...n}=e;this.__opts__={...lp,...n},this.__schemas__={...ap},this.re=t||new rp,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{let n={normalize:(e,t)=>t.normalize(e),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&e.indexOf(`@`)>=0){let n=this.re.get_fuzzy_mail_host_search(),r=this.re.get_mail_name_validator();for(n.lastIndex=0;(t=n.exec(e))!==null;){let n=e.slice(Math.max(0,t.index-65),t.index);if(r.test(n))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){let t=[],n=this.re.get_schema_search(),r,i,a,o,s,c,l=!1,u=!1,d=!1,f=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&(i=this.re.get_fuzzy_mail_host_search(),i.lastIndex=0,a=this.re.get_mail_name_validator());;){let p=Math.max(f-1,0);if(i&&a&&!d&&(!s||s.index<f))for(i.lastIndex<p&&(i.lastIndex=p);;){let t=i.exec(e);if(!t){d=!0,s=void 0;break}let n=a.exec(e.slice(Math.max(0,t.index-65),t.index));if(n){if(s={schema:`mailto:`,index:t.index-n[1].length,lastIndex:t.index+t[0].length},s.index>=f)break;i.lastIndex<p&&(i.lastIndex=p)}}if(r&&!u&&(!o||o.index<f))for(r.lastIndex<p&&(r.lastIndex=p);;){let t=r.exec(e);if(!t){u=!0,o=void 0;break}if(o={schema:``,index:t.index+t[1].length,lastIndex:t.index+t[0].length},o.index>=f)break;r.lastIndex<p&&(r.lastIndex=p)}let m=s;(!m||o&&(o.index<m.index||o.index===m.index&&o.lastIndex>m.lastIndex))&&(m=o);let h;if(!l)for(;;){if(!c){n.lastIndex<p&&(n.lastIndex=p);let t=n.exec(e);if(!t){l=!0;break}c={schema:t[2],index:t.index+t[1].length,lastIndex:t.index+t[0].length}}if(c.index<f){c=void 0;continue}if(m&&c.index>m.index)break;let t=c;c=void 0;let r=this.testSchemaAt(e,t.schema,t.lastIndex);if(r){h={schema:t.schema,index:t.index,lastIndex:t.lastIndex+r};break}}let g=h;if((!g||s&&(s.index<g.index||s.index===g.index&&s.lastIndex>g.lastIndex))&&(g=s),(!g||o&&(o.index<g.index||o.index===g.index&&o.lastIndex>g.lastIndex))&&(g=o),!g)break;g===s?s=void 0:g===o&&(o=void 0);let _=new up(e,g.schema,g.index,g.lastIndex);_.schema?this.__schemas__[_.schema].normalize(_,this):this.normalize(_),t.push(_),f=g.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;let t=this.re.get_schema_at_start().exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new up(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}},fp=Fu(Mu({"../../node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.js":((e,t)=>{let n=2147483647,r=/^xn--/,i=/[^\0-\x7F]/,a=/[\x2E\u3002\uFF0E\uFF61]/g,o={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},s=Math.floor,c=String.fromCharCode;function l(e){throw RangeError(o[e])}function u(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function d(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(a,`.`);let i=u(e.split(`.`),t).join(`.`);return r+i}function f(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}let p=e=>String.fromCodePoint(...e),m=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},h=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},g=function(e,t,n){let r=0;for(e=n?s(e/700):e>>1,e+=s(e/t);e>455;r+=36)e=s(e/35);return s(r+36*e/(e+38))},_=function(e){let t=[],r=e.length,i=0,a=128,o=72,c=e.lastIndexOf(`-`);c<0&&(c=0);for(let n=0;n<c;++n)e.charCodeAt(n)>=128&&l(`not-basic`),t.push(e.charCodeAt(n));for(let u=c>0?c+1:0;u<r;){let c=i;for(let t=1,a=36;;a+=36){u>=r&&l(`invalid-input`);let c=m(e.charCodeAt(u++));c>=36&&l(`invalid-input`),c>s((n-i)/t)&&l(`overflow`),i+=c*t;let d=a<=o?1:a>=o+26?26:a-o;if(c<d)break;let f=36-d;t>s(n/f)&&l(`overflow`),t*=f}let d=t.length+1;o=g(i-c,d,c==0),s(i/d)>n-a&&l(`overflow`),a+=s(i/d),i%=d,t.splice(i++,0,a)}return String.fromCodePoint(...t)},v=function(e){let t=[];e=f(e);let r=e.length,i=128,a=0,o=72;for(let n of e)n<128&&t.push(c(n));let u=t.length,d=u;for(u&&t.push(`-`);d<r;){let r=n;for(let t of e)t>=i&&t<r&&(r=t);let f=d+1;r-i>s((n-a)/f)&&l(`overflow`),a+=(r-i)*f,i=r;for(let r of e)if(r<i&&++a>n&&l(`overflow`),r===i){let e=a;for(let n=36;;n+=36){let r=n<=o?1:n>=o+26?26:n-o;if(e<r)break;let i=e-r,a=36-r;t.push(c(h(r+i%a,0))),e=s(i/a)}t.push(c(h(e,0))),o=g(a,f,d===u),a=0,++d}++a,++i}return t.join(``)};t.exports={version:`2.3.1`,ucs2:{decode:f,encode:p},decode:_,encode:v,toASCII:function(e){return d(e,function(e){return i.test(e)?`xn--`+v(e):e})},toUnicode:function(e){return d(e,function(e){return r.test(e)?_(e.slice(4).toLowerCase()):e})}}})})(),1);function pp(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=df(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=df(e.slice(t,i)),a.pos=i,a.ok=!0,a)}var mp=pp,hp=-2;function gp(e,t,n,r){let i=1,a=t+1;for(;a<n;){let t=e.charCodeAt(a);if(t===93){if(i--,i===0)return a;if(r){let t=a+1<n?e.charCodeAt(a+1):0;if(t===40||t===91)return hp}a++;continue}if(t===92){a+=2;continue}if(t===96||t===60||t===33&&a+1<n&&e.charCodeAt(a+1)===91)return hp;if(t===91){i++,a++;continue}a++}return-1}function _p(e,t,n){let r=1,i=!1,a,o,s=e.src,c=e.posMax,l=e.pos,u=e.linkLabelNoCloseFrom;if(u>=0&&t+1>=u)return-1;let d=s.indexOf(`]`,t+1);if(d<0||d>=c)return e.linkLabelNoCloseFrom=t+1,-1;let f=gp(s,t,c,n);if(f!==hp)return f;for(e.pos=t+1;e.pos<c;){if(a=s.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=l,-1}}let p=-1;return i&&(p=e.pos),e.pos=l,p}var vp=_p;function yp(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=df(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=df(e.slice(t,a)),o}var bp=yp;function xp(e,t){if(!e.attrs)return-1;for(let n=0;n<e.attrs.length;n++)if(e.attrs[n][0]===t)return n;return-1}function Sp(e,t){e.attrs||=[],e.attrs.push(t)}function Cp(e,t,n){let r=xp(e,t),i=[t,n];r<0?Sp(e,i):e.attrs[r]=i}function wp(e,t){let n=xp(e,t);return n>=0?e.attrs[n][1]:null}function Tp(e,t,n){let r=xp(e,t);r<0?Sp(e,[t,n]):e.attrs[r][1]=`${e.attrs[r][1]} ${n}`}var Ep=Bd({attrGet:()=>wp,attrIndex:()=>xp,attrJoin:()=>Tp,attrPush:()=>Sp,attrSet:()=>Cp,parseLinkDestination:()=>pp,parseLinkLabel:()=>_p,parseLinkTitle:()=>yp});function Dp(e){return e.includes(`\r`)||e.includes(`\0`)}function Op(e){return typeof e==`string`?e:e.toString()}function kp(e){if(e.inlineMode){let t=new Vd(`inline`,``,0);t.content=Op(e.src),t.map=[0,1],t.children=[],t.level=0,e.tokens.push(t)}else e.md&&e.md.block&&e.md.block.parse(e.src,e.md,e.env,e.tokens)}var Ap=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,jp=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Mp(e,t){let n=e.pos,r=e.src;if(r.charCodeAt(n)!==60)return!1;let i=n,a=e.posMax;for(;;){if(++n>=a)return!1;let e=r.charCodeAt(n);if(e===60)return!1;if(e===62)break}let o=r.slice(i+1,n);if(jp.test(o)){let n=e.md.normalizeLink(o);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(o);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=o.length+2,!0}if(Ap.test(o)){let n=e.md.normalizeLink(`mailto:${o}`);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(o);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=o.length+2,!0}return!1}var Np=Mp;function Pp(e,t){let n=e.src,r=e.pos;if(n.charCodeAt(r)!==96)return!1;let i=r;r++;let a=e.posMax;for(;r<a&&n.charCodeAt(r)===96;)r++;let o=n.slice(i,r),s=o.length;if(e.backticksScanned&&(e.backticks[s]||0)<=i)return t||(e.pending+=o),e.pos+=s,!0;let c=r,l;for(;(l=n.indexOf("`",c))!==-1;){for(c=l+1;c<a&&n.charCodeAt(c)===96;)c++;let i=c-l;if(i===s){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=o;let i=n.slice(r,l);i.includes(`
19
+ `)&&(i=i.replace(/\n/g,` `)),i.length>2&&i.charCodeAt(0)===32&&i.charCodeAt(i.length-1)===32&&(i=i.slice(1,-1)),t.content=i}return e.pos=c,!0}e.backticks[i]=l}return e.backticksScanned=!0,t||(e.pending+=o),e.pos+=s,!0}var Fp=Pp;function Ip(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;Object.prototype.hasOwnProperty.call(t,n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function Lp(e){let t=e.tokens_meta,n=e.tokens_meta.length;Ip(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&Ip(t[e].delimiters)}var Rp=Lp,zp=`*`,Bp=`_`;function Vp(e,t){if(t)return!1;let n=e.src.charCodeAt(e.pos);if(n!==95&&n!==42)return!1;let r=e.scanDelims(e.pos,n===42);if(!r||r.length===0)return!1;let i=n===42?zp:Bp,a=r.length,o=r.can_open,s=r.can_close,c=e.tokens,l=e.delimiters;for(let t=0;t<a;t++){let t=e.push(`text`,``,0);t.content=i,l.push({marker:n,length:a,token:c.length-1,end:-1,open:o,close:s})}return e.pos+=a,!0}function Hp(e,t){let n=t.length,r=e.tokens;for(let e=n-1;e>=0;e--){let n=t[e],i=n.marker;if(i!==95&&i!==42||n.end===-1)continue;let a=t[n.end],o=n.token,s=a.token,c=e>0&&t[e-1].end===n.end+1&&t[e-1].marker===i&&t[e-1].token===o-1&&t[n.end+1].token===s+1,l=i===42?zp:Bp,u=r[o];c?(u.type=`strong_open`,u.tag=`strong`,u.nesting=1,u.markup=l+l,u.content=``):(u.type=`em_open`,u.tag=`em`,u.nesting=1,u.markup=l,u.content=``);let d=r[s];c?(d.type=`strong_close`,d.tag=`strong`,d.nesting=-1,d.markup=l+l,d.content=``):(d.type=`em_close`,d.tag=`em`,d.nesting=-1,d.markup=l,d.content=``),c&&(r[t[e-1].token].content=``,r[t[n.end+1].token].content=``,e--)}}function Up(e){let t=e.tokens_meta,n=e.tokens_meta.length;Hp(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&Hp(e,t[r].delimiters)}var Wp={tokenize:Vp,postProcess:Up};function Gp(e){return md(e)}function Kp(e){return e>=48&&e<=57}function qp(e){let t=e|32;return Kp(e)||t>=97&&t<=102}function Jp(e){let t=e|32;return t>=97&&t<=122}function Yp(e){return Jp(e)||Kp(e)}function Xp(e,t,n){let r=t+2;if(r>=n)return null;let i=!1,a=7,o=r;for((e.charCodeAt(r)|32)==120&&(i=!0,a=6,r++,o=r);r<n&&r-o<a;){let t=e.charCodeAt(r);if(!(i?qp(t):Kp(t)))break;r++}return r===o||r>=n||e.charCodeAt(r)!==59?null:e.slice(t,r+1)}function Zp(e,t,n){let r=t+1;if(r>=n||!Jp(e.charCodeAt(r)))return null;for(r++;r<n&&r-t-1<32&&Yp(e.charCodeAt(r));)r++;if(r-t-1<2||r>=n||e.charCodeAt(r)!==59)return null;let i=e.slice(t,r+1);return Gp(i)===i?null:i}function Qp(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let i=Xp(e.src,n,r);if(i){if(!t){let t=(i.charCodeAt(2)|32)==120?Number.parseInt(i.slice(3,-1),16):Number.parseInt(i.slice(2,-1),10),n=e.push(`text_special`,``,0);n.content=rf(t)?af(t):af(65533),n.markup=i,n.info=`entity`}return e.pos+=i.length,!0}}else{let i=Zp(e.src,n,r);if(i){let n=Gp(i);if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=i,t.info=`entity`}return e.pos+=i.length,!0}}return!1}var $p=Qp,em=(()=>{let e=Array(256).fill(0);for(let t=0;t<32;t++)e[`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.charCodeAt(t)]=1;return e})(),tm=Array(128),nm=Array(128);for(let e=0;e<128;e++){let t=String.fromCharCode(e);tm[e]=`\\${t}`,nm[e]=em[e]?t:tm[e]}function rm(e,t,n){e.pending&&e.pushPending();let r=new Vd(`text_special`,``,0);r.level=e.level,r.content=t,r.markup=n,r.info=`escape`,e.pendingLevel=e.level,e.tokens.push(r),e.tokens_meta.push(null)}function im(e,t){let n=e.pos,r=e.posMax,i=e.src;if(i.charCodeAt(n)!==92||(n++,n>=r))return!1;let a=i.charCodeAt(n);if(a===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(a=i.charCodeAt(n),a===9||a===32);)n++;return e.pos=n,!0}if(a<128)return t?(e.pos=n+1,!0):(rm(e,nm[a],tm[a]),e.pos=n+1,!0);if(t){if(a>=55296&&a<=56319&&n+1<r){let e=i.charCodeAt(n+1);e>=56320&&e<=57343&&n++}return e.pos=n+1,!0}let o=i.charAt(n);if(a>=55296&&a<=56319&&n+1<r){let e=i.charCodeAt(n+1);e>=56320&&e<=57343&&(o+=i.charAt(n+1),n++)}let s=`\\${o}`;return rm(e,a<256&&em[a]?o:s,s),e.pos=n+1,!0}var am=im;function om(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++){let e=i[t];e&&(e.nesting&&e.nesting<0&&r--,e.level=r,e.nesting&&e.nesting>0&&r++,e.type===`text`&&t+1<a&&i[t+1]?.type===`text`?i[t+1].content=e.content+i[t+1].content:(t!==n&&(i[n]=e),n++))}t!==n&&(i.length=n)}var sm=om,cm=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,lm=`<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>`,um=RegExp(`^(?:${cm}|${lm}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<\\?[\\s\\S]*?\\?>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),dm=RegExp(`^(?:${cm}|${lm})`);function fm(e){return e===32||e===9||e===10||e===12||e===13}function pm(e){if(e.length<3||e.charCodeAt(0)!==60||(e.charCodeAt(1)|32)!=97)return!1;let t=e.charCodeAt(2);return t===62||fm(t)}function mm(e){if(e.length<4||e.charCodeAt(0)!==60||e.charCodeAt(1)!==47||(e.charCodeAt(2)|32)!=97)return!1;for(let t=3;t<e.length;t++){let n=e.charCodeAt(t);if(n===62)return!0;if(!fm(n))return!1}return!1}function hm(e){let t=e|32;return t>=97&&t<=122}function gm(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos,i=e.src;if(i.charCodeAt(r)!==60||r+2>=n)return!1;let a=i.charCodeAt(r+1);if(a!==33&&a!==63&&a!==47&&!hm(a))return!1;let o=i.slice(r).match(um);if(!o)return!1;let s=o[0];if(!t){let t=e.pushSimple(`html_inline`,``);t.content=s,pm(s)&&e.linkLevel++,mm(s)&&e.linkLevel--}return e.pos+=s.length,!0}var _m=gm;function vm(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=vp(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),n===32||n===10);a++);if(a>=f)return!1;if(s=mp(e.src,a,e.posMax),s.ok){for(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``,l=a;a<f&&(n=e.src.charCodeAt(a),n===32||n===10);a++);if(s=bp(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),n===32||n===10);a++);else c=``}if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=vp(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[tf(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0);n.attrs=[[`src`,u],[`alt`,``]],n.children=t,n.content=r,c&&n.attrs.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var ym=vm;function bm(e,t,n){for(;t<n;){let n=e.charCodeAt(t);if(n!==32&&n!==10)break;t++}return t}function xm(e,t){if(e.src.charCodeAt(e.pos)!==91)return!1;let n=e.src,r=e.pos,i=e.posMax,a=e.pos+1,o=vp(e,e.pos,!0);if(o<0)return!1;let s=o+1,c=``,l=``,u=!0;if(s<i&&n.charCodeAt(s)===40){s=bm(n,s+1,i);let t=mp(n,s,i);if(t.ok){let n=e.md.normalizeLink(t.str);e.md.validateLink(n)&&(c=n,s=t.pos,u=!1)}else s<i&&n.charCodeAt(s)===41&&(c=``,u=!1);if(!u){if(s=bm(n,s,i),s<i&&n.charCodeAt(s)!==41){let e=bp(n,s,i);e.ok&&(l=e.str,s=bm(n,e.pos,i))}s<i&&n.charCodeAt(s)===41?s++:u=!0}}if(u){if(e.env.references===void 0)return!1;let t;if(s=o+1,s<i&&n.charCodeAt(s)===91){let r=s+1,i=vp(e,s);i>=0?(t=n.slice(r,i),t||=n.slice(a,o),s=i+1):t=n.slice(a,o)}else t=n.slice(a,o);let u=e.env.references[tf(t)];if(!u)return e.pos=r,!1;c=u.href,l=u.title}if(!t){e.pos=a,e.posMax=o;let t=e.push(`link_open`,`a`,1);t.attrs=l?[[`href`,c],[`title`,l]]:[[`href`,c]],e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=s,e.posMax=i,!0}var Sm=xm;function Cm(e){let t=e|32;return t>=97&&t<=122}function wm(e){return e>=48&&e<=57}function Tm(e){return Cm(e)||wm(e)||e===43||e===45||e===46}function Em(e){if(e.length===0)return null;let t=e.length-1;for(;t>=0&&Tm(e.charCodeAt(t));)t--;return t++,t>=e.length||!Cm(e.charCodeAt(t))?null:e.slice(t)}function Dm(e,t,n){let r=t;for(;r<n;){let t=e.charCodeAt(r);if(t<=32||t===127||t===60)break;r++}return e.slice(t,r)}function Om(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=Em(e.pending);if(!i)return!1;let a=Dm(e.src,n-i.length,r),o=e.md.linkify.matchAtStart(a);if(!o)return!1;let s=o.url;if(s.length<=i.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-i.length,!0}function km(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t){if(r>=0&&e.pending.charCodeAt(r)===32){if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.pushSimple(`hardbreak`,`br`)}else e.pending=e.pending.slice(0,-1),e.pushSimple(`softbreak`,`br`)}else e.pushSimple(`softbreak`,`br`)}for(n++;n<i;){let t=e.src.charCodeAt(n);if(t!==9&&t!==32)break;n++}return e.pos=n,!0}var Am=km;function jm(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0);if(!i)return!1;let a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function Mm(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function Nm(e){let t=e.delimiters;Mm(e,t);let n=e.tokens_meta;if(n)for(let t=0;t<n.length;t++)n[t]&&n[t].delimiters&&Mm(e,n[t].delimiters)}var Pm={tokenize:jm,postProcess:Nm},Fm=new Uint8Array(256);for(let e of[10,33,35,36,37,38,42,43,45,58,60,61,62,64,91,92,93,94,95,96,123,125,126])Fm[e]=1;function Im(e){return e<256&&Fm[e]===1}function Lm(e,t){let n=e.src,r=e.pos,i=e.posMax;if(r>=i||Im(n.charCodeAt(r)))return!1;let a=r+1;for(;a<i&&!Im(n.charCodeAt(a));)a++;return t||(e.pending+=a===r+1?n.charAt(r):n.slice(r,a)),e.pos=a,!0}var Rm=Lm;function zm(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Bm(e){if(e.length===0)return 0;let t=e.slice().sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]}function Vm(e,t){return{chain:e,name:t,calls:0,hits:0,inclusiveMs:0,medianMs:0,maxMs:0,normalCalls:0,normalHits:0,silentCalls:0,silentHits:0,samples:[]}}function Hm(e){let t=e;if(!t)return null;if(t.__mdtsRuleProfile)return t.__mdtsRuleProfile;if(!t.__mdtsProfileRules)return null;let n=t.__mdtsProfileRules===!0?{}:t.__mdtsProfileRules,r={enabled:!0,fixture:n.fixture,mode:n.mode,startedAt:zm(),records:Object.create(null)};return t.__mdtsRuleProfile=r,r}function Um(e,t,n,r,i,a){let o=Hm(e);if(!o)return;let s=`${t}:${n}`,c=o.records[s]??(o.records[s]=Vm(t,n));c.calls++,c.inclusiveMs+=r,r>c.maxMs&&(c.maxMs=r),c.samples.push(r),a?(c.silentCalls++,i&&c.silentHits++):(c.normalCalls++,i&&c.normalHits++),i&&c.hits++,o.completedAt=zm()}function Wm(e){let t=Hm(e);if(!t)return null;let n=Object.keys(t.records);for(let e=0;e<n.length;e++){let r=t.records[n[e]];r.medianMs=Bm(r.samples)}return t.completedAt=zm(),t}var Gm=class{rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t,n){let r=this.rules.findIndex(t=>t.name===e);r>=0&&this.rules.splice(r,1),this.rules.push({name:e,fn:t,alt:n?.alt||[],enabled:!0}),this.invalidateCache()}at(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(t===void 0){if(r<0)return;let e=this.rules[r];return Object.freeze({name:e.name,fn:e.fn,alt:e.alt?Object.freeze(e.alt.slice()):void 0,enabled:e.enabled})}if(r<0)throw Error(`Parser rule not found: ${e}`);this.rules[r].fn=t,n?.alt!==void 0&&(this.rules[r].alt=n.alt),this.invalidateCache()}before(e,t,n,r){let i=this.rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this.rules.findIndex(e=>e.name===t);a>=0&&this.rules.splice(a,1),this.rules.splice(i,0,{name:t,fn:n,alt:r?.alt||[],enabled:!0}),this.invalidateCache()}after(e,t,n,r){let i=this.rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this.rules.findIndex(e=>e.name===t);a>=0&&this.rules.splice(a,1),this.rules.splice(i+1,0,{name:t,fn:n,alt:r?.alt||[],enabled:!0}),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled||(this.rules[n].enabled=!0,i=!0)}return i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled&&(this.rules[n].enabled=!1,i=!0)}return i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this.rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}getRules(e){let t=e||``;return this.cache||this.compileCache(),this.cache.get(t)??[]}getNamedRules(e){let t=e||``;return this.namedCache||this.compileCache(),this.namedCache.get(t)??[]}compileCache(){let e=new Set([``]);for(let t of this.rules)if(t.enabled&&t.alt)for(let n of t.alt)e.add(n);let t=new Map,n=new Map;for(let r of e){let e=[],i=[];for(let t of this.rules)t.enabled&&(r===``||t.alt?.includes(r))&&(e.push(t.fn),i.push({name:t.name,fn:t.fn}));t.set(r,e),n.set(r,i)}this.cache=t,this.namedCache=n}},Km=class{src;md;env;tokens;tokens_meta;pos;posMax;level;pending;pendingLevel;cache;delimiters;_prev_delimiters;backticks;backticksScanned;linkLevel;linkLabelNoCloseFrom;maxNesting;constructor(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=e.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache=[],this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0,this.linkLabelNoCloseFrom=-1,this.maxNesting=t.options.maxNesting}pushPending(){let e=new Vd(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e}pushSimple(e,t){this.pending&&this.pushPending();let n=new Vd(e,t,0);return n.level=this.level,this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(null),n}push(e,t,n){if(this.pending&&this.pushPending(),n===0)return this.pushSimple(e,t);let r=new Vd(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,t){let{src:n,posMax:r}=this,i=n.charCodeAt(e),a=e;for(;a<r&&n.charCodeAt(a)===i;)a++;let o=a-e,s=e>0?n.charCodeAt(e-1):32,c=a<r?n.charCodeAt(a):32,l=Xd(s),u=Xd(c),d=$d(s),f=$d(c),p=!u&&(!f||l||d),m=!l&&(!d||u||f);return{can_open:p&&(t||!m||d),can_close:m&&(t||!p||f),length:o}}};Km.prototype.Token=Vd;var qm=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/;function Jm(e,t){switch(e.src.charCodeAt(e.pos)){case 10:return Am(e,t);case 33:return ym(e,t);case 38:return $p(e,t);case 42:case 95:return Wp.tokenize(e,t);case 58:return e.md.options.linkify&&Om(e,t);case 60:return Np(e,t)||_m(e,t);case 91:return Sm(e,t);case 92:return am(e,t);case 96:return Fp(e,t);case 126:return Pm.tokenize(e,t);default:return Rm(e,t)}}function Ym(e){return!qm.test(e)}var Xm=class{ruler;ruler2;cachedRulesVersion=-1;cachedRules=[];cachedRules2Version=-1;cachedRules2=[];defaultRulerVersion;defaultRuler2Version;constructor(){this.ruler=new Gm,this.ruler2=new Gm,this.ruler.push(`text`,Rm),this.ruler.push(`linkify`,Om),this.ruler.push(`newline`,Am),this.ruler.push(`escape`,am),this.ruler.push(`backticks`,Fp),this.ruler.push(`strikethrough`,Pm.tokenize),this.ruler.push(`emphasis`,Wp.tokenize),this.ruler.push(`link`,Sm),this.ruler.push(`image`,ym),this.ruler.push(`autolink`,Np),this.ruler.push(`html_inline`,_m),this.ruler.push(`entity`,$p),this.ruler2.push(`balance_pairs`,Rp),this.ruler2.push(`strikethrough`,Pm.postProcess),this.ruler2.push(`emphasis`,Wp.postProcess),this.ruler2.push(`fragments_join`,sm),this.defaultRulerVersion=this.ruler.version,this.defaultRuler2Version=this.ruler2.version}skipToken(e){let t=e.pos,n=this.getRules(),r=n.length,i=e.cache,a=i[t],o=!!e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`));if(a!==void 0){e.pos=a;return}let s=!1;if(e.level<e.maxNesting){if(o){let n=this.ruler.getNamedRules(``);for(let i=0;i<r;i++){e.level++;let r=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();s=n[i].fn(e,!0);let a=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();if(Um(e.env,`inline`,n[i].name,a-r,!!s,!0),e.level--,s){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}}else if(this.isDefaultRuleset()){if(e.level++,s=Jm(e,!0),e.level--,s&&t>=e.pos)throw Error(`inline rule didn't increment state.pos`)}else for(let i=0;i<r;i++)if(e.level++,s=n[i](e,!0),e.level--,s){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;s||e.pos++,i[t]=e.pos}tokenize(e){let t=this.getRules(),n=t.length,r=e.posMax;if(!(e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`)))){let i=this.isDefaultRuleset();for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<e.maxNesting){if(i)o=Jm(e,!1);else for(let r=0;r<n&&(o=t[r](e,!1),!o);r++);if(o&&a>=e.pos)throw Error(`inline rule didn't increment state.pos`)}if(o){if(e.pos>=r)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending();return}let i=this.ruler.getNamedRules(``);for(;e.pos<r;){let t=e.pos,a=!1;if(e.level<e.maxNesting)for(let r=0;r<n;r++){let n=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();a=i[r].fn(e,!1);let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();if(Um(e.env,`inline`,i[r].name,o-n,!!a,!1),a){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(a){if(e.pos>=r)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending()}isDefaultRuleset(){return this.ruler.version===this.defaultRulerVersion&&this.ruler2.version===this.defaultRuler2Version}parseSource(e,t,n,r){if(typeof e==`string`&&e.length>0&&this.isDefaultRuleset()&&Ym(e)){let t=new Vd(`text`,``,0);t.content=e,r.push(t);return}let i=new Km(e,t,n,r);this.tokenize(i);let a=this.getRules2(),o=a.length;if(!(i.env&&(Object.prototype.hasOwnProperty.call(i.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(i.env,`__mdtsProfileRules`)))){for(let e=0;e<o;e++)a[e](i,!1);return}let s=this.ruler2.getNamedRules(``);for(let e=0;e<o;e++){let t=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();s[e].fn(i,!1);let n=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();Um(i.env,`inline2`,s[e].name,n-t,!0,!1)}}parse(e,t,n,r){this.parseSource(e,t,n,r)}getRules(){return this.cachedRulesVersion!==this.ruler.version&&(this.cachedRules=this.ruler.getRules(``),this.cachedRulesVersion=this.ruler.version),this.cachedRules}getRules2(){return this.cachedRules2Version!==this.ruler2.version&&(this.cachedRules2=this.ruler2.getRules(``),this.cachedRules2Version=this.ruler2.version),this.cachedRules2}};function Zm(e){let t=e.tokens,n=!!(e.md?.inline)?.isDefaultRuleset?.();for(let r=0,i=t.length;r<i;r++){let i=t[r];if(i.type===`inline`&&e.md){if(i.children||=[],n&&i.content.length>0&&Ym(i.content)){let e=new Vd(`text`,``,0);e.content=i.content,i.children.push(e);continue}e.md.inline.parse(i.content,e.md,e.env,i.children)}}}var Qm=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,$m=/[0-9a-z]/i;function eh(e){return e.includes(`.`)||e.includes(`@`)||e.includes(`:`)}var th=new WeakMap;function nh(e){let t=e.re?.get_schema_search?.();if(!t)return!1;let n=th.get(e);if(n&&n.schemaSearch===t)return n.safe;let r=e.__schemas__,i=!0;if(r){for(let e in r)if(e.charCodeAt(e.length-1)!==58){i=!1;break}}return th.set(e,{schemaSearch:t,safe:i}),i}function rh(e){return/^<a[>\s]/i.test(e)}function ih(e){return/^<\/a\s*>/i.test(e)}function ah(e,t){if(t.schema||t.index!==0||!t.raw)return t;for(let n=1;n<t.raw.length;n++){let r=t.raw[n-1],i=t.raw[n];if(!Qm.test(r)||!$m.test(i))continue;let a=t.raw.slice(n),o=e.match(a)?.[0];if(o&&o.index===0&&o.lastIndex===a.length)return{...o,index:t.index+n,lastIndex:t.index+n+o.lastIndex}}return t}function oh(e){let t=e.tokens;if(!e.md?.options?.linkify)return;let n=nh(e.md.linkify),r=e=>!n||eh(e);for(let n=0;n<t.length;n++){let i=t[n];if(i.type!==`inline`||!r(i.content))continue;let a=i.children;a||(a=[],i.children=a);let o=0;for(let t=a.length-1;t>=0;t--){let n=a[t];if(n.type===`link_close`){for(t--;t>=0&&a[t].level!==n.level&&a[t].type!==`link_open`;)t--;continue}if(n.type===`html_inline`&&(rh(n.content)&&o>0&&o--,ih(n.content)&&o++),o>0||n.type!==`text`||!r(n.content))continue;let i=n.content,s=(e.md.linkify.match(i)||[]).map(t=>ah(e.md.linkify,t));if(s.length===0)continue;let c=[],l=n.level,u=0;s.length>0&&s[0].index===0&&t>0&&a[t-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t],r=e.md.normalizeLink(n.url);if(!e.md.validateLink(r))continue;let a=n.text;a=n.schema?n.schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:${a}`).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://${a}`).replace(/^http:\/\//,``);let o=n.index;if(o>u){let e=new Vd(`text`,``,0);e.content=i.slice(u,o),e.level=l,c.push(e)}let d=new Vd(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new Vd(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new Vd(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=n.lastIndex}if(u!==0){if(u<i.length){let e=new Vd(`text`,``,0);e.content=i.slice(u),e.level=l,c.push(e)}a.splice(t,1,...c)}}}}var sh=/\r\n?|\n/g,ch=/\0/g;function lh(e){if(!e||typeof e.src!=`string`)return;let t=e.src,n=t.includes(`\r`),r=t.includes(`\0`);if(!n&&!r)return;let i=t;n&&(i=i.replace(sh,`
20
+ `)),r&&(i=i.replace(ch,`�`)),e.src=i}var uh=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,dh=/\((?:c|tm|r)\)/i,fh=/\((c|tm|r)\)/gi,ph={c:`©`,r:`®`,tm:`™`};function mh(e,t){return ph[t.toLowerCase()]}function hh(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(fh,mh)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function gh(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&uh.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function _h(e){if(e.md?.options?.typographer)for(let t=e.tokens.length-1;t>=0;t--){let n=e.tokens[t];if(n.type!==`inline`)continue;let r=n.content||(Array.isArray(n.children)?n.children.map(e=>e.type===`text`?e.content:``).join(``):``);dh.test(r)&&hh(n.children||[]),uh.test(r)&&gh(n.children||[])}}var vh=class{rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t){let n=this.rules.findIndex(t=>t.name===e);n>=0&&this.rules.splice(n,1),this.rules.push({name:e,fn:t,enabled:!0}),this.invalidateCache()}at(e,t){let n=this.rules.findIndex(t=>t.name===e);if(n<0)throw Error(`Parser rule not found: ${e}`);this.rules[n].fn=t,this.invalidateCache()}before(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(r<0)throw Error(`Parser rule not found: ${e}`);let i=this.rules.findIndex(e=>e.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(r,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}after(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(r<0)throw Error(`Parser rule not found: ${e}`);let i=this.rules.findIndex(e=>e.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(r+1,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled||(this.rules[n].enabled=!0,i=!0)}return i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled&&(this.rules[n].enabled=!1,i=!0)}return i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this.rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}compileCache(){this.cache=this.rules.filter(e=>e.enabled).map(e=>e.fn),this.namedCache=this.rules.filter(e=>e.enabled).map(e=>({name:e.name,fn:e.fn}))}getRules(e=``){return this.cache||this.compileCache(),this.cache}getNamedRules(e=``){return this.namedCache||this.compileCache(),this.namedCache}},yh=/['"]/,bh=/['"]/g,xh=`’`;function Sh(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function Ch(e,t){let n,r=[],i=t.md&&t.md.options&&t.md.options.quotes||`“”‘’`;for(let t=0;t<e.length;t++){let a=e[t],o=e[t].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,a.type!==`text`)continue;let s=a.content,c=0,l=s.length;OUTER:for(;c<l;){bh.lastIndex=c;let u=bh.exec(s);if(!u)break;let d=!0,f=!0;c=u.index+1;let p=u[0]===`'`,m=32;if(u.index-1>=0)m=s.charCodeAt(u.index-1);else for(n=t-1;n>=0&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(c<l)h=s.charCodeAt(c);else for(n=t+1;n<e.length&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=$d(m),_=$d(h),v=Xd(m),y=Xd(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&u[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&(a.content=Sh(a.content,u.index,xh));continue}if(f)for(n=r.length-1;n>=0;n--){let d=r[n];if(r[n].level<o)break;if(d.single===p&&r[n].level===o){d=r[n];let o,f;p?(o=i[2]||`‘`,f=i[3]||`’`):(o=i[0]||`“`,f=i[1]||`”`),a.content=Sh(a.content,u.index,f),e[d.token].content=Sh(e[d.token].content,d.pos,o),c+=f.length-1,d.token===t&&(c+=o.length-1),s=a.content,l=s.length,r.length=n;continue OUTER}}d?r.push({token:t,pos:u.index,single:p,level:o}):f&&p&&(a.content=Sh(a.content,u.index,xh))}}}function wh(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--){let n=e.tokens[t];if(n.type!==`inline`)continue;let r=typeof n.content==`string`?n.content:(n.children||[]).map(e=>e.content||``).join(``);yh.test(r)&&n.children&&Ch(n.children,e)}}function Th(e){let t=e.tokens||[],n=t.length;for(let e=0;e<n;e++){let n=t[e];if(n.type!==`inline`||!Array.isArray(n.children))continue;let r=n.children,i=r.length;for(let e=0;e<i;e++)r[e].type===`text_special`&&(r[e].type=`text`);let a=0,o=0;for(;o<i;o++)r[o].type===`text`&&o+1<i&&r[o+1].type===`text`?r[o+1].content=r[o].content+r[o+1].content:(o!==a&&(r[a]=r[o]),a++);o!==a&&(r.length=a)}}var Eh=/^(?:vbscript|javascript|file|data):/,Dh=/^data:image\/(?:gif|png|jpeg|webp);/,Oh=[`http:`,`https:`,`mailto:`],kh=/[^\0-\x7F]/,Ah=/xn--/,jh=/%(?![0-9a-f]{2})|[^\w;/?:@&=+$,\-.!~*'()#%]/i,Mh=/%[0-9a-f]{2}/i;function Nh(e){let t=e.trim().toLowerCase();return!Eh.test(t)||Dh.test(t)}function Ph(e){let t=Ld(e,!0);if(t.hostname&&(!t.protocol||Oh.includes(t.protocol))&&kh.test(t.hostname))try{t.hostname=fp.default.toASCII(t.hostname)}catch{}let n=wd(t);return jh.test(n)?Cd(n):n}function Fh(e){let t=Ld(e,!0);if(t.hostname&&(!t.protocol||Oh.includes(t.protocol))&&(kh.test(t.hostname)||Ah.test(t.hostname)))try{t.hostname=fp.default.toUnicode(t.hostname)}catch{}let n=wd(t);return Mh.test(n)?yd(n,`${yd.defaultChars}%`):n}function Ih(e){switch(e){case 9:case 32:return!0}return!1}function Lh(e,t,n,r){let i=e.src,a=e.bMarks,o=e.eMarks,s=e.tShift,c=e.sCount,l=e.bsCount,u=a[t]+s[t],d=o[t],f=e.lineMax;if(c[t]-e.blkIndent>=4||i.charCodeAt(u)!==62)return!1;if(r)return!0;let p=[],m=[],h=[],g=[],_=e.md.block.ruler.getRulesForState(e,`blockquote`),v=e.parentType;e.parentType=`blockquote`;let y=!1,b;for(b=t;b<n;b++){let t=c[b]<e.blkIndent;if(u=a[b]+s[b],d=o[b],u>=d)break;if(i.charCodeAt(u++)===62&&!t){let e=c[b]+1,t,n;i.charCodeAt(u)===32?(u++,e++,n=!1,t=!0):i.charCodeAt(u)===9?(t=!0,(l[b]+e)%4==3?(u++,e++,n=!1):n=!0):t=!1;let r=e;for(p.push(a[b]),a[b]=u;u<d;){let e=i.charCodeAt(u);if(Ih(e))e===9?r+=4-(r+l[b]+ +!!n)%4:r++;else break;u++}y=u>=d,m.push(l[b]),l[b]=c[b]+1+ +!!t,h.push(c[b]),c[b]=r-e,g.push(s[b]),s[b]=u-a[b];continue}if(y)break;let r=!1;for(let t=0,i=_.length;t<i;t++)if(_[t](e,b,n,!0)){r=!0;break}if(r){e.lineMax=b,e.blkIndent!==0&&(p.push(a[b]),m.push(l[b]),g.push(s[b]),h.push(c[b]),c[b]-=e.blkIndent);break}p.push(a[b]),m.push(l[b]),g.push(s[b]),h.push(c[b]),c[b]=-1}let x=e.blkIndent;e.blkIndent=0;let S=e.push(`blockquote_open`,`blockquote`,1);S.markup=`>`;let C=[t,0];S.map=C,e.md.block.tokenize(e,t,b);let w=e.push(`blockquote_close`,`blockquote`,-1);w.markup=`>`,e.lineMax=f,e.parentType=v,C[1]=e.line;for(let e=0;e<g.length;e++)a[e+t]=p[e],s[e+t]=g[e],c[e+t]=h[e],l[e+t]=m[e];return e.blkIndent=x,!0}function Rh(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=`${e.getLines(t,i,4+e.blkIndent,!1)}\n`,a.map=[t,e.line],!0}function zh(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.includes(String.fromCharCode(o)))return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}var Bh=[``,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],Vh=[``,`#`,`##`,`###`,`####`,`#####`,`######`];function Hh(e){switch(e){case 9:case 32:return!0}return!1}function Uh(e,t,n,r){let i=e.src,a=e.bMarks,o=e.tShift,s=e.eMarks,c=a[t]+o[t],l=s[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let u=i.charCodeAt(c);if(u!==35||c>=l)return!1;let d=1;for(u=i.charCodeAt(++c);u===35&&c<l&&d<=6;)d++,u=i.charCodeAt(++c);if(d>6||c<l&&!Hh(u))return!1;if(r)return!0;l=e.skipSpacesBack(l,c);let f=e.skipCharsBack(l,35,c);f>c&&Hh(i.charCodeAt(f-1))&&(l=f),e.line=t+1;let p=e.push(`heading_open`,Bh[d],1);p.markup=Vh[d],p.map=[t,e.line];let m=e.push(`inline`,``,0);m.content=i.slice(c,l).trim(),m.map=[t,e.line],m.children=[];let h=e.push(`heading_close`,Bh[d],-1);return h.markup=Vh[d],!0}function Wh(e){switch(e){case 9:case 32:return!0}return!1}function Gh(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!Wh(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=String.fromCharCode(o).repeat(s),!0}var Kh=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(${`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`).join(`|`)})(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(`${dm.source}\\s*$`),/^$/,!1]];function qh(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<Kh.length&&!Kh[s][0].test(o);s++);if(s===Kh.length)return!1;if(r)return Kh[s][2];let c=t+1;if(!Kh[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent);c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),Kh[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let l=e.push(`html_block`,``,0);return l.map=[t,c],l.content=e.getLines(t,c,e.blkIndent,!0),!0}function Jh(e){switch(e){case 9:case 32:return!0}return!1}var Yh={Pipe:1,ParagraphTerminator:2},Xh=new Uint8Array(256);for(let e of[35,42,43,45,60,62,95,96,124,126,48,49,50,51,52,53,54,55,56,57])Xh[e]=1;var Zh=class{src;md;env;tokens;bMarks=[];eMarks=[];tShift=[];sCount=[];bsCount=[];lineFlags=[];blkIndent=0;line=0;lineMax=0;tight=!1;ddIndent=-1;listIndent=-1;parentType=`root`;level=0;constructor(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r;let i=this.src,a=i.length,o=this.bMarks,s=this.eMarks,c=this.tShift,l=this.sCount,u=this.bsCount,d=this.lineFlags,f=0,p=i.indexOf(`|`);for(;f<a;){let e=f;for(;e<a&&e-f<4&&i.charCodeAt(e)!==10;)e++;if(e-f===4&&e<a){let t=i.indexOf(`
21
+ `,e);e=t===-1?a:t}let t=0,n=0,r=f;for(;r<e;){let e=i.charCodeAt(r);if(e===32){t++,n++,r++;continue}if(e===9){t++,n+=4-n%4,r++;continue}break}let m=0;r<e&&(Xh[i.charCodeAt(r)]===1&&(m|=Yh.ParagraphTerminator),p<f&&(p=i.indexOf(`|`,f)),p!==-1&&p<e&&(m|=Yh.Pipe|Yh.ParagraphTerminator),p===-1&&(p=a)),o.push(f),s.push(e),c.push(t),l.push(n),u.push(0),d.push(m),f=e+1}o.push(a),s.push(a),c.push(0),l.push(0),u.push(0),d.push(0),this.lineMax=o.length-1}push(e,t,n){if(n===0){let n=new Vd(e,t,0);return n.block=!0,n.level=this.level,this.tokens.push(n),n}let r=new Vd(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){let t=this.bMarks,n=this.tShift,r=this.eMarks;for(let i=this.lineMax;e<i&&!(t[e]+n[e]<r[e]);e++);return e}skipSpaces(e){let t=this.src;for(let n=t.length;e<n;e++){let n=t.charCodeAt(e);if(n!==9&&n!==32)break}return e}skipSpacesBack(e,t){if(e<=t)return e;let n=this.src;for(;e>t;){let t=n.charCodeAt(--e);if(t!==9&&t!==32)return e+1}return e}skipChars(e,t){let n=this.src;for(let r=n.length;e<r&&n.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;let r=this.src;for(;e>n;)if(t!==r.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return``;if(e+1===t){let t=e,i=this.bMarks[t],a=i,o=r?this.eMarks[t]+1:this.eMarks[t],s=0,c=this.src,l=this.bsCount,u=this.tShift;for(;a<o&&s<n;){let e=c.charCodeAt(a);if(e===9||e===32)e===9?s+=4-(s+l[t])%4:s++;else if(a-i<u[t])s++;else break;a++}return s>n?` `.repeat(s-n)+c.slice(a,o):c.slice(a,o)}let i=Array(t-e),a=this.src,o=this.bMarks,s=this.eMarks,c=this.bsCount,l=this.tShift;for(let u=0,d=e;d<t;d++,u++){let e=0,f=o[d],p=f,m;for(m=d+1<t||r?s[d]+1:s[d];p<m&&e<n;){let t=a.charCodeAt(p);if(Jh(t))t===9?e+=4-(e+c[d])%4:e++;else if(p-f<l[d])e++;else break;p++}e>n?i[u]=` `.repeat(e-n)+a.slice(p,m):i[u]=a.slice(p,m)}return i.join(``)}};Zh.prototype.Token=Vd;function Qh(e,t,n){for(let r=t;r<n;r++)if(e.charCodeAt(r)===124)return!0;return!1}function $h(e){let t=e?.md?.block?.ruler;return t?t.version===t.__mdtsDefaultVersion:!1}function eg(e,t,n,r,i){if(e.lineFlags&&(e.lineFlags[t]&Yh.ParagraphTerminator)===0||r>=i)return!1;let a=n.charCodeAt(r);switch(a){case 35:case 42:case 43:case 45:case 60:case 62:case 95:case 96:case 126:return!0}return a>=48&&a<=57||Qh(n,r,i)}var tg=[``,`h1`,`h2`];function ng(e,t,n){let r=e.md.block.ruler.getRulesForState(e,`paragraph`),i=e.src,a=e.bMarks,o=e.tShift,s=e.eMarks,c=e.sCount,l=e.blkIndent,u=$h(e);if(c[t]-l>=4)return!1;let d=e.parentType;e.parentType=`paragraph`;let f=0,p,m=t+1;for(;m<n;m++){let t=a[m]+o[m],d=s[m];if(t>=d)break;if(c[m]-l>3)continue;if(c[m]>=l&&(p=i.charCodeAt(t),p===45||p===61)){let e=t+1,n=e;for(;e<d&&i.charCodeAt(e)===p;)e++;for(n=e;e<d;){let t=i.charCodeAt(e);if(t!==9&&t!==32)break;e++}if(e>=d){f=p===61?1:2;break}if(n-t>1)continue}if(c[m]<0||u&&!eg(e,m,i,t,d))continue;let h=!1;for(let t=0,i=r.length;t<i;t++)if(r[t](e,m,n,!0)){h=!0;break}if(h)break}if(!f)return!1;let h;if(m===t+1){let e=a[t]+o[t],n=s[t];for(;n>e;){let e=i.charCodeAt(n-1);if(e!==9&&e!==32)break;n--}h=i.slice(e,n)}else h=e.getLines(t,m,l,!1).trim();e.line=m+1;let g=p===61?`=`:`-`,_=e.push(`heading_open`,tg[f],1);_.markup=g,_.map=[t,e.line];let v=e.push(`inline`,``,0);v.content=h,v.map=[t,e.line-1],v.children=[];let y=e.push(`heading_close`,tg[f],-1);return y.markup=g,e.parentType=d,!0}function rg(e){switch(e){case 9:case 32:return!0}return!1}function ig(e,t){let n=e.eMarks,r=e.bMarks,i=e.tShift,a=e.src,o=n[t],s=r[t]+i[t],c=a.charCodeAt(s++);return c!==42&&c!==45&&c!==43||s<o&&!rg(a.charCodeAt(s))?-1:s}function ag(e,t){let n=e.bMarks,r=e.tShift,i=e.eMarks,a=e.src,o=n[t]+r[t],s=i[t],c=o;if(c+1>=s)return-1;let l=a.charCodeAt(c++);if(l<48||l>57)return-1;for(;;){if(c>=s)return-1;if(l=a.charCodeAt(c++),l>=48&&l<=57){if(c-o>=10)return-1;continue}if(l===41||l===46)break;return-1}return c<s&&(l=a.charCodeAt(c),!rg(l))?-1:c}function og(e,t,n){let r=e.bMarks,i=e.tShift,a=e.src,o=r[t]+i[t],s=0;for(let e=o;e<n-1;e++)s=s*10+a.charCodeAt(e)-48;return s}var sg=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`];function cg(e,t){let n=e.level+2,r=e.tokens;for(let e=t+2,i=r.length-2;e<i;e++){let t=r[e];if(t.level===n){if(t.type===`paragraph_open`){t.hidden=!0,r[e+2].hidden=!0,e+=2;continue}if(t.nesting===1){let t=1;for(;t>0&&++e<i;)t+=r[e].nesting}}}}function lg(e,t,n,r){let i,a,o=0,s=t,c=!0;if(e.sCount[s]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]<e.blkIndent)return!1;let l=!1;r&&e.parentType===`paragraph`&&e.sCount[s]>=e.blkIndent&&(l=!0);let u,d,f,p=e.src,m=e.bMarks,h=e.tShift,g=e.eMarks,_=e.sCount,v=e.bsCount,y=m[s]+h[s];if(y>=g[s])return!1;let b=p.charCodeAt(y);if(b>=48&&b<=57){if(f=ag(e,s),f<0||(u=!0,o=y,d=og(e,s,f),l&&d!==1))return!1}else if(b===42||b===45||b===43){if(f=ig(e,s),f<0)return!1;u=!1}else return!1;if(l&&e.skipSpaces(f)>=g[s])return!1;if(r)return!0;let x=p.charCodeAt(f-1),S=String.fromCharCode(x);if(u){let t=e.push(`ordered_list_open`,`ol`,1);d!==void 0&&d!==1&&(t.attrs=[[`start`,String(d)]])}else e.push(`bullet_list_open`,`ul`,1);let C=[s,0];e.tokens[e.tokens.length-1].map=C,e.tokens[e.tokens.length-1].markup=S;let w=!1,T=e.tokens.length-1,E=e.md.block.ruler.getRulesForState(e,`list`),D=e.parentType;for(e.parentType=`list`;s<n;){a=f,i=g[s];let t=_[s]+f-(m[s]+h[s]),r=t;for(;a<i;){let e=p.charCodeAt(a);if(e===9)r+=4-(r+v[s])%4;else if(e===32)r++;else break;a++}let l=a,d;d=l>=i?1:r-t,d>4&&(d=1);let y=t+d,b=e.push(`list_item_open`,`li`,1);b.markup=S;let C=[s,0];b.map=C,u&&(b.info=f-o-1==1?sg[p.charCodeAt(o)-48]:p.slice(o,f-1));let T=e.tight,D=e.tShift[s],O=e.sCount[s],k=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=y,e.tight=!0,e.tShift[s]=l-m[s],e.sCount[s]=r,l>=i&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,s,n,!0),(!e.tight||w)&&(c=!1),w=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=k,e.tShift[s]=D,e.sCount[s]=O,e.tight=T,e.push(`list_item_close`,`li`,-1).markup=S,s=e.line,C[1]=s,s>=n||e.sCount[s]<e.blkIndent||e.sCount[s]-e.blkIndent>=4)break;let A=!1;for(let t=0,r=E.length;t<r;t++)if(E[t](e,s,n,!0)){A=!0;break}if(A)break;if(u){if(f=ag(e,s),f<0)break;o=m[s]+h[s]}else if(f=ig(e,s),f<0)break;if(x!==p.charCodeAt(f-1))break}return u?e.push(`ordered_list_close`,`ol`,-1).markup=S:e.push(`bullet_list_close`,`ul`,-1).markup=S,C[1]=s,e.line=s,e.parentType=D,c&&cg(e,T),!0}function ug(e){return e===9||e===32}function dg(e,t,n){let r=e.md.block.ruler.getRulesForState(e,`paragraph`),i=e.parentType,a=e.src,o=e.bMarks,s=e.tShift,c=e.eMarks,l=e.sCount,u=e.blkIndent,d=$h(e),f=t+1;for(e.parentType=`paragraph`;f<n&&!e.isEmpty(f);f++){if(l[f]-u>3||l[f]<0)continue;if(i===`list`&&l[f]>=u){let e=o[f]+s[f],t=c[f];if(e<t){let n=a.charCodeAt(e);if(n===42||n===45||n===43){if(e+1>=t||ug(a.charCodeAt(e+1)))break}else if(n>=48&&n<=57&&e+1<t){let n=e+1;for(;;){if(n>=t){n=-1;break}let r=a.charCodeAt(n++);if(r>=48&&r<=57){if(n-e>=10){n=-1;break}continue}if((r===41||r===46)&&(n>=t||ug(a.charCodeAt(n))))break;n=-1;break}if(n>=0)break}}}let t=o[f]+s[f],p=c[f];if(d&&!eg(e,f,a,t,p))continue;let m=!1;for(let t=0,i=r.length;t<i;t++)if(r[t](e,f,n,!0)){m=!0;break}if(m)break}let p=e.getLines(t,f,u,!1).trim();e.line=f;let m=e.push(`paragraph_open`,`p`,1);m.map=[t,e.line];let h=e.push(`inline`,``,0);return h.content=p,h.map=[t,e.line],h.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}function fg(e){switch(e){case 9:case 32:return!0}return!1}function pg(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1,s=e.md.block.ruler.getRulesForState(e,`reference`);if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function c(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.parentType;e.parentType=`reference`;let i=!1;for(let r=0,a=s.length;r<a;r++)if(s[r](e,t,n,!0)){i=!0;break}if(e.parentType=r,i)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let l=e.src.slice(i,a+1);a=l.length;let u=-1;for(i=1;i<a;i++){let e=l.charCodeAt(i);if(e===91)return!1;if(e===93){u=i;break}if(e===10){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}else if(e===92&&(i++,i<a&&l.charCodeAt(i)===10)){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}}if(u<0||l.charCodeAt(u+1)!==58)return!1;for(i=u+2;i<a;i++){let e=l.charCodeAt(i);if(e===10){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}else if(!fg(e))break}let d=e.md.helpers.parseLinkDestination(l,i,a);if(!d.ok)return!1;let f=e.md.normalizeLink(d.str);if(!e.md.validateLink(f))return!1;i=d.pos;let p=i,m=o,h=i;for(;i<a;i++){let e=l.charCodeAt(i);if(e===10){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}else if(!fg(e))break}let g=e.md.helpers.parseLinkTitle(l,i,a);for(;g.can_continue;){let t=c(o);if(t===null)break;l+=t,i=a,a=l.length,o++,g=e.md.helpers.parseLinkTitle(l,i,a,g)}let _;for(i<a&&h!==i&&g.ok?(_=g.str,i=g.pos):(_=``,i=p,o=m);i<a&&fg(l.charCodeAt(i));)i++;if(i<a&&l.charCodeAt(i)!==10&&_)for(_=``,i=p,o=m;i<a&&fg(l.charCodeAt(i));)i++;if(i<a&&l.charCodeAt(i)!==10)return!1;let v=tf(l.slice(1,u));return v?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[v]===void 0&&(e.env.references[v]={title:_,href:f}),e.line=o,!0):!1}function mg(e){switch(e){case 9:case 32:return!0}return!1}var hg=65536;function gg(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function _g(e,t){if(e.lineFlags)return(e.lineFlags[t]&Yh.Pipe)!==0;for(let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];n<r;n++)if(e.src.charCodeAt(n)===124)return!0;return!1}function vg(e){if(!e.includes(`\\`))return e.split(`|`);let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function yg(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!mg(s)||o===45&&mg(s)||!_g(e,t))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!mg(t))return!1;a++}let c=gg(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=gg(e,t).trim(),e.sCount[t]-e.blkIndent>=4)return!1;l=vg(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRulesForState(e,`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=gg(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=vg(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>hg))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}var bg=class{_rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t,n){this._rules.push({name:e,enabled:!0,fn:t,alt:n?.alt||[]}),this.invalidateCache()}before(e,t,n,r){let i=this._rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this._rules.findIndex(e=>e.name===t);a>=0&&this._rules.splice(a,1),this._rules.splice(i,0,{name:t,enabled:!0,fn:n,alt:r?.alt||[]}),this.invalidateCache()}after(e,t,n,r){let i=this._rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this._rules.findIndex(e=>e.name===t);a>=0&&this._rules.splice(a,1),this._rules.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:r?.alt||[]}),this.invalidateCache()}getRules(e){let t=e||``;return this.cache||this.compileCache(),this.cache[t]??[]}getNamedRules(e){let t=e||``;return this.namedCache||this.compileCache(),this.namedCache[t]??[]}getRulesForState(e,t){let n=e?.env;return n&&(Object.prototype.hasOwnProperty.call(n,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(n,`__mdtsProfileRules`))?this.getNamedRules(t).map(({name:e,fn:t})=>(n,r,i,a)=>{let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),s=t(n,r,i,a),c=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();return Um(n?.env,`block`,e,c-o,s,!!a),s}):this.getRules(t)}at(e,t,n){let r=this._rules.findIndex(t=>t.name===e);if(r===-1)throw Error(`Parser rule not found: ${e}`);this._rules[r].fn=t,n?.alt&&(this._rules[r].alt=n.alt),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;return n.forEach(e=>{let n=this._rules.findIndex(t=>t.name===e);if(n===-1){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}r.push(e),this._rules[n].enabled||(this._rules[n].enabled=!0,i=!0)}),i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;return n.forEach(e=>{let n=this._rules.findIndex(t=>t.name===e);if(n===-1){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}r.push(e),this._rules[n].enabled&&(this._rules[n].enabled=!1,i=!0)}),i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this._rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}compileCache(){let e=new Set([``]);for(let t of this._rules)if(t.enabled)for(let n of t.alt)e.add(n);let t=Object.create(null),n=Object.create(null);for(let r of e){let e=[],i=[];for(let t of this._rules)t.enabled&&(r===``||t.alt.includes(r))&&(e.push(t.fn),i.push({name:t.name,fn:t.fn}));t[r]=e,n[r]=i}this.cache=t,this.namedCache=n}},xg=[[`table`,yg,[`paragraph`,`reference`]],[`code`,Rh],[`fence`,zh,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,Lh,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,Gh,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,lg,[`paragraph`,`reference`,`blockquote`]],[`reference`,pg],[`html_block`,qh,[`paragraph`,`reference`,`blockquote`]],[`heading`,Uh,[`paragraph`,`reference`,`blockquote`]],[`lheading`,ng],[`paragraph`,dg]],Sg=class{ruler;cachedRulesVersion=-1;cachedRules=[];constructor(){this.ruler=new bg;for(let e=0;e<xg.length;e++)this.ruler.push(xg[e][0],xg[e][1],{alt:(xg[e][2]||[]).slice()});this.ruler.__mdtsDefaultVersion=this.ruler.version}tokenize(e,t,n){let r=this.getRules(),i=r.length,a=e.md.options.maxNesting,o=e.bMarks,s=e.tShift,c=e.eMarks,l=e.sCount,u=t,d=!1;if(!(e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`)))){for(;u<n;){for(;u<n&&o[u]+s[u]>=c[u];)u++;if(e.line=u,u>=n||l[u]<e.blkIndent)break;if(e.level>=a){e.line=n;break}let t=e.line,f=!1;for(let a=0;a<i;a++)if(f=r[a](e,u,n,!1),f){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!f)throw Error(`none of the block rules matched`);e.tight=!d,o[e.line-1]+s[e.line-1]>=c[e.line-1]&&(d=!0),u=e.line,u<n&&o[u]+s[u]>=c[u]&&(d=!0,u++,e.line=u)}return}let f=this.ruler.getNamedRules(``);for(;u<n;){for(;u<n&&o[u]+s[u]>=c[u];)u++;if(e.line=u,u>=n||l[u]<e.blkIndent)break;if(e.level>=a){e.line=n;break}let t=e.line,r=!1;for(let a=0;a<i;a++){let i=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();r=f[a].fn(e,u,n,!1);let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();if(Um(e.env,`block`,f[a].name,o-i,r,!1),r){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}}if(!r)throw Error(`none of the block rules matched`);e.tight=!d,o[e.line-1]+s[e.line-1]>=c[e.line-1]&&(d=!0),u=e.line,u<n&&o[u]+s[u]>=c[u]&&(d=!0,u++,e.line=u)}}parse(e,t,n,r){if(!e||e.length===0)return;let i=new Zh(e,t,n,r);this.tokenize(i,i.line,i.lineMax)}getRules(){return this.cachedRulesVersion!==this.ruler.version&&(this.cachedRules=this.ruler.getRules(``),this.cachedRulesVersion=this.ruler.version),this.cachedRules}},Cg=class{src;env;tokens;inlineMode;md;constructor(e,t,n={}){this.src=typeof e==`string`?e||``:e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}};Cg.prototype.Token=Vd;var wg=[[`normalize`,lh],[`block`,kp],[`inline`,Zm],[`linkify`,oh],[`replacements`,_h],[`smartquotes`,wh],[`text_join`,Th]],Tg={html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,maxNesting:100},Eg={parseLinkLabel:_p,parseLinkDestination:pp,parseLinkTitle:yp};function Dg(){return{...Tg}}function Og(){return{...Eg}}var kg=class{fallbackParser;lastState=null;block;inline;ruler;linkifyInstance=null;cachedCoreRulesVersion=-1;cachedCoreRules=[];cachedCoreNamedRulesVersion=-1;cachedCoreNamedRules=[];constructor(){this.block=new Sg,this.inline=new Xm,this.ruler=new vh;for(let e=0;e<wg.length;e++){let[t,n]=wg[e];this.ruler.push(t,n)}this.fallbackParser={block:this.block,inline:this.inline,core:this,options:Dg(),helpers:Og(),normalizeLink:Ph,normalizeLinkText:Fh,validateLink:Nh,linkify:null}}resolveParser(e){return e||(this.linkifyInstance||=new dp({fuzzyLink:!0}),this.fallbackParser.block!==this.block&&(this.fallbackParser.block=this.block),this.fallbackParser.inline!==this.inline&&(this.fallbackParser.inline=this.inline),this.fallbackParser.core=this,this.fallbackParser.linkify=this.linkifyInstance,this.fallbackParser)}createState(e,t={},n){return new Cg(e,this.resolveParser(n),t)}getCoreRules(){return this.cachedCoreRulesVersion!==this.ruler.version&&(this.cachedCoreRules=this.ruler.getRules(``),this.cachedCoreRulesVersion=this.ruler.version),this.cachedCoreRules}getCoreNamedRules(){return this.cachedCoreNamedRulesVersion!==this.ruler.version&&(this.cachedCoreNamedRules=this.ruler.getNamedRules(``),this.cachedCoreNamedRulesVersion=this.ruler.version),this.cachedCoreNamedRules}process(e,t){let n=!!e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`));if(!n&&!t){let t=this.getCoreRules();for(let n=0;n<t.length;n++)t[n](e);return}let r=this.getCoreNamedRules();for(let i=0;i<r.length;i++){let a=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();r[i].fn(e);let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();n&&Um(e.env,`core`,r[i].name,o-a,!0,!1),t?.(r[i],e)}n&&Wm(e.env)}parseSource(e,t={},n){if(typeof e!=`string`&&Dp(e))return this.parse(Op(e),t,n);let r=this.createState(e,t,n);return this.process(r),this.lastState=r,r}parse(e,t={},n){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);return this.parseSource(e,t,n)}getTokens(){return this.lastState?this.lastState.tokens:[]}},Ag=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/;function jg(e){return!Ag.test(e)}function Mg(e,t){let n=e.indexOf(`
22
+ `,t);return n===-1?e.length:n}function Ng(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9)return!1}return!0}function Pg(e,t,n){return t+2<n&&e.charCodeAt(t)===96&&e.charCodeAt(t+1)===96&&e.charCodeAt(t+2)===96}function Fg(e,t,n){return t+1<n&&e.charCodeAt(t)===45&&e.charCodeAt(t+1)===32}function Ig(e){if(e.length>3)return jg(e);for(let t=0;t<e.length;t++)switch(e.charCodeAt(t)){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!1}return!0}var Lg=[``,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],Rg=[``,`#`,`##`,`###`,`####`,`#####`,`######`],zg=0,Bg=1,Vg=2;function Hg(e,t,n,r){let i=new Vd(e,t,n);return i.level=r,i.block=!0,i}function Ug(e,t,n){let r=Hg(`inline`,``,0,n);r.map=[t,t+1],r.content=e;let i=new Vd(`text`,``,0);return i.content=e,r.children=[i],r}function Wg(e,t,n,r,i){let a=0,o=n;for(;o<r&&t.charCodeAt(o)===35&&a<6;)o++,a++;if(a===0||o>=r||t.charCodeAt(o)!==32)return!1;let s=o+1;for(;s<r&&t.charCodeAt(s)===32;)s++;let c=r;for(;c>s&&t.charCodeAt(c-1)===32;)c--;let l=c;for(;l>s&&t.charCodeAt(l-1)===35;)l--;if(l>s&&t.charCodeAt(l-1)===32)for(c=l-1;c>s&&t.charCodeAt(c-1)===32;)c--;let u=t.slice(s,c);if(!jg(u))return!1;let d=Lg[a],f=Rg[a],p=Hg(`heading_open`,d,1,0);p.map=[i,i+1],p.markup=f,e.push(p),e.push(Ug(u,i,1));let m=Hg(`heading_close`,d,-1,0);return m.markup=f,e.push(m),!0}function Gg(e,t,n){let r=Hg(`paragraph_open`,`p`,1,0);r.map=[n,n+1],e.push(r),e.push(Ug(t,n,1)),e.push(Hg(`paragraph_close`,`p`,-1,0))}function Kg(e,t,n){let r=e.charCodeAt(n-1);return r===32||r===9?e.slice(t,n).trim():e.slice(t,n)}function qg(e,t){for(;t<e.length&&e.charCodeAt(t)===10;)t++;return t}function Jg(e,t){let n=Hg(`bullet_list_open`,`ul`,1,0);return n.map=[t,t],n.markup=`-`,e.push(n),n}function Yg(e,t,n){let r=Hg(`list_item_open`,`li`,1,1);r.map=[n,n+1],r.markup=`-`,e.push(r);let i=Hg(`paragraph_open`,`p`,1,2);i.map=[n,n+1],i.hidden=!0,e.push(i),e.push(Ug(t,n,3));let a=Hg(`paragraph_close`,`p`,-1,2);a.hidden=!0,e.push(a);let o=Hg(`list_item_close`,`li`,-1,1);return o.markup=`-`,e.push(o),r}function Xg(e){let t=Hg(`bullet_list_close`,`ul`,-1,0);t.markup=`-`,e.push(t)}function Zg(e,t,n,r){if(!Pg(e,t,n))return null;let i=e.slice(t+3,n);if(i.includes("`"))return null;let a=n<e.length?n+1:n,o=a,s=a,c=r+1;for(;s<e.length;){let t=Mg(e,s);if(Pg(e,s,t)&&Ng(e,s+3,t)){let n=Hg(`fence`,`code`,0,0);return n.map=[r,c+1],n.markup="```",n.info=i,n.content=e.slice(a,o),{token:n,nextPos:t<e.length?t+1:t,nextLine:c+1}}s=t<e.length?t+1:t,o=s,c++}return null}function Qg(e,t){if(e.length===0)return t&&(t.matched=!0),[];if(e.includes(`\r`)||e.includes(`\0`))return null;let n=[],r=e.length>=1e5?zg:Vg,i=``,a=!1,o=!1,s=0,c=0;for(;s<e.length;){let l=Mg(e,s);if(s===l){s=l<e.length?l+1:l,c++;continue}let u=e.charCodeAt(s);if(u===32||u===9){if(!Ng(e,s,l))return null;s=l<e.length?l+1:l,c++;continue}if(u===35){if(!Wg(n,e,s,l,c))return null;t&&(t.blocks++,t.headings++);let r=l<e.length?l+1:l;s=qg(e,r),c+=1+s-r;continue}if(u===45){if(!Fg(e,s,l))return null;let r=c,i=s,a=c,o=null,u=null;for(;i<e.length;){let t=Mg(e,i);if(!Fg(e,i,t))break;let s=i+2,c=t===s+1?e[s]:e.slice(s,t);if(!Ig(c))return null;o===null&&(o=Jg(n,r)),u=Yg(n,c,a),i=t<e.length?t+1:t,a++}if(o===null||u===null)return null;let d=i,f=a;for(;d<e.length;){if(e.charCodeAt(d)===10){d++,f++;continue}let t=Mg(e,d);if(!Ng(e,d,t)){if(Fg(e,d,t))return null;break}d=t<e.length?t+1:t,f++}o.map[1]=f,u.map[1]=f,Xg(n),t&&(t.blocks++,t.lists++),s=d,c=f;continue}if(u===96){let r=Zg(e,s,l,c);if(!r)return null;n.push(r.token),t&&(t.blocks++,t.fences++),s=qg(e,r.nextPos),c=r.nextLine+s-r.nextPos;continue}let d=Kg(e,s,l),f;if(r===Vg?(t&&t.paragraphCacheBypasses++,f=jg(d)):r===Bg&&d===i?(t&&t.paragraphCacheHits++,f=a):(t&&t.paragraphCacheMisses++,f=jg(d),r===zg?(o&&(r=d===i?Bg:Vg),i=d,a=f,o=!0):r===Bg&&(i=d,a=f)),!f)return null;let p=l<e.length?l+1:l;if(p<e.length&&e.charCodeAt(p)!==10&&!Ng(e,p,Mg(e,p)))return null;Gg(n,d,c),t&&(t.blocks++,t.paragraphs++),s=qg(e,p),c+=1+s-p}return t&&(t.matched=!0),n}var $g=/[&<>"]/,e_=/[&<>"]/g,t_=/&/g,n_=/[<>"]/g,r_={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};function i_(e){return r_[e]||e}function a_(e){if(e.length===0)return``;if(e.length<32)return $g.test(e)?e.replace(e_,i_):e;let t=e.includes(`&`),n=e.includes(`<`),r=e.includes(`>`),i=e.includes(`"`);return!t&&!n&&!r&&!i?e:t&&!n&&!r&&!i?e.replace(t_,`&amp;`):t?e.replace(e_,i_):e.replace(n_,i_)}var o_=RegExp(`\\\\([!"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_\`{|}~])|&([a-z#][a-z0-9]{1,31});`,`gi`),s_=/^#(?:x[a-f0-9]{1,8}|\d{1,8})$/i;function c_(e){return!e.includes(`\\`)&&!e.includes(`&`)?e:e.replace(o_,(e,t,n)=>{if(t)return t;if(s_.test(n)){let e=n[1].toLowerCase()===`x`?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);return rf(e)?af(e):`�`}let r=md(e);return r===e?e:r})}var l_=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/,u_=/[\n!"#$%&*+\-:<=>@[\]\\^_`{}~]/,d_=/"/g;function f_(e,t){let n=e.indexOf(`
23
+ `,t);return n===-1?e.length:n}function p_(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9)return!1}return!0}function m_(e,t){for(;t<e.length&&e.charCodeAt(t)===10;)t++;return t}function h_(e,t){return t>=e.length||e.charCodeAt(t)===10?!1:!p_(e,t,f_(e,t))}function g_(e,t,n){return t+2<n&&e.charCodeAt(t)===96&&e.charCodeAt(t+1)===96&&e.charCodeAt(t+2)===96}function __(e,t,n){let r=e.charCodeAt(n-1);return r===32||r===9?e.slice(t,n).trim():e.slice(t,n)}function v_(e){return u_.test(e)?l_.test(e)?null:e.replace(d_,`&quot;`):e}function y_(e,t,n){let r=0,i=t;for(;i<n&&e.charCodeAt(i)===35&&r<6;)i++,r++;if(r===0||i>=n||e.charCodeAt(i)!==32)return null;let a=i+1;for(;a<n&&e.charCodeAt(a)===32;)a++;let o=n;for(;o>a&&e.charCodeAt(o-1)===32;)o--;let s=o;for(;s>a&&e.charCodeAt(s-1)===35;)s--;if(s>a&&e.charCodeAt(s-1)===32)for(o=s-1;o>a&&e.charCodeAt(o-1)===32;)o--;let c=v_(e.slice(a,o));return c===null?null:`<h${r}>${c}</h${r}>\n`}function b_(e,t,n){return t+1<n&&e.charCodeAt(t)===45&&e.charCodeAt(t+1)===32}var x_=new Uint8Array(256).fill(1);for(let e of[10,33,35,36,37,38,42,43,45,58,60,61,62,64,91,92,93,94,95,96,123,125,126])x_[e]=0;x_[34]=0;function S_(e,t){let n=e.charCodeAt(t);return n===34?`<li>&quot;</li>
24
+ `:n<256&&x_[n]===0?null:`<li>${e[t]}</li>\n`}function C_(e,t,n){let r=t+2;if(n===r+1)return S_(e,r);let i=v_(e.slice(t+2,n));return i===null?null:`<li>${i}</li>\n`}function w_(e,t,n){for(;t<n;){let n=e.charCodeAt(t);if(n!==32&&n!==9)break;t++}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==32&&t!==9)break;n--}let r=n;for(let i=t;i<n;i++){let t=e.charCodeAt(i);if(t===96)return null;if(t===32||t===9){r=i;break}}return e.slice(t,r)}function T_(e,t,n,r,i){if(!g_(e,t,n))return null;let a=w_(e,t+3,n);if(a===null)return null;let o=n<e.length?n+1:n,s=o,c=o;for(;c<e.length;){let t=f_(e,c);if(g_(e,c,t)&&p_(e,c+3,t)){let n=e.slice(o,s),c;return a===r.lang?(i&&i.fenceCacheHits++,c=r.open):(i&&i.fenceCacheMisses++,c=a?`<pre><code class="language-${a_(a)}">`:`<pre><code>`,r.lang=a,r.open=c),{html:`${c}${a_(n)}</code></pre>\n`,nextPos:t<e.length?t+1:t}}c=t<e.length?t+1:t,s=c}return null}function E_(e,t){if(e.length===0)return t&&(t.matched=!0),``;if(e.includes(`\r`)||e.includes(`\0`))return null;let n=0,r=``,i=e.length>=25e4,a=[],o={lang:null,open:``},s=``,c=``,l=``,u=``;for(;n<e.length;){let d=f_(e,n);if(n===d){n=d<e.length?d+1:d;continue}let f=e.charCodeAt(n);if(f===32||f===9){if(!p_(e,n,d))return null;n=d<e.length?d+1:d;continue}if(f===35){let o=y_(e,n,d);if(o===null)return null;t&&(t.blocks++,t.headings++),i?a.push(o):r+=o,n=m_(e,d<e.length?d+1:d);continue}if(f===45){let o=n;for(;o<e.length;){let t=f_(e,o);if(!b_(e,o,t))break;o=t<e.length?t+1:t}if(o===n)return null;let l=e.slice(n,o),u;if(l===s)t&&t.listCacheHits++,u=c;else{t&&t.listCacheMisses++;let r=n;for(u=`<ul>
25
+ `;r<o;){let t=f_(e,r),n=C_(e,r,t);if(n===null)return null;u+=n,r=t<e.length?t+1:t}u+=`</ul>
26
+ `,s=l,c=u}let d=m_(e,o);for(;d<e.length;){if(e.charCodeAt(d)===10){d++;continue}let t=f_(e,d);if(!p_(e,d,t)){if(b_(e,d,t))return null;break}d=t<e.length?t+1:t}t&&(t.blocks++,t.lists++),i?a.push(u):r+=u,n=d;continue}if(f===96){let s=T_(e,n,d,o,t);if(!s)return null;t&&(t.blocks++,t.fences++),i?a.push(s.html):r+=s.html,n=m_(e,s.nextPos);continue}let p=__(e,n,d),m;if(p===l)t&&t.paragraphCacheHits++,m=u;else{t&&t.paragraphCacheMisses++;let e=v_(p);if(e===null)return null;m=`<p>${e}</p>\n`,l=p,u=m}let h=d<e.length?d+1:d;if(h<e.length&&e.charCodeAt(h)!==10&&h_(e,h))return null;t&&(t.blocks++,t.paragraphs++),i?a.push(m):r+=m,n=m_(e,h)}return t&&(t.matched=!0),i?a.join(``):r}function D_(e){return E_(e)}function O_(e,t){return E_(e,t)}var k_={maxChunkChars:1e4,maxChunkLines:200,fenceAware:!0,maxChunks:void 0,fallbackOnGlobalState:!0};function A_(e,t,n={},r){Jf(n);let i={...k_,...r||{}},a=Lf(t);if(i.fallbackOnGlobalState!==!1&&a)return Zf(n,{count:1,fallback:!0,fallbackReason:a,globalStateDetected:a,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines}),zf(n,a,()=>e.core.parse(t,n,e).tokens);let o=j_(t,i);if(i.maxChunks&&o.length>i.maxChunks&&(o=I_(o,i.maxChunks)),M_(t,o))return Zf(n,{count:1,fallback:!0,fallbackReason:`unsafe-chunk-boundary`,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines}),zf(n,a,()=>e.core.parse(t,n,e).tokens);let s=0,c=[];return Zf(n,{count:o.length,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines,globalStateDetected:a||void 0,globalStateFallbackDisabled:i.fallbackOnGlobalState===!1&&!!a}),zf(n,a,()=>{for(let r=0;r<o.length;r++){let i=o[r],a=t.slice(i.start,i.end),l=e.core.parse(a,n,e).tokens;s!==0&&l.length&&P_(l,s),F_(c,l),s+=i.lineCount}return c})}function j_(e,t,n=!0){let r=[],i=0,a=0,o=0,s=0,c=0,l=0,u=null;function d(e){e<=o||(r.push({start:o,end:e,lineCount:s}),o=e,i=0,a=0,s=0)}for(let n=0;n<e.length;){let r=e.indexOf(`
27
+ `,n),o=r;r===-1?(r=e.length,o=e.length):o=r+1;let f=L_(e,n,r);if(t.fenceAware){let t=n;for(;t<r;){let n=e.charCodeAt(t);if(n===32||n===9)t++;else break}let i=e[t];if(i==="`"||i===`~`){let n=t;for(;n<r&&e[n]===i;)n++;let a=n-t;a>=3&&(u?u.marker===i&&a>=u.length&&(u=null):u={marker:i,length:a})}}let p=o-n;i+=p,a+=1,s+=1,f?(c=0,l=0):(c+=1,l+=p);let m=f;if((i>=t.maxChunkChars||a>=t.maxChunkLines)&&!u){if(m)d(o);else{let e=Math.max(10,Math.floor(t.maxChunkLines*.5)),n=Math.max(t.maxChunkChars,8e3);(c>=e||l>=n)&&d(o)}}n=o}return n&&d(e.length),r}function M_(e,t,n={rangesCoverWholeSource:!0}){let r=n.rangesCoverWholeSource?t.length-1:t.length;for(let n=0;n<r;n++)if(!N_(e,t[n].end))return!0;return!1}function N_(e,t){if(t<=0||t>e.length||e.charCodeAt(t-1)!==10)return!1;let n=t-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;for(let r=n+1;r<t-1;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9&&t!==13)return!1}return!0}function P_(e,t){if(t===0)return;let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);for(;n.length;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function F_(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function I_(e,t){if(e.length<=t)return e;let n=[],r=0;for(let i=0;i<t;i++){let a=t-i,o=e.length-r,s=Math.ceil(o/a),c=e.slice(r,r+s),l=0;for(let e=0;e<c.length;e++)l+=c[e].lineCount;n.push({start:c[0].start,end:c[c.length-1].end,lineCount:l}),r+=s}return n}function L_(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9&&t!==13)return!1}return!0}var R_=4e6,z_=8e4,B_=1e4,V_=200,H_=1e4,U_=200;function W_(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function G_(e,t){if(t===0)return;let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);for(;n.length;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function K_(e){return e.length===0?0:bf(e)+(e.charCodeAt(e.length-1)===10?0:1)}function q_(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9&&t!==13)return!1}return!0}function J_(e,t){if(!t||e.length===0)return!1;let n=null;for(let t=0;t<e.length;){let r=e.indexOf(`
28
+ `,t);r===-1&&(r=e.length);let i=t;for(;i<r;){let t=e.charCodeAt(i);if(t===32||t===9)i++;else break}let a=e[i];if(a==="`"||a===`~`){let t=i;for(;t<r&&e[t]===a;)t++;let o=t-i;o>=3&&(n?n.marker===a&&o>=n.length&&(n=null):n={marker:a,length:o})}t=r===e.length?e.length:r+1}return n!==null}function Y_(e,t){if(e.length===0||e.charCodeAt(e.length-1)!==10)return!1;let n=e.length-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;return q_(e,n+1,e.length-1)?!J_(e,t):!1}function X_(e,t,n,r={}){let i=r.mode??`full`,a=r.fenceAware??(i===`stream`?e.options.streamChunkFenceAware??!0:e.options.fullChunkFenceAware??!0);if(r.maxChunkChars!==void 0||r.maxChunkLines!==void 0||r.autoTune===!1){let t=r.maxChunkChars??(i===`stream`?e.options.streamChunkSizeChars??H_:e.options.fullChunkSizeChars??B_),n=r.maxChunkLines??(i===`stream`?e.options.streamChunkSizeLines??U_:e.options.fullChunkSizeLines??V_);return{maxChunkChars:t,maxChunkLines:n,holdBelowChars:t,holdBelowLines:n,fenceAware:a}}return i===`stream`?t<=5e3?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:a}:t<=2e4?{maxChunkChars:16e3,maxChunkLines:200,holdBelowChars:16e3,holdBelowLines:200,fenceAware:a}:t<=5e4?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:a}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:a}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:a}:t<=1e5&&n<=2500?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:1e5,holdBelowLines:2500,fenceAware:a}:t<=2e5?{maxChunkChars:2e4,maxChunkLines:150,holdBelowChars:2e4,holdBelowLines:150,fenceAware:a}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:a}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:a}}var Z_=class{md;options;pending=``;tokens=[];committedChars=0;committedLines=0;fedChunks=0;parsedChunks=0;globalStateEnv=null;markedGlobalStateReason=null;constructor(e,t={}){if(this.md=e,this.options={mode:`full`,autoTune:!0,retainTokens:!0,...t},this.options.retainTokens===!1&&!this.options.onChunkTokens)throw Error(`UnboundedBuffer with retainTokens=false requires onChunkTokens`)}feed(e){e&&(this.pending+=e,this.fedChunks+=1)}flushAvailable(e={}){if(!this.pending)return null;let t=this.resolveWindow(),n=K_(this.pending);if(this.pending.length<t.holdBelowChars&&n<t.holdBelowLines)return this.updateEnvDiagnostics(e,t,n),null;let r=j_(this.pending,{maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,fenceAware:t.fenceAware,maxChunks:void 0},!1);if(!r.length||M_(this.pending,r,{rangesCoverWholeSource:!1}))return this.updateEnvDiagnostics(e,t,n),null;let i=this.commitRanges(r,e);return this.pending=this.pending.slice(i),this.updateEnvDiagnostics(e,t,K_(this.pending)),this.tokens}flushIfBoundary(e={}){if(!this.pending)return null;let t=this.resolveWindow();if(!Y_(this.pending,t.fenceAware))return this.updateEnvDiagnostics(e,t,K_(this.pending)),null;let n=j_(this.pending,{maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,fenceAware:t.fenceAware,maxChunks:void 0},!0);if(!n.length)return this.updateEnvDiagnostics(e,t,K_(this.pending)),null;let r=M_(this.pending,n,{rangesCoverWholeSource:!0})?[{start:0,end:this.pending.length,lineCount:K_(this.pending)}]:n;return this.commitRanges(r,e),this.pending=``,this.updateEnvDiagnostics(e,t,0),this.tokens}flushForce(e={}){if(!this.pending){this.prepareGlobalStateEnv(e,``);let t=this.resolveWindow();return this.updateEnvDiagnostics(e,t,0),this.tokens}let t=this.resolveWindow(),n=j_(this.pending,{maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,fenceAware:t.fenceAware,maxChunks:void 0},!0);if(n.length){let t=M_(this.pending,n,{rangesCoverWholeSource:!0})?[{start:0,end:this.pending.length,lineCount:K_(this.pending)}]:n;this.commitRanges(t,e),this.pending=``}return this.updateEnvDiagnostics(e,t,0),this.tokens}reset(){this.pending=``,this.tokens=[],this.committedChars=0,this.committedLines=0,this.fedChunks=0,this.parsedChunks=0,this.globalStateEnv=null,this.markedGlobalStateReason=null}peek(){return this.tokens}pendingText(){return this.pending}stats(){return{mode:this.options.mode??`full`,fedChunks:this.fedChunks,parsedChunks:this.parsedChunks,committedChars:this.committedChars,committedLines:this.committedLines,pendingChars:this.pending.length,pendingLines:K_(this.pending),retainedTokens:this.options.retainTokens!==!1}}resolveWindow(){let e=this.committedChars+this.pending.length,t=this.committedLines+K_(this.pending);return X_(this.md,e,t,this.options)}prepareGlobalStateEnv(e,t){if(this.globalStateEnv!==e&&(Rf(e)&&Hf(e),this.globalStateEnv=e,this.markedGlobalStateReason=null),this.markedGlobalStateReason)return;let n=Lf(t);n&&(Bf(e,n),this.markedGlobalStateReason=n)}commitRanges(e,t){if(!e.length)return 0;this.prepareGlobalStateEnv(t,this.pending);let n=0;try{for(let r=0;r<e.length;r++){let i=e[r],a=this.pending.slice(i.start,i.end),o=this.md.core.parse(a,t,this.md).tokens,s=this.committedChars,c=this.committedLines;c!==0&&o.length&&G_(o,c),this.options.retainTokens!==!1&&W_(this.tokens,o),this.committedChars+=a.length,this.committedLines+=i.lineCount,this.parsedChunks+=1,this.options.onChunkTokens&&this.options.onChunkTokens(o,{chunkIndex:this.parsedChunks,chunkChars:a.length,chunkLines:i.lineCount,tokenCount:o.length,startOffset:s,endOffset:this.committedChars,startLine:c,endLine:this.committedLines}),n=i.end}return this.markedGlobalStateReason&&Vf(t),n}catch(e){throw this.markedGlobalStateReason&&=(Hf(t),this.globalStateEnv=null,null),e}}updateEnvDiagnostics(e,t,n){Qf(e,{mode:this.options.mode??`full`,maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,committedChars:this.committedChars,committedLines:this.committedLines,pendingChars:this.pending.length,pendingLines:n,fedChunks:this.fedChunks,parsedChunks:this.parsedChunks,globalStateDetected:this.markedGlobalStateReason||void 0})}};function Q_(e,t,n={},r={}){Jf(n);let i=new Z_(e,{mode:`full`,...r});for(let e of t)i.feed(e),i.flushAvailable(n);return i.flushForce(n)}async function $_(e,t,n={},r={}){Jf(n);let i=new Z_(e,{mode:`full`,...r});for await(let e of t)i.feed(e),i.flushAvailable(n);return i.flushForce(n)}function ev(e,t,n,r={},i={}){Jf(r);let a=new Z_(e,{mode:`full`,...i,retainTokens:!1,onChunkTokens:n});for(let e of t)a.feed(e),a.flushAvailable(r);return a.flushForce(r),a.stats()}async function tv(e,t,n,r={},i={}){Jf(r);let a=new Z_(e,{mode:`full`,...i,retainTokens:!1,onChunkTokens:n});for await(let e of t)a.feed(e),a.flushAvailable(r);return a.flushForce(r),a.stats()}function nv(e,t,n){if(e.options.autoUnbounded===!1)return!1;let r=e.options.autoUnboundedThresholdChars??R_,i=e.options.autoUnboundedThresholdLines??z_;return t>=r||n>=i}function rv(e,t,n){if(e.options.autoUnbounded===!1)return`no`;if(t>=(e.options.autoUnboundedThresholdChars??R_))return`yes`;let r=e.options.autoUnboundedThresholdLines??z_;return n===void 0?t<2*r-1?`no`:`need-lines`:n>=r?`yes`:`no`}function iv(e,t,n={},r={}){Jf(n);let i=Lf(t);if(Rf(n)&&Hf(n),r.fallbackOnGlobalState!==!1&&i)return Qf(n,{mode:`full`,fallback:!0,fallbackReason:i,committedChars:t.length,committedLines:bf(t),pendingChars:0,pendingLines:0,fedChunks:1,parsedChunks:1,globalStateDetected:i}),zf(n,i,()=>e.core.parse(t,n,e).tokens);let a=[],o=new Z_(e,{mode:`full`,...r,retainTokens:!1,onChunkTokens(e){W_(a,e)}});if(i&&Bf(n,i),o.feed(t),o.flushForce(n),i&&(Vf(n),r.fallbackOnGlobalState===!1)){let e=Kf(n)?.unbounded;e&&(e.globalStateDetected=i,e.globalStateFallbackDisabled=!0)}return a}var av=(e,t,n)=>e<t?t:e>n?n:e;function ov(e){return e.experimental?{...e,...e.experimental}:e}var sv=[{max:5e3,strategy:`discrete`,maxChunkChars:32e3,maxChunkLines:150,maxChunks:8,notes:`<=5k`},{max:2e4,strategy:`discrete`,maxChunkChars:24e3,maxChunkLines:200,maxChunks:12,notes:`<=20k`},{max:1e5,strategy:`plain`,notes:`<=100k plain`},{max:2e5,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:150,maxChunks:12,notes:`<=200k`},{max:5e5,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:`<=500k`},{max:5e6,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:`<=5M`}],cv=[{max:5e3,strategy:`discrete`,maxChunkChars:16e3,maxChunkLines:250,maxChunks:8,notes:`<=5k`},{max:2e4,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:`<=20k`},{max:1e5,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:`<=100k`},{max:5e5,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:`<=500k`},{max:5e6,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:`<=5M`}];function lv(e,t){return{strategy:t.strategy,maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,maxChunks:t.maxChunks,fenceAware:e,notes:t.notes}}function uv(e,t=Math.max(0,e/40|0),n={}){let r=ov(n),i=r.fullChunkFenceAware??!0,a=r.fullChunkTargetChunks??8,o=r.fullChunkAdaptive!==!1;for(let t=0;t<sv.length;t++){let n=sv[t];if(e<=n.max){if(n.strategy!==`adaptive`)return lv(i,n);break}}return e>5e6?{strategy:`plain`,fenceAware:i,notes:`>5M plain`}:o?{strategy:`adaptive`,maxChunkChars:av(Math.ceil(e/a),8e3,64e3),maxChunkLines:av(Math.ceil(t/a),150,700),maxChunks:av(Math.ceil(e/64e3),a,16),fenceAware:i,notes:`adaptive fallback`}:{strategy:`discrete`,maxChunkChars:r.fullChunkSizeChars??1e4,maxChunkLines:r.fullChunkSizeLines??200,fenceAware:i,maxChunks:r.fullChunkMaxChunks}}function dv(e,t=Math.max(0,e/40|0),n={}){let r=ov(n),i=r.streamChunkFenceAware??!0,a=r.streamChunkTargetChunks??8,o=r.streamChunkAdaptive!==!1;for(let t=0;t<cv.length;t++){let n=cv[t];if(e<=n.max){if(n.strategy!==`adaptive`)return lv(i,n);break}}return e>5e6?{strategy:`plain`,fenceAware:i,notes:`>5M plain`}:o?{strategy:`adaptive`,maxChunkChars:av(Math.ceil(e/a),8e3,64e3),maxChunkLines:av(Math.ceil(t/a),150,700),maxChunks:av(Math.ceil(e/64e3),a,32),fenceAware:i,notes:`adaptive fallback`}:{strategy:`discrete`,maxChunkChars:r.streamChunkSizeChars??1e4,maxChunkLines:r.streamChunkSizeLines??200,maxChunks:r.streamChunkMaxChunks,fenceAware:i}}var fv={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`]},inline2:{rules:[`balance_pairs`,`emphasis`,`fragments_join`]}}},pv={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},mv={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`]},inline2:{rules:[`balance_pairs`,`fragments_join`]}}};function hv(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function gv(e,t){if(hv(e))throw TypeError(`Renderer rule "${t}" returned a Promise. Use renderAsync() instead.`);return e}var _v=e=>hv(e)?e:Promise.resolve(e);function vv(e){switch(e){case`alt`:case`class`:case`href`:case`id`:case`lang`:case`rel`:case`src`:case`start`:case`style`:case`target`:case`title`:return e;default:return a_(e)}}function yv(e){if(!e||e.length===0)return``;let t=e[0],n=` ${vv(t[0])}="${a_(t[1])}"`;for(let t=1;t<e.length;t++){let r=e[t];n+=` ${vv(r[0])}="${a_(r[1])}"`}return n}function bv(e){if(!e)return{langName:``,langAttrs:``};let t=0;for(;t<e.length;){let n=e.charCodeAt(t);if(n===32||n===9||n===10)break;t++}if(t>=e.length)return{langName:e,langAttrs:``};let n=t;for(;n<e.length;){let t=e.charCodeAt(n);if(t!==32&&t!==9&&t!==10)break;n++}return{langName:e.slice(0,t),langAttrs:n<e.length?e.slice(n):``}}function xv(e,t,n,r,i){if(t.indexOf(`<pre`)===0)return`${t}\n`;if(n){if(!e.attrs||e.attrs.length===0)return`<pre><code class="${a_(`${i.langPrefix??`language-`}${r}`)}">${t}</code></pre>\n`;let n=e.attrIndex(`class`),a=e.attrs?e.attrs.slice():[],o=`${i.langPrefix??`language-`}${r}`;return n<0?a.push([`class`,o]):(a[n]=a[n].slice(),a[n][1]+=` ${o}`),`<pre><code${yv(a)}>${t}</code></pre>\n`}return`<pre><code${yv(e.attrs)}>${t}</code></pre>\n`}function Sv(e){return!e.attrs||e.attrs.length===0?`<code>${a_(e.content)}</code>`:`<code${yv(e.attrs)}>${a_(e.content)}</code>`}function Cv(e){let t=a_(e.content);return e.attrs?`<pre${yv(e.attrs)}><code>${t}</code></pre>\n`:`<pre><code>${t}</code></pre>\n`}function wv(e,t){let n=e.attrs;if(!n||n.length===0)switch(e.type){case`paragraph_open`:return`${t}<p>`;case`heading_open`:return`<${e.tag}>`;case`td_open`:return`${t}<td>`;case`th_open`:return`${t}<th>`;default:return null}if(n.length===1&&n[0][0]===`style`){if(e.type===`td_open`)return`${t}<td style="${a_(n[0][1])}">`;if(e.type===`th_open`)return`${t}<th style="${a_(n[0][1])}">`}return null}function Tv(e){let t=e.attrs;return!t||t.length===0?`<a>`:t.length===1?`<a ${vv(t[0][0])}="${a_(t[0][1])}">`:t.length===2?`<a ${vv(t[0][0])}="${a_(t[0][1])}" ${vv(t[1][0])}="${a_(t[1][1])}">`:`<a${yv(t)}>`}function Ev(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:case`image`:return!0;default:return!1}}function Dv(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:return!0;default:return!1}}function Ov(e,t){if(e.hidden)return``;let n=e.attrs,r=e.nesting,i=e.tag;if(!n||n.length===0)return r===0?t?`<${i} />`:`<${i}>`:r===-1?`</${i}>`:`<${i}>`;let a=(r===-1?`</`:`<`)+i+yv(n);return r===0&&t&&(a+=` /`),`${a}>`}var kv={langPrefix:`language-`,xhtmlOut:!1,breaks:!1},Av=Object.prototype.hasOwnProperty,jv={code_inline(e,t){return Sv(e[t])},code_block(e,t){return Cv(e[t])},fence(e,t,n,r,i){let a=e[t],o=a.info?c_(a.info).trim():``,{langName:s,langAttrs:c}=bv(o),l=n.highlight,u=a_(a.content);if(!l)return xv(a,u,o,s,n);let d=l(a.content,s,c);return hv(d)?d.then(e=>xv(a,e||u,o,s,n)):xv(a,d||u,o,s,n)},image(e,t,n,r,i){let a=e[t],o=i.renderInlineAsText(a.children||[],n,r),s=a.attrIndex(`alt`);return s>=0&&a.attrs?a.attrs[s][1]=o:a.attrs?a.attrs.push([`alt`,o]):a.attrs=[[`alt`,o]],Ov(a,n.xhtmlOut===!0)},hardbreak(e,t,n){return n.xhtmlOut?`<br />
29
+ `:`<br>
30
+ `},softbreak(e,t,n){return n.breaks?n.xhtmlOut?`<br />
31
+ `:`<br>
32
+ `:`
33
+ `},text(e,t){return a_(e[t].content)},text_special(e,t){return a_(e[t].content)},html_block(e,t){return e[t].content},html_inline(e,t){return e[t].content}};function Mv(e,t,n){let r=e.info?c_(e.info).trim():``,{langName:i,langAttrs:a}=bv(r),o=t.highlight,s=a_(e.content);if(!o)return xv(e,s,r,i,t);let c=o(e.content,i,a);if(hv(c))throw TypeError(`Renderer rule "fence" returned a Promise. Use renderAsync() instead.`);return xv(e,c||s,r,i,t)}function Nv(e,t,n,r){switch(e.type){case`text`:return t.text===jv.text?e.content.length===0?``:a_(e.content):null;case`text_special`:return t.text_special===jv.text_special?e.content.length===0?``:a_(e.content):null;case`softbreak`:return t.softbreak===jv.softbreak?r:null;case`hardbreak`:return t.hardbreak===jv.hardbreak?n:null;case`html_inline`:return t.html_inline===jv.html_inline?e.content:null;case`code_inline`:return t.code_inline===jv.code_inline?Sv(e):null;default:return null}}function Pv(e,t,n,r,i){let a=e[0];switch(a.type){case`text`:if(i.text===jv.text)return a.content.length===0?``:a_(a.content);break;case`text_special`:if(i.text_special===jv.text_special)return a.content.length===0?``:a_(a.content);break;case`softbreak`:if(i.softbreak===jv.softbreak)return t.breaks?t.xhtmlOut?`<br />
34
+ `:`<br>
35
+ `:`
36
+ `;break;case`hardbreak`:if(i.hardbreak===jv.hardbreak)return t.xhtmlOut?`<br />
37
+ `:`<br>
38
+ `;break;case`html_inline`:if(i.html_inline===jv.html_inline)return a.content;break;case`code_inline`:if(i.code_inline===jv.code_inline)return Sv(a)}let o=i[a.type];if(!o)return Ov(a,t.xhtmlOut===!0);let s=o(e,0,t,n,r);return typeof s==`string`?s:gv(s,a.type)}var Fv=class{rules;baseOptions;normalizedBase;constructor(e={}){this.baseOptions={...e},this.normalizedBase=this.buildNormalizedBase(),this.rules={...jv}}set(e){return this.baseOptions={...this.baseOptions,...e},this.normalizedBase=this.buildNormalizedBase(),this}render(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);if(e.length===1)return this.renderSingleToken(e,e[0],t,n);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=r.xhtmlOut===!0,s,c,l,u,d,f,p=``,m=``,h=!1,g=``;for(let t=0;t<e.length;t++){let n=e[t],_=n.type,v=t>0&&e[t-1].hidden?`
39
+ `:``;if(_===`list_item_open`&&(!n.attrs||n.attrs.length===0)&&t+3<e.length){let n=e[t+1],a=e[t+2],o=e[t+3];if(n.type===`paragraph_open`&&n.hidden&&a.type===`inline`&&o.type===`paragraph_close`&&o.hidden){g+=`${v}<li>${this.renderInlineTokens(a.children||[],r,i)}`,t+=3;continue}}if(t+2<e.length){let a=e[t+1],o=e[t+2];if(a.type===`inline`&&o.nesting===-1&&o.tag===n.tag&&!o.hidden){let e=wv(n,v);if(e!==null){g+=`${e+this.renderInlineTokens(a.children||[],r,i)}</${n.tag}>\n`,t+=2;continue}}}if(_===`inline`){let e=n.children||[];if(e.length===1){h||=(s=a.text,c=a.text_special,l=a.softbreak,u=a.hardbreak,d=a.html_inline,f=a.code_inline,p=r.xhtmlOut?`<br />
40
+ `:`<br>
41
+ `,m=r.breaks?p:`
42
+ `,!0);let t=e[0];switch(t.type){case`text`:if(s===jv.text){g+=a_(t.content);continue}break;case`text_special`:if(c===jv.text_special){g+=a_(t.content);continue}break;case`softbreak`:if(l===jv.softbreak){g+=m;continue}break;case`hardbreak`:if(u===jv.hardbreak){g+=p;continue}break;case`html_inline`:if(d===jv.html_inline){g+=t.content;continue}break;case`code_inline`:if(f===jv.code_inline){g+=Sv(t);continue}}}g+=this.renderInlineTokens(e,r,i);continue}let y=a[_];if(!y){let i=n.attrs;if(!n.hidden){if(!i||i.length===0)switch(_){case`hr`:g+=o?`<hr />
43
+ `:`<hr>
44
+ `;continue;case`heading_open`:g+=`<${n.tag}>`;continue;case`heading_close`:g+=`</${n.tag}>\n`;continue;case`paragraph_open`:g+=`${v}<p>`;continue;case`paragraph_close`:g+=`</p>
45
+ `;continue;case`list_item_open`:{let n=e[t+1];g+=v+(n&&(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===`li`)?`<li>`:`<li>
46
+ `);continue}case`list_item_close`:g+=`</li>
47
+ `;continue;case`bullet_list_open`:g+=`${v}<ul>\n`;continue;case`bullet_list_close`:g+=`</ul>
48
+ `;continue;case`blockquote_open`:g+=v+(e[t+1]&&e[t+1].nesting===-1&&e[t+1].tag===`blockquote`?`<blockquote>`:`<blockquote>
49
+ `);continue;case`blockquote_close`:g+=`</blockquote>
50
+ `;continue;case`ordered_list_open`:g+=`${v}<ol>\n`;continue;case`ordered_list_close`:g+=`</ol>
51
+ `;continue;case`table_open`:g+=`${v}<table>\n`;continue;case`table_close`:g+=`</table>
52
+ `;continue;case`thead_open`:g+=`${v}<thead>\n`;continue;case`thead_close`:g+=`</thead>
53
+ `;continue;case`tbody_open`:g+=`${v}<tbody>\n`;continue;case`tbody_close`:g+=`</tbody>
54
+ `;continue;case`tr_open`:g+=`${v}<tr>\n`;continue;case`tr_close`:g+=`</tr>
55
+ `;continue;case`td_open`:g+=`${v}<td>`;continue;case`td_close`:g+=`</td>
56
+ `;continue;case`th_open`:g+=`${v}<th>`;continue;case`th_close`:g+=`</th>
57
+ `;continue}else if(i.length===1){let e=i[0];if(_===`ordered_list_open`&&e[0]===`start`){g+=`${v}<ol start="${a_(e[1])}">\n`;continue}if(_===`td_open`&&e[0]===`style`){g+=`${v}<td style="${a_(e[1])}">`;continue}if(_===`th_open`&&e[0]===`style`){g+=`${v}<th style="${a_(e[1])}">`;continue}}}g+=this.renderToken(e,t,r);continue}if(_===`code_block`&&y===jv.code_block){g+=Cv(n);continue}if(_===`fence`&&y===jv.fence){g+=Mv(n,r,this);continue}if(_===`html_block`&&y===jv.html_block){g+=n.content;continue}let b=y(e,t,r,i,this);g+=typeof b==`string`?b:gv(b,n.type)}return g}async renderAsync(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=``;for(let t=0;t<e.length;t++){let n=e[t];if(n.type===`inline`){o+=await this.renderInlineTokensAsync(n.children||[],r,i);continue}let s=a[n.type];o+=s?await _v(s(e,t,r,i,this)):this.renderToken(e,t,r)}return o}renderInline(e,t,n){let r=this.mergeOptions(t),i=n??{};return this.renderInlineTokens(e,r,i)}async renderInlineAsync(e,t,n){let r=this.mergeOptions(t),i=n??{};return this.renderInlineTokensAsync(e,r,i)}renderInlineAsText(e,t,n){let r=this.mergeOptions(t),i=n??{};return this.renderInlineAsTextInternal(e,r,i)}renderAttrs(e){return yv(e.attrs)}renderToken(e,t,n){let r=e[t];if(r.hidden)return``;let i=r.block,a=r.nesting,o=r.tag,s=r.attrs,c=!1;if(i&&(c=!0,a===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===o)&&(c=!1)}let l=i&&a!==-1&&t>0&&e[t-1].hidden?`
58
+ `:``,u=c?`>
59
+ `:`>`;if(!s||s.length===0)return a===0?n.xhtmlOut?`${l}<${o} /${u}`:`${l}<${o}${u}`:a===-1?`${l}</${o}${u}`:`${l}<${o}${u}`;let d=l+(a===-1?`</`:`<`)+o+yv(s);return a===0&&n.xhtmlOut&&(d+=` /`),d+u}mergeOptions(e){let t=this.normalizedBase;if(!e||e.highlight===t.highlight&&e.langPrefix===t.langPrefix&&e.xhtmlOut===t.xhtmlOut&&e.breaks===t.breaks)return t;let n=null,r=()=>(n||={...t},n);if(Av.call(e,`highlight`)&&e.highlight!==t.highlight&&(r().highlight=e.highlight),Av.call(e,`langPrefix`)){let n=e.langPrefix;n!==t.langPrefix&&(r().langPrefix=n)}if(Av.call(e,`xhtmlOut`)){let n=e.xhtmlOut;n!==t.xhtmlOut&&(r().xhtmlOut=n)}if(Av.call(e,`breaks`)){let n=e.breaks;n!==t.breaks&&(r().breaks=n)}return n||t}buildNormalizedBase(){return Object.freeze({...kv,...this.baseOptions})}renderSingleToken(e,t,n,r){let i=this.rules,a=t.type;if(a===`code_block`&&i.code_block===jv.code_block)return Cv(t);if(a===`html_block`&&i.html_block===jv.html_block)return t.content;let o=this.mergeOptions(n),s=r??{};if(a===`inline`)return this.renderInlineTokens(t.children||[],o,s);let c=i[a];if(!c)return t.block?this.renderToken(e,0,o):Ov(t,o.xhtmlOut===!0);if(a===`fence`&&c===jv.fence)return Mv(t,o,this);let l=c(e,0,o,s,this);return typeof l==`string`?l:gv(l,a)}renderInlineTokens(e,t,n){if(!e||e.length===0)return``;let r=this.rules;if(e.length===1)return Pv(e,t,n,this,r);let i=t.xhtmlOut===!0,a=i?`<br />
60
+ `:`<br>
61
+ `,o=t.breaks?a:`
62
+ `,s=r.text,c=r.text_special,l=r.softbreak,u=r.hardbreak,d=r.html_inline,f=r.code_inline,p=r.link_open,m=r.link_close,h=r.em_open,g=r.em_close,_=r.strong_open,v=r.strong_close,y=``;for(let b=0;b<e.length;b++){let x=e[b];if(x.type===`link_open`&&!p&&!m&&b+2<e.length){let t=e[b+1];if(e[b+2].type===`link_close`&&Ev(t)){let n=Nv(t,r,a,o);if(n!==null){let t=`${Tv(x)+n}</a>`;if(l===jv.softbreak&&b+3<e.length&&e[b+3].type===`softbreak`){y+=t+o,b+=3;continue}y+=t,b+=2;continue}}}if(x.type===`link_open`&&!p&&!m&&b+1<e.length&&e[b+1].type===`link_close`){y+=`${Tv(x)}</a>`,b+=1;continue}if(x.type===`em_open`&&!h&&!g&&b+2<e.length){let t=e[b+1];if(e[b+2].type===`em_close`&&Dv(t)){let e=Nv(t,r,a,o);if(e!==null){y+=`<em>${e}</em>`,b+=2;continue}}}if(x.type===`strong_open`&&!_&&!v&&b+2<e.length){let t=e[b+1];if(e[b+2].type===`strong_close`&&Dv(t)){let e=Nv(t,r,a,o);if(e!==null){y+=`<strong>${e}</strong>`,b+=2;continue}}}switch(x.type){case`text`:if(s===jv.text){let t=x.content.length===0?``:a_(x.content);if(d===jv.html_inline&&b+1<e.length&&e[b+1].type===`html_inline`){for(y+=t+e[++b].content;b+1<e.length&&e[b+1].type===`html_inline`;)y+=e[++b].content;continue}y+=t;continue}break;case`text_special`:if(c===jv.text_special){x.content.length!==0&&(y+=a_(x.content));continue}break;case`softbreak`:if(l===jv.softbreak){y+=o;continue}break;case`hardbreak`:if(u===jv.hardbreak){y+=a;continue}break;case`html_inline`:if(d===jv.html_inline){for(y+=x.content;b+1<e.length&&e[b+1].type===`html_inline`;)y+=e[++b].content;continue}break;case`code_inline`:if(f===jv.code_inline){y+=Sv(x);continue}}let S=r[x.type];if(!S){y+=x.block?this.renderToken(e,b,t):Ov(x,i);continue}let C=S(e,b,t,n,this);y+=typeof C==`string`?C:gv(C,x.type)}return y}async renderInlineTokensAsync(e,t,n){if(!e||e.length===0)return``;let r=this.rules,i=``;for(let a=0;a<e.length;a++){let o=r[e[a].type];i+=o?await _v(o(e,a,t,n,this)):this.renderToken(e,a,t)}return i}renderInlineAsTextInternal(e,t,n){if(!e||e.length===0)return``;let r=``;for(let i=0;i<e.length;i++){let a=e[i];switch(a.type){case`text`:case`text_special`:r+=a.content;break;case`image`:r+=this.renderInlineAsTextInternal(a.children||[],t,n);break;case`html_inline`:case`html_block`:r+=a.content;break;case`softbreak`:case`hardbreak`:r+=`
63
+ `}}return r}},Iv=[],Lv=4096;function Rv(e){let t={...e};return Array.isArray(e.quotes)&&(t.quotes=[...e.quotes]),e.experimental&&(t.experimental={...e.experimental}),t}function zv(e,t){let n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(n=>{if(!Object.hasOwn(e,n))return!1;let r=e[n],i=t[n];if(Array.isArray(r)&&Array.isArray(i))return r.length===i.length&&r.every((e,t)=>Object.is(e,i[t]));if(n===`experimental`&&r&&i){let e=r,t=i,n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(n=>Object.hasOwn(e,n)&&Object.is(e[n],t[n]))}return Object.is(r,i)})}function Bv(e){return{options:Rv(e.options),coreVersion:e.core.ruler.version,blockVersion:e.block.ruler.version,inlineVersion:e.inline.ruler.version,inline2Version:e.inline.ruler2.version}}function Vv(e,t){return zv(e.options,t.options)&&e.coreVersion===t.core.ruler.version&&e.blockVersion===t.block.ruler.version&&e.inlineVersion===t.inline.ruler.version&&e.inline2Version===t.inline.ruler2.version}function Hv(e){let t=e.length,n=0;for(;n<=t;){let r=e.indexOf(`
64
+ `,n);r===-1&&(r=t);let i=r<t,a=n,o=0;for(;a<r;){let t=e.charCodeAt(a);if(t===32){if(o++,a++,o>=4)return!0;continue}if(t===9){if(o+=4-o%4,a++,o>=4)return!0;continue}break}if(a<r){let t=e.charCodeAt(a);switch(t){case 35:{let t=a;for(;t<r&&e.charCodeAt(t)===35;)t++;let n=t-a;if(n>0&&n<=6){if(t<r){let n=e.charCodeAt(t);if(n===32||n===9||n===13)return!0}else if(t===r&&i)return!0}break}case 62:{let t=a+1;if(t<r){let n=e.charCodeAt(t);if(n===32||n===9||n===13)return!0}else if(t===r&&i)return!0;break}case 45:case 42:case 43:{let t=a+1;if(t<r){let n=e.charCodeAt(t);if(n===32||n===9||n===13)return!0}else if(t===r&&i)return!0;break}case 96:case 126:{let n=a;for(;n<r&&e.charCodeAt(n)===t;)n++;if(n-a>=3)return!0;break}default:if(t>=48&&t<=57){let t=a+1;for(;t<r;){let n=e.charCodeAt(t);if(n<48||n>57)break;t++}if(t<r&&e.charCodeAt(t)===46){let n=t+1;if(n<r){let t=e.charCodeAt(n);if(t===32||t===9||t===13)return!0}else if(n===r&&i)return!0}}}}if(r===t)break;n=r+1}return!1}function Uv(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n][0]!==t[n][0]||e[n][1]!==t[n][1])return!1;return!0}function Wv(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Gv(e[n],t[n]))return!1;return!0}function Gv(e,t){if(!e||!t||e.type!==t.type)return!1;let n=e.map,r=t.map;return!!n!=!!r||n&&r&&(n[0]!==r[0]||n[1]!==r[1])||e.tag!==t.tag||e.nesting!==t.nesting||e.markup!==t.markup||e.info!==t.info||e.block!==t.block||e.hidden!==t.hidden||!Uv(e.attrs,t.attrs)||!Wv(e.children,t.children)?!1:(e.content||``)===(t.content||``)}function Kv(){return{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:`idle`}}var qv=class{core;anchorBlock=new Sg;cache=null;snapshots=new WeakSet;stats=Kv();normalizeLineEndings=!0;tokenMapsTrusted=!0;allowUntrustedTailReuse=!1;MIN_SIZE_FOR_OPTIMIZATION=1e3;DEFAULT_SKIP_CACHE_CHARS=1e6;DEFAULT_SKIP_CACHE_LINES=1e5;IMPLICIT_STREAM_CHUNK_MIN_CHARS=16e4;MIN_LIST_LINES_FOR_MERGE=80;MIN_LIST_CHARS_FOR_MERGE=800;MIN_TABLE_LINES_FOR_MERGE=48;MIN_TABLE_CHARS_FOR_MERGE=1200;MIN_UNBOUNDED_APPEND_TOTAL_CHARS=5e5;MIN_UNBOUNDED_APPEND_CHARS=64e3;MIN_UNBOUNDED_APPEND_LINES=700;constructor(e){this.core=e}reset(){this.cache=null,this.stats.resets+=1,this.stats.lastMode=`reset`}resetStats(){let{resets:e}=this.stats;this.stats=Kv(),this.stats.resets=e}snapshot(){let e=this.cache;if(!e)return null;let t=e.snapshotState??{cache:e};e.snapshotState=t;let n={state:t,get sourceLength(){return this.state.cache.src.length},get tokenCount(){return this.state.cache.tokens.length}};return this.snapshots.add(n),n}restore(e,t){if(!this.snapshots.has(e))throw TypeError(`Invalid stream snapshot`);let n=e.state.cache;return this.cache=n,Vv(n.config,t)?n.tokens:this.parse(n.src,n.env,t)}append(e,t,n){let r=this.cache;if(!r)throw Error(`Stream append requires cached history; call stream.parse(fullSource) first`);return this.ensureBoundaryState(r),this.parse(r.src+e,t,n,e)}parse(e,t,n,r){let i=this.cache,a=i?.env,o=n.core.ruler.getNamedRules(``),s=o.findIndex(e=>e.fn===lh),c=o.findIndex(e=>e.fn===kp),l=o.find(e=>e.name===`normalize`);this.normalizeLineEndings=s>=0&&c>=0&&s<c;let u=t,d=!!i&&!Vv(i.config,n),f=l&&l.fn!==lh,p=l&&!this.normalizeLineEndings&&e.includes(`\r`),m=c<0||o.slice(0,c).some(e=>e.fn!==lh);this.tokenMapsTrusted=!(c<0||o.slice(c+1).some(e=>e.fn!==Zm&&e.fn!==oh&&e.fn!==_h&&e.fn!==wh&&e.fn!==Th)),this.allowUntrustedTailReuse=this.tokenMapsTrusted||n.options?.streamTailLocalPostBlockRules===!0;let h=d||f||p||m?null:i;if(Jf(u??i?.env??a),!h||u&&u!==h.env){let t=u??i?.env??a??{},o=!!n.__explicitStreamChunkFallbackSetting,s=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy(),c=!!n.options?.streamChunkedFallback,l=!o&&s,d=c||l,f=n.options?.streamChunkAdaptive!==!1,p=n.options?.streamChunkTargetChunks??8,m=n.options?.streamChunkSizeChars,h=n.options?.streamChunkSizeLines,g=n.options?.streamChunkMaxChunks,_=!!n.__explicitStreamChunkConfig,v=n.options?.autoTuneChunks!==!1,y=n.options?.streamChunkFenceAware??!0,b=n.options?.streamLargeCachePolicy??`retain`,x=n.options?.streamSkipCacheAboveChars??this.DEFAULT_SKIP_CACHE_CHARS,S=n.options?.streamSkipCacheAboveLines??this.DEFAULT_SKIP_CACHE_LINES,C,w=!1;if(b===`skip`&&(w=e.length>=x,!w&&S!==void 0&&(C=bf(e),w=C>=S)),w&&r===void 0&&!i?.snapshotState){let r=this.parseFullDocument(e,t,n,C,!1);return this.cache=null,this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,Xf(t,{area:`stream`,path:`stream-full`,reason:`skip-cache-large-one-shot`,unbounded:!!Kf(t)?.unbounded}),r.tokens}if(d){let r=(e,t,n)=>e<t?t:e>n?n:e;C===void 0&&(C=bf(e));let i=v&&!_?dv(e.length,C,n.options):null,a=i?.maxChunkChars??(f?r(Math.ceil(e.length/p),8e3,64e3):m??1e4),o=i?.maxChunkLines??(f?r(Math.ceil(C/p),150,700):h??200),s=i?.maxChunks??(f?r(Math.ceil(e.length/64e3),p,32):g),u=e.length>0&&e.charCodeAt(e.length-1)===10,d=l&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&i?.strategy!==`plain`;if((c||d)&&(e.length>=a*2||C>=o*2)&&u){let r=A_(n,e,t,{maxChunkChars:a,maxChunkLines:o,fenceAware:i?.fenceAware??y,maxChunks:s}),l=Kf(t)?.chunk?.globalStateDetected??null,u=this.setCache({src:e,tokens:r,env:t,lineCount:C,lastSegment:void 0,globalStateReason:l},n);return this.updateCacheLineCount(u,C),this.recordChunkedParseResult(t,c?`explicit-initial-large-doc`:`default-initial-large-doc`),r}}let T=this.parseFullDocument(e,t,n,C);C=T.lineCount;let E=this.setCache({src:e,tokens:T.tokens,env:t,lineCount:C,lastSegment:void 0,globalStateReason:T.globalStateReason},n);return this.updateCacheLineCount(E,C),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,Xf(t,{area:`stream`,path:`stream-full`,reason:`initial-parse`,unbounded:!!Kf(t)?.unbounded}),T.tokens}if(e===h.src)return this.stats.total+=1,this.stats.cacheHits+=1,this.stats.lastMode=`cache`,Xf(h.env,{area:`stream`,path:`stream-cache`,reason:`same-source`}),h.tokens;let g=r===void 0?e.startsWith(h.src)?e.slice(h.src.length):null:r,_=h.globalStateReason;_===void 0&&(_=Lf(h.src),h.globalStateReason=_);let v=_?null:g===null?Lf(e):this.detectGlobalStateForAppend(h,g),y=_||v;if(y){let t=u??h.env;Hf(t);let r=this.parseFullDocument(e,t,n),i=r.tokens,a=r.lineCount,o=this.setCache({src:e,tokens:i,env:t,lineCount:a,lastSegment:void 0,globalStateReason:r.globalStateReason},n);return this.updateCacheLineCount(o,a),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,Xf(t,{area:`stream`,path:`stream-full`,reason:`global-state:${y}`,unbounded:!!Kf(t)?.unbounded}),i}let b=n.options?.streamOptimizationMinSize??this.MIN_SIZE_FOR_OPTIMIZATION;if(h.src.length<b&&e.length<b*1.5&&g===null){let t=u??h.env,r=this.parseFullDocument(e,t,n),i=r.tokens,a=r.lineCount,o=this.setCache({src:e,tokens:i,env:t,lineCount:a,lastSegment:void 0,globalStateReason:r.globalStateReason},n);return this.updateCacheLineCount(o,a),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,Xf(t,{area:`stream`,path:`stream-full`,reason:`small-non-append`,unbounded:!!Kf(t)?.unbounded}),i}let x=this.ensureLastSegment(h,r!==void 0),S=this.tokenMapsTrusted||this.allowUntrustedTailReuse&&(h.lastSegmentVerified===!0||!!(x&&this.hasVerifiedSegmentAnchor(h,x,n))),C=g!==null&&this.shouldPreferTailReparseForAppend(h,S)||!this.tokenMapsTrusted?null:this.getAppendedSegment(h,e,g);if(C){let t=h.lineCount??bf(h.src),r=3;C.length>5e3?r=8:C.length>1e3?r=6:C.length>200&&(r=4),r=Math.min(r,t);let i=null,a=n.options?.streamContextParseStrategy??`chars`,o=n.options?.streamContextParseMinChars??200,s=n.options?.streamContextParseMinLines??2,c,l=()=>(c===void 0&&(c=bf(C)),c),u=this.canDirectlyParseAppend(h),d=u&&this.shouldUseUnboundedAppend(e,h,C),f=!1;if(!u)switch(a){case`lines`:f=l()>=s;break;case`constructs`:if(C.length>=o){f=!0;break}if(Hv(C)){f=!0;break}f=l()>=s;break;default:f=C.length>=o}if(r>0&&f){let e=this.getTailLines(h.src,r)+C;try{let a=this.core.parse(e,h.env,n).tokens,o=a.findIndex(e=>e.map&&typeof e.map[1]==`number`&&e.map[1]>r);if(o!==-1){let e=a.slice(o),n=t-r;n!==0&&this.shiftTokenLines(e,n),i={tokens:e}}}catch{i=null}}else i=null;if(!i){let e=t;if(d)i={tokens:iv(n,C,h.env,{mode:`stream`})},e>0&&this.shiftTokenLines(i.tokens,e);else{let t=this.core.parse(C,h.env,n);e>0&&this.shiftTokenLines(t.tokens,e),i=t}}let p=0;if(h.tokens.length>0&&i.tokens.length>0){let e=h.tokens[h.tokens.length-1],t=i.tokens[0];try{e.type===`inline`&&t.type===`inline`&&(t.children&&t.children.length>0&&(e.children||=[],this.appendTokens(e.children,t.children)),e.content=(e.content||``)+(t.content||``),p=1)}catch{p=0}}let m=h.tokens.length;if(i.tokens.length>p){let e=h.tokens,t=i.tokens,n=Math.min(e.length,t.length-p),r=0;for(let i=n;i>0;i--){let n=!0;for(let r=0;r<i;r++){let a=e[e.length-i+r],o=t[p+r];if(!Gv(a,o)){n=!1;break}}if(n){r=i;break}}r>0&&(p+=r),t.length>p&&this.appendTokens(h.tokens,t,p)}if(h.boundary?this.updateBoundaryStateForAppend(h,C):this.updateFenceMarkerCacheForAppend(h,C),h.src=e,h.globalStateReason=null,h.lineCount=t+(c??l()),h.tokens.length>m){let n=this.getLastSegment(h.tokens,e,m,h.tokens.length,e.length-C.length,t);if(n){h.lastSegment=n;let t=e.length-C.length;h.lastSegmentSource=C.slice(Math.max(0,n.srcOffset-t))}else h.lastSegment=void 0,h.lastSegmentSource=void 0}else h.lastSegment=void 0,h.lastSegmentSource=void 0;return h.lastSegmentVerified=void 0,this.stats.total+=1,this.stats.appendHits+=1,d&&(this.stats.unboundedAppendHits=(this.stats.unboundedAppendHits||0)+1),this.stats.lastMode=`append`,Xf(h.env,{area:`stream`,path:d?`stream-unbounded-append`:`stream-append`,reason:d?`large-delta`:`safe-append`,unbounded:d}),h.tokens}let w=u??h.env,T=S?this.tryTailSegmentReparse(e,h,w,n,x??void 0,g??void 0):this.allowUntrustedTailReuse?this.tryUntrustedParagraphTailReparse(e,h,w,n):null;if(T)return this.stats.total+=1,this.stats.tailHits+=1,this.stats.lastMode=`tail`,Xf(w,{area:`stream`,path:`stream-tail`,reason:`tail-reparse`}),T;let E=!!n.__explicitStreamChunkFallbackSetting,D=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy(),O=!!n.options?.streamChunkedFallback,k=!E&&!C&&D,A=O||k,j=n.options?.streamChunkAdaptive!==!1,ee=n.options?.streamChunkTargetChunks??8,te=n.options?.streamChunkSizeChars,M=n.options?.streamChunkSizeLines,N=n.options?.streamChunkMaxChunks,P=!!n.__explicitStreamChunkConfig,F=n.options?.autoTuneChunks!==!1,I=n.options?.streamChunkFenceAware??!0,L=C&&h.lineCount!==void 0?h.lineCount+bf(C):void 0;if(A){L===void 0&&(L=bf(e));let t=(e,t,n)=>e<t?t:e>n?n:e,r=F&&!P?dv(e.length,L,n.options):null,i=r?.maxChunkChars??(j?t(Math.ceil(e.length/ee),8e3,64e3):te??1e4),a=r?.maxChunkLines??(j?t(Math.ceil(L/ee),150,700):M??200),o=r?.maxChunks??(j?t(Math.ceil(e.length/64e3),ee,32):N),s=e.length>0&&e.charCodeAt(e.length-1)===10,c=k&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&r?.strategy!==`plain`;if((O||c)&&(e.length>=i*2||L>=a*2)&&s){let t=A_(n,e,w,{maxChunkChars:i,maxChunkLines:a,fenceAware:r?.fenceAware??I,maxChunks:o}),s=Kf(w)?.chunk?.globalStateDetected??null,c=this.setCache({src:e,tokens:t,env:w,lineCount:L,lastSegment:void 0,globalStateReason:s},n);return this.updateCacheLineCount(c,L),this.recordChunkedParseResult(w,O?`explicit-fallback-large-doc`:`default-fallback-large-doc`),t}}let ne=this.parseFullDocument(e,w,n,L),re=ne.tokens;L=ne.lineCount;let ie=this.setCache({src:e,tokens:re,env:w,lineCount:L,lastSegment:void 0,globalStateReason:ne.globalStateReason},n);return this.updateCacheLineCount(ie,L),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,Xf(w,{area:`stream`,path:`stream-full`,reason:`fallback-full`,unbounded:!!Kf(w)?.unbounded}),re}recordChunkedParseResult(e,t){let n=Kf(e)?.chunk,r=n?.fallback?String(n.fallbackReason||`global-state`):null;if(this.stats.total+=1,r){this.stats.fullParses+=1,this.stats.lastMode=`full`,Xf(e,{area:`stream`,path:`stream-full`,reason:`global-state:${r}`,unbounded:!!Kf(e)?.unbounded});return}this.stats.chunkedParses=(this.stats.chunkedParses||0)+1,this.stats.lastMode=`chunked`,Xf(e,{area:`stream`,path:`stream-chunked`,chunked:!0,reason:t})}parseFullDocument(e,t,n,r,i=!0){Rf(t)&&Hf(t);let a=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy()?rv(n,e.length,r):`no`;if(a===`yes`){let a=iv(n,e,t),o=Kf(t)?.unbounded?.globalStateDetected??null;return Xf(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-char-threshold`,unbounded:!0}),{tokens:a,lineCount:r??(i?bf(e):0),globalStateReason:o}}let o=r;if(a===`need-lines`&&(o=bf(e),nv(n,e.length,o))){let r=iv(n,e,t),i=Kf(t)?.unbounded?.globalStateDetected??null;return Xf(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-line-threshold`,unbounded:!0}),{tokens:r,lineCount:o,globalStateReason:i}}o===void 0&&(o=i?bf(e):0);let s=Lf(e);return{tokens:zf(t,s,()=>this.core.parse(e,t,n).tokens),lineCount:o,globalStateReason:s}}shouldUseUnboundedAppend(e,t,n){return!n||e.length<this.MIN_UNBOUNDED_APPEND_TOTAL_CHARS&&n.length<this.MIN_UNBOUNDED_APPEND_CHARS?!1:n.length>=this.MIN_UNBOUNDED_APPEND_CHARS||bf(n)>=this.MIN_UNBOUNDED_APPEND_LINES}getAppendedSegment(e,t,n){let r=e.src;if(n===null||n===void 0&&!t.startsWith(r)||(n===void 0?!r.endsWith(`
65
+ `):!this.ensureBoundaryState(e).endsWithNewline))return null;let i=n??t.slice(r.length);if(!i)return null;let a=i.length;if(i.charCodeAt(a-1)!==10)return null;let o=0,s=-1;for(let e=0;e<a&&!(i.charCodeAt(e)===10&&(s===-1&&(s=e),o++,o>=2));e++);if(o<2)return null;let c=(s===-1?i:i.slice(0,s)).trim();if(c.length===0)return null;if(/^[-=]+$/.test(c)){let t;if(n!==void 0)t=this.ensureBoundaryState(e).previousLineNonBlank;else{let e=r.slice(0,-1),n=e.lastIndexOf(`
66
+ `);t=e.slice(n+1).trim().length>0}if(t)return null}if(n!==void 0){let t=this.ensureLastSegment(e);if(t&&this.segmentHasFence(e,t)){let n=this.tokenMapsTrusted?this.ensureSegmentSourceOffset(e,t):0;if(this.endsInsideOpenFence(r,n))return null}}else{let t=this.tokenMapsTrusted?this.ensureLastSegment(e)?.srcOffset??0:0;if((this.tokenMapsTrusted||this.cacheHasFenceMarker(e))&&this.endsInsideOpenFence(r,t))return null}return this.mayContainReferenceDefinition(i)?null:i}tryTailSegmentReparse(e,t,n,r,i,a){let o=i??this.ensureLastSegment(t);if(!o)return null;let s=a!==void 0;if(s&&this.ensureSegmentSourceOffset(t,o),o.srcOffset<=0&&o.tokenStart<=0)return null;if(!s){let n=t.src.slice(0,o.srcOffset);if(!e.startsWith(n))return null}let c=s?t.lastSegmentSource??t.src.slice(o.srcOffset):t.src.slice(o.srcOffset),l=s?c+a:e.slice(o.srcOffset);if(l===c)return null;let u=s?a:e.startsWith(t.src)?e.slice(t.src.length):null,d=s&&this.tokenMapsTrusted?e:this.getNormalizedUpdatedSource(t,e,a);if(u){let i=this.tryContainerTailAppendMerge(e,t,n,r,o,u,d);if(i)return t.lastSegmentSource=s?l:void 0,i}if(this.mayContainReferenceDefinition(c)||this.mayContainReferenceDefinition(l))return null;try{let i=this.parseAtLineOffset(l,n,r,o.lineStart,d),a=i.state,c=this.getLastSegment(a.tokens,l,0,a.tokens.length,i.mapsShifted?0:void 0,i.mapsShifted?o.lineStart:void 0);return o.lineStart>0&&!i.mapsShifted&&this.shiftTokenLines(a.tokens,o.lineStart),u?s?this.updateBoundaryStateForAppend(t,u):this.updateFenceMarkerCacheForAppend(t,u):(t.boundary=void 0,t.hasFenceMarker=void 0),t.src=e,t.normalizedSrc=d,t.env=n,t.globalStateReason=null,(!s||!u)&&(t.globalStateCarry=void 0),t.tokens.length=o.tokenStart,this.appendTokens(t.tokens,a.tokens),t.lineCount=o.lineStart+bf(l),c?(t.lastSegment={tokenStart:o.tokenStart+c.tokenStart,tokenEnd:o.tokenStart+c.tokenEnd,lineStart:i.mapsShifted?c.lineStart:o.lineStart+c.lineStart,lineEnd:i.mapsShifted?c.lineEnd:o.lineStart+c.lineEnd,srcOffset:o.srcOffset+c.srcOffset},t.lastSegmentSource=s?l.slice(c.srcOffset):void 0):(t.lastSegment=null,t.lastSegmentSource=void 0),t.lastSegmentVerified=void 0,t.tokens}catch{return null}}tryUntrustedParagraphTailReparse(e,t,n,r){if(t.boundary?t.boundary.endsWithBlankLine:this.endsWithBlankLine(t.src))return null;let i=this.ensureLastSegment(t);if(!i||t.tokens[i.tokenStart]?.type!==`paragraph_open`)return null;let a=t.tokens.slice(i.tokenStart,i.tokenEnd).find(e=>e.type===`inline`);if(!a?.content)return null;let o=t.src.length;for(;o>0;){let e=t.src.charCodeAt(o-1);if(e!==10&&e!==13)break;o--}let s=t.src.lastIndexOf(a.content,o-a.content.length);return s<0||s+a.content.length!==o?null:this.tryTailSegmentReparse(e,t,n,r,{...i,lineStart:this.countSourceLineBreaks(t.src,s),srcOffset:s})}countSourceLineBreaks(e,t){let n=0;for(let r=0;r<t;r++){let t=e.charCodeAt(r);t===10?n++:this.normalizeLineEndings&&t===13&&(n++,e.charCodeAt(r+1)===10&&r++)}return n}hasVerifiedSegmentAnchor(e,t,n){t.srcOffset<0&&this.ensureSegmentSourceOffset(e,t);let r=e.lineCount??bf(e.src),i=this.getDocLineCount(e.src,r);if(!(t.lineStart>=0&&t.lineStart<=t.lineEnd&&t.lineEnd<=i&&t.srcOffset<e.src.length))return!1;let a=e.src.slice(t.srcOffset);try{let r=Object.create(n);Object.defineProperty(r,"block",{value:this.anchorBlock});let i=this.core.createState(a,{},r);this.normalizeLineEndings&&lh(i),this.anchorBlock.parse(i.src,r,i.env,i.tokens);let o=this.getLastSegment(i.tokens,a);if(!o||o.tokenStart!==0)return!1;let s=typeof i.src==`string`?i.src:a,c=i.tokens[0]?.type,l=e.tokens[t.tokenStart]?.type,u=l===`table_open`&&c===`paragraph_open`&&/^\s*\|/.test(s)||l===`inline`&&c===`html_block`||l===`math_block`&&c===`paragraph_open`&&/^\s*\$\$\s*(?:\n|$)/.test(s);if(c!==l&&!u)return!1;let d=e.tokens.slice(t.tokenStart,t.tokenEnd).map(e=>e.content).filter(Boolean),f=0;for(let e of d){if(f=s.indexOf(e,f),f<0)return!1;f+=e.length}return!0}catch{return!1}}normalizeSource(e){return e.replace(/\r\n?/g,`
67
+ `).replace(/\0/g,`�`)}cacheHasFenceMarker(e){return e.hasFenceMarker===void 0&&(e.hasFenceMarker=e.src.includes("```")||e.src.includes(`~~~`)),e.hasFenceMarker}updateFenceMarkerCacheForAppend(e,t){if(this.cacheHasFenceMarker(e))return;let n=e.src.slice(-2)+t;e.hasFenceMarker=n.includes("```")||n.includes(`~~~`)}getNormalizedUpdatedSource(e,t,n){if(!this.normalizeLineEndings)return t;if(n===void 0&&!t.startsWith(e.src))return this.normalizeSource(t);let r=e.normalizedSrc??this.normalizeSource(e.src),i=n??t.slice(e.src.length),a=this.normalizeSource(i);return e.src.endsWith(`\r`)&&i.startsWith(`
68
+ `)&&(a=a.slice(1)),r+a}parseAtLineOffset(e,t,n,r,i){if(this.tokenMapsTrusted||r<=0)return{state:this.core.parse(e,t,n),mapsShifted:!1};let a=this.core.createState(e,t,n),o=!1;return this.core.process(a,(e,t)=>{!o&&e.fn===kp&&(this.shiftTokenLines(t.tokens,r),i!==void 0&&(t.src=i),o=!0)}),{state:a,mapsShifted:o}}getTailLines(e,t){if(t<=0)return``;let n=t;for(let t=e.length-1;t>=0;t--)if(e.charCodeAt(t)===10&&(n--,n===0))return e.slice(t+1);return e}endsInsideOpenFence(e,t){let n=e.slice(t),r=n.length,i=null,a=0;for(;a<r;){let e=n.indexOf(`
69
+ `,a);if(this.normalizeLineEndings){let t=n.indexOf(`\r`,a);t>=0&&(e===-1||t<e)&&(e=t)}e===-1&&(e=r);let t=a,o=0;for(;t<e;){let e=n.charCodeAt(t);if(e===32){if(t++,o++,o>=4)break}else if(e===9){o=4;break}else break}if(o<4&&t<e){let r=n.charCodeAt(t);if(r===96||r===126){let a=t;for(;a<e&&n.charCodeAt(a)===r;)a++;let o=a-t;if(o>=3){if(!i){let t=r===96?n.indexOf("`",a):-1;t>=0&&t<e||(i={marker:r,length:o})}else if(i.marker===r&&o>=i.length){let t=a;for(;t<e;){let e=n.charCodeAt(t);if(e===32||e===9)t++;else break}t===e&&(i=null)}}}}if(e===r)break;a=e+(this.normalizeLineEndings&&n.charCodeAt(e)===13&&n.charCodeAt(e+1)===10?2:1)}return i!==null}peek(){return this.cache?.tokens??Iv}hasCache(){return this.cache!==null}getStats(){return{...this.stats}}setCache(e,t){let n=this.cache?.snapshotState,r={...e,config:Bv(t),snapshotState:n};return n&&(n.cache=r),this.cache=r,r}appendTokens(e,t,n=0,r=t.length){for(let i=n;i<r;i++)e.push(t[i])}updateCacheLineCount(e,t){e.lineCount=t??bf(e.src),e.lastSegment=void 0,e.lastSegmentVerified=void 0,e.normalizedSrc=void 0,e.globalStateCarry=e.src.slice(-4096),e.boundary=void 0,e.lastSegmentSource=void 0}detectGlobalStateForAppend(e,t){if(e.globalStateReason)return e.globalStateReason;let n=(e.globalStateCarry??e.src.slice(-4096))+t,r=Lf(n);return e.globalStateCarry=n.length>Lv?n.slice(n.length-Lv):n,r&&(e.globalStateReason=r),r}ensureLastSegment(e,t=!1){return e.lastSegment===void 0&&(e.lastSegment=this.getLastSegment(e.tokens,e.src,0,e.tokens.length,void 0,void 0,t)),e.lastSegment}getLastSegment(e,t,n=0,r=e.length,i,a,o=!1){if(r<=n)return null;let s=1/0,c=-1,l=0;for(let u=r-1;u>=n;u--){let n=e[u];if(n.map&&(n.map[0]<s&&(s=n.map[0]),n.map[1]>c&&(c=n.map[1])),n.nesting<0){l+=-n.nesting;continue}if(n.nesting>0){if(l-=n.nesting,n.level===0&&l<=0){let e=Number.isFinite(s)?s:n.map?.[0]??0,l=c>=e?c:n.map?.[1]??e;return{tokenStart:u,tokenEnd:r,lineStart:e,lineEnd:l,srcOffset:o?-1:this.getLineStartOffset(t,e,i,a)}}continue}if(n.level===0&&l===0){let e=Number.isFinite(s)?s:n.map?.[0]??0,l=c>=e?c:n.map?.[1]??e;return{tokenStart:u,tokenEnd:r,lineStart:e,lineEnd:l,srcOffset:o?-1:this.getLineStartOffset(t,e,i,a)}}}return null}segmentHasFence(e,t){let n=Math.min(t.tokenEnd,e.tokens.length);for(let r=t.tokenStart;r<n;r++)if(e.tokens[r].type===`fence`)return!0;return!1}ensureSegmentSourceOffset(e,t){if(t.srcOffset<0){let n=e.lineCount;t.srcOffset=n!==void 0&&t.lineStart<=n&&t.lineEnd<=n+1?this.getLineStartOffsetFromEnd(e.src,t.lineStart,n):this.getLineStartOffset(e.src,t.lineStart)}return t.srcOffset}getLineStartOffsetFromEnd(e,t,n){if(t<=0)return 0;let r=n-t+1,i=e.length;for(;r>0;){if(i=e.lastIndexOf(`
70
+ `,i-1),i<0)return 0;r--}return i+1}getLineStartOffset(e,t,n,r){return n!==void 0&&r!==void 0&&t>=r?this.getLineStartOffsetFrom(e,n,t-r):this.getLineStartOffsetFrom(e,0,t)}getLineStartOffsetFrom(e,t,n){if(n<=0)return t;let r=n,i=t;for(;i<e.length;){let t=e.charCodeAt(i);if(t===10)i++,r--;else if(this.normalizeLineEndings&&t===13)i++,i<e.length&&e.charCodeAt(i)===10&&i++,r--;else{i++;continue}if(r===0)return i}return e.length}mayContainReferenceDefinition(e){return e.includes(`]:`)?/(?:^|\n)[ \t]{0,3}\[[^\]\n]+\]:/.test(e):!1}canDirectlyParseAppend(e){if(!this.tokenMapsTrusted||!(e.boundary?e.boundary.endsWithBlankLine:this.endsWithBlankLine(e.src)))return!1;let t=this.ensureLastSegment(e);if(!t)return!1;switch(e.tokens[t.tokenStart]?.type){case`paragraph_open`:case`heading_open`:case`fence`:case`code_block`:case`html_block`:case`hr`:case`table_open`:return!0;default:return!1}}tryContainerTailAppendMerge(e,t,n,r,i,a,o){if(!a||this.mayContainReferenceDefinition(a))return null;let s=t.tokens[i.tokenStart];switch(s?.type){case`bullet_list_open`:case`ordered_list_open`:return this.tryListTailAppendMerge(e,t,n,r,i,a,s,o);case`table_open`:return this.tryTableTailAppendMerge(e,t,n,r,i,a,s,o);default:return null}}tryListTailAppendMerge(e,t,n,r,i,a,o,s){if(t.src.length===0||!(t.boundary?t.boundary.endsWithNewline:t.src.charCodeAt(t.src.length-1)===10))return null;this.ensureSegmentSourceOffset(t,i);let c=i.lineEnd-i.lineStart,l=t.src.length-i.srcOffset;if(c<this.MIN_LIST_LINES_FOR_MERGE&&l<this.MIN_LIST_CHARS_FOR_MERGE)return null;let u=o.type===`bullet_list_open`?`bullet_list_close`:`ordered_list_close`,d=t.lineCount??bf(t.src),f,p=!1;try{let e=this.parseAtLineOffset(a,n,r,d,s);f=e.state.tokens,p=e.mapsShifted}catch{return null}if(!this.isSingleTopLevelContainer(f,o.type,u,o.markup))return null;let m=f.slice(1,-1);if(m.length===0)return null;d>0&&!p&&this.shiftTokenLines(m,d);let h=this.getListParagraphMode(t.tokens,i.tokenStart,t.tokens.length,o.level),g=this.getListParagraphMode(f,0,f.length,0);(h===`loose`||g===`loose`||(t.boundary?t.boundary.endsWithBlankLine:this.endsWithBlankLine(t.src))||(f[0]?.map?.[0]??0)-(p?d:0)>0)&&(this.setListParagraphVisibility(t.tokens,i.tokenStart,t.tokens.length,o.level,!1),this.setListParagraphVisibility(m,0,m.length,o.level,!1)),t.tokens.splice(t.tokens.length-1,0,...m),t.boundary?this.updateBoundaryStateForAppend(t,a):this.updateFenceMarkerCacheForAppend(t,a),t.src=e,t.normalizedSrc=s,t.env=n,t.globalStateReason=null;let _=d+bf(a);t.lineCount=_;let v=this.getCachedDocLineCount(t,_);return o.map&&(o.map[1]=v),t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:v,srcOffset:i.srcOffset},t.lastSegmentVerified=!0,t.tokens}tryTableTailAppendMerge(e,t,n,r,i,a,o,s){if(t.src.length===0||!(t.boundary?t.boundary.endsWithNewline:t.src.charCodeAt(t.src.length-1)===10)||/(?:^|\n)[ \t]*\n/.test(a))return null;this.ensureSegmentSourceOffset(t,i);let c=i.lineEnd-i.lineStart,l=t.src.length-i.srcOffset;if(c<this.MIN_TABLE_LINES_FOR_MERGE&&l<this.MIN_TABLE_CHARS_FOR_MERGE)return null;let u=this.getTableHeaderContext(t.src.slice(i.srcOffset));if(!u)return null;let d=`${u}${a}`,f=i.lineEnd-2,p,m=!1;try{let e=this.parseAtLineOffset(d,n,r,f,s);p=e.state.tokens,m=e.mapsShifted}catch{return null}if(!this.isSingleTopLevelContainer(p,`table_open`,`table_close`)||(p[0]?.map?.[1]??-1)!==this.getDocLineCount(d))return null;let h=this.getTableBodySection(p,0,p.length,0),g=this.getTableBodySection(t.tokens,i.tokenStart,t.tokens.length,o.level);if(!h||!g||h.tbodyOpenIndex<0||h.tbodyCloseIndex<0)return null;let _=g.tbodyOpenIndex>=0?p.slice(h.tbodyOpenIndex+1,h.tbodyCloseIndex):p.slice(h.tbodyOpenIndex,h.tbodyCloseIndex+1);if(_.length===0)return null;f!==0&&!m&&this.shiftTokenLines(_,f);let v=g.tbodyCloseIndex>=0?g.tbodyCloseIndex:g.tableCloseIndex,y=t.lineCount??bf(t.src);t.tokens.splice(v,0,..._),t.boundary?this.updateBoundaryStateForAppend(t,a):this.updateFenceMarkerCacheForAppend(t,a),t.src=e,t.normalizedSrc=s,t.env=n,t.globalStateReason=null;let b=y+bf(a);t.lineCount=b;let x=this.getCachedDocLineCount(t,b);if(o.map&&(o.map[1]=x),g.tbodyOpenIndex>=0){let e=t.tokens[g.tbodyOpenIndex];e?.map&&(e.map[1]=x)}return t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:x,srcOffset:i.srcOffset},t.lastSegmentVerified=!0,t.tokens}getTableHeaderContext(e){let t=e.indexOf(`
71
+ `);if(t<0)return null;let n=e.indexOf(`
72
+ `,t+1);return n<0?null:e.slice(0,n+1)}getTableBodySection(e,t,n,r){if(t<0||t>=n||e[t]?.type!==`table_open`)return null;let i=-1;for(let a=n-1;a>t;a--){let t=e[a];if(t.type===`table_close`&&t.level===r){i=a;break}}if(i<0)return null;let a=-1,o=-1;for(let n=t+1;n<i;n++){let t=e[n];if(t.type===`tbody_open`&&t.level===r+1){a=n;break}}if(a>=0){for(let t=i-1;t>a;t--){let n=e[t];if(n.type===`tbody_close`&&n.level===r+1){o=t;break}}if(o<0)return null}return{tableCloseIndex:i,tbodyOpenIndex:a,tbodyCloseIndex:o}}isSingleTopLevelContainer(e,t,n,r){if(e.length<2)return!1;let i=e[0],a=e[e.length-1];if(i.type!==t||a.type!==n||i.level!==0||a.level!==0||r!==void 0&&i.markup!==r)return!1;let o=0;for(let t=0;t<e.length;t++){let n=e[t];if(n.level===0&&t>0&&t<e.length-1&&o===0)return!1;(n.nesting>0||n.nesting<0)&&(o+=n.nesting)}return o===0}getListParagraphMode(e,t,n,r){let i=!1,a=!1,o=r+2;for(let r=t;r<n;r++){let t=e[r];if(t.type===`paragraph_open`&&t.level===o&&(t.hidden?i=!0:a=!0,i&&a))return`loose`}return a?`loose`:i?`tight`:`none`}setListParagraphVisibility(e,t,n,r,i){let a=r+2;for(let r=t;r<n;r++){let t=e[r];(t.type===`paragraph_open`||t.type===`paragraph_close`)&&t.level===a&&(t.hidden=i)}}shouldPreferTailReparseForAppend(e,t){let n=this.ensureLastSegment(e);if(!n)return!1;let r=e.tokens[n.tokenStart];if(!this.tokenMapsTrusted)return t;switch(r?.type){case`bullet_list_open`:case`ordered_list_open`:case`blockquote_open`:case`table_open`:return!0;case`paragraph_open`:case`code_block`:case`html_block`:return!(e.boundary?e.boundary.endsWithBlankLine:this.endsWithBlankLine(e.src));default:return r?.nesting===1}}endsWithBlankLine(e){let t=e.length;if(t<2||e.charCodeAt(t-1)!==10)return!1;let n=t-2;for(;n>=0;){let t=e.charCodeAt(n);if(t===32||t===9){n--;continue}return t===10}return!0}ensureBoundaryState(e){if(e.boundary)return e.boundary;let t=e.src,n=t.length,r=n>0&&t.charCodeAt(n-1)===10,i=r?n-1:n,a=i-1;for(;a>=0&&t.charCodeAt(a)!==10;)a--;let o=!1;for(let e=a+1;e<i;e++){let n=t.charCodeAt(e);if(n!==32&&n!==9){o=!0;break}}return e.boundary={currentLineNonBlank:!r&&o,previousLineNonBlank:r?o:!1,endsWithNewline:r,endsWithBlankLine:this.endsWithBlankLine(t)},e.boundary}updateBoundaryStateForAppend(e,t){let n=this.ensureBoundaryState(e),r=n.currentLineNonBlank,i=n.previousLineNonBlank;for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n===10?(i=r,r=!1):n!==32&&n!==9&&(r=!0)}n.currentLineNonBlank=r,n.previousLineNonBlank=i,n.endsWithNewline=t.length>0?t.charCodeAt(t.length-1)===10:n.endsWithNewline,n.endsWithBlankLine=e.src.length+t.length>=2&&n.endsWithNewline&&!i}getDocLineCount(e,t=bf(e)){return e.length===0?0:e.charCodeAt(e.length-1)===10?t:t+1}getCachedDocLineCount(e,t){return e.src.length===0?0:e.boundary?e.boundary.endsWithNewline?t:t+1:this.getDocLineCount(e.src,t)}shiftTokenLines(e,t){if(t===0)return;let n=null;for(let r=0;r<e.length;r++){let i=e[r];if(i.map&&(i.map[0]+=t,i.map[1]+=t),i.children){n??=[];for(let e=i.children.length-1;e>=0;e--)n.push(i.children[e]);for(;n.length>0;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}}}},Jv={default:pv,zero:mv,commonmark:fv};function Yv(e){return{core:e.core.ruler.version,block:e.block.ruler.version,inline:e.inline.ruler.version,inline2:e.inline.ruler2.version}}function Xv(e,t){return e.core.ruler.version!==t.core||e.block.ruler.version!==t.block||e.inline.ruler.version!==t.inline||e.inline.ruler2.version!==t.inline2}function Zv(e){return e.experimental?{...e,...e.experimental}:e}function Qv(e,t){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0)return!0;let n=e.experimental;return!!n&&Object.prototype.hasOwnProperty.call(n,t)&&n[t]!==void 0}function $v(e,t,n){for(let r=0;r<n.length;r++){let i=n[r];if(Qv(t,i)||Qv(e,i))return!0}return!1}function ey(e,t,n){return Qv(t,n)||Qv(e,n)}function ty(e,t){let n=Kf(e)?.chunk;if(n?.fallback){Xf(e,{area:`parse`,path:`plain`,reason:`global-state:${n.fallbackReason||`unknown`}`});return}Xf(e,{area:`parse`,path:`full-chunk`,chunked:!0,reason:t})}function ny(){return typeof performance<`u`?performance.now():Date.now()}function ry(e,t){let n={html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100,stream:!1,streamOptimizationMinSize:1e3,streamTailLocalPostBlockRules:!1,streamChunkedFallback:!1,streamChunkSizeChars:1e4,streamChunkSizeLines:200,streamChunkFenceAware:!0,streamChunkAdaptive:!0,streamChunkTargetChunks:8,streamChunkMaxChunks:void 0,streamLargeCachePolicy:`retain`,streamSkipCacheAboveChars:1e6,streamSkipCacheAboveLines:1e5,fullChunkedFallback:!1,fullChunkThresholdChars:2e4,fullChunkThresholdLines:400,fullChunkSizeChars:1e4,fullChunkSizeLines:200,fullChunkFenceAware:!0,fullChunkAdaptive:!0,fullChunkTargetChunks:8,fullChunkMaxChunks:void 0,autoTuneChunks:!0,autoUnbounded:!0,autoUnboundedThresholdChars:4e6,autoUnboundedThresholdLines:8e4},r=`default`,i;!t&&typeof e!=`string`?(i=e,r=`default`):typeof e==`string`&&(r=e,i=t);let a=Jv[r];if(!a)throw Error(`Wrong \`markdown-it\` preset "${r}", check name`);if(a?.options&&(n={...n,...a.options}),i&&(n={...n,...i}),n=Zv(n),typeof n.quotes==`string`){let e=n.quotes;e.length>=4?n.quotes=[e[0],e[1],e[2],e[3]]:n.quotes=[`“`,`”`,`‘`,`’`]}let o=$v(a?.options,i,[`fullChunkSizeChars`,`fullChunkSizeLines`,`fullChunkMaxChunks`]),s=$v(a?.options,i,[`streamChunkSizeChars`,`streamChunkSizeLines`,`streamChunkMaxChunks`]),c=ey(a?.options,i,`fullChunkedFallback`),l=ey(a?.options,i,`streamChunkedFallback`),u=!1,d=null,f=null,p=new kg,m=null,h=()=>(m||=new Fv(n),m),g=null,_=()=>(g||=new qv(p),g),v=null,y=()=>(v||=new dp({fuzzyLink:!0}),v),b=e=>!u&&!!d&&!Xv(e,d),x=(e,t)=>r==="default"&&!u&&m===null&&f!==null&&e.parse===f&&b(e)&&!e.stream.enabled&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.xhtmlOut===!1&&e.options.breaks===!1&&e.options.langPrefix===`language-`&&e.options.linkify===!1&&e.options.typographer===!1&&e.options.highlight===null,S=(e,t)=>r==="default"&&!u&&b(e)&&!e.stream.enabled&&!e.options.fullChunkedFallback&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.linkify===!1&&e.options.typographer===!1,C={core:p,block:p.block,inline:p.inline,get linkify(){let e=y();return Object.defineProperty(this,"linkify",{value:e,writable:!0,configurable:!0}),e},get renderer(){let e=h();return Object.defineProperty(this,"renderer",{value:e,writable:!0,configurable:!0}),e},options:n,__explicitFullChunkConfig:o,__explicitStreamChunkConfig:s,__explicitFullChunkFallbackSetting:c,__explicitStreamChunkFallbackSetting:l,__canUseImplicitLargeInputStrategy(){return b(this)},set(e){let t=Zv(e);return this.options={...this.options,...t},(Qv(e,`fullChunkSizeChars`)||Qv(e,`fullChunkSizeLines`)||Qv(e,`fullChunkMaxChunks`))&&(o=!0,this.__explicitFullChunkConfig=!0),(Qv(e,`streamChunkSizeChars`)||Qv(e,`streamChunkSizeLines`)||Qv(e,`streamChunkMaxChunks`))&&(s=!0,this.__explicitStreamChunkConfig=!0),Qv(e,`fullChunkedFallback`)&&(c=!0,this.__explicitFullChunkFallbackSetting=!0),Qv(e,`streamChunkedFallback`)&&(l=!0,this.__explicitStreamChunkFallbackSetting=!0),m&&m.set(t),typeof t.stream==`boolean`&&(this.stream.enabled=t.stream,g&&(g.reset(),g.resetStats())),this},configure(e){let t=typeof e==`string`?Jv[e]:e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");if(t.options&&this.set(t.options),t.components){let e=t.components;e.core?.rules&&this.core.ruler.enableOnly(e.core.rules),e.block?.rules&&this.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&this.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&this.inline.ruler2.enableOnly(e.inline2.rules)}return this},enable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.enable(n,!0);for(let e=0;e<t.length;e++)i.add(t[e])}if(!t){let e=n.filter(e=>!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},disable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.disable(n,!0);for(let e=0;e<t.length;e++)i.add(t[e])}if(!t){let e=n.filter(e=>!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},use(e,...t){let n=typeof e==`function`?e:e&&typeof e.default==`function`?e.default:void 0;if(!n)throw TypeError(`MarkdownIt.use: plugin must be a function`);let r=[this,...t],i=e;return u=!0,n.apply(i,r),this},render(e,t){let n;if(x(this,e.length)){t!==void 0&&(Jf(t),n=Uf(`render`));let r=n?ny():0,i=n?O_(e,n):D_(e);if(n&&(n.attemptMs=ny()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),Yf(t,n)),i!==null)return t!==void 0&&Xf(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&Yf(r,n),h().render(i,this.options,r)},async renderAsync(e,t){let n;if(x(this,e.length)){t!==void 0&&(Jf(t),n=Uf(`render`));let r=n?ny():0,i=n?O_(e,n):D_(e);if(n&&(n.attemptMs=ny()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),Yf(t,n)),i!==null)return t!==void 0&&Xf(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&Yf(r,n),h().renderAsync(i,this.options,r)},renderIterable(e,t={}){let n=this.parseIterable(e,t);return h().render(n,this.options,t)},async renderAsyncIterable(e,t={}){let n=await this.parseAsyncIterable(e,t);return h().renderAsync(n,this.options,t)},renderInline(e,t={}){let n=this.parseInline(e,t);return h().render(n,this.options,t)},validateLink:Nh,normalizeLink:Ph,normalizeLinkText:Fh,utils:Hd,helpers:{...Ep},parse(e,t){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);if(t!==void 0&&Jf(t),S(this,e.length)){let n=t===void 0?void 0:Uf(`parse`),r=n?ny():0,i=Qg(e,n);if(n&&(n.attemptMs=ny()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),Yf(t,n)),i!==null)return t!==void 0&&Xf(t,{area:`parse`,path:`stock-fast`,reason:`stock-subset`}),i}let n=t??{},r;if(!this.stream.enabled&&!this.options.fullChunkedFallback&&b(this)){let i=rv(this,e.length);if(i===`yes`){let r=iv(this,e,n);return Xf(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`char-threshold`}),r}i===`need-lines`&&(r=bf(e))}if(!this.stream.enabled){let i=e.length,a=this.options.autoTuneChunks!==!1,s=o,l=!c&&b(this),u=!!this.options.fullChunkedFallback,d=l&&i>=2e5,f;(u||d||r!==void 0)&&(f=r??bf(e));let p=(u||d)&&a&&!s?uv(i,f,this.options):null;if(u||d){let r=f??0;if(u?i>=(this.options.fullChunkThresholdChars??2e4)||r>=(this.options.fullChunkThresholdLines??400):d){if(p&&p.strategy!==`plain`){let r=A_(this,e,n,{maxChunkChars:p.maxChunkChars,maxChunkLines:p.maxChunkLines,fenceAware:p.fenceAware,maxChunks:p.maxChunks});return t&&ty(t,u?`explicit-full-chunk`:`default-large-string`),r}if(u){let a=(e,t,n)=>e<t?t:e>n?n:e,o=this.options.fullChunkAdaptive!==!1,s=this.options.fullChunkTargetChunks??8,c=a(Math.ceil(i/s),8e3,64e3),l=a(Math.ceil(r/s),150,700),u=o?c:this.options.fullChunkSizeChars??1e4,d=o?l:this.options.fullChunkSizeLines??200,f=o?a(Math.ceil(i/64e3),s,32):this.options.fullChunkMaxChunks,p=A_(this,e,n,{maxChunkChars:u,maxChunkLines:d,fenceAware:this.options.fullChunkFenceAware??!0,maxChunks:f});return t&&ty(t,`explicit-full-chunk`),p}}}if(r!==void 0&&b(this)&&nv(this,i,f??r)){let r=iv(this,e,n);return Xf(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`line-threshold`}),r}}let i=Lf(e);return Xf(t,{area:`parse`,path:`plain`,reason:`default-plain`}),zf(n,i,()=>p.parse(e,n,this).tokens)},parseIterable(e,t={}){return Jf(t),Q_(this,e,t)},parseAsyncIterable(e,t={}){return Jf(t),$_(this,e,t)},parseIterableToSink(e,t,n={}){return Jf(n),ev(this,e,t,n)},parseAsyncIterableToSink(e,t,n={}){return Jf(n),tv(this,e,t,n)},parseInline(e,t={}){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);Jf(t),Rf(t)&&Hf(t);let n=p.createState(e,t,this);return n.inlineMode=!0,p.process(n),n.tokens}};if(C.stream={enabled:!!n.stream,parse(e,t){return C.stream.enabled?_().parse(e,t,C):C.parse(e,t??{})},append(e,t){if(!C.stream.enabled)throw Error(`Stream append requires stream mode`);return _().append(e,t,C)},snapshot(){return g?g.snapshot():null},restore(e){if(!C.stream.enabled)throw Error(`Stream restore requires stream mode`);return _().restore(e,C)},reset(){_().reset()},hasCache(){return g?.hasCache()??!1},peek(){return g?g.peek():[]},stats(){return g?g.getStats():{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:`idle`}},resetStats(){g&&g.resetStats()}},a?.components){let e=a.components;e.core?.rules&&C.core.ruler.enableOnly(e.core.rules),e.block?.rules&&C.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&C.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&C.inline.ruler2.enableOnly(e.inline2.rules)}return d=Yv(C),f=C.parse,C}var iy=ry,ay=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`],oy=`a.abbr.b.bdi.bdo.button.cite.code.data.del.dfn.em.font.i.ins.kbd.label.mark.q.s.samp.small.span.strong.sub.sup.time.u.var`.split(`.`),sy=`article.aside.blockquote.details.div.figcaption.figure.footer.header.h1.h2.h3.h4.h5.h6.li.main.nav.ol.p.pre.section.summary.table.tbody.td.th.thead.tr.ul`.split(`.`),cy=[`svg`,`g`,`path`],ly=`address.audio.body.canvas.caption.colgroup.datalist.dd.dialog.dl.dt.fieldset.form.head.hgroup.html.iframe.legend.map.menu.meter.noscript.object.optgroup.option.output.picture.progress.rp.rt.ruby.script.select.style.template.textarea.tfoot.title.video`.split(`.`),uy=`onclick.onerror.onload.onmouseover.onmouseout.onmousedown.onmouseup.onkeydown.onkeyup.onfocus.onblur.onsubmit.onreset.onchange.onselect.ondblclick.ontouchstart.ontouchend.ontouchmove.ontouchcancel.onwheel.onscroll.oncopy.oncut.onpaste.oninput.oninvalid.onsearch.innerhtml.outerhtml.textcontent.innertext.srcdoc.ping`.split(`.`),dy=[`action`,`data`,`href`,`src`,`srcset`,`poster`,`xlink:href`,`formaction`],fy=[`script`],py=[`pre`,`iframe`,`picture`,`script`,`style`,`table`,`tbody`,`td`,`tfoot`,`th`,`thead`,`textarea`,`tr`,`title`,`video`],my=new Set(ay),hy=new Set(sy),gy=new Set([...ay,...oy,...sy,...cy]);[...gy,...ly];var _y=new Set(uy),vy=new Set(dy),yy=new Set(fy),by=new Set(py);function xy(e){let t=``;for(let n of e){let e=n.charCodeAt(0);e<=31||e>=127&&e<=159||/\s/u.test(n)||(t+=n)}return t}var Sy={amp:`&`,bsol:`\\`,colon:`:`,newline:`
73
+ `,sol:`/`,tab:` `};function Cy(e){return e.replace(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z][a-z0-9]+));?/gi,(e,t,n,r)=>{let i=t??n;if(i){let e=Number.parseInt(i,t?10:16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return Sy[String(r??``).toLowerCase()]??e})}var wy=new Set([`http`,`https`,`mailto`,`tel`]),Ty=new Set([`javascript`,`vbscript`,`data`,`file`,`ftp`,`blob`,`filesystem`,`intent`,`chrome`,`chrome-extension`,`moz-extension`,`ms-browser-extension`,`view-source`]),Ey=new Set([`http`,`https`]);function Dy(e){return e.match(/^([a-z][a-z0-9+.-]*):/i)?.[1]?.toLowerCase()??``}var Oy=/^https?:\/\//i;function ky(e){if(!Oy.test(e))return!1;for(let t of e){let e=t.charCodeAt(0);if(t===`&`||e<=32||e>=127&&e<=159||e>127&&/\s/u.test(t))return!1}return!0}function Ay(e,t,n){if(!jy(t,n)||!e.startsWith(`file:///`))return!1;let r=e.charAt(8);return r!==`/`&&r!==`\\`}function jy(e,t){return e?(e===`a`||e===`area`)&&(!t||t===`href`||t===`xlink:href`):!t||t===`href`}function My(e,t){return t===`href`||t===`xlink:href`?jy(e,t)?wy:Ey:t===`src`||t===`srcset`||t===`poster`||t===`action`||t===`formaction`||t===`data`?Ey:wy}function Ny(e,t={}){if(ky(e))return!1;let n=xy(Cy(e)).toLowerCase(),r=String(t.tagName??``).toLowerCase(),i=String(t.attrName??``).toLowerCase();if(!n)return!1;if(n.startsWith(`data:`)){let e=/^data:image\/(?:png|gif|jpe?g|webp|avif|bmp);/i.test(n);return r===`img`&&i===`src`?!e:!0}if(/^[\\/]{2}/.test(n))return!0;if(n.startsWith(`/`)||n.startsWith(`./`)||n.startsWith(`../`)||n.startsWith(`#`)||n.startsWith(`?`))return!1;let a=Dy(n);return a?a===`file`?!Ay(n,r,i):jy(r,i)?Ty.has(a):!My(r,i).has(a):!1}function Py(e){let t=Cy(String(e??``)).trim();if(!t||t.startsWith(`#`)||t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`?`))return!1;let n=Dy(xy(t).toLowerCase());return n===`http`||n===`https`}function Fy(e,t={}){let n=String(e??``).trim();return n?Ny(n,t)?``:n:``}function Iy(e){return Fy(e,{tagName:`img`,attrName:`src`})}function Ly(e,t,n){function r(e){return e.trim().split(` `,2)[0]===t}function i(e,n,r,i,a){return e[n].nesting===1&&e[n].attrJoin(`class`,t),a.renderToken(e,n,r,i,a)}n||={};let a=n.marker||`:`,o=a.charCodeAt(0),s=a.length,c=n.validate||r,l=n.render||i;function u(e,n,r,i){let l,u=!1,d=e.bMarks[n]+e.tShift[n],f=e.eMarks[n];if(o!==e.src.charCodeAt(d))return!1;for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);let p=Math.floor((l-d)/s);if(p<3)return!1;l-=(l-d)%s;let m=e.src.slice(d,l),h=e.src.slice(l,f);if(!c(h,m))return!1;if(i)return!0;let g=n;for(;g++,!(g>=r||(d=e.bMarks[g]+e.tShift[g],f=e.eMarks[g],d<f&&e.sCount[g]<e.blkIndent));)if(o===e.src.charCodeAt(d)&&!(e.sCount[g]-e.blkIndent>=4)){for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);if(!(Math.floor((l-d)/s)<p)&&(l-=(l-d)%s,l=e.skipSpaces(l),!(l<f))){u=!0;break}}let _=e.parentType,v=e.lineMax;e.parentType=`container`,e.lineMax=g;let y=e.push(`container_`+t+`_open`,`div`,1);y.markup=m,y.block=!0,y.info=h,y.map=[n,g],e.md.block.tokenize(e,n+1,g);let b=e.push(`container_`+t+`_close`,`div`,-1);return b.markup=e.src.slice(d,l),b.block=!0,e.parentType=_,e.lineMax=v,e.line=g+ +!!u,!0}e.block.ruler.before(`fence`,`container_`+t,u,{alt:[`paragraph`,`reference`,`blockquote`,`list`]}),e.renderer.rules[`container_`+t+`_open`]=l,e.renderer.rules[`container_`+t+`_close`]=l}function Ry(e){let t=String(e??``).trim();if(!t.startsWith(`{`)||!t.endsWith(`}`))return null;let n=t.slice(1,-1).trim();if(!n)return{};if(n.includes(`{`)||n.includes(`[`)||n.includes(`]`))return null;let r=[],i=``,a=!1,o=!1;for(let e=0;e<n.length;e++){let t=n[e];if(t===`\\`){i+=t,e+1<n.length&&(i+=n[e+1],e++);continue}if(!o&&t===`'`){a=!a,i+=t;continue}if(!a&&t===`"`){o=!o,i+=t;continue}if(!a&&!o&&t===`,`){r.push(i.trim()),i=``;continue}i+=t}i.trim()&&r.push(i.trim());let s={};for(let e of r){if(!e)continue;let t=!1,n=!1,r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===`\\`){i++;continue}if(!n&&a===`'`){t=!t;continue}if(!t&&a===`"`){n=!n;continue}if(!t&&!n&&a===`:`){r=i;break}}if(r===-1)return null;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();if(!i)return null;let o=i;if(o.startsWith(`"`)&&o.endsWith(`"`)||o.startsWith(`'`)&&o.endsWith(`'`))try{o=JSON.parse(o.replace(/^'/,`"`).replace(/'$/,`"`))}catch{return null}if(!/^[_$A-Z][\w$-]*$/i.test(o))return null;let c;if(!a)c=``;else if(a.startsWith(`"`)&&a.endsWith(`"`)||a.startsWith(`'`)&&a.endsWith(`'`))try{c=JSON.parse(a.replace(/^'/,`"`).replace(/'$/,`"`))}catch{c=a}else c=/^-?\d+(?:\.\d+)?$/.test(a)?Number(a):a===`true`||a===`false`?a===`true`:a===`null`?null:a;s[o]=c}return s}function zy(e,t,n){for(let r of e){let e=r,i=e.map;if(Array.isArray(i)&&i.length>=2){let r=Number(i[0]),a=Number(i[1]);Number.isFinite(r)&&Number.isFinite(a)&&(e.map=[r+t,Math.min(a+t,n)])}Array.isArray(e.children)&&zy(e.children,t,n)}}function By(e){[`admonition`,`info`,`warning`,`error`,`tip`,`danger`,`note`,`caution`].forEach(t=>{e.use(Ly,t,{render(e,n){return e[n].nesting===1?`<div class="vmr-container vmr-container-${t}">`:`</div>
74
+ `}})}),e.block.ruler.before(`fence`,`vmr_container_fallback`,(e,t,n,r)=>{let i=e,a=i.bMarks[t]+i.tShift[t],o=i.eMarks[t],s=i.src.slice(a,o),c=s.match(/^:::\s*([^\s{]+)/);if(!c)return!1;let l=c[1];if(!l.trim())return!1;let u=s.slice(c[0].length).trim(),d,f,p=u.indexOf(`{`),m=p>=0?u.slice(p).trimStart():void 0;if(p===-1)d=u||void 0;else{if(d=u.slice(0,p).trim()||void 0,m?.startsWith(`{`)){let e=0,t=-1;for(let n=0;n<m.length;n++)if(m[n]===`{`?e++:m[n]===`}`&&e--,e===0){t=n+1;break}t>0&&(f=m.slice(0,t))}f||(d=u||void 0)}if(r)return!0;let h=!!i.env.__markstreamFinal,g=t+1,_=!1;for(;g<=n;){let e=i.bMarks[g]+i.tShift[g],t=i.eMarks[g];if(i.src.slice(e,t).trim()===`:::`){_=!0;break}g++}_||(g=n);let v=i.push(`vmr_container_open`,`div`,1);if(v.attrSet(`class`,`vmr-container vmr-container-${l}`),v.map=[t,_?g:n],v.meta={...v.meta??{},unclosed:!_&&!h},d&&v.attrSet(`data-args`,d),f)try{let e=JSON.parse(f);for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}}catch{let e=Ry(f);if(e)for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}else v.attrSet(`data-attrs`,f)}let y=[];for(let e=t+1;e<g;e++){let t=i.bMarks[e]+i.tShift[e],n=i.eMarks[e];y.push(i.src.slice(t,n))}if(y.some(e=>e.trim().length>0)){let e=y.join(`
75
+ `);e.endsWith(`
76
+ `)||(e+=`
77
+ `),e.endsWith(`
78
+
79
+ `)||(e+=`
80
+ `);let n=i.tokens[i.tokens.length-1];n&&(n.raw=e);let r=[];i.md.block.parse(e,i.md,i.env,r),zy(r,t+1,t+1+y.length),i.tokens.push(...r)}let b=i.push(`vmr_container_close`,`div`,-1);return _||(b.hidden=!0,b.map=[n,n]),i.line=_?g+1:g,!0},{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function Vy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Hy(e,t=0){let n=!1,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`\\`){i++;continue}if(!r&&t===`'`){n=!n;continue}if(!n&&t===`"`){r=!r;continue}if(!n&&!r&&t===`>`)return i}return-1}function Uy(e){let t=[],n=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];if(!e)continue;let n=r[2]||r[3]||r[4]||``;t.push([e,n])}return t}var Wy=/^[a-z][a-z0-9_-]*$/;function Gy(e){return Wy.test(String(e??``).trim().toLowerCase())}function Ky(e){let t=String(e??``).trim();if(!t)return``;if(!t.startsWith(`<`))return Gy(t)?t.toLowerCase():``;let n=1;for(;n<t.length&&/\s/.test(t[n]);)n++;if(t[n]===`/`)for(n++;n<t.length&&/\s/.test(t[n]);)n++;let r=n;for(;n<t.length&&/[\w-]/.test(t[n]);)n++;let i=t.slice(r,n).toLowerCase(),a=t[n]??``;return a&&!/[\s/>]/.test(a)?``:Gy(i)?i:``}function qy(e){if(!e||e.length===0)return[];let t=new Set,n=[];for(let r of e){let e=Ky(r);e&&!t.has(e)&&(t.add(e),n.push(e))}return n}function Jy(e){return Ky(e)}function Yy(e,t){let n=String(e??``),r=Ky(t);if(!r)return!1;let i=Vy(r),a=n.match(new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?(\s*\/)?>`,`i`));return a?a[1]?!0:new RegExp(String.raw`<\s*\/\s*${i}\s*>`,`i`).test(n):!1}function Xy(e,t){let n=String(e??``),r=Ky(t);if(!r)return n;let i=Vy(r),a=new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?>\s*`,`i`),o=new RegExp(String.raw`\s*<\s*\/\s*${i}\s*>\s*$`,`i`);return n.replace(a,``).replace(o,``)}var Zy=my,Qy=gy,$y=new Set(hy);$y.delete(`details`);var eb=/<([A-Z][\w-]*)(?=[\s/>]|$)/gi,tb=/<\/\s*([A-Z][\w-]*)(?=[\s/>]|$)/gi,nb=/^<\s*(?:\/\s*)?([A-Z][\w-]*)/i,rb=/^<\s*([A-Z][\w:-]*)(?=[\s/>]|$)/i;function ib(e){return(e.match(nb)?.[1]??``).toLowerCase()}function ab(e){return/^\s*<\s*\//.test(e)}function ob(e,t){return Zy.has(t)||/\/\s*>\s*$/.test(e)}function sb(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(!i||i.type!==`html_inline`)continue;let a=String(i.content??``),o=ib(a);if(o===t){if(ab(a)){if(n===0)return r;n--;continue}ob(a,o)||n++}}return-1}function cb(e,t){let n=0;for(let r of e){if(!r||r.type!==`html_inline`)continue;let e=String(r.content??``),i=ib(e);if(i===t){if(ab(e)){n>0&&n--;continue}ob(e,i)||n++}}return n}function lb(e,t,n=0){let r=new RegExp(String.raw`<\s*(\/?)\s*${Vy(t)}(?=[\s>/])[^>]*>`,`gi`);r.lastIndex=Math.max(0,n);let i=0,a;for(;(a=r.exec(e))!==null;){let e=a[0]??``,t=!!a[1],n=!t&&/\/\s*>$/.test(e);if(t){if(i===0)return{start:a.index,end:a.index+e.length};i--;continue}n||i++}return null}function ub(e,t){let n=new RegExp(String.raw`<\s*(\/?)\s*${Vy(t)}(?=[\s>/])[^>]*>`,`gi`),r=0,i;for(;(i=n.exec(e))!==null;){let e=i[0]??``,t=!!i[1],n=!t&&/\/\s*>$/.test(e);if(t){r>0&&r--;continue}n||r++}return r}function db(e){let t=e;return String(t.raw??t.content??t.markup??``)}function fb(e){let t=e;return t.meta||={},t.meta}function pb(e,t,n){let r=fb(e);r.markstreamCustomHtmlRaw=t,r.markstreamCustomHtmlInner=n}function mb(e,t){if(!t.size)return;let n=Array.from(t,e=>new RegExp(String.raw`<\s*${Vy(e)}(?=[\s>/])`,`i`)),r=[],i=!1,a=e=>e?n.some(t=>t.test(e)):!1,o=e=>{if(e&&r.length)for(let t of r)t.raw+=e,t.inner+=e},s=()=>{r.length&&i&&(o(`
81
+ `),i=!1)},c=e=>{o(e)},l=e=>{for(let t=0;t<r.length;t++)r[t].raw+=e,t<r.length-1&&(r[t].inner+=e);let t=r.pop();pb(t.token,t.raw,t.inner)},u=e=>{let t=r[r.length-1]?.tag;if(!t)return null;let n=new RegExp(String.raw`^\s*<\s*\/\s*${Vy(t)}\s*>`,`i`);return e.match(n)?.[0]??null},d=e=>!!u(e),f=(e,n,i)=>{let a=i??(e.type===`html_inline`?ib(n):``);if(!(a&&t.has(a))){o(n);return}let s=ab(n),c=!s&&ob(n,a);if(s){if(!r.length||r[r.length-1].tag!==a){o(n);return}l(n);return}if(o(n),c){pb(e,n,``);return}r.push({tag:a,token:e,raw:n,inner:``})};for(let n of e){if(n.type===`inline`&&Array.isArray(n.children)){let e=String(n.content??``);if(d(e)?i=!1:s(),!r.length&&!a(e)){i=!1;continue}let o=0,l=!0;for(let i of n.children){let n=db(i),a=i.type===`html_inline`?ib(n):``,s=a&&t.has(a),u=n;if(l&&e&&n&&(r.length||s)){let t=e.indexOf(n,o);if(t!==-1)c(e.slice(o,t)),u=e.slice(t,t+n.length),o=t+n.length;else{if(r.length&&!s)continue;l=!1}}f(i,u,a)}l&&e&&o<e.length&&r.length&&c(e.slice(o)),i=r.length>0;continue}if(r.length&&typeof n.content==`string`){let e=db(n),t=n.type===`html_block`?u(e):null;if(t){l(`${i?`
82
+ `:``}${t}`),i=r.length>0;continue}if(!n.content)continue;s(),o(n.content),i=!0}}for(let e of r)pb(e.token,e.raw,e.inner)}function hb(e){return/^\s*<\s*[!?]/.test(e)}function gb(e){let t=new Set(Qy);if(e&&Array.isArray(e))for(let n of e){let e=String(n??``).trim();if(!e)continue;let r=e.match(/^[<\s/]*([A-Z][\w-]*)/i);r&&t.add(r[1].toLowerCase())}return t}function _b(e,t){if(t.has(e))return!0;for(let n of t)if(n.startsWith(e))return!0;return!1}function vb(e,t){let n=null;for(let r of e.matchAll(eb)){let i=r.index??-1;if(i<0)continue;let a=(r[1]??``).toLowerCase();_b(a,t)&&Hy(e.slice(i))===-1&&(!n||i<n.index)&&(n={index:i,tag:a,closing:!1})}for(let r of e.matchAll(tb)){let i=r.index??-1;if(i<0)continue;let a=(r[1]??``).toLowerCase();_b(a,t)&&Hy(e.slice(i))===-1&&(!n||i<n.index)&&(n={index:i,tag:a,closing:!0})}let r=/<\/\s*$/.exec(e);if(r&&typeof r.index==`number`){let t=r.index;!e.slice(t).includes(`>`)&&(!n||t<n.index)&&(n={index:t,tag:``,closing:!0})}let i=/<\s*$/.exec(e);if(i&&typeof i.index==`number`){let t=i.index,r=e.slice(t);!r.startsWith(`</`)&&!r.includes(`>`)&&(!n||t<n.index)&&(n={index:t,tag:``,closing:!1})}return n}function yb(e,t){let n=e;return Object.assign(Object.create(Object.getPrototypeOf(n)),n,{type:`text`,content:t,raw:t})}function bb(e,t){if(!e.length)return{children:e};let n=[],r=null,i=null;function a(e,t){e&&(t?n.push(yb(t,e)):n.push({type:`text`,content:e,raw:e}))}function o(e,r){let i=0;for(;i<e.length;){let o=e.indexOf(`<`,i);if(o===-1){a(e.slice(i),r);break}a(e.slice(i,o),r);let s=e.slice(o),c=s.match(nb);if(!c){a(`<`,r),i=o+1;continue}let l=Hy(s);if(l===-1){a(`<`,r),i=o+1;continue}let u=s.slice(0,l+1),d=(c[1]??``).toLowerCase();t.has(d)?n.push({type:`html_inline`,tag:``,content:u,raw:u}):a(u,r),i=o+u.length}}function s(e,n){if(!e)return;let a=vb(e,t);if(!a){o(e,n);return}let s=e.slice(0,a.index);s&&o(s,n),r={tag:a.tag,buffer:e.slice(a.index),closing:a.closing},i=r.buffer}for(let a of e){if(r){r.buffer+=db(a),i=r.buffer;let e=Hy(r.buffer);if(e===-1)continue;let t=r.buffer.slice(0,e+1),o=r.buffer.slice(e+1);n.push({type:`html_inline`,tag:``,content:t,raw:t}),r=null,i=null,o&&s(o);continue}if(a.type===`html_inline`){let e=db(a),n=(e.match(nb)?.[1]??``).toLowerCase();if(n&&t.has(n)&&Hy(e)===-1){r={tag:n,buffer:e,closing:/^<\s*\//.test(e)},i=r.buffer;continue}}if(a.type===`text`){let e=String(a.content??``);if(!e.includes(`<`)){n.push(a);continue}s(e,a);continue}n.push(a)}return{children:n,pendingBuffer:i??void 0}}var xb=[`a`,`span`,`strong`,`em`,`b`,`i`,`u`];function Sb(e,t={}){let n=new Set;if(t.customHtmlTags?.length)for(let e of t.customHtmlTags){let t=Ky(e);t&&n.add(t)}let r=e=>{let t=e,r=new Set(n),i=Array.isArray(t.env?.__markstreamCustomHtmlTags)?t.env.__markstreamCustomHtmlTags:[];for(let e of i){let t=Ky(String(e??``));t&&r.add(t)}let a=gb(Array.from(r)),o=new Set(xb);for(let e of r)o.add(e);return{autoCloseInlineTagSet:o,commonHtmlTags:a,customTagSet:r,shouldMergeHtmlBlockTag:e=>r.has(e)||!a.has(e)||$y.has(e)}},i=e=>{if(e.type===`html_block`)return String(e.content??``);if(e.type!==`inline`||!Array.isArray(e.children)||e.children.length!==1)return``;let t=e.children[0];return t?.type===`html_block`?String(e.content??t.content??``):``},a=(e,t)=>{e.type=`html_block`,e.content=t,e.raw=t,e.children=[]},o=e=>e.replace(/^(?:\r?\n)+/,``),s=e=>/^(?: {4}|\t)/.test(e),c=e=>e.replace(/^(?: {4}|\t)/gm,``),l=(e,t)=>{let n=o(e);if(!/\S/.test(n))return[];if(s(n))return[{type:`code_block`,content:c(n),raw:n}];let r=n.replace(/^[\t ]+/,``);if(!r)return[];if(r.startsWith(`<`))return[{type:`html_block`,content:r}];let i={type:`inline`,tag:``,nesting:0,content:r,children:[{type:`text`,content:r,raw:r}]};return t===`paragraph`?[{type:`paragraph_open`,tag:`p`,nesting:1},i,{type:`paragraph_close`,tag:`p`,nesting:-1}]:t===`text`?[{type:`text`,content:r,raw:r}]:[i]},u=(e,t,n)=>e[t-1]?.type===`paragraph_open`&&e[t+1]?.type===`paragraph_close`?`inline`:n,d=(e,t)=>{let n=o(t);return!/\S/.test(n)||e.type!==`inline`||!Array.isArray(e.children)?!1:(e.content=`${String(e.content??``)}${n}`,e.children.push({type:`text`,content:n,raw:n}),!0)};e.core.ruler.after(`inline`,`fix_html_inline_streaming`,e=>{let t=e.tokens??[],{commonHtmlTags:n,customTagSet:i}=r(e);for(let e of t){let t=e;if(t.type!==`inline`||!Array.isArray(t.children))continue;let r=String(t.content??``),i=t.children.length?t.children:r.includes(`<`)?[{type:`text`,content:r,raw:r}]:null;if(i)try{let e=bb(i,n);if(t.children=e.children,e.pendingBuffer){let n=r.lastIndexOf(e.pendingBuffer);if(n!==-1){let e=r.slice(0,n);t.content=e,typeof t.raw==`string`&&(t.raw=e)}}}catch(e){console.error(`[applyFixHtmlInlineTokens] failed to fix streaming html inline`,e)}}mb(t,i)}),e.core.ruler.push(`fix_html_inline_tokens`,e=>{let t=e.tokens??[],{autoCloseInlineTagSet:n,customTagSet:o,shouldMergeHtmlBlockTag:s}=r(e),c=[];for(let e=0;e<t.length;e++){let n=t[e];if(c.length>0){let[r,i]=c[c.length-1];if(e!==i){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let a=String(n.content??n.raw??``);if(a){let n=t[i],o=`${String(n.content||``)}\n${a}`,s=Hy(o),f=s===-1?null:lb(o,r,s+1);if(f){let r=o.slice(0,f.end),i=o.slice(f.end);n.content=r,n.loading=!1,t.splice(e,1),c.pop();let a=d(n,i)?[]:l(i,u(t,e,`paragraph`));a.length&&t.splice(e,0,...a),e--;continue}n.content=o,n.loading!==!1&&(n.loading=!0)}t.splice(e,1),e--;continue}}let r=i(n);if(r){if(hb(r))continue;let i=(r.match(/<\s*(?:\/\s*)?([^\s>/]+)/)?.[1]??``).toLowerCase(),o=/^\s*<\s*\//.test(r);if(!i||!s(i))continue;if(a(n,r),!o)i&&!RegExp(`^\\s*<\\s*${i}\\b[^>]*\\/\\s*>`,`i`).test(r)&&ub(r,i)>0&&c.push([i,e]);else if(c.length>0&&i&&c[c.length-1][0]===i){let[,n]=c[c.length-1],i=t[n];i.content=`${String(i.content||``)}\n${r}`,i.loading=!1,c.pop(),t.splice(e,1),e--}continue}if(c.length>0){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let r=n.content||``,i=RegExp(`<\\s*\\/\\s*${c[c.length-1][0]}\\s*>`,`i`).test(r);if(r){let[,e]=c[c.length-1],n=t[e];n.content=`${n.content||``}\n${r}`,n.loading!==!1&&(n.loading=!i)}i&&c.pop(),t.splice(e,1),e--}else continue}if(o.size>0){let e=new Map,n=new Map,r=t=>{let n=e.get(t);return n||(n=RegExp(`<\\s*${t}\\b`,`i`),e.set(t,n)),n},i=e=>{let t=n.get(e);return t||(t=RegExp(`<\\s*\\/\\s*${e}\\s*>`,`i`),n.set(e,t)),t},a=[];for(let e=0;e<t.length;e++){let n=t[e],s=String(n.content??``);if(a.length>0){let r=a[a.length-1],o=t[r.index],c=n.type===`html_block`?i(r.tag).exec(s):null;if(c){let n=c.index+c[0].length,i=s.slice(0,n),f=s.slice(n);o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push({type:`html_inline`,content:`</${r.tag}>`,raw:`</${r.tag}>`}),a.pop();let p=d(o,f)?[]:l(f,u(t,e,`paragraph`));p.length?t.splice(e,1,...p):(t.splice(e,1),e--);continue}if(n.type!==`inline`)continue;let f=Array.isArray(n.children)?n.children:[],p=sb(f,r.tag);if(p!==-1){let n=f.slice(0,p+1),r=f.slice(p+1),i=n.map(e=>String(e?.content??e?.raw??``)).join(``);if(o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push(...n),r.length){let n=r.map(e=>String(e.content??e.raw??``)).join(``);if(n.trim()){let r=n.replace(/^\s+/,``);if(d(o,n))t.splice(e,1),e--;else if(r.startsWith(`<`))t.splice(e,1,{type:`html_block`,content:r});else{let r=l(n,u(t,e,`paragraph`));t.splice(e,1,...r)}}else t.splice(e,1),e--}else t.splice(e,1),e--;a.pop();continue}o.content=`${String(o.content??``)}\n${s}`,Array.isArray(o.children)&&o.children.push(...f),t.splice(e,1),e--;continue}if(n.type!==`inline`)continue;let c=Array.isArray(n.children)?n.children:[];for(let t of o)if((c.length?cb(c,t):r(t).test(s)&&!i(t).test(s)?1:0)>0){a.push({tag:t,index:e});break}}}{let e=0;for(let n=0;n<t.length;n++){let r=t[n];if(r.type===`paragraph_open`){e++;continue}r.type===`paragraph_close`&&(e>0?e--:(t.splice(n,1),n--))}}for(let e=0;e<t.length;e++){let r=t[e];if(r.type===`html_block`){let n=(r.content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase();if(n.startsWith(`!`)||n.startsWith(`?`)){r.loading=!1;continue}if(o.has(n)){let i=String(r.content??``),a=Hy(i),o=a===-1?null:lb(i,n,a+1);r.loading=o?!1:r.loading===void 0||r.loading;let s=o?.start??-1,c=o?o.end-o.start:0;if(s!==-1){let o=i.slice(0,s+c),u=``;a!==-1&&a<s&&(u=i.slice(a+1,s)),r.children=[{type:n,content:u,raw:o,attrs:[],tag:n,loading:!1}],r.content=o,r.raw=o;let d=l(i.slice(s+c)||``,`text`);d.length&&t.splice(e+1,0,...d)}else r.children=[{type:n,content:``,raw:i,attrs:[],tag:n,loading:!0}];continue}if([`br`,`hr`,`img`,`input`,`link`,`meta`,`div`,`p`,`ul`,`li`].includes(n))continue;r.type=`inline`;let i=[],a=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,s;for(;(s=a.exec(r.content||``))!==null;){let e=s[1],t=s[2]||s[3]||s[4]||``;i.push([e,t])}let c=String(r.content??``),u=RegExp(`<\\/\\s*${n}\\s*>`,`i`).exec(c),d=u?u.index:-1,f=u?u[0].length:0;if(d!==-1){let i=c.slice(0,d+f),a=(c.slice(d+f)||``).replace(/^\s+/,``);r.children=[{type:`html_block`,content:i,tag:n,loading:!1}],r.content=i,r.raw=i,a&&t.splice(e+1,0,a.startsWith(`<`)?{type:`html_block`,content:a}:{type:`text`,content:a,raw:a})}else r.children=[{type:`html_block`,content:r.content,tag:n,loading:!0}];continue}if(!r||r.type!==`inline`)continue;if(r.children.length===2&&r.children[0].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase(),t=r.children[1],i=String(t?.content??``).match(/^<\s*\/\s*([^\s>]+)/)?.[1]?.toLowerCase()??``;if(t?.type===`html_inline`&&i===e)continue;n.has(e)?(r.children[0].loading=!0,r.children[0].tag=e,r.children.push({type:`html_inline`,tag:e,loading:!0,content:`</${e}>`})):r.children=[{type:`html_block`,loading:!0,tag:e,content:String(r.children[0]?.content??``)+String(r.children[1]?.content??``)}];continue}if(r.children.length===3&&r.children[0].type===`html_inline`&&r.children[2].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase();if(n.has(e))continue;r.children=[{type:`html_block`,loading:!1,tag:e,content:r.children.map(e=>e.content).join(``)}];continue}if(!r.content?.startsWith(`<`)||r.children?.length!==1)continue;let i=String(r.content),a=r,s=a.children[0];if(s?.type!==`html_inline`){/^<\s*(?:\/\s*)?[A-Z][\w:-]*\s*$/i.test(i)&&(a.children.length=0);continue}let c=String(s.content??i).match(rb)?.[1]?.toLowerCase()??``;if(c){if(/\/\s*>\s*$/.test(i)||Zy.has(c)){a.children=[{type:`html_inline`,content:i}];continue}a.children.length=0}}})}function Cb(e){let t=e.trim();return!t||/^&[a-z0-9#]+;/i.test(t)?!1:!!(/^(?:const|let|var|function|class|import|export|if|for|while|return|await|async|yield|try|catch|throw|new|typeof|instanceof|switch|case|break|continue|def|ruby|perl|print|echo|true|false|null|undefined|NaN|Infinity|this)\b/.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\])*\s*\(/i.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[[\d+\]])+/i.test(t)||/\w+\s*(?:===?|!==?|<=?|>=?|\+\+|--|&&|\|\||\?\.)/.test(t)||/^(?:!!|\+\+|--)\s*\w/.test(t)||/[\w$]+\s*(?:\+=|-=|\*=|\/=|%=|\*\*=|=)/.test(t)||/^(?:https?:\/\/|ftp:\/\/|file:\/\/|\/\/|www\.)/i.test(t)||/`[^`]*\$\{[^}]*\}[^`]*`/.test(t)||/<\/?[A-Z][a-zA-Z0-9]*/.test(t)||/<[a-z][a-z0-9]*\s[^>]+>/.test(t)||/^(["'`]).*\1\s*[;,]?$/.test(t)||/^\[[\s\S]*\]$/.test(t)||/^\{[\s\S]*\}$/.test(t)||/^\(\s*\)$/.test(t)||/[\w$]+(?:\s*[+\-*/%<>=!&|^~:]+\s*[\w$]+|\s*\.\s*[\w$]+)/.test(t)||/=>|->|::/.test(t)||/^@[\w.$]+$/.test(t)||/^(?:0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|\d+(?:\.\d*)?(?:px|em|rem|%|vh|vw|deg|s|ms)?)$/.test(t)||/^\$[\w$]+\s*[=:]/.test(t)||/\|\s*\w+|\w+\s*\|/.test(t)||/^(?:git|npm|yarn|pnpm|bun|pip|cargo|go|rust|python|node|java|mvn|gradle|docker|kubectl)\s+/.test(t)||/(?:console|window|document|Math|JSON|Date|Array|Object|String|Number|Boolean)\.[a-zA-Z]/.test(t)||/^(?:\/\/|#|\/\*|\*\/|<!--|-->)/.test(t)||/^(?:<<<|<<\s*['"]?\w+['"]?)/.test(t))}function wb(e,t={}){t.enabled!==!1&&e.core.ruler.after(`inline`,`fix_indented_code_block`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n.type!==`code_block`)continue;let r=String(n.content??``).trim();if(!r)continue;let i=r.split(/\r?\n/).filter(e=>e.trim().length>0);if(i.length===1&&!Cb(i[0]??``)){let r=i[0]??``,a=n.level??0;t.splice(e,1,{type:`paragraph_open`,tag:`p`,nesting:1,level:a},{type:`inline`,tag:``,nesting:0,level:a,content:r,children:[{type:`text`,content:r,level:a+1,raw:r}],block:!0},{type:`paragraph_close`,tag:`p`,nesting:-1,level:a}),e+=2}}})}var Tb=Symbol(`markstream.parse-context`);function Eb(e){return!!(e&&e[Tb]===!0)}function Db(e={},t={}){return{...e,[Tb]:!0,customHtmlBlockCursor:0,disableStreamParse:!1,disableStructuredReuse:!1,insideStrong:!1,isFragment:!1,...t}}function Ob(e){return Eb(e)?e:Db(e)}function kb(e,t=e,n={}){return Db(t,{runtime:e.runtime,markdownIt:e.markdownIt,...n})}var Ab=/\.([a-z0-9]{1,15})$/i,jb=/[_()[\]{}<>]/u,Mb=/^(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/i,Nb=/[?#@]/u,Pb=/[\\/]/u,Fb=/^[\p{L}\p{N}./\\-]+$/u,Ib=/^[A-Za-z0-9-]{1,63}$/u,Lb=/^xn--[a-z0-9-]{2,59}$/i,Rb=/^(?:[A-Z]{1,6}|\d{1,8})$/u,zb=/^(?=.{1,12}$)[A-Z0-9]+(?:[-.][A-Z0-9]+)*$/iu,Bb=/文件名\s*[::]?|附件\s*[::]?|路径\s*[::]?|路徑\s*[::]?|文件列表\s*[::]?|文档列表\s*[::]?|文檔列表\s*[::]?|\bfile\s*names?\b\s*[::]?|\battachments?\b\s*[::]?|\bpaths?\b\s*[::]?|\bfile\s+lists?\b\s*[::]?|\bdocument\s+lists?\b\s*[::]?/iu,Vb=/文件名\s*[::]?|文件\s*[::]?|附件\s*[::]?|档案\s*[::]?|檔案\s*[::]?|文档\s*[::]?|文檔\s*[::]?|资料\s*[::]?|資料\s*[::]?|路径\s*[::]?|路徑\s*[::]?|\bfile\s*name\b\s*[::]?|\battachments?\b\s*[::]?|\bfiles?\b\s*[::]?|\bdocuments?\b\s*[::]?|\bdocs?\b\s*[::]?|\bpaths?\b\s*[::]?/iu,Hb=/股票代码|股票代碼|证券代码|證券代碼|(?:代码|代碼|交易所|后缀|後綴|市场|市場)(?=$|[\s::/|,,、()()])|\btickers?\b|\bsymbols?\b|\bexchanges?\b/iu,Ub=2e3,Wb=16384,Gb=512*Ub,Kb={},qb=new Set([`ai`,`md`,`py`,`rs`,`sh`,`zip`]),Jb=new Set([`as`,`bj`,`de`,`hk`,`l`,`ln`,`ny`,`pa`,`sh`,`ss`,`sz`,`t`,`us`]),Yb=new Set([...Jb,`at`,`ax`,`cn`,`co`,`it`,`jp`,`ks`,`mc`,`mx`,`nz`,`pl`,`sa`,`si`,`to`,`tw`]),Xb=new Set([`com`,`dev`,`io`,`page`,`site`]),Zb=new Set([`app`,`apk`,`dmg`,`exe`,`ipa`,`lock`,`log`,`markdown`,`webmanifest`]),Qb=new Set(`7z.ai.astro.avi.bash.bz2.c.cjs.cpp.cs.csv.doc.docx.fish.flac.gif.go.gz.h.hpp.html.java.jpeg.jpg.js.json.jsx.kt.md.mdx.mjs.mov.mp3.mp4.pdf.php.png.ppt.pptx.ps1.py.rar.rb.rs.sh.sql.svg.swift.svelte.tar.tgz.toml.ts.tsx.txt.vue.wav.webp.xls.xlsx.xml.yaml.yml.zip.zsh`.split(`.`)),$b=new Map,ex=0;function tx(e,t){if(!e||e.length>Wb)return t;for($b.has(e)||(ex+=e.length),$b.set(e,t);$b.size>Ub||ex>Gb;){let e=$b.keys().next().value;if(!e)break;$b.delete(e),ex-=e.length}return t}function nx(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function rx(e,t){let n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return nx(n)?n:void 0}function ix(e,t){if(!nx(t))return e;let n=Ob(e),r=n.linkifyDemotionContext;return{...n,linkifyDemotionContext:{filename:r?.filename||t?.filename,explicitFilename:r?.explicitFilename||t?.explicitFilename,marketTicker:r?.marketTicker||t?.marketTicker}}}function ax(e){let t=gx(e);return nx(t)?t:void 0}function ox(e){return e.replace(/^[\s>*_`[\]((【《"'“‘]+/u,``).replace(/[\s<*_`\]))】》"'.。;;,,、::!?!?]+$/u,``)}function sx(e,t){if(!nx(t))return;let n=String(e??``).trim().split(/\s+/u).map(ox).filter(Boolean);if(n.length===0)return;let r={};return t?.filename&&n.every(e=>xx(e,{filename:!0,explicitFilename:t.explicitFilename}))&&(r.filename=!0),t?.explicitFilename&&r.filename&&(r.explicitFilename=!0),t?.marketTicker&&n.every(e=>xx(e,{marketTicker:!0}))&&(r.marketTicker=!0),nx(r)?r:void 0}function cx(e,t=!1){let n=Ob(e).linkifyDemotionSeedContext;return{options(r){return t||r==null?ix(e,n):ix(e,rx(ax(r),sx(r,n)))},remember(e){let r=ax(e);n=t?rx(n,r):rx(r,sx(e,n))},reset(){n=void 0},snapshot(){return n}}}function lx(e){return Ib.test(e)&&!e.startsWith(`-`)&&!e.endsWith(`-`)}function ux(e){let t=e.split(`.`);if(t.length<2)return!1;let n=t[t.length-1]?.toLowerCase()??``;return lx(n)||Lb.test(n)?t.every(lx):!1}function dx(e){return Array.from(e).some(e=>e.charCodeAt(0)>127)}function fx(e){return e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,``).split(/[/?#]/,1)[0]??``}function px(e){return e.split(`.`).some(e=>e.toLowerCase().startsWith(`xn--`))}function mx(e,t,n){let r=fx(t);return dx(e)&&px(r)&&String(n??``).toLowerCase().includes(r.toLowerCase())}function hx(e){if(!e)return!1;if(e.includes(`文件`)||e.includes(`附件`)||e.includes(`路径`)||e.includes(`路徑`)||e.includes(`文档`)||e.includes(`文檔`)||e.includes(`档案`)||e.includes(`檔案`)||e.includes(`资料`)||e.includes(`資料`)||e.includes(`股票`)||e.includes(`证券`)||e.includes(`證券`)||e.includes(`代码`)||e.includes(`代碼`)||e.includes(`交易所`)||e.includes(`后缀`)||e.includes(`後綴`)||e.includes(`市场`)||e.includes(`市場`))return!0;let t=e.toLowerCase();return t.includes(`file`)||t.includes(`attachment`)||t.includes(`document`)||t.includes(`doc`)||t.includes(`path`)||t.includes(`ticker`)||t.includes(`symbol`)||t.includes(`exchange`)}function gx(e){let t=String(e??``);return $b.get(t)||(hx(t)?tx(t,{explicitFilename:Bb.test(t),filename:Vb.test(t),marketTicker:Hb.test(t)}):tx(t,Kb))}function _x(e){return ux(e.split(/[\\/]/)[0]??``)}function vx(e){let t=e.replace(/[^a-z]/gi,``);return t.length>=2&&t===t.toUpperCase()}function yx(e){if(jb.test(e)||!Fb.test(e))return!0;if(Pb.test(e))return!_x(e);let t=e.replace(Ab,``);return dx(t)?!0:t.split(`.`).filter(Boolean).some(vx)}function bx(e,t,n){if(!(n?Yb:Jb).has(t))return!1;let r=e.slice(0,-(t.length+1));return r===``?e.startsWith(`.`):(n?zb:Rb).test(r)}function xx(e,t={}){if(!e||Mb.test(e)||Nb.test(e))return!1;let n=e.match(Ab);if(!n)return!1;let r=String(n[1]??``).toLowerCase();return bx(e,r,t.marketTicker===!0)?!0:Qb.has(r)?!qb.has(r)||t.filename?!0:yx(e):!!(t.explicitFilename&&Xb.has(r)||t.filename&&Zb.has(r))}var Sx=new WeakMap,Cx=new WeakSet;function wx(e,t){return Sx.set(e,t),e}function Tx(e){return Sx.get(e)}function Ex(e){Cx.add(e)}function Dx(e){return e===void 0||Cx.has(e)}var Ox=[`!`];function kx(e){return e===`linkify`||e===`autolink`?e:`recovery`}function Ax(e){return{type:`text`,content:e,raw:e}}function jx(e,t){t===1?e.push({type:`em_open`,tag:`em`,nesting:1}):t===2?e.push({type:`strong_open`,tag:`strong`,nesting:1}):t===3&&(e.push({type:`strong_open`,tag:`strong`,nesting:1}),e.push({type:`em_open`,tag:`em`,nesting:1}))}function Mx(e,t){t===1?e.push({type:`em_close`,tag:`em`,nesting:-1}):t===2?e.push({type:`strong_close`,tag:`strong`,nesting:-1}):t===3&&(e.push({type:`em_close`,tag:`em`,nesting:-1}),e.push({type:`strong_close`,tag:`strong`,nesting:-1}))}function Nx(e,t,n,r=`recovery`){let i=``;if(t.includes(`"`)){let e=t.split(`"`);t=e[0].trim(),i=e[1].trim()}return wx({type:`link`,loading:n,href:t,title:i,text:e,children:[{type:`text`,content:e,raw:e}],raw:String(`[${e}](${t})`)},r)}function Px(e,t){if(e&&t&&(e.href=String(e.href??``)+t,e.text=String(e.text??``)+t,e.raw=String(`[${e.text}](${e.href})`),Array.isArray(e.children)&&e.children.length)){let n=e.children[e.children.length-1];n?.type===`text`?(n.content=String(n.content??``)+t,n.raw=String(n.raw??``)+t):e.children.push(Ax(t))}}function Fx(e,t){let n=-1;for(let r of t){let t=e.indexOf(r);t!==-1&&(n===-1||t<n)&&(n=t)}return n}function Ix(e){let t=e.attrs?.find(e=>e?.[0]===`href`)?.[1];return typeof t==`string`?t:``}function Lx(e,t){if(!e)return;e.attrs=Array.isArray(e.attrs)?e.attrs:[];let n=e.attrs.findIndex(e=>e?.[0]===`href`);n>=0?e.attrs[n][1]=t:e.attrs.push([`href`,t])}function Rx(e,t,n){let r=``;for(let i=t+1;i<n;i++){let t=e[i];if(t?.type!==`text`||typeof t.content!=`string`)return null;r+=t.content}return r||null}function zx(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===`(`)t++;else if(r===`)`){if(t===0)return n;t--}}return-1}function Bx(e){e.core.ruler.after(`inline`,`fix_link_tokens`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n&&n.type===`inline`&&Array.isArray(n.children))try{n.children=Vx(n.children,typeof n.content==`string`?n.content:void 0)}catch(e){console.error(`[applyFixLinkTokens] failed to fix inline children`,e)}}})}function Vx(e,t){if(e.length<3)return e;let n=e.some(e=>e.type===`code_inline`),r=new Map,i=0;for(let t=0;t<e.length;t++){let n=e[t];if(n.type===`link_open`){let a=-1;for(let n=t+1;n<e.length;n++)if(e[n]?.type===`link_close`){a=n;break}if(a!==-1&&n.markup===`linkify`){r.set(n,i);let o=Rx(e,t,a),s=i>0&&o?zx(o):-1;if(s!==-1&&o)for(let e of o.slice(s))e===`(`?i++:e===`)`&&i>0&&i--}a!==-1&&(t=a);continue}if(n.type===`text`&&typeof n.content==`string`)for(let e of n.content)e===`(`?i++:e===`)`&&i>0&&i--}let a=gx(t);for(let i=0;i<=e.length-1;i++){i<0&&(i=0);let o=e[i];if(!o)break;if(o.type===`link_open`&&(o.markup===`linkify`||o.markup===`autolink`)){let s=-1;for(let t=i+1;t<e.length;t++)if(e[t]?.type===`link_close`){s=t;break}if(s!==-1){let c=Rx(e,i,s),l=Ix(o);if(!n&&o.markup===`linkify`&&c&&!mx(c,l,t)&&xx(c,a)){e.splice(i,s-i+1,Ax(c));continue}let u=Fx(c??``,Ox);if(o.markup===`linkify`&&c?.includes(`)`)&&(r.get(o)??0)>0){let e=zx(c);e!==-1&&(u===-1||e<u)&&(u=e)}let d=Fx(l,Ox),f=u;for(let t=i+1;t<s;t++){let n=e[t];if(n?.type!==`text`||typeof n.content!=`string`)continue;if(f>=n.content.length){f-=n.content.length;continue}if(f<0)break;let r=n.content[f],i=n.content.slice(0,f),a=n.content.slice(f);for(let n=t+1;n<s;n++){let t=e[n];t?.type===`text`&&typeof t.content==`string`&&(a+=t.content)}n.content=i,n.raw=i;let c=s-(t+1);c>0&&(e.splice(t+1,c),s=t+1);let u=l;if(r===`!`&&d!==-1)u=l.slice(0,d);else if(a){let e=encodeURI(a);if(e&&l.endsWith(e))u=l.slice(0,l.length-e.length);else{let e=r?encodeURI(r):``,t=e?l.indexOf(e):-1;t!==-1&&(u=l.slice(0,t))}}u!==l&&Lx(o,u),a&&e.splice(s+1,0,Ax(a));break}}}if(!n){if(o?.type===`em_open`&&e[i-1]?.type===`text`&&e[i-1].content?.endsWith(`*`)){let t=e[i-1].content?.replace(/(\*+)$/,``)||``;e[i-1].content=t,o.type=`strong_open`,o.tag=`strong`,o.markup=`**`;for(let t=i+1;t<e.length;t++)if(e[t]?.type===`em_close`){e[t].type=`strong_close`,e[t].tag=`strong`,e[t].markup=`**`;break}}else if(o?.type===`text`&&o.content?.endsWith(`(`)&&e[i+1]?.type===`link_open`){let t=o.content.match(/\[([^\]]+)\]/);if(t){let n=o.content.slice(0,t.index),r=n.match(/(\*+)$/),a=kx(e[i+1]?.markup),s=[];if(r){n=n.slice(0,r.index),n&&s.push(Ax(n));let o=t[1],c=r[1].length;jx(s,c);let l=e[i+2]?.content||``;if(e[i+4]?.type===`text`&&!e[i+4].content?.startsWith(`)`)&&(l+=e[i+4]?.content||``,e[i+4].content=``),s.push(Nx(o,l,!e[i+4]?.content?.startsWith(`)`),a)),Mx(s,c),e[i+4]?.type===`text`){let t=e[i+4].content?.replace(/^\)\**/,``);t&&s.push(Ax(t)),e.splice(i,5,...s)}else e.splice(i,4,...s)}else{n&&s.push(Ax(n));let r=t[1],o=r.match(/^\*+/);if(o){let t=o[0].length;r=r.replace(/^\*+/,``).replace(/\*+$/,``);let n=e[i+2]?.content||``;if(e[i+4]?.type===`text`&&!e[i+4].content?.startsWith(`)`)&&(n+=e[i+4]?.content||``,e[i+4].content=``),jx(s,t),s.push(Nx(r,n,!e[i+4]?.content?.startsWith(`)`),a)),Mx(s,t),e[i+4]?.type===`text`){let t=e[i+4].content?.replace(/^\)/,``);t&&s.push(Ax(t)),e.splice(i,5,...s)}else e.splice(i,4,...s);i===0?i=s.length-1:i-=s.length+1;continue}let c=e[i+2]?.content||``;if(e[i+4]?.type===`text`&&!e[i+4].content?.startsWith(`)`)&&(c+=e[i+4]?.content||``,e[i+4].content=``),s.push(Nx(r,c,!e[i+4]?.content?.startsWith(`)`),a)),e[i+4]?.type===`text`){let t=e[i+4].content?.replace(/^\)/,``);t&&s.push(Ax(t)),e.splice(i,5,...s)}else e.splice(i,4,...s)}i-=s.length+1;continue}}else if(o.type===`link_open`&&o.markup===`linkify`&&e[i-1]?.type===`text`&&e[i-1].content?.endsWith(`(`)){if(e[i-2]?.type===`link_close`){let t=[],n=e[i-3].content||``,r=o.attrs?.find(e=>e[0]===`href`)?.[1]||``;if(e[i+3]?.type===`text`){let a=(e[i+3]?.content??``).indexOf(`)`),o=a===-1;a===-1&&(r+=e[i+3]?.content?.slice(0,a)||``,e[i+3].content=``),t.push(Nx(n,r,o,`linkify`));let s=e[i+3].content?.replace(/^\)\**/,``);s&&t.push(Ax(s)),e.splice(i-4,8,...t)}else t.push(wx({type:`link`,loading:!0,href:r,title:``,text:n,children:[{type:`text`,content:r,raw:r}],raw:String(`[${n}](${r})`)},`linkify`)),e.splice(i-4,7,...t);continue}if(e[i-1].content===`](`&&e[i-3]?.type===`text`&&e[i-3].content?.endsWith(`)`)){if(e[i-2]?.type===`strong_open`){let[t,n]=e[i-3].content?.split(`[**`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else if(e[i-2]?.type===`em_open`){let[t,n]=e[i-3].content?.split(`[*`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else{let[t,n]=e[i-3].content?.split(`[`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}}}if(o.type===`link_close`&&o.nesting===-1&&e[i-2]?.type===`link_open`&&e[i+1]?.type===`text`&&e[i-1]?.type===`text`){let t=e[i-1].content||``,n=e[i-2].attrs||[],r=n.find(e=>e[0]===`href`)?.[1]||``,a=n.find(e=>e[0]===`title`)?.[1]||``,s=3,c=2,l=(e[i-3]?.content||``).match(/^(\*+)$/),u=[];if(l){c+=1;let e=l[1].length;jx(u,e)}if(o.markup!==`linkify`&&e[i+1].type===`text`&&e[i+1]?.content?.startsWith(`](`)){s+=1;for(let t=i+1;t<e.length;t++){let n=l?l[1].length:e[i-3].markup.length,r=e[t];if(n===1&&r.type===`em_close`||n===2&&r.type===`strong_close`||n===3&&(r.type===`em_close`||r.type===`strong_close`))break;s+=1}}let d=wx({type:`link`,loading:!1,href:r,title:a,text:t,children:[{type:`text`,content:t,raw:t}],raw:String(`[${t}](${r})`)},o.markup?kx(o.markup):`explicit`);if(u.push(d),l){let e=l[1].length;Mx(u,e)}e.splice(i-c,s,...u),i-=u.length+1;continue}if(o.content?.startsWith(`](`)&&e[i-1].markup?.includes(`*`)&&e[i-4]?.type===`text`&&e[i-4].content?.endsWith(`[`)){let t=e[i-1].markup.length,n=[],r=e[i-4].content.slice(0,e[i-4].content.length-t);r&&n.push(Ax(r)),jx(n,t);let a=e[i-2].content||``,s=o.content.slice(2),c=!0;if(e[i+1]?.type===`text`){let t=(e[i+1]?.content??``).indexOf(`)`);c=t===-1,t===-1&&(s+=e[i+1]?.content?.slice(0,t)||``,e[i+1].content=``)}if(n.push(Nx(a,s,c)),Mx(n,t),e[i+1]?.type===`text`){let t=e[i+1].content?.replace(/^\)\**/,``);t&&n.push(Ax(t)),e.splice(i-4,8,...n)}else e[i+1]?.type===`link_open`?e.splice(i-4,10,...n):e.splice(i-4,7,...n);i-=n.length+1;continue}if(o.content?.startsWith(`](`)&&e[i-1].type===`strong_close`&&e[i-4]?.type===`text`&&e[i-4]?.content?.includes(`**[`)){let t=[],n=e[i-4].content.split(`**[`)[0];n&&t.push(Ax(n)),jx(t,2);let r=e[i-2].content||``,a=o.content.slice(2),s=!0;if(e[i+1]?.type===`text`){let t=(e[i+1]?.content??``).indexOf(`)`);s=t===-1,t===-1&&(a+=e[i+1]?.content?.slice(0,t)||``,e[i+1].content=``)}if(t.push(Nx(r,a,s)),Mx(t,2),e[i+1]?.type===`text`){let n=e[i+1].content?.replace(/^\)\**/,``);n&&t.push(Ax(n)),e.splice(i-4,8,...t)}else e[i+1]?.type===`link_open`?e.splice(i-4,10,...t):e.splice(i-4,7,...t);i-=t.length+1;continue}if(o.type===`strong_close`&&e[i+1]?.type===`text`&&e[i+1].content?.includes(`](`)&&e[i-1].type===`text`&&/\[.*$/.test(e[i-1].content||``)){let t=[],[n,r]=e[i-1].content?.split(`[`)||[``,``];n&&t.push(Ax(n)),jx(t,2);let[a,s]=e[i+1].content.split(`](`);a=r+a;let c=4;if(e[i+2]?.type===`link_open`){let t=e[i+2].attrs?.find(e=>e[0]===`href`)?.[1];e[i+5]?.type===`text`&&e[i+5].content===`.`?(s=(t||s)+e[i+5].content,e[i+5].content=``):s=t||s,c+=3}let l=!0;if(o.nesting===-1&&(a=a.replace(/\*+$/,``)),e[i+2]?.type===`text`){let t=(e[i+2]?.content??``).indexOf(`)`);l=t===-1,t===-1&&(s+=e[i+2]?.content?.slice(0,t)||``,e[i+2].content=``)}t.push(Nx(a,s,l)),Mx(t,2),e.splice(i-2,c,...t)}if(o.type===`text`&&/\*+\[[^\]]*$/.test(o.content||``)&&e[i+1]?.type===`strong_open`&&e[i+2]?.type===`text`&&e[i+2].content===`](`&&e[i+3]?.type===`link_open`&&e[i+5]?.type===`link_close`&&e[i+6]?.type===`text`&&e[i+6].content===`)`&&e[i+7]?.type===`strong_close`){let t=(o.content||``).match(/^(\*+)\[(.*)$/);if(t){let n=(t[2]||``)+t[1],r=e[i+3]?.attrs?.find(e=>e[0]===`href`)?.[1]||``;!r&&e[i+4]?.type===`text`&&(r=e[i+4].content||``);let a=[];jx(a,2),a.push(Nx(n,r,!1)),Mx(a,2),e.splice(i,9,...a),i-=a.length-1;continue}}}}if(n)return e;for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n?.type!==`link`||r?.type!==`text`||typeof r.content!=`string`||!r.content.startsWith(`!`))continue;let i=String(n.href??``);if(String(n.text??``)!==i||!i.endsWith(`=`)&&!i.endsWith(`#`))continue;Px(n,`!`);let a=r.content.slice(1);a?(r.content=a,r.raw=a):e.splice(t+1,1)}return e}function Hx(e){e.core.ruler.after(`inline`,`fix_list_item_tokens`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n&&n.type===`inline`&&Array.isArray(n.children))try{n.children=Ux(n.children)}catch(e){console.error(`[applyFixListItem] failed to fix inline children`,e)}}})}function Ux(e){let t=e[e.length-1],n=String(t?.content??``);return t?.type===`text`&&/^\s*\d+\.\s*$/.test(n)&&e[e.length-2]?.tag===`br`&&e.splice(e.length-1,1),e}function Wx(e){e.core.ruler.after(`inline`,`fix_strong_tokens`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n&&n.type===`inline`&&Array.isArray(n.children))try{n.children=Gx(n.children)}catch(e){console.error(`[applyFixStrongTokens] failed to fix inline children`,e)}}})}function Gx(e){let t=0,n=new Set,r=new Set,i=0;for(let a=0;a<e.length;a++){let o=e[a],s=o.type;if(s===`strong_open`){t++;let r=String(o.markup??``),i=a-1;for(;i>=0&&e[i].type===`text`&&e[i].content===``;)i--;let s=e[i],c=a+1;for(;c<e.length&&e[c].type===`text`&&e[c].content===``;)c++;let l=e[c];r===`__`&&(s?.content?.endsWith(`_`)||l?.content?.startsWith(`_`)||l?.markup?.includes(`_`))&&(o.type=`text`,o.tag=``,o.content=r,o.raw=r,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null,n.add(t))}else if(s===`strong_close`)n.has(t)&&o.markup===`__`&&(o.type=`text`,o.content=o.markup,o.raw=String(o.markup??``),o.tag=``,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null),t--,t<0&&(t=0);else if(s===`em_open`){i++;let t=String(o.markup??``),n=a-1;for(;n>=0&&e[n].type===`text`&&e[n].content===``;)n--;let s=e[n],c=a+1;for(;c<e.length&&e[c].type===`text`&&e[c].content===``;)c++;let l=e[c];t===`_`&&(s?.content?.endsWith(`_`)||l?.content?.startsWith(`_`)||l?.markup?.includes(`_`))&&(o.type=`text`,o.tag=``,o.content=t,o.raw=t,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null,r.add(i))}else s===`em_close`&&(r.has(i)&&o.markup===`_`&&(o.type=`text`,o.content=o.markup,o.raw=String(o.markup??``),o.tag=``,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null),i--,i<0&&(i=0))}if(e.length<5)return e;let a=e.length-4,o=e[a],s=[...e],c=e[a+1],l=String(o.content??``);if(o.type===`link_open`&&e[a-1]?.type===`em_open`&&e[a-2]?.type===`text`&&e[a-2].content?.endsWith(`*`)){let t=String(e[a-2].content??``).slice(0,-1),n=[{type:`strong_open`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``},e[a],e[a+1],e[a+2],{type:`strong_close`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``}];t&&n.unshift({type:`text`,content:t,raw:t}),s.splice(a-2,6,...n)}else if(o.type===`text`&&l.endsWith(`*`)&&c.type===`em_open`){let t=e[a+2],n=t?.type===`text`?4:3,r=[{type:`strong_open`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``},{type:`text`,content:t?.type===`text`?String(t.content??``):``,raw:t?.type===`text`?String(t.content??``):``},{type:`strong_close`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``}],i=l.slice(0,-1);i&&r.unshift({type:`text`,content:i,raw:i}),s.splice(a,n,...r)}return s=Kx(s),s}function Kx(e){if(e.length<7)return e;let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=e[n+1],a=e[n+2],o=e[n+3],s=e[n+4],c=e[n+5],l=e[n+6];if(r?.type===`strong_open`&&i?.type===`text`&&a?.type===`strong_close`&&o?.type===`strong_open`&&s?.type===`math_inline`&&c?.type===`strong_close`&&l?.type===`text`){let e=String(l.content??``),a=e.indexOf(`**`);if(a!==-1){let o=e.slice(0,a),u=e.slice(a+2);t.push(r),t.push(i),t.push(s),o&&t.push({...l,type:`text`,content:o,raw:o}),t.push(c),u&&t.push({...l,type:`text`,content:u,raw:u}),n+=6;continue}}if(r?.type===`strong_open`&&i?.type===`text`&&a?.type===`strong_close`&&o?.type===`strong_open`&&s?.type===`math_inline`&&c?.type===`strong_close`){let a=qx(e,n+6);if(a){t.push(r),t.push(i),t.push(s);for(let r=n+6;r<a.index;r++)t.push(e[r]);a.beforeClose&&t.push({...e[a.index],type:`text`,content:a.beforeClose,raw:a.beforeClose}),t.push(c),a.afterClose&&t.push({...e[a.index],type:`text`,content:a.afterClose,raw:a.afterClose}),n=a.index;continue}}t.push(r)}return t}function qx(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.type===`strong_open`)return null;if(t?.type!==`text`)continue;let r=String(t.content??``),i=r.indexOf(`**`);if(i!==-1)return{index:n,beforeClose:r.slice(0,i),afterClose:r.slice(i+2)}}return null}function Jx(e){e.core.ruler.after(`block`,`fix_table_tokens`,e=>{let t=e;try{let e=oS(t.tokens??[],!!t.env?.__markstreamFinal,t.src??``);Array.isArray(e)&&(t.tokens=e)}catch(e){console.error(`[applyFixTableTokens] failed to fix table tokens`,e)}})}function Yx(e){let t=Array.isArray(e)?[...e]:null,n=t?[t[0],t[0]+1]:null;return[{type:`table_open`,tag:`table`,attrs:null,map:t,children:null,content:``,markup:``,info:``,level:0,nesting:1,block:!0,loading:!0,meta:null},{type:`thead_open`,tag:`thead`,attrs:null,block:!0,level:1,map:n,nesting:1,children:null},{type:`tr_open`,tag:`tr`,attrs:null,block:!0,level:2,map:n,nesting:1,children:null}]}function Xx(){return[{type:`tr_close`,tag:`tr`,attrs:null,block:!0,level:2,map:null,nesting:-1,children:null},{type:`thead_close`,tag:`thead`,attrs:null,block:!0,level:1,map:null,nesting:-1,children:null},{type:`table_close`,tag:`table`,attrs:null,map:null,children:null,content:``,markup:``,info:``,level:0,nesting:-1,block:!0,meta:null}]}function Zx(e){return[{type:`th_open`,tag:`th`,attrs:null,block:!0,level:3,map:null,nesting:1,children:null},{type:`inline`,tag:``,children:null,content:e,level:4,attrs:null,map:null,nesting:0,block:!0},{type:`th_close`,tag:`th`,attrs:null,block:!0,level:3,map:null,nesting:-1,children:null}]}function Qx(e,t){if(!e.startsWith(`|`)||e.includes(`
83
+ `)||t&&!e.endsWith(`|`))return null;let n=e.slice(1).split(`|`);return n.at(-1)===``&&n.pop(),n.length>0&&n.every(e=>e.trim().length>0)?n:null}function $x(e){return Qx(e,!0)!==null}function eS(e){return/^:?-+:?$/.test(e.trim())}function tS(e){if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`);return t.at(-1)===``&&t.pop(),t.length>0&&t.every(eS)}function nS(e){return/^(?:[::]-*|:?-+:?)?$/.test(e.trim())}function rS(e){if(e===``)return!0;if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`),n=t.at(-1)??``;return t.slice(0,-1).every(eS)&&nS(n)}function iS(e){return e===`|`||e===`|:`}function aS(e){let t=Qx(e,!0);return t!==null&&t.every(e=>!e.includes(`:`))}function oS(e,t=!1,n=``){if(e.length<3)return e;let r=e.length-2,i=e[r];if(i.type!==`inline`)return e;let a=e[r-1]?.map,o=String(i.content??``),s=o.split(`
84
+ `)[0]??``,[c=``,l=``,...u]=o.split(`
85
+ `),d=!t&&!o.includes(`
86
+ `)&&/\r?\n$/.test(n)&&$x(o),f=null;if(!t&&(o.includes(`
87
+ `)&&u.length===0&&$x(c)&&rS(l)||d)){let t=s.slice(1,-1).split(`|`).map(e=>e.trim()).flatMap(e=>Zx(e)),n=[...Yx(a),...t,...Xx()];f=[...e],f.splice(r-1,3,...n)}else if(o.includes(`
88
+ `)&&u.length===0&&$x(c)&&tS(l)){let t=s.slice(1,-1).split(`|`).map(e=>e.trim()).flatMap(e=>Zx(e)),n=[...Yx(a),...t,...Xx()];f=[...e],f.splice(r-1,3,...n)}else if(o.includes(`
89
+ `)&&u.length===0&&aS(c)&&iS(l))return i.content=o.slice(0,-2),i.children.splice(2,1),e;return f??e}function sS(e,t,n,r){let i=e.length;if(n===`$$`&&r===`$$`){let n=t;for(;n<i-1;){if(e[n]===`$`&&e[n+1]===`$`){let t=n-1,r=0;for(;t>=0&&e[t]===`\\`;)r++,t--;if(r%2==0)return n}n++}return-1}let a=n[n.length-1],o=r,s=0,c=t;for(;c<i;){if(e.slice(c,c+o.length)===o){let t=c-1,n=0;for(;t>=0&&e[t]===`\\`;)n++,t--;if(n%2==0){if(s===0)return c;s--,c+=o.length;continue}}let t=e[c];if(t===`\\`){c+=2;continue}t===a?s++:t===o[o.length-1]&&s>0&&s--,c++}return-1}var cS=sS,lS=[`boldsymbol`,`mathbb`,`mathcal`,`mathfrak`,`mathrm`,`mathit`,`mathsf`,`vec`,`hat`,`bar`,`tilde`,`overline`,`underline`,`mathscr`,`mathnormal`,`operatorname`,`mathbf*`].map(e=>e.replace(/[.*+?^${}()|[\\]"\]/g,`\\$&`)).join(`|`),uS=/\\[a-z]+/i,dS=`(?:\\\\|\\u0008)`,fS=new RegExp(String.raw`${dS}(?:${lS})\s*\{[^}]+\}`,`i`),pS=new RegExp(String.raw`(?:${dS})?(?:${lS})\s*\{`,`i`),mS=/\\(?:text|frac|left|right|times)/,hS=/(?:^|[^+])\+(?!\+)|[=\-*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/,gS=/\b[A-Z]{2,}-[A-Z]{2,}\b/i,_S=/[A-Z]+\s*\([^)]+\)/i,vS=/^\(\s*[a-z](?:\s*,\s*[a-z])+\s*\)$/i,yS=/\b(?:sin|cos|tan|log|ln|exp|sqrt|frac|sum|lim|int|prod)\b/,bS=/\b\d{4}\/\d{1,2}\/\d{1,2}(?:[ T]\d{1,2}:\d{2}(?::\d{2})?)?\b/,xS={"\b":`\\b`,"\v":`\\v`,"\f":`\\f`};function SS(e){let t=``;for(let n of e)t+=xS[n]??n;return t}function CS(e){if(!e)return!1;let t=SS(e),n=t.trim();if(bS.test(n)||n.includes(`**`))return!1;if(n.length>2e3)return!0;let r=uS.test(t),i=fS.test(t),a=pS.test(t),o=mS.test(t),s=/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)_(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t)||/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)\^(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t),c=hS.test(t)&&!gS.test(t),l=_S.test(t),u=vS.test(n),d=yS.test(t),f=/^\([a-z]\)$/i.test(n)||/^(?:[a-z]|pi)$/i.test(n),p=/^(?:[A-Z][a-z]?(?:_\{?\d+\}?|\^\{?\d+\}?)?)+$/.test(n);return r||i||a||o||s||c||l||u||d||f||p}var wS=`__markstreamMathPluginApplied`,TS=80,ES=2e4,DS=24096;function OS(e){return!!e[wS]}function kS(e){e[wS]=!0}var AS=`ldots.cdots.quad.in.displaystyle.int_.lim.lim_.ce.pu.end.infty.perp.mid.operatorname.to.rightarrow.leftarrow.math.mathrm.mathit.mathbb.mathcal.mathfrak.implies.alpha.beta.gamma.delta.epsilon.lambda.sum.sum_.prod.sqrt.fbox.boxed.color.rule.edef.fcolorbox.hline.hdashline.cdot.times.pm.le.ge.neq.sin.cos.tan.log.ln.exp.frac.text.left.right`.split(`.`),jS=[`cdot`,`mathbf{`,`partial`,`mu_{`],MS=AS.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),NS=`[ \r\b\f\v]`,PS=RegExp(`([^\\\\])(${jS.map(e=>e).join(`|`)})+`,`g`),FS=/span\{([^}]+)\}/,IS=/\\operatorname\{span\}\{((?:[^{}]|\{[^}]*\})+)\}/,LS=/(^|[^\\])\\\r?\n/g,RS=/(^|[^\\])\\$/g,zS=/[\p{L}\p{M}\p{N}\p{Pe}\p{Pf}'′″‴|‖]/u,BS=RegExp(`(${NS})|(${MS})\\b`,`g`),VS=new Map,HS=new Map;function US(e){if(!e)return BS;let t=[...e];t.sort((e,t)=>t.length-e.length);let n=t.join(``),r=VS.get(n);if(r)return r;let i=`(?:${t.map(e=>e.replace(/[.*+?^${}()|[\\]\\"\]/g,`\\$&`)).join(`|`)})`,a=RegExp(`(${NS})|(${i})\\b`,`g`);return VS.set(n,a),a}function WS(e,t){let n=e?[]:[...t??[]];e||n.sort((e,t)=>t.length-e.length);let r=e?`__default__`:n.join(``),i=HS.get(r);if(i)return i;let a=e?[lS,MS].filter(Boolean).join(`|`):[n.map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),lS].filter(Boolean).join(`|`),o=RegExp(`(^|[^\\\\\\w])(${a})\\s*\\{`,`g`);return HS.set(r,o),o}var GS={" ":`t`,"\r":`r`,"\b":`b`,"\f":`f`,"\v":`v`};function KS(e){let t=/(^|[^\\])(__|\*\*)/g,n=0;for(;t.exec(e)!==null;)n++;return n}function qS(e){return e.replace(/(^|[^\\])!+/gu,(e,t)=>{if(t&&zS.test(t))return e;let n=t?e.slice(t.length):e;return`${t}${`\\!`.repeat(n.length)}`})}function JS(e){let t=/(^|[^\\])(__|\*\*)/g,n,r=null;for(;(n=t.exec(e))!==null;)r={marker:n[2],index:n.index+(n[1]?.length??0)};return r}function YS(e,t){let n=t?.commands??AS,r=t?.escapeExclamation??!0,i=t?.commands==null,a=US(i?void 0:n),o=e.replace(a,(e,t,r,i,a)=>{if(t!==void 0&&GS[t]!==void 0)return`\\${GS[t]}`;if(r&&n.includes(r)){let t=a&&typeof i==`number`?a[i-1]:void 0;return t===`\\`||t&&/\w/.test(t)?e:`\\${r}`}return e});r&&(o=qS(o));let s=o,c=WS(i,i?void 0:n);return s=s.replace(c,(e,t,n)=>`${t}\\${n}{`),s=s.replace(FS,`span\\{$1\\}`).replace(IS,`\\operatorname{span}\\{$1\\}`),s=s.replace(LS,`$1\\\\
90
+ `),s=s.replace(RS,`$1\\\\`),s=s.replace(PS,`$1\\$2`),s}function XS(e){let t=e.trim();return!(!CS(t)||/"[^"\n]{1,80}"\s*:\s*/.test(t)||!(/\\[a-z]+/i.test(t)||/[=+*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/.test(t)||/[_^]/.test(t))&&/\s-\s/.test(t))}var ZS=new WeakMap;function QS(e){let t=ZS.get(e);if(t)return t;let n=e.src,r=e.env?.__markstreamFinal!==!0,i=[];for(let e=0;e<n.length;e++){let t=n[e];(t===`$`||t===`\\`)&&i.push(e)}return t={codeSpanRanges:eC(n),imageRanges:nC(n,r),mathOpenerPositions:i},ZS.set(e,t),t}function $S(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<t?n=i+1:r=i}return n<e.length}function eC(e){let t=[],n=0;for(;n<e.length;){if(e[n]!=="`"){n++;continue}let r=n,i=1;for(;r+i<e.length&&e[r+i]==="`";)i++;let a=r+i,o=-1;for(;a<e.length;){if(e[a]!=="`"){a++;continue}let t=1;for(;a+t<e.length&&e[a+t]==="`";)t++;if(t===i){o=a;break}a+=t}if(o!==-1){t.push([r,o+i]),n=o+i;continue}n=r+i}return t}function tC(e,t){for(let n of e)if(t>=n[0]&&t<n[1])return n;return null}function nC(e,t=!1){let n=[],r=0;for(;r<e.length-1;){if(e[r]===`!`&&e[r+1]===`[`){let i=r,a=r+2,o=1;for(;a<e.length&&o>0;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}e[a]===`[`?o++:e[a]===`]`&&o--,a++}if(o===0&&a<e.length&&e[a]===`(`){let o=a+1,s=1;for(;o<e.length&&s>0;){if(e[o]===`\\`&&o+1<e.length){o+=2;continue}e[o]===`(`?s++:e[o]===`)`&&s--,o++}if(s===0){n.push([i,o]),r=o;continue}if(t){n.push([i,e.length]),r=e.length;continue}}}r++}return n}function rC(e,t){let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function iC(e,t){let n=t;for(;n<e.length;){let t=e.indexOf(`$`,n);if(t===-1)return-1;if(rC(e,t)){n=t+1;continue}return t}return-1}function aC(e,t){let n=t;for(;n<e.length;){let t=iC(e,n);if(t===-1)return-1;if(t>0&&e[t-1]===`$`||t+1<e.length&&e[t+1]===`$`){n=t+1;continue}return t}return-1}function oC(e,t,n=0){let r=Math.max(0,n);for(;r<e.length;){let n=e.indexOf(t,r);if(n===-1)return-1;if(!rC(e,n))return n;r=n+Math.max(1,t.length)}return-1}function sC(e,t,n=0,r=e.length,i=[]){let a=0,o=Math.max(0,n),s=Math.min(e.length,Math.max(0,r));for(;o<s;){let n=e.indexOf(t,o);if(n===-1||n>=s)break;let r=tC(i,n);if(r){o=Math.max(n+Math.max(1,t.length),r[1]);continue}rC(e,n)||a++,o=n+Math.max(1,t.length)}return a}function cC(e,t,n){let r=uC(String(e??``));if(!r.endsWith(t))return-1;let i=r.length-t.length;if(i<=0||!uC(r.slice(0,i)).trim()||rC(r,i))return-1;let a=eC(r);if(tC(a,i))return-1;let o=sC(r,t,0,i,a);if(t===`$$`){if(o%2==1)return-1}else if(o>sC(r,n,0,i,a))return-1;return i}function lC(e){return e===` `||e===` `}function uC(e){let t=e.length;for(;t>0&&lC(e[t-1]);)t--;return e.slice(0,t)}function dC(e){let t=0;for(let n=0;n<e.length;n++)e[n]===`
91
+ `&&t++;return t}function fC(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57}function pC(e){if(e.length<3)return!1;let t=e[0];if(t!==`-`&&t!==`*`&&t!==`_`&&t!==`=`)return!1;let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i===t){n++;continue}if(!lC(i))return!1}return n>=3}function mC(e){let t=e.trim();if(!t)return!1;let n=0;t[n]===`:`&&n++;let r=0;for(;t[n]===`-`;)r++,n++;return r<3?!1:(t[n]===`:`&&n++,n===t.length)}function hC(e){if(!e.includes(`|`))return!1;let t=e[0]===`|`?e.slice(1):e;return(t.endsWith(`|`)?t.slice(0,-1):t).split(`|`).every(mC)}function gC(e){let t=0;if(!fC(e[t]))return!1;for(;fC(e[t]);)t++;return e[t]!==`.`&&e[t]!==`)`?!1:lC(e[t+1])}function _C(e){let t=e.trimStart();if(!t||t.startsWith("```")||t.startsWith(`~~~`)||t.startsWith(`:::`)||t[0]===`>`||t[0]===`<`)return!0;if(t[0]===`#`){let e=0;for(;t[e]===`#`;)e++;if(e>=1&&e<=6&&lC(t[e]))return!0}return!!((t[0]===`-`||t[0]===`+`||t[0]===`*`)&&lC(t[1])||gC(t)||pC(t)||hC(t))}function vC(e,t){return e?t?`${e}\n${t}`:e:t}function yC(e){let t=String(e??``).trim();return t?CS(t):!1}function bC(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return t.toString(36)}function xC(e,t){if(e.length<=DS)return{source:e,lineOffset:0};if(t){let n=e.length-DS,r=e.indexOf(`
92
+ `,n);r=r===-1?e.length:r+1;let i=t.lineOffset+dC(e.slice(t.windowStart,r));return t.lineOffset=i,t.windowStart=r,{source:e.slice(r),lineOffset:i}}let n=e.length-DS,r=e.indexOf(`
93
+ `,n);n=r===-1?e.length:r+1;let i=dC(e.slice(0,n));return{source:e.slice(n),lineOffset:i}}function SC(e,t){let n=String(e??``);if(!n||!n.includes(`$$`)&&!n.includes(`\\[`))return!1;let{source:r}=xC(n,t);if(!r)return!1;let i=r.split(/\r?\n/),a=Math.max(0,i.length-TS-2),o=[[`$$`,`$$`],[`\\[`,`\\]`]];for(let e=a;e<i.length;e++){let t=uC(i[e]);if(t&&!_C(t)){for(let[e,n]of o)if(cC(t,e,n)!==-1)return!0}}return!1}function CC(e,t){let n=String(e??``);if(!n||!n.includes(`$$`)&&!n.includes(`\\[`))return null;let{source:r,lineOffset:i}=xC(n,t);if(!r)return null;let a=r.split(/\r?\n/),o=Math.max(0,a.length-TS-2),s=[[`$$`,`$$`],[`\\[`,`\\]`]];for(let e=o;e<a.length-1;e++){let t=uC(a[e]);for(let[n,r]of s){let o=cC(t,n,r);if(o===-1)continue;let s=``,c=!1;for(let t=e+1;t<a.length;t++){if(t-e>TS){c=!0;break}let l=a[t],u=oC(l,r);if(u!==-1){let a=vC(s,l.slice(0,u));if(!yC(a)){c=!0;break}let d=l.slice(u+r.length),f=d.trim()?`suffix:${bC(d)}`:`nosuffix`;return[`closed`,n,i+e,o,i+t,u,bC(a),f].join(`:`)}if(_C(l)){c=!0;break}if(s=vC(s,l),s.length>ES){c=!0;break}}if(!c&&yC(s))return[`pending`,n,i+e,o].join(`:`)}}return null}function wC(e,t){let n=String(e??``).trim();return!n||!/^\d[\d,.]*\s*[~~-]\s*$/.test(n)?!1:/\d/.test(String(t??``))}function TC(e){let t=String(e??``).trimStart(),n=t.match(/^\d+(?:,\d{3})*(?:\.\d+)?/);if(!n)return!1;let r=t.slice(n[0].length);return/^\s*(?:[+\-*/^_=<>]|\\[a-z]+)/i.test(r)?!1:r===``||/^[)\s,.!?;:]/.test(r)}function EC(e){let t=String(e??``).trim();return t?/^(?:\.{3,}|…+)$/.test(t):!1}function DC(e,t){kS(e);let n=(e,t,n)=>{let r=String(t??``).replace(/^[\t ]+/,``).replace(/[\t ]+$/,``);if(!r)return;let i=e.push(`paragraph_open`,`p`,1);i.map=[n,n+1];let a=e.push(`inline`,``,0);a.content=r,a.map=[n,n+1],a.children=[],e.push(`paragraph_close`,`p`,-1)},r=(e,n)=>{let r=e,i=!!t?.strictDelimiters,a=!r?.env?.__markstreamFinal,o=(e,t)=>{let n=t;for(;n<e.length&&(e[n]===` `||e[n]===` `);)n++;if(n===t||!(e[n]===`
94
+ `||e[n]===`\r`&&e[n+1]===`
95
+ `))return t;let i=e.slice(t,n),a=r.push(`text`,``,0);return a.content=i,n};if(/^\*[^*]+/.test(r.src))return!1;let s=String(r.pending??``),c=Math.max(0,r.pos-s.length),l=QS(r);if(!$S(l.mathOpenerPositions,c))return!1;if(r.src[r.pos]===`$`){let e=r.pos+1;for(;r.src[e]===`$`;)e++;let t=e-r.pos,n=r.src[e];if(t>=3&&(!n||/\s/.test(n))){let t=r.push(`text`,``,0);return t.content=r.src.slice(r.pos,e),r.pos=e,!0}}let u=[[`$$`,`$$`],[`$`,`$`],[`\\(`,`\\)`]],d=c,f=c,p=c,m=r.src,{codeSpanRanges:h,imageRanges:g}=l;for(let[e,s]of u){let c=!1;e===`$$`&&d!==p&&(d=p);let l=-1,u=-1,_=0,v=n=>{if((n===`undefined`||n==null)&&(n=``),n===`\\`){r.pos+=n.length,d=r.pos;return}if(n===`\\)`||n===`\\(`){let e=r.push(`text_special`,``,0);e.content=n===`\\)`?`)`:`(`,e.markup=n,r.pos+=n.length,d=r.pos;return}if(!n)return;if(e===`$$`&&n.includes(`$`)){let e=0;for(;e<n.length;){let i=iC(n,e);if(i===-1){let t=n.slice(e);if(t){let e=r.push(`text`,``,0);e.content=t,r.pos+=t.length,d=r.pos}break}if(i>0&&n[i-1]===`$`||i+1<n.length&&n[i+1]===`$`){let t=n.slice(e,i+1);if(t){let e=r.push(`text`,``,0);e.content=t,r.pos+=t.length,d=r.pos}e=i+1;continue}let a=n.slice(e,i);if(a){let e=r.push(`text`,``,0);e.content=a,r.pos+=a.length,d=r.pos}let o=aC(n,i+1);if(o===-1){let e=n.slice(i),t=r.push(`text`,``,0);t.content=e,r.pos+=e.length,d=r.pos;break}let s=n.slice(i+1,o),c=s.includes("`"),l=!s||!s.trim(),u=n[o+1],f=wC(s,u),p=EC(s);if(!c&&!l&&!f&&!p){let n=r.push(`math_inline`,`math`,0);n.content=YS(s,t),n.markup=`$`,n.raw=`$${s}$`,n.loading=!1,r.pos+=o-i+1,d=r.pos,e=o+1;continue}let m=r.push(`text`,``,0);m.content=`$`,r.pos+=1,d=r.pos,e=i+1}return}let i=n.indexOf(`![`);if(i!==-1){if(i>0){let e=n.slice(0,i),t=r.push(`text`,``,0);t.content=e,r.pos+=e.length,d=r.pos}let e=n.slice(i).match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(e){let[,t,a]=e,o=a.match(/^(\S+)(?:\s+"([^"]+)")?\s*$/),s=o?o[1]:a,c=o&&o[2]?o[2]:null,l=r.push(`image`,`img`,0);l.attrs=[[`src`,s],[`alt`,t]],c&&l.attrs.push([`title`,c]),l.content=t,l.children=[{type:`text`,content:t,tag:``}],r.pos+=e[0].length,d=r.pos;let u=n.slice(i+e[0].length);u&&v(u);return}let t=r.push(`text`,``,0);t.content=n,r.pos+=n.length,d=r.pos;return}let a=r.push(`text`,``,0);a.content=n,r.pos+=n.length,d=r.pos};for(;!(d>=m.length);){let p=m.indexOf(e,d);if(p===-1)break;if(rC(m,p)){d=p+Math.max(1,e.length);continue}let y=tC(h,p);if(y){d=y[1];continue}let b=tC(g,p);if(b){d=b[1];continue}if(p===l&&d===u){if(_++,_>2){d=p+Math.max(1,e.length);continue}}else _=0,l=p,u=d;if(e===`(`&&p>0){let t=p-1;for(;t>=0&&m[t]===` `;)t--;if(t>=0&&m[t]===`]`){d=p+e.length;continue}}if(e===`$`&&p>0&&m[p-1]===`$`){d=p+1;continue}if(e===`$`&&p<m.length-1&&m[p+1]===`$`){d=p+2;continue}let x=e===`$`?aC(m,p+e.length):cS(m,p+e.length,e,s);if(x===-1){let o=m.slice(p+e.length);if(o.includes(e)){d=m.indexOf(e,p+e.length);continue}if(x===-1){let l=e===`$`&&TC(o);if(a&&!i&&!l&&CS(o)&&!o.includes("`")){if(d=p+e.length,c=!0,!n){r.pending=``;let n=f?m.slice(f,d):m.slice(0,d),i=KS(n)%2==1;if(f)v(m.slice(f,d));else{let t=m.slice(0,d);t.endsWith(e)&&(t=t.slice(0,t.length-e.length)),v(t)}if(i){let i=JS(n)?.marker??`**`,a=r.push(`strong_open`,``,0);a.markup=i;let c=r.push(`math_inline`,`math`,0);c.content=YS(o,t),c.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,c.raw=`${e}${o}${s}`,c.loading=!0,a.content=o,r.push(`strong_close`,``,0)}else{let n=r.push(`math_inline`,`math`,0);n.content=YS(o,t),n.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,n.raw=`${e}${o}${s}`,n.loading=!0}r.pos=m.length}d=m.length,f=d}break}}let S=m.slice(p+e.length,x),C=S.includes("`"),w=!S||!S.trim(),T=e===`$`,E=m[x+s.length],D=T&&wC(S,E),O=T&&EC(S);if(i?C||w||D||O:C||w||D||O||!T&&!CS(S)){d=x+s.length;let e=m.slice(r.pos,d);r.pending||(v(e),f=d);continue}if(c=!0,!n){let n=m.slice(r.pos-(r.pending??``).length,p),i=m.slice(0,d)?m.slice(f,p):n,a=KS(i)%2==1;p!==r.pos&&a&&(i=r.pending+m.slice(r.pos,p));let c=a?JS(i):null,l=c?.marker??`**`;if(r.pending!==i){if(r.pending=``,a){if(c){let e=i.slice(c.index+l.length);v(i.slice(0,c.index));let t=r.push(`strong_open`,``,0);t.markup=l;let n=r.push(`text`,``,0);n.content=e,r.push(`strong_close`,``,0)}else v(i)}else v(i)}if(a){let n=r.push(`strong_open`,``,0);n.markup=l;let i=r.push(`math_inline`,`math`,0);i.content=YS(S,t),i.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,i.raw=`${e}${S}${s}`,i.loading=!1;let a=m.slice(x+s.length).startsWith(l);return a&&r.push(`strong_close`,``,0),r.pos=o(m,x+s.length),d=r.pos,f=d,a||r.push(`strong_close`,``,0),!0}{let n=r.push(`math_inline`,`math`,0);n.content=YS(S,t),n.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,n.raw=`${e}${S}${s}`,n.loading=!1}}return d=o(m,x+s.length),f=d,r.pos=d,!0}if(c){if(n)r.pos=d;else{if(e===`$$`&&d<m.length&&m.slice(d).includes(`$`)){let e=d;for(;!(e>=m.length);){let n=iC(m,e);if(n===-1)break;if(n+1<m.length&&m[n+1]===`$`){e=n+2;continue}if(n>0&&m[n-1]===`$`){e=n+1;continue}let i=aC(m,n+1);if(i===-1)break;let a=m.slice(n+1,i),o=a.includes("`"),s=!a||!a.trim(),c=m[i+1],l=wC(a,c),u=EC(a);if(!o&&!s&&!l&&!u){let o=m.slice(d,n);o&&v(o);let s=r.push(`math_inline`,`math`,0);s.content=YS(a,t),s.markup=`$`,s.raw=`$${a}$`,s.loading=!1,d=i+1,e=i+1}else v(`$`),e=n+1}e<m.length&&v(m.slice(e))}else d<m.length&&v(m.slice(d));r.pos=m.length}return!0}}return!1},i=(e,r,i,a)=>{let o=e,s=!o?.env?.__markstreamFinal,c=t?.strictDelimiters,l=c?[[`\\[`,`\\]`],[`$$`,`$$`]]:[[`\\[`,`\\]`],[`[`,`]`],[`$$`,`$$`]],u=o.bMarks[r]+o.tShift[r],d=o.src.slice(u,o.eMarks[r]).trim(),f=!1,p=``,m=``,h=!1,g=``,_=!1;for(let[e,n]of l)if(d.startsWith(e)){if(e.includes(`[`)){let a=e===`\\[`?d.slice(e.length):``;if(e===`\\[`&&oC(a,n)===-1&&!/^\s*!\[/.test(a)&&!a.includes("`")&&CS(a)){f=!0,p=e,m=n;break}if(t?.strictDelimiters){if(d.replace(`\\`,``)===`[`){if(r+1<i){f=!0,p=e,m=n;break}continue}}else if(d.replace(`\\`,``)===`[`){if(r+1<i){f=!0,p=e,m=n;break}continue}else{let t=o.tokens[o.tokens.length-1];if(t&&t.type===`list_item_open`&&t.mark===`-`&&d.slice(e.length,d.indexOf(`]`)).trim()===`x`)continue;if(d.replace(`\\`,``).startsWith(`[`)&&!d.includes(`](`)){let t=d.indexOf(`]`);if(d.slice(t).trim()!==`]`)continue;let r=d.slice(e.length,t);if(e===`[`?XS(r):CS(r)){f=!0,p=e,m=n;break}continue}}}else{f=!0,p=e,m=n;break}}else if((e===`$$`||e===`\\[`)&&d.endsWith(e)&&r+1<i){let t=cC(d,e,n);if(t===-1)continue;g=uC(d.slice(0,t)),_=!0;let i=o.bMarks[r+1]+o.tShift[r+1];d=o.src.slice(i,o.eMarks[r+1]).trim(),h=!0,f=!0,p=e,m=n;break}if(!f)return!1;if(a&&!_)return!0;let v=d.indexOf(p),y=v+p.length,b=!c&&p===`[`?d.indexOf(`\\]`,y):-1,x=b>=0?`\\]`:m,S=b>=0?b:oC(d,m,y);if(!h&&S>p.length){let e=d.slice(v+p.length,S),t=o.push(`math_block`,`math`,0);t.content=YS(e),t.markup=p===`$$`?`$$`:p===`[`?`[]`:`\\[\\]`,t.map=[r,r+1],t.raw=`${p}${e}${x}`,t.block=!0,t.loading=!1,o.line=r+1;let i=d.slice(S+x.length);return i.trim()&&n(o,i,r),!0}let C=r,w=``,T=!1,E=``,D=r,O=h?d:d===p?``:d.slice(p.length),k=!c&&p===`\\[`?`]`:``,A=oC(O,m);if(A!==-1){let e=A;w=O.slice(0,e),E=O.slice(e+m.length),D=h?r+1:r,T=!0,C=D}else for(O&&!h&&(w=O),C=r+1;C<i;C++){let e=o.bMarks[C]+o.tShift[C],t=o.eMarks[C],n=o.src.slice(e,t),r=n.trim();if(!c&&p===`[`&&r===`\\]`){m=`\\]`,T=!0;break}if(k&&n.trim()===k){m=k,T=!0;break}if(r===m){T=!0;break}if(!c&&p===`[`&&n.includes(`\\]`)){T=!0;let e=n.indexOf(`\\]`);m=`\\]`;let t=n.slice(0,e);t&&(w+=(w?`
96
+ `:``)+t),E=n.slice(e+m.length),D=C;break}if(oC(n,m)!==-1){T=!0;let e=oC(n,m),t=n.slice(0,e);t&&(w+=(w?`
97
+ `:``)+t),E=n.slice(e+m.length),D=C;break}w+=(w?`
98
+ `:``)+n}if((!s||c)&&!T)return!1;let j=/^\s*!\[/.test(w);if(!(_?!j&&yC(w):p===`$$`?!j:p===`[`?XS(w):CS(w)))return!1;if(a)return!0;g&&n(o,g,r);let ee=o.push(`math_block`,`math`,0);return ee.content=YS(w),ee.markup=p===`$$`?`$$`:p===`[`?`[]`:`\\[\\]`,ee.raw=`${p}${w}${w.startsWith(`
99
+ `)?`
100
+ `:``}${m}`,ee.map=[r,C+1],ee.block=!0,ee.loading=!T,o.line=C+1,E.trim()&&n(o,E,D),!0};e.inline.ruler.before(`escape`,`math`,r),e.block.ruler.before(`lheading`,`explicit_math_block`,(e,t,n,r)=>{let a=e,o=a.bMarks[t]+a.tShift[t],s=a.src.slice(o,a.eMarks[t]).trim();return!s.startsWith(`$$`)&&!s.startsWith(`\\[`)?!1:i(e,t,n,r)},{alt:[`paragraph`,`reference`,`blockquote`,`list`]}),e.block.ruler.before(`paragraph`,`math_block`,i,{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function OC(e){let t=e.renderer.rules.image||function(e,t,n,r,i){let a=e,o=i;return o.renderToken?o.renderToken(a,t,n):``};e.renderer.rules.image=(e,n,r,i,a)=>{let o=e;return o[n].attrSet?.(`loading`,`lazy`),t(o,n,r,i,a)},e.renderer.rules.fence=e.renderer.rules.fence||((t,n)=>{let r=t[n],i=String(r.info??``).trim();return`<pre class="${i?`language-${e.utils.escapeHtml(i.split(/\s+/g)[0])}`:``}"><code>${e.utils.escapeHtml(String(r.content??``))}</code></pre>`})}var kC=/^<a[>\s]/i,AC=/^<\/a\s*>/i;function jC(e,t){if(e?.type!==`inline`)return!1;let n=e.children;if(!Array.isArray(n)||n.length===0)return t.test(String(e.content??``));let r=0;for(let e=n.length-1;e>=0;e--){let i=n[e];if(i?.type===`link_close`){for(e--;e>=0&&n[e]?.level!==i.level&&n[e]?.type!==`link_open`;)e--;continue}if(i?.type===`html_inline`){let e=String(i.content??``);kC.test(e)&&r>0&&r--,AC.test(e)&&r++}if(!(r>0)&&i?.type===`text`&&t.test(String(i.content??``)))return!0}return!1}function MC(e){let t=e.core?.ruler,n=t.getNamedRules?.().find(e=>e.name===`linkify`)?.fn;typeof n==`function`&&t.at(`linkify`,e=>{if(!e.md?.options?.linkify)return;let t=Array.isArray(e.tokens)?e.tokens:[],r=e.md.linkify;if(!r)return;let i=t.filter(e=>jC(e,r));if(i.length)return n(Object.assign(Object.create(Object.getPrototypeOf(e)),e,{tokens:i}))})}function NC(e){let t=e.inline.ruler,n=t.getNamedRules?.(),r=n?.find(e=>e.name===`link`)?.fn,i=n?.find(e=>e.name===`image`)?.fn;if(typeof r!=`function`||typeof i!=`function`)return;let a=e.validateLink,o=e;o.__markstreamOriginalValidateLink=a,t.at(`link`,(...e)=>{let t=e[0].md,n=t?.validateLink===a?t.options?.validateLink:t?.validateLink;if(!t||typeof n!=`function`)return r(...e);let i=t.validateLink;t.validateLink=n;try{return r(...e)}finally{t.validateLink=i}}),t.at(`image`,(...e)=>{let t=e[0].md;if(!t)return i(...e);let n=t.validateLink;t.validateLink=a;try{return i(...e)}finally{t.validateLink=n}})}function PC(e={}){let t=e.markdownItOptions??{},n=typeof t.experimental==`object`&&t.experimental!==null?t.experimental:{},r=!Object.prototype.hasOwnProperty.call(t,`stream`)||!!t.stream,i=Object.prototype.hasOwnProperty.call(t,`validateLink`),a={stream:r,...n},o=new iy({html:!0,linkify:!0,typographer:!0,...t,experimental:a}),s=`streamTailLocalPostBlockRules`;if(!(Object.prototype.hasOwnProperty.call(t,s)||Object.prototype.hasOwnProperty.call(n,s))&&Object.prototype.hasOwnProperty.call(o.options,s)&&(o.options[s]=!0),!i){let e=e=>!Ny(e,{tagName:`a`,attrName:`href`});Ex(e),o.set({validateLink:e})}return NC(o),MC(o),(e.enableMath??!0)&&DC(o,{...e.mathOptions??{}}),(e.enableContainers??!0)&&By(o),e.enableFixIndentedCodeBlock!==!1&&wb(o),Bx(o),Wx(o),Hx(o),Jx(o),OC(o),Sb(o,{customHtmlTags:e.customHtmlTags}),o}var FC=new Map;function IC(e,t){let n=t?`${e}:::${t}`:e,r=FC.get(n);if(!r&&(r=new RegExp(e,t),FC.set(n,r),FC.size>200)){let e=Array.from(FC.keys()).slice(0,50);for(let t of e)FC.delete(t)}return r.lastIndex=0,r}var LC=/\S/,RC=/^(?:<!doctype\s+html[^>]*>\s*)?<html(?:\s[^>]*)?>/i,zC=/<\/html>\s*$/i,BC=/^<\s*[!?]/,VC=/^([A-Z][\w:-]*)/i,HC=/\/\s*>$/;function UC(e){let t=e.search(LC);if(t===-1||e.charCodeAt(t)!==60)return null;let n=e.trim();if(!n)return null;let r=RC.test(n),i=zC.test(n);return!r||!i?null:[{type:`html_block`,tag:`html`,raw:e,content:e,loading:!1}]}function WC(e){let t=e.raw;if(typeof t==`string`)return t;let n=e.content;return typeof n==`string`?n:``}function GC(e,t){if(e.type!==`html_block`||!t)return!1;let n=String(e.raw??e.content??``);return IC(String.raw`^\s*<\s*\/\s*${Vy(t)}\s*>\s*$`,`i`).test(n)}var KC=new Set([`iframe`,`script`,`style`,`textarea`,`title`]);function qC(e,t,n){if(!e||!t)return null;let r=t.toLowerCase(),i=t=>{if(e.startsWith(`<!--`,t)){let n=e.indexOf(`-->`,t+4);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}if(e.startsWith(`<![CDATA[`,t)){let n=e.indexOf(`]]>`,t+9);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}let n=Hy(e,t);if(n===-1)return null;let r=n+1,i=e.slice(t,r);if(BC.test(i))return{closing:!1,end:r,selfClosing:!1,tag:``};let a=i.slice(1).trimStart(),o=a.startsWith(`/`);o&&(a=a.slice(1).trimStart());let s=a.match(VC);return s?.[1]?{closing:o,end:r,selfClosing:HC.test(i),tag:s[1].toLowerCase()}:{closing:!1,end:t+1,selfClosing:!1,tag:``}},a=(t,n)=>{let r=IC(String.raw`<\s*\/\s*${Vy(t)}(?=\s|>)`,`gi`);r.lastIndex=n;let a=r.exec(e);if(!a||a.index==null)return null;let o=i(a.index);return o?{start:a.index,end:o.end}:null},o=-1,s=-1,c=Math.max(0,n);for(;c<e.length;){let t=e.indexOf(`<`,c);if(t===-1)return null;let n=i(t);if(!n)return null;if(!n.closing&&n.tag===r){o=t,s=n.end-1;break}if(!n.closing&&KC.has(n.tag)){c=a(n.tag,n.end)?.end??e.length;continue}c=n.end}if(o===-1||s===-1)return null;let l=e.slice(o,s+1);if(my.has(r)||HC.test(l))return{raw:l,start:o,end:s+1,closed:!0};if(KC.has(r)){let t=a(r,s+1);return t?{raw:e.slice(o,t.end),start:o,end:t.end,closeStart:t.start,closed:!0}:{raw:e.slice(o),start:o,end:e.length,closed:!1}}let u=1,d=s+1;for(;d<e.length;){let t=e.indexOf(`<`,d);if(t===-1)return{raw:e.slice(o),start:o,end:e.length,closed:!1};let n=i(t);if(!n)return null;if(n.closing&&n.tag===r){u--;let r=n.end;if(u===0)return{raw:e.slice(o,r),start:o,end:r,closeStart:t,closed:!0};d=r;continue}if(!n.closing&&n.tag===r){!n.selfClosing&&!my.has(n.tag)&&u++,d=n.end;continue}if(!n.closing&&KC.has(n.tag)){d=a(n.tag,n.end)?.end??e.length;continue}d=n.end}return{raw:e.slice(o),start:o,end:e.length,closed:!1}}function JC(e,t){if(!t)return 0;let n=0,r=0;for(;n<e.length&&r<t.length;){if(e[n]===t[r]){n++,r++;continue}if(e[n]===`\r`||e[n]===`
101
+ `){n++;continue}return-1}return r===t.length?n:-1}function YC(e,t,n){return n?e:`${e.replace(/<[^>]*$/,``)}\n</${t}>`}function XC(e){return e.replace(/\r\n/g,`
102
+ `).replace(/(^|\n)[ \t]{1,4}/g,`$1`)}function ZC(e,t,n){return n?e.includes(n,t)?!0:XC(e.slice(Math.max(0,t))).includes(XC(n)):!1}function QC(e,t){let n=Math.max(0,t);for(;n<e.length&&(e[n]===` `||e[n]===` `);)n++;return e[n]===`\r`?(n++,e[n]===`
103
+ `&&n++,n):e[n]===`
104
+ `?n+1:t}function $C(e,t){let n=IC(String.raw`<\s*\/\s*${Vy(t)}(?=\s|>)`,`gi`),r=-1,i;for(;(i=n.exec(e))!==null;)r=i.index;return r}var ew=/^\s*(?:<!--|<!|<\?)/,tw=/^\s*<([A-Z][\w:-]*)/i,nw=/\/\s*>$/,rw=/<[^>]*$/;function iw(e,t,n){let r=t.toLowerCase(),i=IC(String.raw`^<\s*${r}(?=\s|>|/)`,`i`),a=IC(String.raw`^<\s*\/\s*${r}(?=\s|>)`,`i`),o=0,s=Math.max(0,n);for(;s<e.length;){let t=e.indexOf(`<`,s);if(t===-1)return-1;let n=e.slice(t);if(a.test(n)){let e=Hy(n);if(e===-1)return-1;if(o===0)return t+e+1;o--,s=t+e+1;continue}if(i.test(n)){let e=Hy(n);if(e===-1)return-1;let r=n.slice(0,e+1);nw.test(r)||o++,s=t+e+1;continue}s=t+1}return-1}function aw(e){let t=String(e.content??``);if(ew.test(t))return{type:`html_block`,content:t,raw:t,tag:``,loading:!1};let n=(t.match(tw)?.[1]||``).toLowerCase();if(!n)return{type:`html_block`,content:t,raw:t,tag:``,loading:!1};let r=Hy(t),i=r===-1?t:t.slice(0,r+1),a=r!==-1&&nw.test(i),o=my.has(n),s=Uy(i),c=(r===-1?-1:iw(t,n,r+1))!==-1,l=!(o||a||c);return{type:`html_block`,content:l?`${t.replace(rw,``)}\n</${n}>`:t,raw:t,tag:n,attrs:s.length?s:void 0,loading:l}}function ow(e,t,n){let r=Eb(n)?n.sourceLineMapper:void 0;if(!r)return{startLine:e,endLine:t};let i=r(e),a=t>e?r(t-1).endLine:r(t).startLine;return{startLine:i.startLine,endLine:Math.max(i.startLine,a)}}function sw(e,t){let n=Math.max(0,Math.min(e.length,Math.trunc(t))),r=0;for(let t=0;t<n;t++)e[t]===`
105
+ `&&r++;return r}function cw(e,t,n){let r=Math.max(0,Math.min(e.length,Math.trunc(t))),i=Math.max(r,Math.min(e.length,Math.trunc(n))),a=sw(e,r),o=sw(e,i);return i>r&&e[i-1]!==`
106
+ `&&o++,{startLine:a,endLine:o}}function lw(e,t,n,r){let i=cw(e,t,n);return ow(i.startLine,i.endLine,r)}function uw(e,t){let n=e?.map;if(!Array.isArray(n)||n.length<2)return null;let r=Number(n[0]),i=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(i)?null:ow(r,i,t)}function dw(e,t,n){if(!n?.includeSourceMap)return e;let r=uw(t,n);if(!r)return e;if(e.sourceMap=r,e.type===`code_block`){let t=e;t.startLine=r.startLine,t.endLine=r.endLine}return e}function fw(e,t,n,r){if(!r?.includeSourceMap)return e;let i=t?.map;if(!Array.isArray(i)||i.length<2)return e;let a=Number(i[0]),o=Number(i[1]),s=Number(n);return!Number.isFinite(a)||!Number.isFinite(o)||!Number.isFinite(s)||(e.sourceMap=ow(a,Math.max(o,s),r)),e}function pw(e){let t=Object.assign(Object.create(Object.getPrototypeOf(e)),e);return Array.isArray(e.attrs)&&(t.attrs=e.attrs.map(e=>[...e])),Array.isArray(e.map)&&(t.map=[...e.map]),Array.isArray(e.children)&&(t.children=e.children.map(e=>pw(e))),t}function mw(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function hw(e,t,n){for(let r of Reflect.ownKeys(e)){let i=Object.getOwnPropertyDescriptor(e,r);if(!i||!(`value`in i))continue;let a=Object.getOwnPropertyDescriptor(t,r);(!a||`value`in a&&a.writable!==!1)&&(t[r]=gw(i.value,n))}}function gw(e,t=new WeakMap){if(!e||typeof e!=`object`)return e;let n=e,r=t.get(n);if(r)return r;if(Array.isArray(e)){let r=[];t.set(n,r);for(let n of e)r.push(gw(n,t));return r}if(e instanceof Map){let r=new Map;t.set(n,r);for(let[n,i]of e)r.set(gw(n,t),gw(i,t));return r}if(e instanceof Set){let r=new Set;t.set(n,r);for(let n of e)r.add(gw(n,t));return r}if(e instanceof Date){let r=new Date(e.getTime());return t.set(n,r),r}if(e instanceof RegExp){let r=new RegExp(e.source,e.flags);return r.lastIndex=e.lastIndex,t.set(n,r),r}if(typeof URL<`u`&&e instanceof URL){let r=new URL(e.href);return t.set(n,r),hw(n,r,t),r}if(typeof URLSearchParams<`u`&&e instanceof URLSearchParams){let r=new URLSearchParams(e.toString());return t.set(n,r),hw(n,r,t),r}if(e instanceof Error){let r,i=e.constructor;try{r=new i(e.message)}catch{r=Error(e.message)}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),t.set(n,r),hw(n,r,t),r}if(typeof Promise<`u`&&e instanceof Promise||typeof Node<`u`&&e instanceof Node)return t.set(n,e),e;if(!mw(e)){let r=Object.create(Object.getPrototypeOf(e));return t.set(n,r),hw(n,r,t),r}let i={};t.set(n,i);let a=e;for(let e of Object.keys(a))i[e]=gw(a[e],t);return i}function _w(e,t){for(let n=0;n<t.length;n++){let r=Object.getOwnPropertyDescriptor(e,t[n]);if(t[n]===`__proto__`||!r||!(`value`in r)||r.writable!==!0||r.configurable!==!0)return!1}return!0}function vw(e,t=!0){if(!t)return pw(e);let n=Reflect.ownKeys(e),r=Object.keys(e);if(n.length===r.length&&_w(e,r))try{return yw(e,r,t)}catch{return bw(e,t)}return bw(e,t)}function yw(e,t,n){let r=Object.getPrototypeOf(e),i={},a=new WeakMap,o=e.children,s=e.attrs,c=e.map,l=e;for(let e=0;e<t.length;e++){let r=t[e],u=l[r];if(r===`children`&&Array.isArray(o)){let e=Array(o.length);for(let t=0;t<o.length;t++)e[t]=vw(o[t],n);i[r]=e}else if(r===`attrs`&&Array.isArray(s)){let e=Array(s.length);for(let t=0;t<s.length;t++){let n=s[t];e[t]=[n[0],n[1]]}i[r]=e}else i[r]=r===`map`&&Array.isArray(c)?[c[0],c[1]]:n&&u&&typeof u==`object`?gw(u,a):u}return Object.setPrototypeOf(i,r),i}function bw(e,t=!0){let n=Object.create(Object.getPrototypeOf(e)),r=new WeakMap;for(let i of Reflect.ownKeys(e)){let a=Object.getOwnPropertyDescriptor(e,i);if(!a)continue;if(!(`value`in a)){Object.defineProperty(n,i,a);continue}let o=a.value,s=o;i===`attrs`&&Array.isArray(o)?s=o.map(e=>[...e]):i===`map`&&Array.isArray(o)?s=[...o]:i===`children`&&Array.isArray(o)?s=o.map(e=>vw(e,t)):t&&o&&typeof o==`object`&&(s=gw(o,r)),Object.defineProperty(n,i,{...a,value:s})}return n}function xw(e,t=!0){return e.map(e=>vw(e,t))}function Sw(e,t){let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function Cw(e){return e===` `||e===` `}function ww(e,t){return t===` `?e+1:e+4-e%4}function Tw(e){let t=0,n=0;for(;t<e.length&&Cw(e[t]);)n=ww(n,e[t]),t++;return{index:t,column:n}}function Ew(e){let t=Tw(e);return t.column>3?null:t}function Dw(e){let t=Ew(e);if(!t)return null;let n=t.index,r=e[n];if(r!=="`"&&r!==`~`)return null;let i=n;for(;i<e.length&&e[i]===r;)i++;let a=i-n;if(a<3)return null;let o=e.slice(i);return r==="`"&&o.includes("`")?null:{markerChar:r,markerLen:a,rest:o}}function Ow(e){let t=Ew(e);if(!t)return null;let n=e.slice(t.index),r=/^(?:[-+*]|\d{1,9}[.)])(?=[\t ]|$)/.exec(n)?.[0];if(!r)return null;let i=t.index+r.length,a=t.column+r.length;if(!Cw(e[i]))return null;for(;i<e.length&&Cw(e[i]);)a=ww(a,e[i]),i++;return{content:e.slice(i),contentIndent:a}}function kw(e){let t=e,n=!1;for(;;){let e=Ew(t);if(!e)return n?t:null;let r=e.index;if(t[r]!==`>`)return n?t:null;n=!0,r++,(t[r]===` `||t[r]===` `)&&r++,t=t.slice(r)}}function Aw(e){let t=Dw(e);if(t)return{...t,inBlockquote:!1,inList:!1,listIndent:0};let n=kw(e),r=n==null?null:Dw(n);if(r)return{...r,inBlockquote:!0,inList:!1,listIndent:0};let i=Ow(e);if(!i)return null;let a=Dw(i.content);return a==null?null:{...a,inBlockquote:!1,inList:!0,listIndent:i.contentIndent}}function jw(e,t,n){let r=t;for(;r<e.length&&e[r]===n;)r++;return r-t}function Mw(e,t,n){let r=t;for(;r<e.length;){let t=e.indexOf("`",r);if(t===-1)return-1;let i=jw(e,t,"`");if(i===n)return t;r=t+i}return-1}var Nw=[`$`,`\\[`],Pw=/(^|\r?\n)[\t ]*:::[\t ]*(?:warning|info|note|tip|danger|caution|error)(?=[\t ]|\r?\n|$)[^\r\n]*(?:\r?\n[\t ]*)*$/;function Fw(){return{fenceChar:``,fenceInBlockquote:!1,fenceInList:!1,fenceLen:0,fenceListIndent:0,inDollarMath:!1,inFence:!1,inMath:!1,listContentIndent:null,dollarMathOpenOffset:null,mathOpenOffset:null}}function Iw(e){return{...e}}function Lw(e,t,n,r=Yw(t).state,i={lineOffset:0,windowStart:0}){e.tolerantMathBoundary={explicitBracketMath:r,source:t,key:n,pendingCandidate:n===null&&SC(t,i),scanWindow:i}}function Rw(e){return e.endsWith(`$`)||e.endsWith(`\\`)}function zw(e){let t=Math.max(e.lastIndexOf(`
107
+ `)+1,0),n=e.slice(t).replace(/[\t ]+$/,``);return Nw.some(e=>n.endsWith(e))}function Bw(e,t){return t?!!(t.includes(`$$`)||t.includes(`\\[`)||e.endsWith(`$`)&&t[0]===`$`||e.endsWith(`\\`)&&t[0]===`[`||zw(e)&&/[\r\n]/.test(t)):!1}function Vw(e,t){let n=!1,r=``,i=0,a=!1,o=!1,s=0,c=null,l=0;for(;l<t;){let u=e.indexOf(`
108
+ `,l),d=u===-1||u>=t?t:u,f=e.slice(l,d),p=f.endsWith(`\r`)?f.slice(0,-1):f,m=Tw(p),h=Ow(p);n&&a&&p.trim()&&kw(p)==null&&(n=!1,r=``,i=0,a=!1,o=!1,s=0),n&&o&&p.trim()&&m.column<s&&!h&&(n=!1,r=``,i=0,a=!1,o=!1,s=0),h?c=h.contentIndent:p.trim()&&c!=null&&m.column<c&&!n&&(c=null);let g=Aw(p);if(g&&(n?g.markerChar===r&&g.markerLen>=i&&/^\s*$/.test(g.rest)&&(n=!1,r=``,i=0,a=!1,o=!1,s=0):(n=!0,r=g.markerChar,i=g.markerLen,a=g.inBlockquote,o=g.inList||c!=null&&!g.inBlockquote&&m.column>=c,s=g.listIndent||c||0)),u===-1||u>=t)break;l=u+1}return n}function Hw(e,t){let n=e=>e===` `||e===` `,r=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},i=e=>{if(e[0]!==`<`)return null;let t=1;for(;t<e.length&&n(e[t]);)t++;let i=e[t]===`/`;if(i)for(t++;t<e.length&&n(e[t]);)t++;let a=t;for(;t<e.length&&r(e[t]);)t++;if(t===a)return null;let o=e.slice(a,t).toLowerCase();if(!hy.has(o))return null;let s=e[t];if(s&&s!==` `&&s!==` `&&s!==`>`&&s!==`/`)return null;let c=Hy(e);if(c===-1)return null;let l=c-1;for(;l>=0&&n(e[l]);)l--;return{closing:i,tag:o,selfClosing:!i&&e[l]===`/`,after:e.slice(c+1)}},a=(e,t)=>{let r=e.toLowerCase(),i=0;for(;i<r.length;){let e=r.indexOf(`</`,i);if(e===-1)return!1;for(i=e+2;i<r.length&&n(r[i]);)i++;if(r.startsWith(t,i)){let e=r[i+t.length];if(!e||e===` `||e===` `||e===`>`)return!0}}return!1},o=[],s=!1,c=!1,l=!1,u=0;for(;u<t;){let n=e.indexOf(`
109
+ `,u),r=n===-1||n>=t?t:n,d=e.slice(u,r),f=d.endsWith(`\r`)?d.slice(0,-1):d,p=Ew(f);if(p){let e=f.slice(p.index);if(s)s=!e.includes(`-->`);else if(c)c=!e.includes(`>`);else if(l)l=!e.includes(`?>`);else if(e.startsWith(`<!--`))s=!e.includes(`-->`);else if(e.startsWith(`<?`))l=!e.includes(`?>`);else if(e.startsWith(`<!`))c=!e.includes(`>`);else{let t=i(e);if(t){if(t.closing){for(let e=o.length-1;e>=0;e--)if(o[e]===t.tag){o.length=e;break}}else t.selfClosing||a(t.after,t.tag)||o.push(t.tag)}}}if(n===-1||n>=t)break;u=n+1}return s||c||l||o.length>0}function Uw(e,t,n){if(!n?.length)return!1;let r=new Set(qy(n));if(!r.size)return!1;let i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>e===` `||e===` `,o=e=>{if(e[0]!==`<`)return null;let t=1;for(;t<e.length&&a(e[t]);)t++;let n=e[t]===`/`;if(n)for(t++;t<e.length&&a(e[t]);)t++;let o=t;for(;t<e.length&&i(e[t]);)t++;if(t===o)return null;let s=e.slice(o,t).toLowerCase();if(!r.has(s))return null;let c=e[t];if(c&&c!==` `&&c!==` `&&c!==`>`&&c!==`/`)return null;let l=e.indexOf(`>`,t);if(l===-1)return null;let u=l-1;for(;u>=0&&a(e[u]);)u--;return{closing:n,tag:s,selfClosing:!n&&e[u]===`/`,after:e.slice(l+1)}},s=(e,t)=>{let n=e.toLowerCase(),r=0;for(;r<n.length;){let e=n.indexOf(`</`,r);if(e===-1)return!1;for(r=e+2;r<n.length&&a(n[r]);)r++;if(n.startsWith(t,r)){let e=n[r+t.length];if(!e||e===` `||e===` `||e===`>`)return!0}}return!1},c=[],l=0;for(;l<t;){let n=e.indexOf(`
110
+ `,l),r=n===-1||n>=t?t:n,i=e.slice(l,r),a=i.endsWith(`\r`)?i.slice(0,-1):i,u=Ew(a);if(u){let e=o(a.slice(u.index));if(e){if(e.closing){for(let t=c.length-1;t>=0;t--)if(c[t]===e.tag){c.length=t;break}}else e.selfClosing||s(e.after,e.tag)||c.push(e.tag)}}if(n===-1||n>=t)break;l=n+1}return c.length>0}function Ww(e,t){let n=Pw.exec(e);if(!n)return null;let r=n[1]??``,i=n.index+r.length,a=e.indexOf(`
111
+ `,i),o=e.slice(i,a===-1?e.length:a);return!Ew(o.endsWith(`\r`)?o.slice(0,-1):o)||Vw(e,i)||Hw(e,i)||Uw(e,i,t)?null:`${e.slice(0,n.index)}${r}`}function Gw(e){e.inFence=!1,e.fenceChar=``,e.fenceLen=0,e.fenceInBlockquote=!1,e.fenceInList=!1,e.fenceListIndent=0}function Kw(e,t,n,r,i){let a=0,o=!1;for(;a<e.length;){let s=a;if(t.inMath){if(e.startsWith(`\\]`,a)&&!Sw(e,s)){r!=null&&i&&n+a+2>r&&(o=!0),t.inMath=!1,t.mathOpenOffset=null,a+=2;continue}a++;continue}if(t.inDollarMath){if(e.startsWith(`$$`,a)&&!Sw(e,s)){r!=null&&i&&n+a+2>r&&(o=!0),t.inDollarMath=!1,t.dollarMathOpenOffset=null,a+=2;continue}a++;continue}if(e[a]==="`"&&!Sw(e,s)){let t=jw(e,a,"`"),n=Mw(e,a+t,t);if(n===-1)break;a=n+t;continue}if(e.startsWith(`\\[`,a)&&!Sw(e,s)){t.inMath=!0,t.mathOpenOffset=n+a,a+=2;continue}if(e.startsWith(`$$`,a)&&!Sw(e,s)){t.inDollarMath=!0,t.dollarMathOpenOffset=n+a,a+=2;continue}a++}return o}function qw(e,t,n=!0){let r=t.markdownIt;if(!OS(r))return e;let i=n?t.pendingExplicitMathTail:void 0,a=i?.source===e?i.state:i&&t.sourceExtends(i.source,e)?Xw(i.state,e.slice(i.source.length),i.source.length-i.state.lineBuffer.length).state:Yw(e).state;n&&(t.pendingExplicitMathTail={source:e,state:a});let{context:o}=a,s=o.inMath?o.mathOpenOffset:o.inDollarMath?o.dollarMathOpenOffset:null;if(s==null)return e;let c=e.slice(s+2),l=e.lastIndexOf(`
112
+ `,s-1)+1;if(e.slice(l,s).trim()!==``&&!/^\r?\n/.test(c)||/^\s*!\[/.test(c))return e;let u=c.trim(),d=/^(?:[a-z]|pi)$/i.test(u);return CS(c)&&!d?e:e.slice(0,s)}function Jw(e,t,n,r,i){let a=Tw(e),o=Ow(e);if(t.inFence&&t.fenceInBlockquote&&e.trim()&&kw(e)==null&&Gw(t),t.inFence&&t.fenceInList&&e.trim()&&a.column<t.fenceListIndent&&!o&&Gw(t),o?t.listContentIndent=o.contentIndent:e.trim()&&t.listContentIndent!=null&&a.column<t.listContentIndent&&!t.inFence&&(t.listContentIndent=null),!t.inMath&&!t.inDollarMath){let o=Aw(e);if(o)t.inFence?o.markerChar===t.fenceChar&&o.markerLen>=t.fenceLen&&/^\s*$/.test(o.rest)&&Gw(t):(t.inFence=!0,t.fenceChar=o.markerChar,t.fenceLen=o.markerLen,t.fenceInBlockquote=o.inBlockquote,t.fenceInList=o.inList||t.listContentIndent!=null&&!o.inBlockquote&&a.column>=t.listContentIndent,t.fenceListIndent=o.listIndent||t.listContentIndent||0);else if(!t.inFence)return Kw(e,t,n,r,i)}else return Kw(e,t,n,r,i);return!1}function Yw(e,t=Fw(),n=null,r=!1,i=0){let a=Iw(t),o=Iw(t),s=``,c=!1,l=0;for(;l<e.length;){let t=e.indexOf(`
113
+ `,l),u=t!==-1,d=u&&t>l&&e[t-1]===`\r`?t-1:u?t:e.length,f=e.slice(l,d);Jw(f,a,i+l,n,r)&&(c=!0),u?(o=Iw(a),s=``):s=f,l=u?t+1:e.length}return{closedOpenMath:c,state:{committedContext:o,context:a,lineBuffer:s}}}function Xw(e,t,n=0){return t&&!e.context.inMath&&!e.context.inDollarMath&&!e.context.inFence&&!e.committedContext.inFence&&!/[\\$`~\r\n]/.test(t)&&(!e.lineBuffer.endsWith(`\\`)||t[0]!==`[`&&t[0]!==`]`)?{closedOpenMath:!1,state:{committedContext:Iw(e.committedContext),context:Iw(e.context),lineBuffer:e.lineBuffer+t}}:Yw(e.lineBuffer+t,e.committedContext,n+e.lineBuffer.length,e.context.inMath||e.context.inDollarMath,n)}function Zw(e,t){let n=e.markdownIt;if(!OS(n)||typeof n.stream?.reset!=`function`)return;let r=e.tolerantMathBoundary;if(r?.source===t)return;let i=r?e.sourceExtends(r.source,t):!1,a=i&&r?t.slice(r.source.length):``,o=i&&r?Xw(r.explicitBracketMath,a,r.source.length-r.explicitBracketMath.lineBuffer.length):Yw(t),s=o.state,c=i&&r?o.closedOpenMath:!1;if(r&&i&&r.key===null&&r.pendingCandidate===!1&&!c&&!Bw(r.source,a)&&!Rw(t)){r.source=t,r.explicitBracketMath=s;return}let l=i&&r?r.scanWindow:{lineOffset:0,windowStart:0},u=CC(t,l);(r&&(r&&!i||r.key!==u||c)||!r&&u)&&e.resetStreamOnly(),Lw(e,t,u,s,l)}function Qw(e){let t=e.tolerantMathBoundary;return typeof t?.key==`string`&&t.key.startsWith(`pending:`)}function $w(e){let t=!1,n=``,r=0,i=!1,a=!1,o=!1,s=0,c=(e,s)=>{let c=Aw(e);if(c){t?c.markerChar===n&&c.markerLen>=r&&/^\s*$/.test(c.rest)&&(t=!1,n=``,r=0):(t=!0,n=c.markerChar,r=c.markerLen);return}if(t)return;let l=0;for(;l<e.length;){if(i){e.startsWith(`$$`,l)&&!Sw(e,l)?(i=!1,l+=2):l++;continue}if(a){e.startsWith(`\\]`,l)&&!Sw(e,l)?(a=!1,l+=2):l++;continue}let t=e[l];if(t==="`"){let t=jw(e,l,"`"),n=Mw(e,l+t,t);if(n===-1)break;l=n+t;continue}if(t===`\\`){let t=e[l+1];t===`[`&&!Sw(e,l)?(a=!0,l+=2):(t===`]`&&Sw(e,l),l+=2);continue}if(t===`$`){if(e[l+1]===`$`&&!Sw(e,l)){i=!0,o=!1,l+=2;continue}if(o){o=!1,l++;continue}let t=e[l+1];(t===void 0||t!==` `&&t!==` `&&!/\d/.test(t))&&(o=!0),l++;continue}l++}};return{scanTo:t=>{for(;s<t;){let n=e.indexOf(`
114
+ `,s),r=n===-1||n>=t?t:n,i=r>s&&e[r-1]===`\r`?r-1:r;if(c(e.slice(s,i),s),n===-1||n>=t){s=t;break}o=!1,s=n+1}},inMath:()=>i||a||o}}function eT(){return typeof performance<`u`?performance.now():Date.now()}function tT(e,t){let n=t.__markstreamFinal===!0?`final`:`streaming`,r=e.streamParseEnvs.get(n);r||(r={},e.streamParseEnvs.set(n,r));for(let e of Object.keys(r))Object.prototype.hasOwnProperty.call(t,e)||delete r[e];return Object.assign(r,t),r}function nT(e,t){let n=e.markdownIt,r=n.stream,i=t.streamParse??`auto`;return t.disableStreamParse!==!0&&n.__markstreamHasCustomParserExtensions===!1&&(i===!0||i===`auto`&&t.final!==!0)&&r?.enabled===!0&&typeof r.parse==`function`}function rT(e,t){let n=e.markdownIt,r=t.streamParse??`auto`,i=n.stream;return t.final===!0&&r===`auto`&&t.disableStreamParse!==!0&&n.__markstreamHasCustomParserExtensions===!1&&i?.enabled===!0&&typeof i.reset==`function`}function iT(e,t){return rT(e,t)?(e.resetForFinalAutoParse(),!0):!1}function aT(e){return typeof e.preTransformTokens==`function`||typeof e.postTransformTokens==`function`}function oT(e,t){let n=e?.map,r=t?.map;return n===r?!0:!Array.isArray(n)||!Array.isArray(r)?!1:n.length===r.length&&n.every((e,t)=>e===r[t])}function sT(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.markup===t.markup&&e.content===t.content&&oT(e,t)}function cT(e,t){return e[t]?.type===`paragraph_open`&&e[t+1]?.type===`inline`&&e[t+2]?.type===`paragraph_close`}function lT(e){for(let t=0;t+5<e.length;t++)if(cT(e,t)&&cT(e,t+3)&&sT(e[t],e[t+3])&&sT(e[t+1],e[t+4])&&sT(e[t+2],e[t+5]))return!0;return!1}function uT(e,t,n){return OS(e)&&SC(t)&&lT(n)}function dT(e){return e.topLevelStreamParseMode}function fT(e,t,n,r,i){let a=e.markdownIt;if(r.customHtmlTags?.length&&(n.__markstreamCustomHtmlTags=r.customHtmlTags),!nT(e,r))return r.isFragment||(e.topLevelStreamParseMode=`sync`),a.parse(t,n);if(Zw(e,t),Qw(e))return e.topLevelStreamParseMode=`sync`,a.parse(t,n);e.markStreamParseStarted();let o=a.stream.parse(t,tT(e,n));if(uT(a,t,o))return e.resetStreamOnly(),e.topLevelStreamParseMode=`sync`,a.parse(t,n);if(e.topLevelStreamParseMode=a.stream?.stats?.()?.lastMode??`stream`,!aT(r))return o;if(!i?.recordTokenCloneMs)return xw(o,!0);let s=eT(),c=xw(o,!0);return i.recordTokenCloneMs(eT()-s),c}var pT=new Set([`code_inline`,`em_close`,`em_open`,`emoji`,`hardbreak`,`html_block`,`html_inline`,`image`,`ins_close`,`ins_open`,`link`,`link_close`,`link_open`,`mark_close`,`mark_open`,`math_inline`,`s_close`,`s_open`,`softbreak`,`strong_close`,`strong_open`,`sub`,`sup`,`text`]),mT=new Map([[`paragraph_open`,`paragraph_close`],[`heading_open`,`heading_close`],[`bullet_list_open`,`bullet_list_close`],[`ordered_list_open`,`ordered_list_close`],[`blockquote_open`,`blockquote_close`],[`table_open`,`table_close`]]),hT=new Set([`code_block`,`fence`,`hr`,`html_block`,`inline`,`math_block`]);function gT(e,t){return e.every(e=>{if(!pT.has(e.type)||(e.type===`link`||e.type===`link_open`||e.type===`link_close`)&&!Dx(t))return!1;if(e.type===`link`){let t=Tx(e);if(t!==`explicit`&&t!==`linkify`&&t!==`autolink`)return!1}if(e.type===`link_open`||e.type===`link_close`){let t=e.markup??``;if(t!==``&&t!==`linkify`&&t!==`autolink`)return!1}let n=e.children;return!Array.isArray(n)||gT(n,t)})}function _T(e){let t=mT.get(e);if(t)return t;let n=/^container_(.+)_open$/.exec(e);return n?`container_${n[1]}_close`:void 0}function vT(e,t,n=0){let r=[],i=!1,a=n;for(;a<e.length;){let n=e[a];if(!n||n.level!==0)return null;let o=_T(n.type),s=a+1;if(o){if(n.nesting!==1)return null;for(;s<e.length;){let t=e[s];if(t.level===0){if(t.type!==o||t.nesting!==-1)return null;s++;break}s++}if(e[s-1]?.type!==o)return null;if(n.type===`paragraph_open`||n.type===`heading_open`){if(s!==a+3||e[a+1]?.type!==`inline`)return null}else i=!0}else if(hT.has(n.type)){if(n.nesting!==0)return null;i=!0}else return null;for(let n=a;n<s;n++){let r=e[n];if(r.type!==`inline`)continue;let i=r.children;if(!Array.isArray(i)||!gT(i,t))return null}r.push(a),a=s}return{mixed:i,starts:r}}function yT(e){return/\r?\n[\t ]*\r?\n[\t ]*$/.test(e)}function bT(e){return e.reuseStableTopLevelNodes===!0&&e.final!==!0&&!e.preTransformTokens&&!e.postTransformTokens&&!e.postTransformNodes&&!e.customHtmlTags?.length&&e.includeSourceMap!==!0}function xT(e,t){let n=e?.map,r=t?.map;return n===r?!0:!Array.isArray(n)||!Array.isArray(r)?!1:n.length===r.length&&n.every((e,t)=>e===r[t])}function ST(e,t){let n=e?.attrs,r=t?.attrs;if(n===r)return!0;if(!Array.isArray(n)||!Array.isArray(r)||n.length!==r.length)return!1;for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t[0]!==i[0]||t[1]!==i[1])return!1}return!0}function CT(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.level===t.level&&e.markup===t.markup&&e.content===t.content&&e.info===t.info&&xT(e,t)&&ST(e,t)}function wT(e,t,n,r,i,a,o,s=0,c){let l=r.starts;if(l.length===0||i.length!==l.length){e.structuredStream=void 0;return}let u=l.map((e,t)=>{let r=l[t+1]??n.length;return{firstToken:n[e],lastToken:n[r-1],tokenCount:r-e}}),d=r.mixed?Math.max(0,l.length-1):yT(t)?l.length:Math.max(0,l.length-1),f=d-s-1,p=f>=0?o?.[f]:c;e.structuredStream={groupBoundaries:u,groupStarts:l,tokenCount:n.length,tokens:n,mixed:r.mixed,source:t,nodes:i,linkifyDemotionContext:p,stableGroupCount:d,requireClosingStrong:a.requireClosingStrong,validateLink:a.validateLink}}function TT(e,t,n,r){if(e.tokens===t)return!0;let i=n.length-1;for(let a=0;a<r;a++){let r=n[a],o=n[a+1]??t.length,s=e.groupBoundaries[a];if(!s||s.tokenCount!==o-r||(s.firstToken!==t[r]||s.lastToken!==t[o-1])&&(a>=i||!CT(s.firstToken,t[r])||!CT(s.lastToken,t[o-1])))return!1}return!0}function ET(e,t,n,r,i){let a=r.disableStructuredReuse,o=nT(e,r)&&bT(r);if(r.isFragment||(e.structuredReuseTailStart=void 0),!o)return a||(e.structuredStream=void 0),i.processTokens(n,r);if(a)return i.processTokens(n,r);let s=e.structuredStream,c=dT(e),l=!!s&&(c===`append`||c===`tail`)&&s.tokenCount!==void 0&&s.tokenCount<=n.length&&n===s.tokens,u;if(l){let e=vT(n,r.validateLink,s.tokenCount);u=e?{starts:s.groupStarts.concat(e.starts),mixed:s.mixed||e.mixed}:vT(n,r.validateLink)}else u=vT(n,r.validateLink);if(!u)return e.structuredStream=void 0,i.processTokens(n,r);let d=u.starts,f=s&&u.mixed?Math.min(s.stableGroupCount,Math.max(0,s.groupBoundaries.length-1)):s?.stableGroupCount??0;if(s&&f>0&&s.requireClosingStrong===r.requireClosingStrong&&s.validateLink===r.validateLink&&e.sourceExtends(s.source,t)&&d.length>=f&&(c===`append`||c===`tail`)&&TT(s,n,d,f)){let a=d[f]??n.length,o={...r,linkifyDemotionSeedContext:s.linkifyDemotionContext},c=i.processTokens(n.slice(a),o),l=d.length-f;if(c.length===l){let a=s.nodes.slice(0,f).concat(c);return e.structuredReuseTailStart=f,i.recordReusedTopLevelNodes?.(f),wT(e,t,n,u,a,r,o.linkifyDemotionResultContexts,f,s.linkifyDemotionContext),a}}let p=i.processTokens(n,r);return wT(e,t,n,u,p,r,r.linkifyDemotionResultContexts),p}function DT(e){if(e.type!==`html_block`||String(e.tag??``).toLowerCase()!==`details`)return!1;let t=String(e.raw??e.content??``);return/^\s*<details\b/i.test(t)}function OT(e){if(e.type!==`html_block`)return!1;let t=String(e.raw??e.content??``);return/^\s*<\/details\b/i.test(t)}function kT(e,t){return kb(e,{final:t,requireClosingStrong:e.requireClosingStrong,customHtmlTags:e.customHtmlTags,validateLink:e.validateLink},{disableStreamParse:!0,disableStructuredReuse:!0,isFragment:!0})}var AT=new Set([`admonition`,`blockquote`,`code_block`,`definition_list`,`footnote`,`heading`,`list`,`math_block`,`table`,`thematic_break`]),jT=/(?:^|\n)\s{0,3}(?:#{1,6}\s+\S|[-+*]\s+\S|\d+[.)]\s+\S|>\s*\S|`{3,}|~{3,}|(?:\*{3,}|-{3,}|_{3,})(?:\s|$)|\|.*\|)/m,MT=/(?:^|\n)(?: {4}|\t)(?![ \t]*<)\S/m;function NT(e){return/\n\s*\n/.test(e)||jT.test(e)||MT.test(e)}function PT(e){if(e.length===0)return!1;if(e.some(e=>AT.has(String(e?.type??``).toLowerCase()))||e.some(e=>{if(e?.type!==`html_block`)return!1;let t=e;return Array.isArray(t.children)&&t.children.length>0})||e.length>1)return!0;let[t]=e;return!!(t&&t.type===`paragraph`)}function FT(e){let t=[],n=0;for(;n<e.length;){for(;/\s/.test(e[n]??``);)n++;if(n>=e.length)break;let r=e.slice(n).match(/^<([A-Z][\w:-]*)/i);if(!r?.[1])return null;let i=qC(e,r[1],n);if(!i||i.start!==n)return null;t.push(i.raw),n=i.end}return t.length>1?t:null}function IT(e,t,n){return e.trim()?t.parseFragment(e,n):[]}function LT(e,t,n,r,i){let a=n.customHtmlTags?.join(`\0`)??``,o=n.runtime,s=i?o?.siblingHtmlChildren:void 0,c=s&&s.final===r&&s.customHtmlTags===a&&s.requireClosingStrong===n.requireClosingStrong&&s.validateLink===n.validateLink,l=e.map((e,r)=>c&&s.blocks[r]===e?s.children[r]:IT(e,t,n));return i&&o&&(o.siblingHtmlChildren={blocks:e,children:l,customHtmlTags:a,final:r,requireClosingStrong:n.requireClosingStrong,validateLink:n.validateLink}),l.flat()}function RT(e,t,n,r){return e.map(e=>{if(e?.type!==`html_block`)return e;let i=e,a=String(i.tag??``).toLowerCase();if(!a||a===`details`||by.has(a)||Array.isArray(i.children))return e;let o=String(e.raw??i.content??``);if(!o)return e;let s=Hy(o);if(s===-1)return e;let c=qC(o,a,0),l=c?.closeStart??-1,u=c?.closed===!0&&l>=s+1,d=u?o.slice(s+1,l):o.slice(s+1);if(!d.trim()||!NT(d))return e;let f=kT(n,r),p=u?null:FT(d),m=!n.isFragment&&typeof n.preTransformTokens!=`function`&&typeof n.postTransformTokens!=`function`&&typeof n.postTransformNodes!=`function`&&t.markdownIt.__markstreamHasCustomParserExtensions===!1&&Dx(n.validateLink),h=p?LT(p,t,f,r,m):IT(d,t,f);return PT(h)&&(i.children=h),e})}function zT(e,t=0){for(let n=t;n<e.length;n++)if(e[n]?.type===`html_block`)return!0;return!1}function BT(e,t,n){let r=IT(e,t,n),i=r[0];return r.length===1&&i?.type===`paragraph`&&Array.isArray(i.children)?i.children:r}function VT(e,t,n){let r=aw({content:e}),i=Hy(e),a=$C(e,`summary`);if(i!==-1&&a!==-1&&a>=i+1){let o=BT(e.slice(i+1,a),t,n);o.length>0&&(r.children=o)}return r.raw=e,r}function HT(e,t,n){let r=Hy(e);if(r===-1)return[];let i=e.slice(r+1);if(!i.trim())return[];let a=qC(i,`summary`,0);if(!a)return IT(i,t,n);let o=i.slice(0,a.start),s=i.slice(a.end);return[...IT(o,t,n),VT(a.raw,t,n),...IT(s,t,n)]}function UT(e,t,n,r,i,a=0){let o=[],s=a;for(let a=0;a<e.length;a++){let c=e[a],l=WC(c),u=-1;if(l&&(u=t.indexOf(l,s),u!==-1&&(s=u+l.length)),!DT(c)){o.push(c);continue}let d=String(c.raw??WC(c)??``),f=u===-1?t.indexOf(d,Math.max(0,s-d.length)):u;if(f===-1){o.push(c);continue}let p=1,m=-1;for(let t=a+1;t<e.length;t++){let n=e[t];if(DT(n)){p++;continue}if(OT(n)&&(p--,p===0)){m=t;break}}let h=qC(t,`details`,f),g=m===-1&&h?.closed===!0,_=g?(()=>{let e=$C(d,`details`);return e===-1?d:d.slice(0,e)})():d,v=m===-1?`</details>`:String(e[m].raw??WC(e[m])??`</details>`),y=g||m!==-1&&h?.closed===!0,b=v.replace(/[\t\r\n ]+$/,``),x=y?(()=>{let e=(h?.raw??``).lastIndexOf(b);return e===-1?t.length:f+e})():t.length,S=Hy(d),C=S===-1?f+d.length:f+S+1,w=t.slice(C,x===-1?t.length:x),T=x+b.length,E=y?Math.max(x+v.length,QC(t,T)):t.length,D=y?t.slice(x,E):v,O=y?t.slice(f,E):t.slice(f),k=bT(r)&&(r.runtime?.structuredReuseTailStart??0)>0?r.runtime?.detailsStitchCache:void 0,A=k?.get(c);if(A&&A.openRaw===d&&A.explicitClose===y&&A.closeSliceEnd===E&&A.middleSource===w){if(o.push(A.node),s=y?E:t.length,m===-1&&!g)break;m!==-1&&(a=m);continue}let[j]=UT(g?[]:m===-1?e.slice(a+1):e.slice(a+1,m),t,n,r,i,f+d.length),ee=HT(_,n,kT(r,i)),te=j,M=j[0];if(!ee.some(e=>{let t=e;return t?.type===`html_block`&&String(t.tag??``).toLowerCase()===`summary`})){if(M?.type===`html_block`&&String(M.tag??``).toLowerCase()===`summary`&&!Array.isArray(M.children))te=[VT(String(M.raw??M.content??``),n,kT(r,i)),...j.slice(1)];else if(S!==-1){let e=qC(t,`summary`,f+S+1);if(e&&e.closed){let a=t.slice(f+S+1,e.start);/^[\t \r\n]*$/.test(a)&&(ee=[VT(e.raw,n,kT(r,i)),...ee])}}}let N=n.markdownIt.parse(w,{__markstreamFinal:i}),P=n.markdownIt.renderer.render(N,n.markdownIt.options,{__markstreamFinal:i}),F=S===-1?d:t.slice(f,f+S+1),I={...c,tag:`details`,attrs:Uy(d.slice(0,S+1)),raw:O,content:`${F}${P}${D}`,children:[...ee,...te],loading:!i&&!y};if(r.includeSourceMap&&(I.sourceMap=lw(t,f,y?E:t.length,r)),k&&y&&k.set(c,{openRaw:d,explicitClose:y,closeSliceEnd:E,middleSource:w,node:I}),o.push(I),s=y?E:t.length,m===-1&&!g)break;m!==-1&&(a=m)}return[o,s]}function WT(e,t,n,r,i,a=0){if(!n)return e;let o=e.slice(),s=a;for(let e=0;e<o.length;e++){let a=o[e],c=WC(a),l=c?n.indexOf(c,s):-1;if(a?.type!==`html_block`){l!==-1&&(s=l+c.length);continue}let u=String(a.tag??``).toLowerCase();if(!u)continue;if(u===`details`){l!==-1&&(s=l+c.length);continue}let d=qC(n,u,l===-1?s:l);if(!d)continue;s=d.end;let f=String(a.content??c),p=String(a.raw??f),m=l+p.length;if(l!==-1&&d.end<m&&n.slice(l,m)===p){s=m,i?.includeSourceMap&&(a.sourceMap=lw(n,l,m,i));continue}let h=YC(d.raw,u,d.closed),g=!t&&!d.closed,_=f!==h||p!==d.raw||!!a.loading!==g,v=Hy(d.raw),y=v===-1?``:d.raw.slice(0,v+1),b=y?Uy(y):[];if(a.content=h,a.raw=d.raw,a.loading=g,a.attrs=b.length?b:void 0,i?.includeSourceMap&&(a.sourceMap=lw(n,d.start,d.end,i)),!_)continue;let x=JC(d.raw,p);x===-1&&(x=0);let S=e+1;for(;S<o.length;){if(d.closed&&GC(o[S],u)){o.splice(S,1);continue}let e=WC(o[S]);if(!e)break;let t=d.raw.indexOf(e,x);if(t===-1){if(ZC(n,d.end,e))break;let t=r.getInternalNodeSourceRange(o[S]);if(!t)break;if(t.start>=d.start&&t.end<=d.end){o.splice(S,1);continue}break}x=t+e.length,o.splice(S,1)}}return o}function GT(e){let t=e.meta??{};return{type:`checkbox`,checked:t.checked===!0,raw:t.checked?`[x]`:`[ ]`}}function KT(e){let t=e,n=t.attrGet?t.attrGet(`checked`):void 0,r=n===``||n===`true`;return{type:`checkbox_input`,checked:r,raw:r?`[x]`:`[ ]`}}function qT(e){let t=String(e.content??``);return{type:`emoji`,name:t,markup:String(e.markup??``),raw:`:${t}:`}}function JT(e,t,n,r,i=!1){let a=``,o=t+1,s=1,c=[];for(;o<e.length;){if(e[o].type===n){if(s===1)break;s--}r&&e[o].type===r&&s++;let t=e[o];a+=String(i?e[o].content??t.text??``:e[o].content??``),c.push(e[o]),o++}return{content:a,innerTokens:c,nextIndex:o<e.length?o+1:e.length}}function YT(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=JT(e,t,`em_close`,void 0,!0);return i.push(...n(o,void 0,void 0,r)),{node:{type:`emphasis`,children:i,raw:`*${a}*`},nextIndex:s}}function XT(e){return IC(`(?:^|\\r\\n|\\n|\\r) {0,3}${e}+[ \\t]*$`)}var ZT=[`diff `,`index `,`--- `,`+++ `,`@@ `],QT=/\r?\n/;function $T(e){let t=String(e??``);return t?ZT.some(e=>e.startsWith(t)||t.startsWith(e)):!1}function eE(e,t,n,r){n.length>0&&e.push(...n),r.length>0&&t.push(...r),n.length=0,r.length=0}function tE(e,t){return!t&&e.startsWith(` `)&&!e.startsWith(` `)?` ${e}`:e}function nE(e,t){let n=[],r=[],i=[],a=[],o=e.split(QT),s=/\r?\n$/.test(e),c=o.some(e=>e.startsWith(`diff `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`@@ `)),l=e=>{let t=e;if(!ZT.some(e=>t.startsWith(e))){if(t.startsWith(`-`)){let e=t.slice(1);i.push(tE(e,c))}else if(t.startsWith(`+`)){let e=t.slice(1);a.push(tE(e,c))}else{eE(n,r,i,a);let e=c&&t.startsWith(` `)?t.slice(1):t;n.push(e),r.push(e)}}},u=s?Math.max(0,o.length-1):o.length;for(let e=0;e<u;e++){let n=o[e]??``;(t||s||e!==u-1||!$T(n))&&l(n)}(t||i.length>0||a.length>0)&&eE(n,r,i,a);let d=n.join(`
115
+ `),f=r.join(`
116
+ `);return{original:t&&s&&d?`${d}\n`:d,updated:t&&s&&f?`${f}\n`:f}}function rE(e){let t=Array.isArray(e.map)&&e.map.length===2,n=e.meta??{},r=typeof n.closed==`boolean`?n.closed:void 0,i=r===!0||r!==!1&&t,a=String(e.info??``),o=a.startsWith(`diff`),s=o?(()=>{let e=a,t=e.indexOf(` `);return t===-1?``:String(e.slice(t+1)??``)})():a,c=String(e.content??``);if(!i&&e.markup){let t=e.markup[0],n=XT(t);n.test(c)&&(c=c.replace(n,``))}if(o){let{original:e,updated:n}=nE(c,i===!0);return{type:`code_block`,language:s,code:String(n??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1||!t,originalCode:e,updatedCode:n}}return{type:`code_block`,language:s,code:String(c??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1||!t}}function iE(e){let t=e.meta??{};return{type:`footnote_reference`,id:String(t.label??``),raw:`[^${String(t.label??``)}]`}}function aE(){return{type:`hardbreak`,raw:`\\
117
+ `}}function oE(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=JT(e,t,`mark_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`highlight`,children:i,raw:`==${a}==`},nextIndex:s}}function sE(e){let t=e?.customHtmlTags;if(!Array.isArray(t)||t.length===0)return gy;let n=new Set(gy);for(let e of qy(t))e&&n.add(e);return n}var cE=null,lE=new WeakMap;function uE(){return cE||={customTagSet:null,allowedTagSet:sE()},cE}function dE(e){let t=e.match(/^<\s*(?:\/\s*)?([\w-]+)/);return t?t[1].toLowerCase():``}function fE(e){return/^<\s*\//.test(e)}function pE(e,t){return/\/\s*>\s*$/.test(t)||my.has(e)}function mE(e){if(!e||e.length===0)return uE();let t=lE.get(e);if(t)return t;let n=e.map(Ky).filter(Boolean);if(!n.length){let t=uE();return lE.set(e,t),t}let r={customTagSet:new Set(n),allowedTagSet:sE({customHtmlTags:e})};return lE.set(e,r),r}function hE(e){let t=e,n=t.raw??t.content??t.markup??``;return String(n??``)}function gE(e){let t=e.meta,n=t?.markstreamCustomHtmlRaw,r=t?.markstreamCustomHtmlInner;return typeof n==`string`&&typeof r==`string`?{raw:n,inner:r}:null}function _E(e,t){let n=t.toLowerCase();for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function vE(e,t,n){let r=e.slice();return _E(r,`href`)||r.push([`href`,t]),n!=null&&!_E(r,`title`)&&r.push([`title`,n]),r}function yE(e){return e.map(hE).join(``)}function bE(e){let t=[],n=e=>{let n=String(e??``);if(!n)return;let r=t[t.length-1];if(r?.type===`text`){r.content=`${r.content}${n}`,r.raw=`${r.raw}${n}`;return}t.push({type:`text`,content:n,raw:n})};for(let r of e)if(r){if(r.type===`reference`||r.type===`footnote_reference`){n(String(r.raw??``));continue}if(`children`in r&&Array.isArray(r.children)){t.push({...r,children:bE(r.children)});continue}t.push(r)}return t}function xE(e,t,n){let r=0;for(let i=t;i<e.length;i++){let t=e[i];if(t.type!==`html_inline`)continue;let a=String(t.content??``),o=dE(a),s=fE(a),c=pE(o,a);if(!s&&!c&&o===n){r++;continue}if(s&&o===n){if(r===0)return i;r--}}return-1}function SE(e,t,n){let r=[e[t]],i=[],a=t+1,o=!1,s=n?xE(e,t+1,n):-1;return s===-1?(i=e.slice(t+1),i.length&&r.push(...i),a=e.length):(i=e.slice(t+1,s),r.push(...i,e[s]),a=s+1,o=!0),{closed:o,html:yE(r),innerTokens:i,nextIndex:a}}function CE(e,t,n,r,i,a,o){let s=String(e.content??``),c=dE(s),{customTagSet:l,allowedTagSet:u}=mE(o?.customHtmlTags);if(!c)return[{type:`inline_code`,code:s,raw:s},n+1];if(!u.has(c)&&!SE(t,n,c).closed){let t=hE(e);return[{type:`text`,content:t,raw:t},n+1]}if(c===`br`)return[{type:`hardbreak`,raw:s},n+1];let d=fE(s),f=pE(c,s);if(d)return[{type:`html_inline`,tag:c,content:s,children:[],raw:s,loading:!1},n+1];if(c===`a`){let e=SE(t,n,c),l=Uy(s),u=e.innerTokens,d=String(_E(l,`href`)??``),f=_E(l,`title`),p=f==null?null:String(f),m=vE(l,d,p),h=bE(u.length?r(u,i,a,o):[]),g=u.length?yE(u):d||``;return!h.length&&g&&h.push({type:`text`,content:g,raw:g}),[{type:`link`,href:d,title:p,text:g,attrs:m,children:h,loading:!e.closed,raw:e.html||s},e.nextIndex]}if(f)return[{type:l?.has(c)?c:`html_inline`,tag:c,content:s,children:[],raw:s,loading:!1},n+1];let p=SE(t,n,c);if(c===`p`||c===`div`)return[{type:`paragraph`,children:bE(p.innerTokens.length?r(p.innerTokens,i,a,o):[]),raw:p.html},p.nextIndex];let m=bE(p.innerTokens.length?r(p.innerTokens,i,a,o):[]),h=p.html||s,g=!p.closed,_=!1;if(!p.closed){let e=`</${c}>`;h.toLowerCase().includes(e.toLowerCase())||(h+=e),_=!0,g=!0}let v=[],y=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,b;for(;(b=y.exec(s))!==null;){let e=b[1],t=b[2]||b[3]||b[4]||``;v.push([e,t])}if(l?.has(c)){let t=gE(e);return[{type:c,tag:c,attrs:v,content:t?t.inner:p.innerTokens.length?yE(p.innerTokens):``,children:p.innerTokens.length?r(p.innerTokens,i,a,o):[],raw:t?.raw??h,loading:e.loading||g,autoClosed:_},p.nextIndex]}return[{type:`html_inline`,tag:c,attrs:v,content:h,children:m,raw:h,loading:g,autoClosed:_},p.nextIndex]}function wE(e){let t=String(e.content??``);return{type:`inline_code`,code:t,raw:t}}function TE(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=JT(e,t,`ins_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`insert`,children:i,raw:`++${String(a)}++`},nextIndex:s}}function EE(e){if(e.type===`math_inline`){if(e.raw)return String(e.raw);let t=e.markup===`$$`?`$$`:`$`;return`${t}${String(e.content??``)}${t}`}return Array.isArray(e.children)&&e.children.length>0?e.children.map(e=>EE(e)).join(``):String(e.content??``)}function DE(e){return!e||!Array.isArray(e.children)||e.children.length===0?``:e.children.map(e=>EE(e)).join(``)}function OE(e,t=!1){let n=e.attrs??[],r=null;if((!n||n.length===0)&&Array.isArray(e.children))for(let t of e.children){let e=t.attrs;if(Array.isArray(e)&&e.length>0){n=e,r=t;break}}let i=String(n.find(e=>e[0]===`src`)?.[1]??``),a=n.find(e=>e[0]===`alt`)?.[1],o=DE(r??e),s=``;o?s=o:a!=null&&String(a).length>0?s=String(a):r?.content!=null&&String(r.content).length>0?s=String(r.content):Array.isArray(r?.children)&&r.children[0]?.content?s=String(r.children[0].content):Array.isArray(e.children)&&e.children[0]?.content?s=String(e.children[0].content):e.content!=null&&String(e.content).length>0&&(s=String(e.content));let c=n.find(e=>e[0]===`title`)?.[1]??null,l=c===null?null:String(c),u=String(e.content??``);return{type:`image`,src:i,alt:s,title:l,raw:u,loading:t}}function kE(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){let e=n?.[0];e&&t.push([String(e),String(n?.[1]??``)])}return t}function AE(e,t){let n=t.toLowerCase();for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function jE(e,t,n){let r=e.slice();return AE(r,`href`)||r.push([`href`,t]),n!=null&&!AE(r,`title`)&&r.push([`title`,n]),r}function ME(e,t,n,r){let i=e[t],a=kE(i.attrs),o=String(AE(a,`href`)??``),s=AE(a,`title`),c=s==null?null:String(s),l=jE(a,o,c),u=t+1,d=[],f=!0;for(;u<e.length&&e[u].type!==`link_close`;)d.push(e[u]),u++;e[u]?.type===`link_close`&&(f=!1);let p=d,m=d[d.length-1];if(Eb(r)&&r.insideStrong&&m?.type===`text`&&String(m.content??``).endsWith(`**`)&&!d.some(e=>e.type===`strong_open`)){let e=String(m.content??``),t=String(m.raw??e),n=pw(m);n.content=e.slice(0,-2),n.raw=t.replace(/\*\*$/,``),p=d.slice(),p[p.length-1]=n}let h=n(p,void 0,void 0,r),g=h.map(e=>{let t=e;return`content`in e?String(t.content??``):String(t.raw??``)}).join(``);return{node:{type:`link`,href:o,title:c,text:g,children:h,raw:String(`[${g}](${o}${c?` "${c}"`:``})`),loading:f,attrs:l},nextIndex:u<e.length?u+1:e.length}}var NE=/\\([\\()[\]`$|*_\-!])/g,PE=new Set([`\\`,`(`,`)`,`[`,`]`,"`",`$`,`|`,`*`,`_`,`-`,`!`]),FE=1,IE=2,LE=4,RE=8,zE=16,BE=32,VE=64,HE=128,UE=256,WE=512,GE=1024,KE=1982;function qE(e){let t=0;for(let n=0;n<e.length;n++)switch(e.charCodeAt(n)){case 33:t|=HE;break;case 36:t|=UE;break;case 40:t|=GE;break;case 42:t|=IE;break;case 91:t|=BE;break;case 92:t|=FE;break;case 93:t|=VE;break;case 95:t|=LE;break;case 96:t|=zE;break;case 124:t|=WE;break;case 126:t|=RE}return t}function JE(e){let t=``,n=0;for(;n<e.length;){if(e[n]!==`\\`){t+=e[n],n++;continue}let r=0;for(;n+r<e.length&&e[n+r]===`\\`;)r++;let i=e[n+r];if(t+=`\\`.repeat(Math.floor(r/2)),r%2==1){if(i&&PE.has(i)){t+=i,n+=r+1;continue}t+=`\\`}n+=r}return t}function YE(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[r+1];if(i===`\\`&&a&&PE.has(a)){if(n===t)return r+1;n++,r++;continue}if(n===t)return r;n++}return-1}function XE(e,t,n){let r=YE(e,t);if(r===-1||n&&e[r]!==n)return!1;let i=0;for(let t=r-1;t>=0&&e[t]===`\\`;t--)i++;return i%2==1}function ZE(e,t){if(!e||!t)return null;let n=e.match(/\[([^\]\n]+)\]\(([^)]*)$/);return n&&n[2]===t?n[1]:null}function QE(e,t){return String(e.markup??``).startsWith(t)}function $E(e,t,n=qE(e)){let r=e,i=String(t.content??``);return(n&FE)!==0&&r.endsWith(`\\`)&&!QE(t,`\\\\`)&&!i.endsWith(`\\\\`)&&(r=r.slice(0,-1)),(n&GE)!==0&&r.endsWith(`(`)&&!QE(t,`\\(`)&&!i.endsWith(`\\(`)&&(r=r.slice(0,-1)),(n&IE)!==0&&/\*+$/.test(r)&&!QE(t,`\\*`)&&!i.endsWith(`\\*`)&&(r=r.replace(/\*+$/,``)),r}function eD(e,t){if(!e)return;let n=String(e);if(n&&(n===t||n.replace(NE,`$1`)===t))return n}function tD(e,t,n,r,i){let a=[],{content:o,innerTokens:s,nextIndex:c}=JT(e,t,`strong_close`,`strong_open`),l={...Ob(i),insideStrong:!0};return a.push(...n(s,eD(r,o),void 0,l)),{node:{type:`strong`,children:a,raw:`**${String(o)}**`},nextIndex:c}}var nD=/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,rD=/:\/\//;function iD(e){return e?nD.test(e)||rD.test(e):!1}function aD(e,t,n){if(!t)return;let r=e.parseInlineTokens([{...n,type:`text`,content:t,raw:t}],t,e.pPreToken,e.options);if(r.length===1&&r[0]?.type===`text`){let t=r[0];e.pushText(String(t.content??``),String(t.raw??t.content??``));return}for(let t of r)e.pushParsed(t)}function oD(e,t){return t.endsWith(`](`)?e.tokens[e.index+1]?.type===`link_open`&&e.tokens[e.index+1]?.markup===`linkify`&&e.tokens[e.index+2]?.type===`text`&&e.tokens[e.index+3]?.type===`link_close`&&e.tokens[e.index+4]?.type===`text`&&String(e.tokens[e.index+4]?.content??``).startsWith(`)`):!1}function sD(e,t){if(cD(e,t))return;if(yD(e)){let{node:t,nextIndex:n}=ME(e.tokens,e.index,e.parseInlineTokens,e.options),r=String(t.text||t.href||``);e.pushText(r,r),e.index=n;return}e.resetCurrentTextNode();let n=e.index,{node:r,nextIndex:i}=ME(e.tokens,e.index,e.parseInlineTokens,e.options);e.index=i;let a=r.text||r.href||``;if(t.markup===`linkify`&&!mx(a,r.href,e.raw)&&xx(a,e.options.linkifyDemotionContext)){e.pushText(a,a);return}let o=r.children.length===1&&r.children[0]?.type===`text`;if(r.loading&&e.raw&&r.text===r.href&&o){let t=ZE(e.raw,r.href);t&&(r.text=t,r.children=[{type:`text`,content:t,raw:t}],r.raw=String(`[${t}](${r.href}${r.title?` "${r.title}"`:``})`))}if(e.options?.validateLink&&!e.options.validateLink(r.href)){e.pushText(r.text,r.text);return}let s=t.attrs?.find(([e])=>e===`href`)?.[1],c=String(s??``);if(e.raw&&c){let t=e.raw.indexOf(`](`);if(t!==-1){let n=e.raw.indexOf(`)`,t+2);n===-1?r.loading=!0:r.loading&&e.raw.slice(t+2,n).includes(c)&&(r.loading=!1)}}/^file:\/\/\/[a-z]:\//i.test(r.href)&&fD(e,r,n-1)||lD(e,r)||e.pushParsed(r)}function cD(e,t){if(t.markup!==`linkify`)return!1;let{node:n,nextIndex:r}=ME(e.tokens,e.index,e.parseInlineTokens,e.options);return dD(e,n,r)?(e.index=r,!0):!1}function lD(e,t){if(t.type!==`link`)return!1;let n=e.result[e.result.length-1];if(!n||n.type!==`text`)return!1;let r=String(n.content??``).match(/^([^[]*)\[([^\]\n]+)\]\($/);if(!r)return!1;let i=t,a=String(i.href??``),o=String(i.text??``),s=String(r[2]??``),c=a.replace(/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,``);if(!a||!(o===a||o===c||iD(o)))return!1;let l=String(r[1]??``);return l?(n.content=l,n.raw=l):e.result.pop(),e.pushParsed({...t,text:s,children:[{type:`text`,content:s,raw:s}],raw:String(`[${s}](${a}${i.title?` "${i.title}"`:``})`)}),!0}function uD(e,t){if(t.type!==`link`)return!1;let n=t,r=String(n.href??``);return r?dD(e,{href:r,title:n.title==null||n.title===``?null:String(n.title),loading:!!n.loading},e.index+1):!1}function dD(e,t,n){let r=e.result[e.result.length-1];if(r?.type!==`image`||r.src||!r.loading||!String(r.raw??``).endsWith(`](`))return!1;let i=e.tokens[n],a=String(i?.content??``);if(i?.type!==`text`||!a.startsWith(`)`))return!1;e.result.pop(),e.currentTextNode=null;let o=String(r.alt??``);e.pushParsed({type:`image`,src:t.href,alt:o,title:t.title,raw:String(`![${o}](${t.href}${t.title?` "${t.title}"`:``})`),loading:!!t.loading});let s=a.slice(1),c=pw(i);return c.content=s,c.raw=s,e.ensureWorkingTokens()[n]=c,!0}function fD(e,t,n=e.index-1){if(t.type!==`link`)return!1;let r=e.result[e.result.length-1],i=e.tokens[n];if(!r||r.type!==`text`||i?.type!==`text`)return!1;let a=String(r.content??``),o=String(i.content??``);if(!a.endsWith(`!`)||!o.endsWith(`!`)||QE(i,`\\!`))return!1;let s=a.slice(0,-1);s?(r.content=s,r.raw=s,e.currentTextNode=r):(e.result.pop(),e.currentTextNode=null);let c=t,l=String(c.text??c.children?.map(e=>String(e?.content??e?.raw??``)).join(``)??``),u=String(c.href??``),d=c.title==null||c.title===``?null:String(c.title);return e.pushParsed({type:`image`,src:u,alt:l,title:d,raw:String(`![${l}](${u}${d?` "${d}"`:``})`),loading:!!c.loading}),!0}function pD(e,t=``,n=null){let r=String(e.alt??e.raw??``);return{type:`link`,href:t,title:n,text:r,children:[e],raw:String(`[${r}](${t}${n?` "${n}"`:``})`),loading:!0}}function mD(e){let t=e.startsWith(`![`)?e:`![${e}`,n=t.slice(2),r=n.indexOf(`](`);return{type:`image`,src:``,alt:r===-1?n.replace(/\]$/,``):n.slice(0,r),title:null,raw:t,loading:!0}}function hD(e,t){let n=t.indexOf(`[![`);if(n===-1||typeof e.raw==`string`&&e.tokens.length===1&&XE(e.raw,n,`[`))return!1;let r=t.slice(0,n);r&&e.pushText(r,r);let i=mD(t.slice(n+1));return e.pushParsed(pD(i)),e.index++,!0}function gD(e,t){if(e.options?.final)return!1;let n=e.tokens[e.index-1];if(n?.type!==`text`||!String(n.content??``).endsWith(`[`)||QE(n,`\\[`))return!1;let r=e.result[e.result.length-1];if(r?.type===`text`&&r.content.endsWith(`[`)){let t=r.content.slice(0,-1);t?(r.content=t,r.raw=t,e.currentTextNode=r):(e.result.pop(),e.currentTextNode=null)}let i=OE(t);return e.pushParsed(pD(i)),e.index++,!0}function _D(e,t){if(t.type!==`link`)return!1;let n=t,r=String(n.raw??``),i=String(n.text??``);if(!r.startsWith(`[![`)&&!i.startsWith(`![`))return!1;let a=n.title==null||n.title===``?null:String(n.title),o={type:`image`,src:String(n.href??``),alt:i.replace(/^!\[/,``).replace(/\]$/,``),title:a,raw:r.startsWith(`[![`)?r.slice(1):r,loading:!0};return e.pushParsed(pD(o)),!0}function vD(e,t){if(!t.startsWith(`](`))return!1;let n=e.tokens[e.index-2];if(n?.type===`text`&&String(n.content??``).endsWith(`[`)&&QE(n,`\\[`))return!1;let r=e.result[e.result.length-1];if(r?.type!==`image`&&r?.type!==`link`)return!1;let i=r,a=r?.type===`link`&&Array.isArray(i.children)&&i.children.length===1&&i.children[0]?.type===`image`?e.result.pop():null,o=a?a.children[0]:e.result.pop();if(!o||o.type!==`image`)return!1;let s=e.tokens[e.index+1],c=String(a?.href??``),l=a?.title==null?null:String(a.title),u=!0;if(s?.type===`link_open`){let{node:t,nextIndex:n}=ME(e.tokens,e.index+1,e.parseInlineTokens,e.options);c=t.href,l=t.title,u=!0,e.index=n}else{if(c=t.slice(2),c.includes(`"`)){let e=c.split(`"`);c=String(e[0]??``).trim(),l=e[1]==null?null:String(e[1]).trim()}e.index++}let d=pD(o,c,l);return d.loading=u,e.pushParsed(d),!0}function yD(e){let t=e.tokens[e.index-3];return e.tokens[e.index-2]?.type===`image`&&e.tokens[e.index-1]?.type===`text`&&String(e.tokens[e.index-1].content??``)===`](`&&t?.type===`text`&&String(t.content??``).endsWith(`[`)&&QE(t,`\\[`)}function bD(e,t,n){let r=t.indexOf(`[`);if(r===-1)return!1;let i=t.slice(0,r),a=t.indexOf(`](`,r);if(a!==-1){let o=e.tokens[e.index+2],s=t.slice(r+1,a);if(s.includes(`[`)){let e=s.indexOf(`[`);i+=t.slice(0,r+e+1);let n=r+e+1;s=t.slice(n+1,a)}let c=e.tokens[e.index+1];if(t.endsWith(`](`)&&c?.type===`link_open`&&o){let t=e.tokens[e.index+4],r=4,a=!0;if(t?.type===`text`){let n=String(t.content??``);if(n.startsWith(`)`)){a=!1;let i=n.slice(1);if(i){let n=pw(t);n.content=i,n.raw=i,e.ensureWorkingTokens()[e.index+4]=n}else r++}else n===`.`&&r++}aD(e,i,n);let c=String(o.content??``);return e.options?.validateLink&&!e.options.validateLink(c)?e.pushText(s,s):e.pushParsed({type:`link`,href:c,title:null,text:s,children:[{type:`text`,content:s,raw:s}],loading:a}),e.index+=r,!0}let l=t.indexOf(`)`,a),u=l===-1?``:t.slice(a+2,l),d=l===-1,f=i.match(/\*+$/);if(f&&(i=i.replace(/\*+$/,``)),aD(e,i,n),f||=s.match(/^\*+/),!e.requireClosingStrong&&f){let t=f[0].length;s=s.replace(/^\*+/,``).replace(/\*+$/,``);let n=[];if(t===1?n.push({type:`em_open`,tag:`em`,nesting:1}):t===2?n.push({type:`strong_open`,tag:`strong`,nesting:1}):t===3&&(n.push({type:`strong_open`,tag:`strong`,nesting:1}),n.push({type:`em_open`,tag:`em`,nesting:1})),n.push({type:`link`,href:u,title:null,text:s,children:[{type:`text`,content:s,raw:s}],loading:d}),t===1){n.push({type:`em_close`,tag:`em`,nesting:-1});let{node:t}=YT(n,0,e.parseInlineTokens,e.options);e.pushParsed(t)}else if(t===2){n.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:t}=tD(n,0,e.parseInlineTokens,void 0,e.options);e.pushParsed(t)}else if(t===3){n.push({type:`em_close`,tag:`em`,nesting:-1}),n.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:t}=tD(n,0,e.parseInlineTokens,void 0,e.options);e.pushParsed(t)}else{let{node:t}=YT(n,0,e.parseInlineTokens,e.options);e.pushParsed(t)}}else e.options?.validateLink&&!e.options.validateLink(u)?e.pushText(s,s):e.pushParsed({type:`link`,href:u,title:null,text:s,children:[{type:`text`,content:s,raw:s}],loading:d});let p=l===-1?``:t.slice(l+1);return p&&(e.dispatchToken({type:`text`,content:p,raw:p}),e.index--),e.index++,!0}return!1}function xD(e,t){let n=t.indexOf(`![`);if(n===-1)return!1;let r=t.slice(0,n);return r&&!e.currentTextNode?e.currentTextNode={type:`text`,content:r,raw:r}:r&&e.currentTextNode&&(e.currentTextNode.content+=r),e.currentTextNode&&=(e.result.push(e.currentTextNode),null),e.pushParsed(mD(t.slice(n))),e.index++,!0}function SD(e,t){gD(e,t)||(e.resetCurrentTextNode(),e.pushParsed(OE(t)),e.index++)}function CD(e,t){let n=t;if(t.type===`link`&&n.href!=null&&e.options.validateLink&&!e.options.validateLink(String(n.href))){e.resetCurrentTextNode();let t=String(n.text??``);e.pushText(t,t),e.index++}else _D(e,t)||uD(e,t)||fD(e,t)||lD(e,t)||e.pushToken(t),e.index++}function wD(e){let t=e.content??``,n=e.raw===`$$`?`$${t}$`:e.raw||``;return{type:`math_inline`,content:t,loading:!!e.loading,raw:n,markup:e.markup}}function TD(e){return{type:`reference`,id:String(e.content??``),raw:String(e.markup??`[${e.content??``}]`)}}function ED(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=JT(e,t,`s_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`strikethrough`,children:i,raw:`~~${a}~~`},nextIndex:s}}function DD(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=JT(e,t,`sub_close`);i.push(...n(o,void 0,void 0,r));let c=String(e[t].content??``),l=a||c;return{node:{type:`subscript`,children:i.length>0?i:[{type:`text`,content:l,raw:l}],raw:`~${l}~`},nextIndex:s}}function OD(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=JT(e,t,`sup_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`superscript`,children:i.length>0?i:[{type:`text`,content:a||String(e[t].content??``),raw:a||String(e[t].content??``)}],raw:`^${a||String(e[t].content??``)}^`},nextIndex:s}}var kD=/\s/u,AD=/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/,jD=/\p{P}/u,MD=/^[\x22\x27《「『【〔〖〘〚〈([{“‘﹁﹃﹙﹛﹝]$/u,ND=/^[\x22\x27》」』】〕〗〙〛〉)]}”’﹂﹄﹚﹜﹞]$/u;function PD(e){let t=0,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`*`){n+=2;continue}e[n]===`*`&&t++,n++}return t}function FD(e,t=0){if(!e)return-1;let n=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[r+1];if(i===`\\`&&a&&PE.has(a)){if(a===`*`&&n>=t){n++,r++;continue}n++,r++;continue}if(i===`*`&&n>=t)return n;n++}return-1}function ID(e){return!!e&&kD.test(e)}function LD(e){return!!e&&(AD.test(e)||jD.test(e))}function RD(e,t){return!!e&&!!t&&/^\p{Script=Han}$/u.test(t)&&MD.test(e)}function zD(e,t){return!!e&&!!t&&/^[\p{L}\p{N}]$/u.test(t)&&ND.test(e)}function BD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!r||ID(r)?!1:!(LD(r)&&!RD(r,n)&&n&&!ID(n)&&!LD(n))}function VD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!n||ID(n)?!1:!(LD(n)&&!zD(n,r)&&r&&!ID(r)&&!LD(r))}function HD(e,t,n=0){let r=n,i=!1;for(;r<t.length;){let n=e?FD(e,r):t.indexOf(`*`,r);if(n===-1)break;if(VD(t,n))return{index:n,sawInvalidClose:i};i=!0,r=n+1}return{index:-1,sawInvalidClose:i}}function UD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+2];return!r||ID(r)?!1:!(LD(r)&&!RD(r,n)&&n&&!ID(n)&&!LD(n))}function WD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+2];return!n||ID(n)?!1:!(LD(n)&&!zD(n,r)&&r&&!ID(r)&&!LD(r))}function GD(e,t=0){let n=t,r=!1;for(;n<e.length;){let t=e.indexOf(`**`,n);if(t===-1)break;if(WD(e,t))return{index:t,sawInvalidClose:r};r=!0,n=t+2}return{index:-1,sawInvalidClose:r}}var KD=/[\p{L}\p{N}]/u,qD=/^[\p{L}\p{N}]+$/u;function JD(e){return e?KD.test(e):!1}function YD(e){return e?qD.test(e):!1}function XD(e,t){let n=t;for(;n<e.length&&e[n]===`*`;)n++;let r=t>0?e[t-1]:void 0,i=n<e.length?e[n]:void 0;return{len:n-t,prev:r,next:i,intraword:JD(r)&&JD(i)}}function ZD(e){let t=[];for(let n=0;n<e.length;){if(e[n]!==`*`){n++;continue}let r=XD(e,n),i=n+r.len;r.len>=2&&r.intraword&&t.push({start:n,end:i}),n=i}for(let n=0;n<t.length-1;n++){let r=t[n],i=t[n+1];if(!YD(e.slice(r.end,i.start)))return i.end}return-1}function QD(e){return!!e&&e.trim()===e&&/^[\p{L}\p{N}\s]+$/u.test(e)}function $D(e,t){let n=t;for(;n<e.length;){let t=e.indexOf(`***`,n);if(t===-1)return-1;let r=XD(e,t);if(r.len>=3)return t;n=t+r.len}return-1}function eO(e){let t=String(e.content??``);return{type:`text`,content:t,raw:t}}var tO=/[^~]*~{2,}[^~]+/,nO=/\*\*/,rO=/[[_*^~]/;function iO(e,t){return t===e.tokens[e.index]}function aO(e,t,n){let r=iO(e,n)&&e.tokens.length===1?e.raw:String(n.content??``),i=[],a=ZD(t);if(a!==-1){e.pushText(t.slice(0,a),t.slice(0,a));let n=t.slice(a);return n&&(e.dispatchToken({type:`text`,content:n,raw:n}),e.index--),e.index++,!0}if(tO.test(t)){let e=t.indexOf(`~~`);e!==-1&&i.push({type:`strikethrough`,index:e})}if(nO.test(t)){let e=t.indexOf(`**`);e!==-1&&i.push({type:`strong`,index:e})}if(/[^*]*\*[^*]+/.test(t)){let e=r?FD(r,0):t.indexOf(`*`);if(r&&e===-1)return!1;e!==-1&&i.push({type:`emphasis`,index:e})}i.sort((e,t)=>e.index===t.index?e.type===t.type?0:e.type===`strong`?-1:+(t.type===`strong`):e.index-t.index);let o=i[0];if(!o)return!1;if(o.type===`strikethrough`){let n=o.index,r=n>-1?t.slice(0,n):``;if(r&&e.pushText(r,r),n===-1)return e.index++,!0;let i=t.indexOf(`~~`,n+2),a=i===-1?t.slice(n+2):t.slice(n+2,i),s=i===-1?``:t.slice(i+2),{node:c}=ED([{type:`s_open`,tag:`s`,content:``,markup:`~~`,info:``,meta:null},{type:`text`,tag:``,content:a,markup:``,info:``,meta:null},{type:`s_close`,tag:`s`,content:``,markup:`~~`,info:``,meta:null}],0,e.parseInlineTokens,e.options);return e.resetCurrentTextNode(),e.pushParsed(c),s&&(e.dispatchToken({type:`text`,content:s,raw:s}),e.index--),e.index++,!0}if(o.type===`strong`){let n=o.index,r=n>-1?t.slice(0,n):``;if(r&&e.pushText(r,r),n===-1)return e.index++,!0;if(e.raw&&n===0){let n=!1,r=0;for(;r<t.length&&t[r]===`*`;)r++;if(e.raw.startsWith(`\\*`)&&(n=!0),n){let n=0,i=0;for(;i<e.raw.length&&n<r;)if(e.raw[i]===`\\`&&i+1<e.raw.length&&e.raw[i+1]===`*`)n+=1,i+=2;else if(e.raw[i]===`*`)break;else i++;if(n>=2)return e.pushText(t,t),e.index++,!0}}if(e.raw&&(t.match(/\*/g)||[]).length>PD(e.raw))return e.pushText(t.slice(r.length),t.slice(r.length)),e.index++,!0;let i=XD(t,n);if(i.len>=3){let r=$D(t,n+i.len);if(r!==-1){let a=t.slice(n+i.len,r);if(QD(a)){let{node:n}=tD([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:a,markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,e.parseInlineTokens,e.raw,e.options);e.resetCurrentTextNode(),e.pushParsed(n);let i=t.slice(r+3);return i&&(e.dispatchToken({type:`text`,content:i,raw:i}),e.index--),e.index++,!0}}}if(!UD(t,n)){let r=t.slice(n,n+i.len);e.pushText(r,r);let a=t.slice(n+i.len);return a&&(e.dispatchToken({type:`text`,content:a,raw:a}),e.index--),e.index++,!0}let a=GD(t,n+2),s=``,c=``;if(a.index!==-1){s=t.slice(n+2,a.index),c=t.slice(a.index+2);let o=a.index,l=XD(t,o);if(i.intraword&&l.intraword&&!YD(s)||!s&&i.len>=4&&i.intraword)return e.pushText(t.slice(r.length),t.slice(r.length)),e.index++,!0}else{if(e.requireClosingStrong||a.sawInvalidClose||i.intraword)return e.pushText(t.slice(r.length),t.slice(r.length)),e.index++,!0;s=t.slice(n+2),c=``}if(!s&&/^\*+$/.test(c))return e.pushText(t,t),e.index++,!0;let{node:l}=tD([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`text`,tag:``,content:s,markup:``,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,e.parseInlineTokens,e.raw,e.options);return e.resetCurrentTextNode(),e.pushParsed(l),c&&(e.dispatchToken({type:`text`,content:c,raw:c}),e.index--),e.index++,!0}if(o.type===`emphasis`){let n=o.index;n===-1&&(n=0);let i=t.slice(0,n);if(i&&e.pushText(i,i),!BD(t,n)){e.pushText(t[n],t[n]);let r=t.slice(n+1);return r&&(e.dispatchToken({type:`text`,content:r,raw:r}),e.index--),e.index++,!0}let a=XD(t,n),s=HD(r,t,n+1),c=s.index,l=e.tokens[e.index+1];if(e.options?.final&&l?.type===`em_open`&&c!==-1&&t.slice(n+1,c).trim()!==t.slice(n+1,c)||c===-1&&(s.sawInvalidClose||e.options?.final||a.intraword||!JD(t[n+1])))return e.pushText(t.slice(n),t.slice(n)),e.index++,!0;let{node:u}=YT([{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:c>-1?t.slice(n+1,c):t.slice(n+1),markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null}],0,e.parseInlineTokens,e.options);if(e.resetCurrentTextNode(),e.pushParsed(u),c!==-1&&c<t.length-1){let n=t.slice(c+1);n&&(e.dispatchToken({type:`text`,content:n,raw:n}),e.index--)}return e.index++,!0}return!1}function oO(e,t,n){if(!t.includes("`"))return!1;let r=(e=>{for(let t=0;t<e.length;t++){if(e[t]!=="`")continue;let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;if(n%2==0)return t}return-1})(t);if(r===-1)return!1;let i=1;for(let e=r+1;e<t.length&&t[e]==="`";e++)i++;let a="`".repeat(i),o=r+i,s=t.indexOf(a,o);if(s===-1){if(i===1){let i=t.slice(0,r),a=t.slice(r+1);return i&&(aO(e,i,n)?e.index--:e.pushText(i,i)),e.pushParsed({type:`inline_code`,code:a,raw:String(a)}),e.index++,!0}let a=t;for(let t=e.index+1;t<e.tokens.length;t++)a+=String((e.tokens[t].content??``)+(e.tokens[t].markup??``));return e.index=e.tokens.length-1,e.pushText(a,a),e.index++,!0}e.resetCurrentTextNode();let c=t.slice(0,r),l=t.slice(r+i,s),u=t.slice(s+i);return c&&(aO(e,c,n)?e.index--:e.pushText(c,c)),e.pushParsed({type:`inline_code`,code:l,raw:String(l??``)}),u&&(e.dispatchToken({type:`text`,content:u,raw:u}),e.index--),e.index++,!0}function sO(e,t){let n=e.options.markdownIt;if(!n||e.tokens.length<=1||!e.tokens.some(e=>e?.type===`math_inline`)||!rO.test(t))return null;let r=n.parseInline(t,{__markstreamFinal:!!e.options?.final});if(!Array.isArray(r)||r.length===0)return null;let i=(r.find(e=>e?.type===`inline`)?.children??[]).filter(e=>e?.type!==`text`||String(e.content??``)!==``);if(!i.length||!i.some(e=>e?.type!==`text`)||i.length===1&&i[0]?.type===`text`&&String(i[0].content??``)===t)return null;let a=e.parseInlineTokens(i,t,e.pPreToken,e.options);return a.length?a:null}function cO(e,t,n,r,i,a=qE(t)){let o=eO({...n,content:t});if(e.currentTextNode){e.currentTextNode.content+=e.options?.final?o.content:$E(o.content,n,a),e.currentTextNode.raw+=o.raw;return}let s=r?.tag===`br`&&e.tokens[e.index-2]?.content===`[`;i||(o.content=e.options?.final?o.content:$E(o.content,n,a)),e.currentTextNode=o,e.currentTextNode.center=s,e.result.push(e.currentTextNode)}function lO(e,t){let n=String(t.content??``),r=qE(n),i=(r&FE)!==0,a=iO(e,t)&&e.tokens.length===1&&i&&typeof e.raw==`string`?String(e.raw):``,o=a?JE(a):i?n.replace(NE,`$1`):n,s=o===n?r:qE(o);if(t.content===`<`||o===`1`&&e.tokens[e.index-1]?.tag===`br`){e.index++;return}let c=(s&UE)===0?-1:o.indexOf(`$`);c!==-1&&c===o.lastIndexOf(`$`)&&o.endsWith(`$`)&&(o=o.slice(0,-1)),o.endsWith(`undefined`)&&!e.raw?.endsWith(`undefined`)&&(o=o.slice(0,-9));let l=e.result.length,u=``;for(let t=e.result.length-1;t>=0;t--){let n=e.result[t];if(n.type!==`text`)break;l=t,u=String(n.content??``)+u}l<e.result.length&&(o.startsWith(u)?(e.currentTextNode=null,e.result.length=l):e.currentTextNode=e.result[e.result.length-1]);let d=e.tokens[e.index+1];if((o==="`"||o===`|`||o===`$`)&&!QE(t,`\\${o}`)||/^\*+$/.test(o)&&!QE(t,`\\*`)){e.index++;return}if(!d&&e.options?.final!==!0&&(s&GE)!==0&&/[^\]]\s*\(\s*$/.test(o)&&(o=o.replace(/\(\s*$/,``)),!o){e.index++;return}if((s&160)==160&&hD(e,o)||(s&1088)==1088&&vD(e,o))return;if((s&KE)===0){cO(e,o,t,e.tokens[e.index-1],d,s),e.index++;return}if((s&BE)!==0&&uO(e,o))return;let f=e.tokens[e.index-1];if((s&BE)!==0&&o===`[`&&!d?.markup?.includes(`*`)&&!QE(t,`\\[`)||(s&VE)!==0&&o===`]`&&!f?.markup?.includes(`*`)&&!QE(t,`\\]`)){e.index++;return}if((s&zE)!==0&&oO(e,n,t)||(s&160)==160&&xD(e,o)||(s&BE)!==0&&(e.tokens[e.index+1]?.type!==`link_open`||oD(e,o))&&bD(e,o,t))return;let p=sO(e,n);if(p){e.resetCurrentTextNode();for(let t of p)e.pushParsed(t);e.index++;return}aO(e,o,t)||(cO(e,o,t,f,d,s),e.index++)}function uO(e,t){if(!(t?.startsWith(`[`)&&e.pPreToken?.type===`list_item_open`))return!1;let n=t.slice(1).match(/[^\s\]]/);if(n===null)return e.index++,!0;if(n&&/x/i.test(n[0])){let t=n[0]===`x`||n[0]===`X`;return e.pushParsed({type:`checkbox_input`,checked:t,raw:t?`[x]`:`[ ]`}),e.index++,!0}return!1}function dO(e,t){if(!e.currentTextNode||t.loading!==!0||t.markup!==`\\(\\)`)return;let n=e.tokens[e.index-1];n&&n.type===`text`&&QE(n,`\\(`)&&e.currentTextNode.content.endsWith(`(`)&&(e.currentTextNode.content=e.currentTextNode.content.slice(0,-1),e.currentTextNode.raw.endsWith(`(`)&&(e.currentTextNode.raw=e.currentTextNode.raw.slice(0,-1)),!e.currentTextNode.content&&e.result[e.result.length-1]===e.currentTextNode&&(e.result.pop(),e.currentTextNode=null))}function fO(e,t){switch(t.type){case`text`:lO(e,t);break;case`softbreak`:e.currentTextNode?(e.currentTextNode.content+=`
118
+ `,e.currentTextNode.raw+=`
119
+ `):(e.currentTextNode={type:`text`,content:`
120
+ `,raw:`
121
+ `},e.result.push(e.currentTextNode)),e.index++;break;case`code_inline`:e.pushParsed(wE(t)),e.index++;break;case`html_inline`:{let[n,r]=CE(t,e.tokens,e.index,e.parseInlineTokens,e.raw,e.pPreToken,e.options);e.pushParsed(n),e.index=r;break}case`link_open`:sD(e,t);break;case`image`:SD(e,t);break;case`strong_open`:{e.resetCurrentTextNode();let{node:n,nextIndex:r}=tD(e.tokens,e.index,e.parseInlineTokens,t.content,e.options);e.pushParsed(n),e.index=r;break}case`em_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=YT(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`s_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=ED(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`mark_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=oE(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`ins_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=TE(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`sub_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=DD(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`sup_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=OD(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`sub`:e.resetCurrentTextNode(),e.pushParsed({type:`subscript`,children:[{type:`text`,content:String(t.content??``),raw:String(t.content??``)}],raw:`~${String(t.content??``)}~`}),e.index++;break;case`sup`:e.resetCurrentTextNode(),e.pushParsed({type:`superscript`,children:[{type:`text`,content:String(t.content??``),raw:String(t.content??``)}],raw:`^${String(t.content??``)}^`}),e.index++;break;case`emoji`:{e.resetCurrentTextNode();let n=e.tokens[e.index-1];n?.type===`text`&&/\|:-+/.test(String(n.content??``))?e.pushText(``,``):e.pushParsed(qT(t)),e.index++;break}case`checkbox`:e.resetCurrentTextNode(),e.pushParsed(GT(t)),e.index++;break;case`checkbox_input`:e.resetCurrentTextNode(),e.pushParsed(KT(t)),e.index++;break;case`footnote_ref`:e.resetCurrentTextNode(),e.pushParsed(iE(t)),e.index++;break;case`footnote_anchor`:{e.resetCurrentTextNode();let n=t.meta??{},r=String(n.label??t.content??``);e.pushParsed({type:`footnote_anchor`,id:r,raw:String(t.content??``)}),e.index++;break}case`hardbreak`:e.resetCurrentTextNode(),e.pushParsed(aE()),e.index++;break;case`fence`:e.resetCurrentTextNode(),e.pushParsed(rE(e.tokens[e.index])),e.index++;break;case`math_inline`:dO(e,t),e.resetCurrentTextNode(),!t.content&&t.markup===`$`&&e.tokens[e.index+1]?.type===`text`&&e.tokens[e.index+2]?.type===`math_inline`?(e.pushParsed(wD({...t,content:e.tokens[e.index+1].content})),e.index+=2):e.pushParsed(wD(t)),e.index++;break;case`reference`:pO(e,t);break;case`text_special`:e.pushText(String(t.content??``),String(t.content??``)),e.index++;break;default:CD(e,t)}}function pO(e,t){e.resetCurrentTextNode(),e.pushParsed(TD(t)),e.index++}var mO=/[!$(*[\\\]_`|~]/;function hO(e,t,n,r){if(!e||e.length===0)return[];if(e.length===1&&e[0].type===`text`){let t=e[0].content;if(typeof t==`string`&&t&&t!==`<`&&!t.endsWith(`undefined`)&&!mO.test(t))return[{type:`text`,content:t,raw:t,center:!1}]}let i=Ob(r),a=i.linkifyDemotionContext,o=gx(t),s={filename:a?.filename||o.filename,explicitFilename:a?.explicitFilename||o.explicitFilename,marketTicker:a?.marketTicker||o.marketTicker};(s.filename||s.explicitFilename||s.marketTicker)&&(i={...i,linkifyDemotionContext:s}),r=i;let c=r?.requireClosingStrong,l=e,u={currentTextNode:null,index:0,options:i,parseInlineTokens:hO,pPreToken:n,raw:t,requireClosingStrong:c,result:[],tokens:e,dispatchToken:e=>fO(u,e),ensureWorkingTokens:d,pushParsed:p,pushText:h,pushToken:m,resetCurrentTextNode:f};function d(){return u.tokens===l&&(u.tokens=u.tokens.slice()),u.tokens}function f(){u.currentTextNode=null}function p(e){f(),u.result.push(e)}function m(e){f();let t=pw(e);u.result.push(t)}function h(e,t){u.currentTextNode?(u.currentTextNode.content+=e,u.currentTextNode.raw+=t??e):(u.currentTextNode={type:`text`,content:String(e??``),raw:String(t??e??``)},u.result.push(u.currentTextNode))}for(;u.index<u.tokens.length;){let e=u.tokens[u.index];fO(u,e)}return u.result}function gO(e){let t=new WeakSet,n=e=>{if(!e||typeof e!=`object`||t.has(e))return;if(t.add(e),Array.isArray(e)){for(let t of e)n(t);return}let r=e;r.type===`html_block`&&r.loading===!0&&(r.loading=!1);for(let e of Object.values(r))n(e)};n(e)}function _O(e,t){let n=t.postTransformNodes;if(typeof n!=`function`)return e;let r=n(e);return Array.isArray(r)?r:e}function vO(e){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)return;e.content=n;let r=e.children;if(Array.isArray(r)&&r.length!==0)for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)break;if(n){e.content=n;break}r.pop();continue}break}}function yO(e){let t=String(e.content??``),n=t.match(/\r?\n\s*\d+[.)]?\s*$/);if(!n||typeof n.index!=`number`)return;e.content=t.slice(0,n.index);let r=e.children;if(Array.isArray(r)&&r.length!==0)for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``);if(/^[ \t\r\n\d.)]*$/.test(t)){r.pop();continue}let n=t.replace(/[ \t\r\n\d.)]+$/g,``);n!==t&&(n?e.content=n:r.pop())}break}}function bO(e){let t=String(e.content??``);return/[ \t\r\n]+$/.test(t)||/\r?\n\s*\d+[.)]?\s*$/.test(t)}function xO(e,t,n,r){let i=e[t],a=[],o=cx(n,!0),s=t+1;for(;s<e.length&&e[s].type!==`bullet_list_close`&&e[s].type!==`ordered_list_close`;)if(e[s].type===`list_item_open`){let t=[],i=s+1;for(;i<e.length&&e[i].type!==`list_item_close`;)if(e[i].type===`paragraph_open`){let a=e[i+1],s=bO(a)?pw(a):a,c=e[i-1];s!==a&&(yO(s),vO(s));let l=String(s.content??``),u={type:`paragraph`,children:r(s.children||[],l,c,o.options()),raw:l};n?.includeSourceMap&&dw(u,e[i],n),t.push(u),o.remember(l),i+=3}else if(e[i].type===`blockquote_open`){let[n,a]=kO(e,i,o.options(),r);t.push(n),o.remember(n.raw),i=a}else if(e[i].type===`bullet_list_open`||e[i].type===`ordered_list_open`){let[n,a]=xO(e,i,o.options(),r);t.push(n),o.remember(n.raw),i=a}else{let n=nk(e,i,o.options(),OO,r);n?(t.push(n[0]),o.remember(n[0].raw),i=n[1]):i+=1}let c={type:`list_item`,children:t,raw:t.map(e=>e.raw).join(``)};n?.includeSourceMap&&dw(c,e[s],n),a.push(c),s=i+1}else s+=1;let c={type:`list`,ordered:i.type===`ordered_list_open`,start:(()=>{if(i.attrs&&i.attrs.length){let e=i.attrs.find(e=>e[0]===`start`);if(e){let t=Number(e[1]);return Number.isFinite(t)&&t!==0?t:1}}})(),items:a,raw:a.map(e=>e.raw).join(`
122
+ `)};return n?.includeSourceMap&&dw(c,i,n),[c,s+1]}function SO(e,t,n,r,i){let a=String(n[1]??`note`),o=String(n[2]??a.charAt(0).toUpperCase()+a.slice(1)),s=[],c=cx(r,!0),l=t+1;for(;l<e.length&&e[l].type!==`container_close`;)if(e[l].type===`paragraph_open`){let t=e[l+1];if(t){let n={type:`paragraph`,children:i(t.children||[],String(t.content??``),void 0,c.options()),raw:String(t.content??``)};r?.includeSourceMap&&dw(n,e[l],r),s.push(n),c.remember(n.raw)}l+=3}else if(e[l].type===`bullet_list_open`||e[l].type===`ordered_list_open`){let[t,n]=xO(e,l,c.options(),i);r?.includeSourceMap&&dw(t,e[l],r),s.push(t),c.remember(t.raw),l=n}else if(e[l].type===`blockquote_open`){let[t,n]=kO(e,l,c.options(),i);r?.includeSourceMap&&dw(t,e[l],r),s.push(t),c.remember(t.raw),l=n}else{let t=tk(e,l,c.options(),i);t?(s.push(t[0]),c.remember(t[0].raw),l=t[1]):l++}return[{type:`admonition`,kind:a,title:o,children:s,raw:`:::${a} ${o}\n${s.map(e=>e.raw).join(`
123
+ `)}\n:::`},l+1]}var CO=new Set([`warning`,`info`,`note`,`tip`,`danger`,`caution`]);function wO(e){let t=0;for(;t<e.length&&t<3&&e[t]===`:`;)t++;if(t===0||e[t]===`:`)return null;let n=e.slice(t).trimStart();if(!n)return null;let r=n.search(/\s/),i=(r===-1?n:n.slice(0,r)).toLowerCase();return CO.has(i)?{kind:i,title:r===-1?``:n.slice(r).trim()}:null}function TO(e,t,n,r){let i=e[t],a=`note`,o=``,s=i.type.match(/^container_(\w+)_open$/);if(s){a=s[1];let e=String(i.info??``).trim();if(e&&!e.startsWith(`:::`)&&e.toLowerCase().startsWith(a)){let t=e.slice(a.length).trim();t&&(o=t)}}else{let e=wO(String(i.info??``).trim());e&&(a=e.kind,o=e.title)}o||=a.charAt(0).toUpperCase()+a.slice(1);let c=[],l=cx(n,!0),u=t+1,d=RegExp(`^container_${a}_close$`);for(;u<e.length&&e[u].type!==`container_close`&&!d.test(e[u].type);)if(e[u].type===`paragraph_open`){let t=e[u+1];if(t){let i=t.children||[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.type===`text`&&/:+/.test(t.content)){a=e;break}}let o={type:`paragraph`,children:r((a===-1?i:i.slice(0,a))||[],void 0,void 0,l.options()),raw:String(t.content??``).replace(/\n:+$/,``).replace(/\n\s*:::\s*$/,``)};n?.includeSourceMap&&dw(o,e[u],n),c.push(o),l.remember(o.raw)}u+=3}else if(e[u].type===`bullet_list_open`||e[u].type===`ordered_list_open`){let[t,i]=xO(e,u,l.options(),r);n?.includeSourceMap&&dw(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else if(e[u].type===`blockquote_open`){let[t,i]=kO(e,u,l.options(),r);n?.includeSourceMap&&dw(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else{let t=tk(e,u,l.options(),r);t?(c.push(t[0]),l.remember(t[0].raw),u=t[1]):u++}return[{type:`admonition`,kind:a,title:o,children:c,raw:`:::${a} ${o}\n${c.map(e=>e.raw).join(`
124
+ `)}\n:::`},u+1]}var EO=/^::: ?(warning|info|note|tip|danger|caution|error) ?(.*)$/;function DO(e,t,n,r){let i=e[t];if(i.type!==`container_open`)return null;let a=EO.exec(String(i.info??``));return a?SO(e,t,a,n,r):null}var OO={parseContainer:(e,t,n,r)=>TO(e,t,n,r),matchAdmonition:DO};function kO(e,t,n,r){let i=[],a=cx(n,!0),o=t+1;for(;o<e.length&&e[o].type!==`blockquote_close`;){let t=e[o];switch(t.type){case`paragraph_open`:{let s=e[o+1],c={type:`paragraph`,children:r(s.children||[],String(s.content??``),void 0,a.options()),raw:String(s.content??``)};n?.includeSourceMap&&dw(c,t,n),i.push(c),a.remember(c.raw),o+=3;break}case`bullet_list_open`:case`ordered_list_open`:{let[t,n]=xO(e,o,a.options(),r);i.push(t),a.remember(t.raw),o=n;break}case`blockquote_open`:{let[t,n]=kO(e,o,a.options(),r);i.push(t),a.remember(t.raw),o=n;break}default:{let t=nk(e,o,a.options(),OO,r);t?(i.push(t[0]),a.remember(t[0].raw),o=t[1]):o++;break}}}let s={type:`blockquote`,children:i,raw:i.map(e=>e.raw).join(`
125
+ `)};return n?.includeSourceMap&&dw(s,e[t],n),[s,o+1]}function AO(e){if(e.info?.startsWith(`diff`))return rE(e);let t=String(e.content??``),n=t.match(/ type="application\/vnd\.ant\.([^"]+)"/),r=t;n?.[1]&&(r=t.replace(/<antArtifact[^>]*>/g,``).replace(/<\/antArtifact>/g,``));let i=Array.isArray(e.map)&&e.map.length===2;return{type:`code_block`,language:n?n[1]:String(e.info??``),code:r,raw:r,loading:!i}}function jO(e,t,n,r){let i=[],a=t+1,o=[],s=[],c=cx(n,!0);for(;a<e.length&&e[a].type!==`dl_close`;)if(e[a].type===`dt_open`){let t=e[a+1];o=r(t.children||[],void 0,void 0,c.options()),c.remember(o.map(e=>e.raw).join(``)),a+=3}else if(e[a].type===`dd_open`){let t=a+1;for(s=[];t<e.length&&e[t].type!==`dd_close`;)if(e[t].type===`paragraph_open`){let n=e[t+1];s.push({type:`paragraph`,children:r(n.children||[],String(n.content??``),void 0,c.options()),raw:String(n.content??``)}),c.remember(String(n.content??``)),t+=3}else t++;o.length>0&&(i.push({type:`definition_item`,term:o,definition:s,raw:`${o.map(e=>e.raw).join(``)}: ${s.map(e=>e.raw).join(`
126
+ `)}`}),o=[]),a=t+1}else a++;return[{type:`definition_list`,items:i,raw:i.map(e=>e.raw).join(`
127
+ `)},a+1]}function MO(e,t,n,r){let i=e[t].meta??{},a=String(i?.label??`0`),o=[],s=cx(n,!0),c=t+1;for(;c<e.length&&e[c].type!==`footnote_close`;)if(e[c].type===`paragraph_open`){let t=e[c+1],n=t.children?[...t.children]:[];e[c+2].type===`footnote_anchor`&&n.push(e[c+2]);let i={type:`paragraph`,children:r(n,String(t.content??``),void 0,s.options()),raw:String(t.content??``)};o.push(i),s.remember(i.raw),c+=3}else c++;return[{type:`footnote`,id:a,children:o,raw:`[^${a}]: ${o.map(e=>e.raw).join(`
128
+ `)}`},c+1]}function NO(e,t,n,r){let i=e[t],a=i.attrs,o=Array.isArray(a)&&a.length?Object.fromEntries(a.filter(e=>Array.isArray(e)&&e.length>=1&&e[0]).map(([e,t])=>[String(e),t==null||t===``||String(t)])):void 0,s=String(i.tag?.substring(1)??`1`),c=Number.parseInt(s,10),l=e[t+1],u=String(l.content??``);return{type:`heading`,level:c,text:u,...o?{attrs:o}:{},children:r(l.children||[],u,void 0,n),raw:u}}function PO(e){let t=String(e.content??``),n=e.raw===`$$`?`$$${t}$$`:String(e.raw??``);return{type:`math_block`,content:t,loading:!!e.loading,raw:n,markup:e.markup}}function FO(e){if(!e)return`left`;for(let t of e){if(!t)continue;let[e,n]=t;if(!n)continue;let r=String(n).trim().toLowerCase();if(e===`style`){let e=/text-align\s*:\s*(left|right|center)/i.exec(r);if(e)return e[1].toLowerCase()}}return`left`}function IO(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function LO(e,t){let n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return IO(n)?n:void 0}function RO(e,t,n){let r=LO(gx(t),n);if(!IO(r))return e;let i=Ob(e),a=i.linkifyDemotionContext;return{...i,linkifyDemotionContext:{filename:a?.filename||r?.filename,explicitFilename:a?.explicitFilename||r?.explicitFilename,marketTicker:a?.marketTicker||r?.marketTicker}}}function zO(e,t,n,r){let i=t+1,a=null,o=[],s=!1;for(;i<e.length&&e[i].type!==`table_close`;)if(e[i].type===`thead_open`)s=!0,i++;else if(e[i].type===`thead_close`)s=!1,i++;else if(e[i].type===`tbody_open`||e[i].type===`tbody_close`)i++;else if(e[i].type===`tr_open`){let t=[],c=i+1,l;for(;c<e.length&&e[c].type!==`tr_close`;)if(e[c].type===`th_open`||e[c].type===`td_open`){let i=e[c].type===`th_open`,o=e[c+1],u=String(o.content??``),d=FO(e[c].attrs),f=t.length,p=!i&&!s,m=p?a?.cells[f]?.raw:void 0;t.push({type:`table_cell`,header:i||s,children:r(o.children||[],u,void 0,RO(n,m,p?l:void 0)),raw:u,align:d}),p&&(l=LO(l,gx(u))),c+=3}else c++;let u={type:`table_row`,cells:t,raw:t.map(e=>e.raw).join(`|`)};s?a=u:o.push(u),i=c+1}else i++;a||={type:`table_row`,cells:[],raw:``};let c=e[t].loading===!0;return[{type:`table`,header:a,rows:o,loading:c&&!n?.final&&o.length===0,raw:[a,...o].map(e=>e.raw).join(`
129
+ `)},i+1]}function BO(){return{type:`thematic_break`,raw:`---`}}var VO=null,HO=new WeakMap;function UO(){return VO||={allowedTagSet:sE(),customTagSet:null},VO}function WO(e){if(!e||e.length===0)return UO();let t=HO.get(e);if(t)return t;let n=e.map(Ky).filter(Boolean);if(!n.length){let t=UO();return HO.set(e,t),t}let r={allowedTagSet:sE({customHtmlTags:e}),customTagSet:new Set(n)};return HO.set(e,r),r}function GO(e,t,n,r){let i=e[t],a=i.attrs,o=``,s={};if(a){for(let[e,t]of a)if(e===`class`){let e=t.match(/(?:\s|^)vmr-container-(\S+)/);e&&(o=e[1])}else if(e.startsWith(`data-`)){let n=e.slice(5);try{s[n]=JSON.parse(t)}catch{s[n]=t}}}let c=[],l=cx(n,!0),u=t+1;for(;u<e.length&&e[u].type!==`vmr_container_close`;)if(e[u].type===`paragraph_open`){let t=e[u+1];if(t){let i={type:`paragraph`,children:r(t.children||[],void 0,void 0,l.options()),raw:String(t.content??``)};n?.includeSourceMap&&dw(i,e[u],n),c.push(i),l.remember(i.raw)}u+=3}else if(e[u].type===`bullet_list_open`||e[u].type===`ordered_list_open`){let[t,i]=xO(e,u,l.options(),r);n?.includeSourceMap&&dw(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else if(e[u].type===`blockquote_open`){let[t,i]=kO(e,u,l.options(),r);n?.includeSourceMap&&dw(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else{let t=tk(e,u,l.options(),r);t?(c.push(t[0]),l.remember(t[0].raw),u=t[1]):u++}let d=u<e.length&&e[u].type===`vmr_container_close`,f=d&&i.meta?.unclosed!==!0||!!n?.final,p=`::: ${o}`;return Object.keys(s).length>0&&(p+=` ${JSON.stringify(s)}`),p+=`
130
+ `,c.length>0&&(p+=i.raw??c.map(e=>e.raw).join(`
131
+ `),p+=`
132
+ `),p+=`:::`,[{type:`vmr_container`,name:o,loading:!f,attrs:Object.keys(s).length>0?s:void 0,children:c,raw:p},d?u+1:u]}function KO(e,t,n,r){if(n?.type.endsWith(`_close`)){let i=Array.isArray(n.map)?Number(n.map[1]):NaN;return Number.isFinite(i)||(i=Array.isArray(t.map)?Number(t.map[1])+1:NaN),fw(e,t,i,r)}return dw(e,t,r)}function qO(e){return e.replace(/^\r?\n/,``).replace(/\r?\n$/,``)}var JO=new Map;function YO(e){let t=JO.get(e);if(t)return t;let n=Vy(e);return t={strip:RegExp(`[\\t ]*<\\s*\\/\\s*${n}[^>]*$`,`i`),search:RegExp(`<\\s*${n}(?=\\s|>|/)`,`gi`),openAny:RegExp(`<\\s*${n}(?=\\s|>|/)`,`gi`),closeAny:RegExp(`<\\s*\\/\\s*${n}(?=\\s|>)`,`gi`)},JO.set(e,t),t}function XO(e,t){if(!e||!t)return e;let n=YO(t).strip;return e.replace(n,``)}function ZO(e,t,n){if(!e||!t)return null;let{openAny:r,closeAny:i}=YO(t.toLowerCase()),a=0,o=Math.max(0,n);for(;o<e.length;){let t=e.indexOf(`<`,o);if(t===-1)break;if(i.lastIndex=t,i.exec(e)?.index===t){let n=Hy(e.slice(t));if(n===-1)return null;if(a===0)return{start:t,end:t+n+1};a--,o=t+n+1;continue}if(r.lastIndex=t,r.exec(e)?.index===t){let n=Hy(e.slice(t));if(n===-1)return null;let r=e.slice(t,t+n+1);/\/\s*>$/.test(r)||a++,o=t+n+1;continue}o=t+1}return null}function QO(e,t,n){if(!e||!t)return null;let{search:r,openAny:i,closeAny:a}=YO(t.toLowerCase());r.lastIndex=Math.max(0,n||0);let o=r.exec(e);if(!o||o.index==null)return null;let s=o.index,c=e.slice(s),l=Hy(c);if(l===-1)return null;let u=s+l;if(/\/\s*>\s*$/.test(c.slice(0,l+1))){let t=u+1;return{raw:e.slice(s,t),start:s,end:t}}let d=1,f=u+1,p=t=>(i.lastIndex=t,i.exec(e)?.index===t),m=t=>(a.lastIndex=t,a.exec(e)?.index===t);for(;f<e.length;){let t=e.indexOf(`<`,f);if(t===-1)return{raw:e.slice(s),start:s,end:e.length};if(m(t)){let n=e.indexOf(`>`,t);if(n===-1)return null;if(d--,d===0){let t=n+1;return{raw:e.slice(s,t),start:s,end:t}}f=n+1;continue}if(p(t)){let n=Hy(e.slice(t));if(n===-1)return null;d++,f=t+n+1;continue}f=t+1}return{raw:e.slice(s),start:s,end:e.length}}function $O(e){return Number.isFinite(e)&&e>0?e:0}function ek(e,t){let n=$O(t);if(!e||n<=0)return 0;let r=0;for(let t=0;t<e.length;t++)if(e[t]===`
133
+ `&&(r++,r===n))return t+1;return e.length}function tk(e,t,n,r){let i=e[t],a=n?.includeSourceMap===!0;switch(i.type){case`heading_open`:{let o=NO(e,t,n,r);return a&&dw(o,i,n),[o,t+3]}case`code_block`:{let e=AO(i);return a&&dw(e,i,n),[e,t+1]}case`fence`:{let e=rE(i);return a&&dw(e,i,n),[e,t+1]}case`math_block`:{let e=PO(i);return a&&dw(e,i,n),[e,t+1]}case`html_block`:{let e=aw(i),r=e.tag?WO(n?.customHtmlTags):null;if(e.tag&&e.loading&&r&&!r.allowedTagSet.has(e.tag)){let e=String(i.content??``).replace(/\n+$/,``),r={type:`paragraph`,children:e?[{type:`text`,content:e,raw:e}]:[],raw:e};return a&&dw(r,i,n),[r,t+1]}if(e.tag&&r?.customTagSet?.has(e.tag)){let r=e.tag,o=Eb(n)?n:void 0,s=String(o?.sourceMarkdown??``),c=Number(o?.customHtmlBlockCursor??0),l=Number(i.map?.[0]??0),u=Array.isArray(i.map)?o?.sourceLineOffsets?.[l]??ek(s,l):0,d=QO(s,r,Math.max($O(c),$O(u)));d&&o&&(o.customHtmlBlockCursor=d.end);let f=String(d?.raw??e.raw??``),p=Hy(f),m=p===-1?f:f.slice(0,p+1),h=p!==-1&&/\/\s*>\s*$/.test(m),g=p===-1?null:ZO(f,r,p+1),_=g?.start??-1,v=``;p!==-1&&(v=_!==-1&&p<_?f.slice(p+1,_):f.slice(p+1)),_===-1&&(v=XO(v,r));let y=[],b=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,x;for(;(x=b.exec(m))!==null;){let e=x[1];if(!e||e.toLowerCase()===r)continue;let t=x[2]||x[3]||x[4]||``;y.push([e,t])}let S=!n?.final&&!h&&g==null,C={type:r,tag:r,content:qO(v),raw:String(d?.raw??e.raw??f),loading:S,attrs:y.length?y:void 0};return a&&(d?C.sourceMap=lw(s,d.start,d.end,n):dw(C,i,n)),[C,t+1]}return a&&dw(e,i,n),[e,t+1]}case`table_open`:{let[o,s]=zO(e,t,n,r);return a&&dw(o,i,n),[o,s]}case`dl_open`:{let[o,s]=jO(e,t,n,r);return a&&dw(o,i,n),[o,s]}case`footnote_open`:{let[o,s]=MO(e,t,n,r);return a&&dw(o,i,n),[o,s]}case`hr`:{let e=BO();return a&&dw(e,i,n),[e,t+1]}}return null}function nk(e,t,n,r,i){let a=tk(e,t,n,i);if(a)return a;let o=e[t],s=n?.includeSourceMap===!0;switch(o.type){case`container_warning_open`:case`container_info_open`:case`container_note_open`:case`container_tip_open`:case`container_danger_open`:case`container_caution_open`:case`container_error_open`:if(r?.parseContainer){let a=r.parseContainer(e,t,n,i);return s&&KO(a[0],o,e[a[1]-1],n),a}break;case`container_open`:if(r?.matchAdmonition){let a=r.matchAdmonition(e,t,n,i);if(a)return s&&KO(a[0],o,e[a[1]-1],n),a}break;case`vmr_container_open`:{let r=GO(e,t,n,i);return s&&KO(r[0],o,e[r[1]-1],n),r}}return null}function rk(){return{type:`hardbreak`,raw:`\\
134
+ `}}function ik(e,t,n,r){let i=e[t+1],a=String(i.content??``);return{type:`paragraph`,children:r(i.children||[],a,void 0,n),raw:a}}function ak(e,t,n){let r=t?.map,i=n.sourceMarkdown,a=n.runtime;if(!Array.isArray(r)||r.length<2||typeof i!=`string`||!a)return;let o=Number(r[0]),s=Number(r[1]);if(!Number.isFinite(o)||!Number.isFinite(s))return;let c=n.sourceLineOffsets;if(!c){c=[0];for(let e=0;e<i.length;e++)i[e]===`
135
+ `&&c.push(e+1);n.sourceLineOffsets=c}a.nodeSourceRanges.set(e,{start:c[Math.max(0,Math.trunc(o))]??i.length,end:c[Math.max(0,Math.trunc(s))]??i.length})}function ok(e,t){return t.nodeSourceRanges.get(e)}function sk(e){return e}var ck=new Map;function lk(e){let t=e?.customHtmlTags;if(!Array.isArray(t)||t.length===0)return null;let n=t.join(`\0`),r=ck.get(n);if(r)return r;let i=qy(t),a=i.length?new Set(i):null;return a&&ck.set(n,a),a}function uk(e){let t=e.raw;if(typeof t==`string`)return t;let n=sk(e).content;return typeof n==`string`?n:e.type===`hardbreak`?`<br>`:``}function dk(e){return{type:`paragraph`,children:e,raw:e.map(uk).join(``)}}function fk(e,t){if(t.sourceMap)for(let n of e)n.sourceMap||=t.sourceMap}function pk(e,t){if(e.type!==`paragraph`)return null;let n=sk(e).children,r=Array.isArray(n)?n:[];if(r.length===0)return null;let i=lk(t);if(!i?.size)return null;let a=-1;for(let e=0;e<r.length;e++){let t=r[e];if(!i.has(String(t?.type??``).toLowerCase()))continue;let n=r.slice(0,e);if(String(sk(t).content??``).trim()&&n.some(e=>e?.type===`hardbreak`)){a=e;break}}if(a===-1)return null;let o=r.slice(0,a),s=r[a];if(!s)return null;let c=[];o.length&&c.push(dk(o)),c.push(s);let l=r.slice(a+1);return l.length&&c.push(dk(l)),c}function mk(e,t,n){if(!e||!Array.isArray(e))return[];let r=[],i=[],a=cx(t),o=t?.includeSourceMap===!0,s=0;for(;s<e.length;){let c=nk(e,s,a.options(),OO,n);if(c){ak(c[0],e[s],t),r.push(c[0]),a.remember(c[0].raw),i.push(a.snapshot()),s=c[1];continue}let l=e[s];switch(l.type){case`paragraph_open`:{let i=String(e[s+1]?.content??``),c=ik(e,s,a.options(i),n);o&&dw(c,l,t);let u=pk(c,t);if(u){o&&fk(u,c);for(let e of u)ak(e,l,t);r.push(...u)}else ak(c,l,t),r.push(c);a.remember(c.raw),s+=3;break}case`bullet_list_open`:case`ordered_list_open`:{let[i,c]=xO(e,s,a.options(),n);o&&dw(i,l,t),ak(i,l,t),r.push(i),a.remember(i.raw),s=c;break}case`blockquote_open`:{let[i,c]=kO(e,s,a.options(),n);o&&dw(i,l,t),ak(i,l,t),r.push(i),a.remember(i.raw),s=c;break}case`footnote_anchor`:{let e=l.meta??{},n={type:`footnote_anchor`,id:String(e.label??l.content??``),raw:String(l.content??``)};o&&dw(n,l,t),ak(n,l,t),r.push(n),a.remember(String(l.content??``)),s++;break}case`hardbreak`:r.push(rk()),a.reset(),s++;break;case`text`:{let e=String(l.content??``),n={type:`paragraph`,raw:e,children:e?[{type:`text`,content:e,raw:e}]:[]};o&&dw(n,l,t),ak(n,l,t),r.push(n),a.remember(e),s++;break}case`inline`:{let e=String(l.content??``),i=n(l.children||[],e,void 0,a.options(e));if(i.length!==0){if(i.every(e=>e.type===`html_block`)){if(o)for(let e of i)dw(e,l,t);for(let e of i)ak(e,l,t);r.push(...i)}else{let n={type:`paragraph`,raw:e,children:i};o&&dw(n,l,t);let a=pk(n,t);if(a){o&&fk(a,n);for(let e of a)ak(e,l,t);r.push(...a)}else ak(n,l,t),r.push(n)}}a.remember(e)}s+=1;break;default:s+=1}let u=a.snapshot();for(;i.length<r.length;)i.push(u)}return t.linkifyDemotionResultContexts=i,r}function hk(e,t){let n=e.sourceLineOffsets;if(n?.source===t)return n.offsets;if(n&&t.length>n.source.length&&e.sourceExtends(n.source,t)){let e=n.offsets;for(let r=n.source.length;r<t.length;r++)t.charCodeAt(r)===10&&e.push(r+1);return n.source=t,e}let r=[0];for(let e=0;e<t.length;e++)t.charCodeAt(e)===10&&r.push(e+1);return e.sourceLineOffsets={source:t,offsets:r},r}var gk=new WeakMap,_k=new WeakSet,vk=new WeakSet;function yk(e,t){return e.customHtmlTags===t.customHtmlTags&&e.hasCustomParserExtensions===t.hasCustomParserExtensions&&e.includeSourceMap===t.includeSourceMap&&e.postTransformNodes===t.postTransformNodes&&e.postTransformTokens===t.postTransformTokens&&e.preTransformTokens===t.preTransformTokens&&e.requireClosingStrong===t.requireClosingStrong&&e.reuseStableTopLevelNodes===t.reuseStableTopLevelNodes&&e.streamParse===t.streamParse&&e.validateLink===t.validateLink}var bk=class{constructor(e){this.streamParseEnvs=new Map,this.htmlPassIdentityPreserving=!1,this.detailsStitchCache=new WeakMap,this.nodeSourceRanges=new WeakMap,this.finalized=!1,this.resettingStream=!1,this.streamStateActive=!1,this.streamResetInCurrentRootParse=!1,this.markdownIt=e}sourceExtends(e,t){return this.sourceRelationPrevious===e&&this.sourceRelationCurrent===t?!0:t.startsWith(e)?(this.sourceRelationPrevious=e,this.sourceRelationCurrent=t,!0):!1}beginRootParse(e,t){this.streamResetInCurrentRootParse=!1;let n=this.documentSource!==void 0&&e!==this.documentSource&&!this.sourceExtends(this.documentSource,e),r=this.semantics!==void 0&&!yk(this.semantics,t);(this.finalized||n||r)&&this.resetDocument(this.streamStateActive),this.finalized=!1,this.documentSource=e,this.semantics=t}finishRootParse(e){this.sourceRelationPrevious=void 0,this.sourceRelationCurrent=void 0,e&&(this.clearDocumentCaches(),this.documentSource=void 0,this.semantics=void 0,this.finalized=!0)}resetForFinalAutoParse(){this.streamResetInCurrentRootParse||this.resetStreamOnly(),this.clearDocumentCaches()}markStreamParseStarted(){this.streamStateActive=!0}resetDocument(e){e&&this.resetStreamOnly(),this.clearDocumentCaches(),this.documentSource=void 0,this.semantics=void 0,this.finalized=!1}resetStreamOnly(){let e=this.markdownIt.stream,t=e?.reset;if(e&&typeof t==`function`){this.resettingStream=!0;try{t.call(e),this.streamStateActive=!1,this.streamResetInCurrentRootParse=!0}finally{this.resettingStream=!1}}}isResettingStream(){return this.resettingStream}handleExternalStreamReset(){this.streamStateActive=!1,this.streamResetInCurrentRootParse=!0,this.clearDocumentCaches(),this.documentSource=void 0,this.semantics=void 0,this.finalized=!1}invalidateConfiguration(){this.resetDocument(!0)}dispose(){this.resetDocument(!0),gk.delete(this.markdownIt)}clearDocumentCaches(){this.safeMarkdown=void 0,this.tolerantMathBoundary=void 0,this.pendingExplicitMathTail=void 0,this.streamParseEnvs.clear(),this.topLevelStreamParseMode=void 0,this.structuredStream=void 0,this.htmlPassIdentityPreserving=!1,this.siblingHtmlChildren=void 0,this.detailsStitchCache=new WeakMap,this.nodeSourceRanges=new WeakMap,this.sourceLineOffsets=void 0,this.sourceRelationPrevious=void 0,this.sourceRelationCurrent=void 0}};function xk(e){let t=e,n=e;if(!_k.has(t)){_k.add(t);let r=e.use;e.use=function(...e){try{return n.__markstreamHasCustomParserExtensions=!0,Reflect.apply(r,this,e)}finally{gk.get(t)?.invalidateConfiguration()}};let i=e.set;e.set=function(...e){try{return Reflect.apply(i,this,e)}finally{gk.get(t)?.invalidateConfiguration()}}}let r=e.stream;if(!r||typeof r.reset!=`function`)return;let i=r;if(vk.has(i))return;vk.add(i);let a=r.reset;r.reset=function(...e){let n=gk.get(t);try{return Reflect.apply(a,this,e)}finally{n?.isResettingStream()||n?.handleExternalStreamReset()}}}function Sk(e){let t=e,n=gk.get(t);return n||(n=new bk(e),gk.set(t,n)),xk(e),n}function Ck(e,t){if(e===t)return;let n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=[],a=0;for(let e=0;e<r.length;e++){let t=r[e]??``;if(n[a]===t){i[e]={startLine:a,endLine:a+1},a++;continue}let o=n[a]??``;if(t!==``&&o!==t&&o.startsWith(t)){let n=t,s=-1;for(let t=e+1;t<r.length;t++){if(n+=r[t]??``,n===o){s=t;break}if(!o.startsWith(n))break}if(s!==-1){for(let t=e;t<=s;t++)i[t]={startLine:a,endLine:a+1};a++,e=s;continue}i[e]={startLine:a,endLine:a+1};continue}let s=n[a]??``,c=-1;for(let e=a+1;e<n.length;e++){if(s+=`\\n${n[e]??``}`,s===t){c=e+1;break}if(!t.startsWith(s))break}if(c!==-1){i[e]={startLine:a,endLine:c},a=c;continue}let l=-1;if(t!==``){let e=Math.min(n.length,a+80);for(let r=a;r<e;r++)if(n[r]===t){l=r;break}}if(l!==-1){i[e]={startLine:l,endLine:l+1},a=l+1;continue}let u=Math.min(Math.max(0,n.length-1),Math.max(0,a-1));i[e]={startLine:u,endLine:u+1}}return e=>{let t=Number.isFinite(e)?Math.max(0,Math.trunc(e)):0;if(t<i.length)return i[t]??{startLine:0,endLine:0};let r=i[i.length-1]??{startLine:Math.max(0,n.length-1),endLine:n.length},a=Math.min(n.length,r.endLine+t-i.length);return{startLine:a,endLine:Math.min(n.length,a+1)}}}var wk=new Map;function Tk(e){let t=wk.get(e);return t||(t=new RegExp(String.raw`(^[\t ]*<\s*\/\s*${e}\s*>[\t ]*)(\r?\n)(?![\t ]*\r?\n|$)`,`gim`),wk.size>=64&&wk.clear(),wk.set(e,t)),t}function Ek(e){let t=e=>e===` `||e===` `||e===`
136
+ `||e===`\r`,n=e=>{if(!e||e[0]!==`<`||e.includes(`>`))return!1;let n=1;if(n<e.length&&t(e[n])||e.startsWith(`<!--`)||e.startsWith(`<?`)||e.startsWith(`<!`)||e[n]===`/`&&(n++,n<e.length&&t(e[n])))return!1;let r=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122},i=e=>{let t=e.charCodeAt(0);return t>=48&&t<=57},a=e=>e===`!`||r(e),o=e=>r(e)||i(e)||e===`:`||e===`-`,s=e=>r(e)||i(e)||e===`_`||e===`.`||e===`:`||e===`-`,c=s;if(n>=e.length||!a(e[n]))return!1;for(n++;n<e.length&&o(e[n]);)n++;for(;n<e.length;){for(;n<e.length&&t(e[n]);)n++;if(n>=e.length)return!0;if(e[n]===`/`){for(n++;n<e.length&&t(e[n]);)n++;return n>=e.length}if(!s(e[n]))return!1;for(n++;n<e.length&&c(e[n]);)n++;for(;n<e.length&&t(e[n]);)n++;if(n<e.length&&e[n]===`=`){for(n++;n<e.length&&t(e[n]);)n++;if(n>=e.length)return!0;let r=e[n];if(r===`"`||r===`'`){for(n++;n<e.length&&e[n]!==r;)n++;if(n>=e.length)return!0;n++}else{for(;n<e.length;){let r=e[n];if(t(r)||r===`<`||r===`>`||r===`"`||r===`'`||r==="`")break;n++}if(n>=e.length)return!0}}}return!0},r=String(e??``),i=r.lastIndexOf(`<`);if(i===-1)return r;if(i>0){let e=r[i-1],t=e===` `||e===` `||e===`
137
+ `||e===`\r`,n=r[i-2];if(!t&&(e!==`n`&&e!==`r`||n!==`\\`))return r}let a=r.slice(i);return a.includes(`>`)||a.length>1&&(a[1]===` `||a[1]===` `||a[1]===`
138
+ `||a[1]===`\r`)||!n(a)||Vw(r,i)?r:r.slice(0,i)}function Dk(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()).filter(Boolean));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===` `){if(t++,t>=4)return!0;continue}if(r===` `)return!0;break}return!1},o=e=>{let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`){r++;continue}if(!n&&i===`'`){t=!t;continue}if(!t&&i===`"`){n=!n;continue}if(!t&&!n&&i===`>`)return r}return-1},s=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;let n=e[t];if(n!=="`"&&n!==`~`)return null;let i=t;for(;i<e.length&&e[i]===n;)i++;let a=i-t;return a<3?null:{markerChar:n,markerLen:a,rest:e.slice(i)}},c=(t,s)=>{if(a(t))return-1;let c=t.replace(/^[ \t]+/,``);if(!c||c.startsWith(`>`)||c.startsWith(`|`)||/^(?:[*+-]|\d+[.)])[\t ]+/.test(c))return-1;let l=!1,u=0;for(;u<t.length;){let a=t[u];if(a!==`<`){r(a)||(l=!0),u++;continue}let c=o(t.slice(u));if(c===-1){l=!0,u++;continue}let d=t.slice(u,u+c+1),f=1;for(;f<d.length&&r(d[f]);)f++;if(f>=d.length){l=!0,u++;continue}let p=d[f];if(p===`!`||p===`?`){l=!0,u+=c+1;continue}if(p===`/`){l=!0,u+=c+1;continue}let m=f;for(;f<d.length&&i(d[f]);)f++;if(f===m){l=!0,u++;continue}let h=d.slice(m,f).toLowerCase(),g=d[f];if(g&&g!==` `&&g!==` `&&g!==`>`&&g!==`/`){l=!0,u++;continue}let _=new RegExp(String.raw`<\s*\/\s*${h}\s*>`,`i`),v=/\/\s*>$/.test(d),y=_.test(t.slice(u+c+1)),b=_.test(e.slice(s+u+c+1)),x=/[\r\n]/.test(e.slice(s+u+c+1));if(l&&n.has(h)&&!v&&!y&&(b||x))return u;l=!0,u+=c+1}return-1},l=!1,u=``,d=0,f=``,p=0;for(;p<e.length;){let t=e.indexOf(`
139
+ `,p),n=t!==-1,r=n&&t>p&&e[t-1]===`\r`,i=n?r?t-1:t:e.length,a=e.slice(p,i),o=n?r?`\r
140
+ `:`
141
+ `:``,m=s(a),h=a;if(!l&&!m){let e=c(a,p);if(e!==-1){let t=o||`
142
+ `;h=`${a.slice(0,e).replace(/[ \t]+$/,``)}${t}${t}${a.slice(e).replace(/^[ \t]+/,``)}`}}f+=h,f+=o,m&&(l?m.markerChar===u&&m.markerLen>=d&&/^\s*$/.test(m.rest)&&(l=!1,u=``,d=0):(l=!0,u=m.markerChar,d=m.markerLen)),p=n?t+1:e.length}return f}function Ok(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`},a=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;return e.slice(t)},o=e=>{let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`){r++;continue}if(!n&&i===`'`){t=!t;continue}if(!t&&i===`"`){n=!n;continue}if(!t&&!n&&i===`>`)return r}return-1},s=(e,t,n)=>{let a=n.toLowerCase(),o=e.indexOf(`<`,t);for(;o!==-1;){let t=o+1;for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`/`){o=e.indexOf(`<`,o+1);continue}for(t++;t<e.length&&r(e[t]);)t++;if(t+a.length>e.length){o=e.indexOf(`<`,o+1);continue}let n=!0;for(let r=0;r<a.length;r++){let i=e[t+r];if((i>=`A`&&i<=`Z`?String.fromCharCode(i.charCodeAt(0)+32):i)!==a[r]){n=!1;break}}if(!n){o=e.indexOf(`<`,o+1);continue}let s=t+a.length;if(s<e.length&&i(e[s])){o=e.indexOf(`<`,o+1);continue}for(;s<e.length&&r(e[s]);)s++;if(s<e.length&&e[s]===`>`)return!0;o=e.indexOf(`<`,o+1)}return!1},c=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`<`)return e;for(t++;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]===`/`)return e;let c=t;for(;t<e.length&&i(e[t]);)t++;if(t===c)return e;let l=e.slice(c,t).toLowerCase();if(!n.has(l))return e;let u=o(e.slice(t));if(u===-1)return e;let d=t+u;if(s(e,d+1,l))return e;let f=a(e.slice(d+1));return f?`${e.slice(0,d+1)}\n${f}`:e},l=``,u=0;for(;u<e.length;){let t=e.indexOf(`
143
+ `,u);if(t===-1){l+=c(e.slice(u));break}let n=t>u&&e[t-1]===`\r`,r=n?t-1:t,i=e.slice(u,r);l+=c(i),l+=n?`\r
144
+ `:`
145
+ `,u=t+1}return l}function kk(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=0,n=!1,i=0;for(;t<e.length;){for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`>`)break;for(n=!0,t++;t<e.length&&r(e[t]);)t++;i=t}return n?{prefix:e.slice(0,i),content:e.slice(i)}:null},a=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;let n=e[t];if(n!=="`"&&n!==`~`)return null;let i=t;for(;i<e.length&&e[i]===n;)i++;let a=i-t;return a<3?null:{markerChar:n,markerLen:a,rest:e.slice(i)}},o=Array.from(n).map(e=>new RegExp(String.raw`(<\s*\/\s*${e}\s*>)${"(?=[\\t ]*(?:#{1,6}[\\t ]+|>|(?:[*+-]|\\d+[.)])[\\t ]+|(?:`{3,}|~{3,})|\\||\\$\\$|:{3,}|\\[\\^[^\\]]+\\]:|(?:-{3,}|\\*{3,}|_{3,})))"}`,`gi`)),s=!1,c=``,l=0,u=``,d=0;for(;d<e.length;){let t=e.indexOf(`
146
+ `,d),n=t!==-1,r=n&&t>d&&e[t-1]===`\r`,f=n?r?t-1:t:e.length,p=e.slice(d,f),m=n?r?`\r
147
+ `:`
148
+ `:``,h=i(p),g=h?.prefix??``,_=h?.content??p,v=a(_);v&&(s?v.markerChar===c&&v.markerLen>=l&&/^\s*$/.test(v.rest)&&(s=!1,c=``,l=0):(s=!0,c=v.markerChar,l=v.markerLen));let y=_;if(!s&&y.includes(`</`))for(let e of o)y=y.replace(e,(e,t,n,r)=>{if(r.replace(/^[\t ]+/,``).startsWith(`|`))return e;let i=r.slice(0,n).replace(/^[\t ]+/,``);if(i.length>0){let n=t.match(/^<\s*\/\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??``,r=i.match(/^<\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??``;if(!n||!r||n!==r)return e}return`${t}\n\n`});if(g){let e=g+y.split(`
149
+ `).join(`\n${g}`);u+=e}else u+=y;u+=m,d=n?t+1:e.length}return u}function Ak(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===` `){if(t++,t>=4)return!0;continue}if(r===` `)return!0;break}return!1},a=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},o=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;return e.slice(t)},s=e=>{let t=0,n=!1,i=0;for(;t<e.length;){for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`>`)break;for(n=!0,t++;t<e.length&&r(e[t]);)t++;i=t}if(!n)return null;let a=e.slice(0,i);return{prefix:a,key:a.replace(/[ \t]+$/,``),content:e.slice(i)}},c=e=>o(e).startsWith(`<`),l=e=>{for(let t=0;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `)return!1}return!0},u=e=>{if(i(e))return``;let t=o(e);if(!t.startsWith(`<`))return``;let s=1;for(;s<t.length&&r(t[s]);)s++;if(s>=t.length||t[s]===`/`||t[s]===`!`||t[s]===`?`)return``;let c=s;for(;s<t.length&&a(t[s]);)s++;if(s===c)return``;let l=t.slice(c,s).toLowerCase();if(!n.has(l))return``;let u=t[s];return u&&u!==` `&&u!==` `&&u!==`>`&&u!==`/`?``:l},d=e=>{if(i(e))return null;let t=o(e);if(!t.startsWith(`<`))return null;let s=1;for(;s<t.length&&r(t[s]);)s++;if(s>=t.length)return null;let c=t[s]===`/`;if(c)for(s++;s<t.length&&r(t[s]);)s++;let l=t[s];if(!l||l===`!`||l===`?`)return null;let u=s;for(;s<t.length&&a(t[s]);)s++;if(s===u)return null;let d=t.slice(u,s).toLowerCase();if(!n.has(d))return null;let f=t[s];if(f&&f!==` `&&f!==` `&&f!==`>`&&f!==`/`)return null;if(c)return{type:`close`,name:d};if(/\/\s*>\s*$/.test(t))return{type:`open`,name:d,complete:!0};let p=t.indexOf(`>`,s);if(p!==-1){let e=t.slice(p+1);if(RegExp(`<\\s*\\/\\s*${d}\\s*>`,`i`).test(e))return{type:`open`,name:d,complete:!0}}return{type:`open`,name:d,complete:!1}},f=e=>{if(i(e))return null;let t=o(e).replace(/[ \t]+$/,``);if(!t.startsWith(`<`)||/^<\s*(?:!--|!doctype\b|\?)/i.test(t))return null;let n=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*\/\s*>\s*$/i);if(n?.[1])return n[1].toLowerCase();let r=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*>[\s\S]*<\s*\/\s*([A-Z][\w:-]*)\s*>\s*$/i);if(!r?.[1]||!r[2])return null;let a=r[1].toLowerCase();return a===r[2].toLowerCase()?a:null},p=!1,m=``,h=0,g=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;let n=e[t];if(n!=="`"&&n!==`~`)return null;let i=t;for(;i<e.length&&e[i]===n;)i++;let a=i-t;return a<3?null:{markerChar:n,markerLen:a,rest:e.slice(i)}},_=e=>g(e),v=e=>{let t=o(e);return t?i(e)?!0:/^(?:#{1,6}[ \t]+|>|[*+-][ \t]+|\d+[.)][ \t]+|`{3,}|~{3,}|\||\$\$|:{3,}|\[\^[^\]]+\]:|-{3,}|\*{3,}|_{3,})/.test(t):!1},y=(t,n,r)=>{let i=t,a=0;for(;i<e.length;){let t=e.indexOf(`
150
+ `,i),o=t!==-1,c=o&&t>i&&e[t-1]===`\r`,u=o?c?t-1:t:e.length,f=e.slice(i,u),p=s(f),m=p?.key??``;if(a>0&&n&&m!==n)break;let h=p?.content??f,g=d(h);if(g?.name===r){if(g.type===`open`)g.complete||a++;else if(a>0&&(a--,a===0))return!1}else if(a>0&&(l(h)||v(h)))return!0;if(o)i=t+1;else break}return!1},b=``,x=0,S=!0,C=!1,w=!1,T=`
151
+ `,E=[],D=``;for(;x<e.length;){let t=e.indexOf(`
152
+ `,x),n=t!==-1,r=n&&t>x&&e[t-1]===`\r`,i=n?r?t-1:t:e.length,a=e.slice(x,i),o=n?r?`\r
153
+ `:`
154
+ `:``,g=s(a),v=g?.key??``,O=g?.content??a,k=_(O);k&&(p?k.markerChar===m&&k.markerLen>=h&&/^\s*$/.test(k.rest)&&(p=!1,m=``,h=0):(p=!0,m=k.markerChar,h=k.markerLen));let A=E.length>0;if(!p&&!A){let e=u(O),t=!!e&&!S&&C&&w&&y(x,v,e);e&&!S&&(!C||t)&&(v&&D&&v===D?b+=`${v}${T}`:v||(b+=T))}if(b+=a,b+=o,o&&(T=o),!p){let e=d(O);if(e){if(e.type===`open`)e.complete||E.push(e.name);else for(let t=E.length-1;t>=0;t--)if(E[t]===e.name){E.length=t;break}}}let j=l(O);S=j,C=!j&&c(O),w=!j&&!!f(O),D=v,x=n?t+1:e.length}return b}function jk(e,t,n){let r=e;if(t?.length&&r.includes(`<`)){let e=qy(t);if(e.length&&(r=Dk(r,e),r=Ok(r,e),r=Ak(r,e),r=kk(r,e),r.includes(`</`)))for(let t of e)r=r.replace(Tk(t),`$1$2$2`)}return n||(r=Ek(r)),r}var Mk=1024,Nk=16;function Pk(e,t,n){let r=e.replace(/([^\\])\r(ight|ho)/g,`$1\\r$2`),i=$w(r);return r=r.replace(/([^\\])\r?\n(abla|eq|ot|exists)/g,(e,t,n,r)=>{i.scanTo(r+1);let a=i.inMath();return i.scanTo(r+e.length),a?`${t}\\n${n}`:e}),t||(r.endsWith(`- *`)&&(r=r.replace(/- \*$/,`- \\*`)),/(?:^|\n)\s*-\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*-\s*$/,e=>e.startsWith(`
155
+ `)?`
156
+ `:``):/(?:^|\n)\s*--\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*--\s*$/,e=>e.startsWith(`
157
+ `)?`
158
+ `:``):/(?:^|\n)\s*>\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*>\s*$/,e=>e.startsWith(`
159
+ `)?`
160
+ `:``):/\n\s*[*+]\s*$/.test(r)?r=r.replace(/\n\s*[*+]\s*$/,`
161
+ `):/(?:^|\n)\s*\d+\s*$/.test(r)?/^\d+$/.test(r.trim())||(r=r.replace(/(?:^|\n)\s*\d+\s*$/,e=>e.startsWith(`
162
+ `)?`
163
+ `:``)):/(?:^|\n)\s*\d+[.)]\s+\*{1,3}\s*$/.test(r)?r=r.replace(/((?:^|\n)\s*\d+[.)]\s+)(\*{1,3})\s*$/,(e,t,n)=>`${t}${n.split(``).map(()=>`\\*`).join(``)}`):/(?:^|\n)\s*\d+[.)]\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*\d+[.)]\s*$/,e=>e.startsWith(`
164
+ `)?`
165
+ `:``):/\n[[(]\n*$/.test(r)&&(r=r.replace(/(\n\[|\n\()+\n*$/g,`
166
+ `)),r=Ww(r,n.customHtmlTags)??r),r=jk(r,n.customHtmlTags,t),r}function Fk(e,t,n,r){let i=`${n?`final`:`stream`}:${(r.customHtmlTags??[]).join(`,`)}`,a=r.isFragment?void 0:e.safeMarkdown,o;if(!n&&!r.customHtmlTags?.length&&a&&a.mode===i&&t.length>=a.source.length&&e.sourceExtends(a.source,t)){let e=Math.max(0,a.source.length-Mk-Nk),i=Pk(t.slice(e),n,r),s=a.source.length-e;o=i.length>=s&&i.slice(0,s)===a.safeMarkdown.slice(-s)?a.safeMarkdown.slice(0,a.safeMarkdown.length-s)+i:Pk(t,n,r)}else o=Pk(t,n,r);return n||(o=qw(o,e,!r.isFragment)),r.isFragment||(e.safeMarkdown={source:t,safeMarkdown:o,mode:i}),o}function Ik(){return typeof performance<`u`?performance.now():Date.now()}function Lk(e,t,n){e&&(e[t]=(e[t]??0)+n)}function Rk(e){return e.parserMetrics}function zk(e,t,n){return t&&Lk(t,`parseMarkdownToStructureTotalMs`,Ik()-n),e}function Bk(e,t,n,r){return zk(_O(e,t),n,r)}function Vk(e,t,n){if(!n)return mk(e,t,hO);Lk(n,`processTokensInputTokens`,e.length);let r=Ik(),i=mk(e,t,hO);return Lk(n,`processTokensMs`,Ik()-r),i}function Hk(e,t){let n=e,r=typeof n.validateLink==`function`&&n.__markstreamOriginalValidateLink&&n.validateLink!==n.__markstreamOriginalValidateLink?n.validateLink:void 0;return t.validateLink??r??n.options?.validateLink??(typeof n.validateLink==`function`?n.validateLink:void 0)}function Uk(e,t){let n=t.runtime,r=t.markdownIt,i={...t,customHtmlBlockCursor:0,sourceLineOffsets:void 0},a=Rk(i),o=a?{recordTokenCloneMs:e=>Lk(a,`tokenCloneMs`,e)}:void 0,s=a?Ik():0,c=!!i.final,l=(e??``).toString();i.isFragment||iT(n,i);let u=Fk(n,l,c,i);a&&Lk(a,`safeMarkdownMs`,Ik()-s);let d=UC(u);if(d){if(i.includeSourceMap){let e={...i,sourceLineMapper:Ck(l,u)};d[0].sourceMap=lw(u,0,u.length,e)}let e=i.preTransformTokens,t=i.postTransformTokens;if(nT(n,i)||typeof e==`function`||typeof t==`function`){let r=fT(n,u,{__markstreamFinal:c},i,o),a=typeof e==`function`&&e(r)||r;typeof t==`function`&&t(a)}return Bk(d,i,a,s)}let f=a?Ik():0,p=fT(n,u,{__markstreamFinal:c},i,o);if(a&&Lk(a,`tokenizeMs`,Ik()-f),!p||!Array.isArray(p))return Bk([],i,a,s);let m=i.preTransformTokens,h=i.postTransformTokens,g=p;m&&typeof m==`function`&&(g=m(g)||g);let _={...i,sourceLineMapper:i.includeSourceMap===!0?Ck(l,u):void 0,sourceMarkdown:u,sourceLineOffsets:hk(n,u),customHtmlBlockCursor:0},v=ET(n,u,g,_,{processTokens:(e,t)=>Vk(e,t,a),recordReusedTopLevelNodes:e=>Lk(a,`processTokensReusedTopLevelNodes`,e)});if(h&&typeof h==`function`){let e=h(g);if(Array.isArray(e)){let t=e[0],n=t?.type;v=t&&typeof n==`string`?Vk(e,{..._,customHtmlBlockCursor:0},a):e}}let y=n.structuredReuseTailStart,b=y&&y>0&&y<v.length?y:0;if(zT(v)){let e=a?Ik():0,t={getInternalNodeSourceRange:e=>ok(e,n),markdownIt:r,parseFragment:(e,t)=>Uk(e,t)},i=b>0&&n.htmlPassIdentityPreserving,o=i?ok(v[b],n)?.start:void 0,s=!1;for(let e=i?b:0;e<v.length;e++){let t=v[e];if(t.type===`html_block`&&String(t.tag??``).toLowerCase()===`details`){s=!0;break}}let l=i&&!s&&o!=null,d=l?v.slice(0,b):[],f=l?v.slice(b):v,p=l?o:0,m=WT(f,c,u,t,_,p),h=m.length===f.length&&m.every((e,t)=>e===f[t]);s&&(m=UT(m,u,t,_,c,p)[0]),m=RT(m,t,_,c),v=l?d.concat(m):m,n.htmlPassIdentityPreserving=!s&&h,a&&Lk(a,`htmlBlockPassesMs`,Ik()-e)}else n.htmlPassIdentityPreserving=!0;return c&&gO(v),v=_O(v,i),i.debug&&console.log(`Parsed Markdown Tree Structure:`,v),zk(v,a,s)}function Wk(e,t,n={}){let r=(e??``).toString(),i=Sk(t),a=Hk(t,n),o=Db(n,{markdownIt:t,runtime:i,validateLink:a}),s=t;i.beginRootParse(r,{customHtmlTags:(n.customHtmlTags??[]).join(`\0`),hasCustomParserExtensions:s.__markstreamHasCustomParserExtensions===!0,includeSourceMap:n.includeSourceMap===!0,postTransformNodes:n.postTransformNodes,postTransformTokens:n.postTransformTokens,preTransformTokens:n.preTransformTokens,requireClosingStrong:n.requireClosingStrong,reuseStableTopLevelNodes:n.reuseStableTopLevelNodes===!0,streamParse:n.streamParse,validateLink:a});try{return Uk(r,o)}finally{i.finishRootParse(n.final===!0)}}var Gk=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g,Kk=/\d/u,qk=/[,.!?;:,。;、!?:]/u,Jk=/\d\p{Script=Han}{1,3}$/u;function Yk(e){return e.pos>0&&e.pos+1<e.posMax&&Kk.test(e.src[e.pos-1])&&Kk.test(e.src[e.pos+1])}function Xk(e,t,n,r,i,a={}){let o=e.charCodeAt(0);return(e,s)=>{let c=e,l=c.posMax,u=c.pos;if(c.src.charCodeAt(u)!==o||s||a.refuseDigitRange&&Yk(c))return!1;c.pos=u+1;let d=!1;for(;c.pos<l;){if(c.src.charCodeAt(c.pos)===o){d=!0;break}c.md.inline.skipToken(c)}if(!d||u+1===c.pos)return c.pos=u,!1;let f=c.src.slice(u+1,c.pos);if(!f||f.match(/(^|[^\\])(\\\\)*\s/))return c.pos=u,!1;let p=c.src[c.pos+1],m=Kk.test(f[0]),h=p!==void 0&&Kk.test(p);if(m&&h&&(Jk.test(c.src.slice(0,u))||qk.test(f)||Kk.test(f[f.length-1])))return c.pos=u,!1;let g=c.push(n,i,1);g.markup=t;let _=c.push(`text`,``,0);_.content=f.replace(Gk,`$1`);let v=c.push(r,i,-1);return v.markup=t,c.pos+=1,!0}}function Zk(e){let t=Xk(`~`,`~`,`sub_open`,`sub_close`,`sub`,{refuseDigitRange:!0});e.inline.ruler.after(`emphasis`,`sub`,t)}var Qk=new Set([...yy,`base`,`button`,`datalist`,`dialog`,`embed`,`fieldset`,`form`,`iframe`,`input`,`legend`,`link`,`meta`,`object`,`optgroup`,`option`,`output`,`param`,`select`,`style`,`template`,`textarea`,`title`]),$k=new Set(`a.abbr.b.blockquote.br.caption.code.col.colgroup.dd.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.ins.kbd.li.mark.ol.p.picture.pre.s.small.source.span.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.ul`.split(`.`));function eA(e){return/^[^\s"'<>`=]+$/.test(e)&&!/^on/i.test(e)}function tA(e){return String(e??``).trim().toLowerCase()}function nA(e,t=`safe`){let n=tA(e);return n?t===`escape`?!0:t===`trusted`?yy.has(n):!$k.has(n):!1}function rA(e,t=`safe`){let n=tA(e);return n?t===`escape`?!0:t===`trusted`?yy.has(n):Qk.has(n):!1}function iA(e,t){let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length!==0&&n.some(e=>{let n=e.split(/\s+/,1)[0]??``;return!n||Ny(n,{tagName:t,attrName:`srcset`})})}function aA(e,t,n,r){return _y.has(e)||n===`safe`&&e===`style`?!0:e===`srcset`?iA(t,r):!!(vy.has(e)&&t&&Ny(t,{tagName:r,attrName:e}))}function oA(e,t){let n=t.toLowerCase();return Object.keys(e).find(e=>e.toLowerCase()===n)}function sA(e,t,n,r=!1){if(t!==`safe`||tA(n)!==`a`)return e;let i=oA(e,`href`);if(r&&(!i||!e[i])){let t=oA(e,`target`),n=oA(e,`rel`);return t&&delete e[t],n&&delete e[n],e}let a=oA(e,`target`);if((a?String(e[a]).trim():``).toLowerCase()!==`_blank`)return e;let o=oA(e,`rel`),s=new Set(String(o?e[o]:``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));return s.add(`noopener`),s.add(`noreferrer`),o&&o!==`rel`&&delete e[o],e.rel=Array.from(s).join(` `),e}function cA(e,t=`safe`,n){let r={};for(let[i,a]of Object.entries(e)){let e=i.trim(),o=e.toLowerCase();e&&eA(e)&&(aA(o,a,t,n)||(r[e]=a))}return sA(r,t,n,!!oA(e,`href`))}var lA=[/javascript:/i,/vbscript:/i,/data:text\/html/i,/expression\s*\(/i,/@import/i],uA=`http://www.w3.org/2000/svg`,dA=new Set([`script`,`style`,`iframe`,`object`,`embed`,`link`,`meta`]),fA=new Set([`svg`,`style`,`g`,`a`,`defs`,`marker`,`path`,`rect`,`circle`,`ellipse`,`line`,`polyline`,`polygon`,`text`,`tspan`,`title`,`desc`,`use`,`image`,`lineargradient`,`radialgradient`,`stop`,`clippath`,`mask`,`pattern`]),pA=new Set([`href`,`xlink:href`,`src`,`srcdoc`,`action`,`data`,`formaction`,`poster`]),mA=new Set([`clip-path`,`fill`,`filter`,`marker-end`,`marker-mid`,`marker-start`,`mask`,`stroke`]),hA=new Set([`circle`,`ellipse`,`image`,`line`,`path`,`polygon`,`polyline`,`rect`,`text`,`tspan`,`use`]);function gA(e){return(e.getAttribute(`href`)||e.getAttribute(`xlink:href`))?.startsWith(`#`)===!0}function _A(e){return!!(e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||e.getAttribute(`src`))}function vA(e){let t=e.nodeName.toLowerCase();return t===`use`?gA(e):t===`image`?_A(e):t===`text`||t===`tspan`?!!e.textContent?.trim():hA.has(t)}function yA(e){return e.replace(/(["'])\s*javascript:/gi,`$1#`).replace(/\bjavascript:/gi,`#`).replace(/(["'])\s*vbscript:/gi,`$1#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function bA(e,t,n){let r=e.toLowerCase(),i=t.toLowerCase(),a=String(n??``).trim();return a?(r===`use`||r===`marker`||r===`clippath`||r===`mask`)&&(i===`href`||i===`xlink:href`)?a.startsWith(`#`)?a:``:r===`a`&&(i===`href`||i===`xlink:href`)?Ny(a,{tagName:`a`,attrName:`href`})?``:a:r===`image`&&(i===`href`||i===`xlink:href`||i===`src`)?Ny(a,{tagName:`img`,attrName:`src`})?``:a:i===`href`||i===`xlink:href`?a.startsWith(`#`)?a:``:Ny(a,{tagName:r,attrName:i})?``:a:``}function xA(e,t){let n=t+4;for(;n<e.length&&/\s/.test(e[n]??``);)n++;let r=e[n];if(r===`"`||r===`'`){let t=n+1,i=e.indexOf(r,t);if(i===-1)return{next:e.length,url:``};for(n=i+1;n<e.length&&/\s/.test(e[n]??``);)n++;return{next:n<e.length&&e[n]===`)`?n+1:n,url:e.slice(t,i)}}let i=n;for(;n<e.length&&e[n]!==`)`;)n++;return{next:n<e.length?n+1:n,url:e.slice(i,n)}}function SA(e){return e.replace(/\\([0-9a-f]{1,6}\s?|.)/gi,(e,t)=>{let n=t.trim();if(/^[0-9a-f]+$/i.test(n)){let e=Number.parseInt(n,16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return String(t).trim()})}function CA(e){let t=SA(e),n=t.toLowerCase(),r=0;for(;r<n.length;){let e=n.indexOf(`url(`,r);if(e===-1)return!1;let i=xA(t,e);if(r=Math.max(i.next,e+4),!i.url.trim().startsWith(`#`))return!0}return!1}function wA(e){let t=SA(e);return lA.some(e=>e.test(t))||CA(t)}function TA(e){if(e.tagName.toLowerCase()!==`a`||e.getAttribute(`target`)?.trim().toLowerCase()!==`_blank`)return;let t=new Set(String(e.getAttribute(`rel`)??``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));t.add(`noopener`),t.add(`noreferrer`),e.setAttribute(`rel`,Array.from(t).join(` `))}function EA(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)?t:0}function DA(e,t){if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??``;n&&t.push(n);return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=n.tagName.toLowerCase();if(!dA.has(r)){if(r===`br`){t.push(`
167
+ `);return}for(let e of Array.from(n.childNodes))DA(e,t)}}function OA(e){for(let t of Array.from(e.querySelectorAll(`foreignObject`))){let n=[];DA(t,n);let r=n.join(``).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(!r.length){t.remove();continue}let i=EA(t.getAttribute(`width`)),a=EA(t.getAttribute(`height`)),o=EA(t.getAttribute(`x`)),s=EA(t.getAttribute(`y`)),c=e.ownerDocument.createElementNS(uA,`text`);c.setAttribute(`x`,String(o+i/2)),c.setAttribute(`y`,String(s+a/2)),c.setAttribute(`text-anchor`,`middle`),c.setAttribute(`dominant-baseline`,`central`);let l=t.querySelector(`.nodeLabel`);if(l?.getAttribute(`class`)&&c.setAttribute(`class`,l.getAttribute(`class`)),r.length===1)c.textContent=r[0];else{let t=-.6*(r.length-1);for(let[n,a]of r.entries()){let r=e.ownerDocument.createElementNS(uA,`tspan`);r.setAttribute(`x`,String(o+i/2)),r.setAttribute(`dy`,n===0?`${t}em`:`1.2em`),r.textContent=a,c.appendChild(r)}}t.parentNode?.replaceChild(c,t)}}function kA(e){OA(e);let t=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of t){let t=e.tagName.toLowerCase();if(!fA.has(t)){e.remove();continue}if(t===`style`&&wA(e.textContent??``)){e.remove();continue}let n=Array.from(e.attributes);for(let r of n){let n=r.name.toLowerCase();if(/^on/i.test(n)){e.removeAttribute(r.name);continue}if(n===`style`&&r.value&&wA(r.value)){e.removeAttribute(r.name);continue}if(n===`srcdoc`){e.removeAttribute(r.name);continue}if(pA.has(n)&&r.value){let i=bA(t,n,r.value);if(!i){e.removeAttribute(r.name);continue}i!==r.value&&e.setAttribute(r.name,i);continue}if(mA.has(n)&&r.value&&CA(r.value)){e.removeAttribute(r.name);continue}if(r.value){let t=yA(r.value);t!==r.value&&e.setAttribute(r.name,t)}}TA(e)}}function AA(e){if(typeof DOMParser>`u`||!e)return null;try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement;if(!t||t.nodeName.toLowerCase()!==`svg`)return null;let n=t;return kA(n),NA(n)?null:n}catch{return null}}function jA(e){return AA(e)?.outerHTML??null}function MA(e){return jA(e)??``}function NA(e){let t=e.getAttribute(`viewBox`);if(t){let e=t.trim().split(/[\s,]+/);if(e.length===4){let t=Number.parseFloat(e[2]||``),n=Number.parseFloat(e[3]||``);if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return!0}}let n=[e,...Array.from(e.querySelectorAll(`*`))],r=!1;for(let e of n){vA(e)&&(r=!0);for(let t of Array.from(e.attributes))if(/\bNaN\b/i.test(t.value)||t.name===`style`&&/max-width:\s*0(?:px)?/i.test(t.value))return!0}return!r}var PA=[];function FA(e){return String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function IA(e){return(String(e||`text`).trim().split(/\s+/)[0]||`text`).replace(/[^\w+.#:-]/g,`-`).replace(/-+/g,`-`)||`text`}function LA(e){return e.replace(/[^\w:.+-]/g,`-`).replace(/-+/g,`-`)}function RA(e=`editor-${Date.now()}`,t={}){let n=PC(t),r=n;r.__markstreamRegisteredPluginCount=PA.length,r.__markstreamHasCustomParserExtensions=!!(t.plugin?.length||t.apply?.length||PA.length);let i={"common.copy":`Copy`},a;if(typeof t.i18n==`function`)a=t.i18n;else if(t.i18n&&typeof t.i18n==`object`){let e=t.i18n;a=t=>e[t]??i[t]??t}else a=e=>i[e]??e;if(Array.isArray(t.plugin))for(let e of t.plugin){let t=e;if(Array.isArray(t)){let[e,...r]=t;typeof e==`function`&&n.use(e,...r)}else typeof t==`function`&&n.use(t)}if(Array.isArray(t.apply))for(let e of t.apply)try{e(n)}catch(e){console.error(`[getMarkdown] apply function threw an error`,e)}if(PA.length)for(let e of PA)if(Array.isArray(e)){let[t,...r]=e;typeof t==`function`&&n.use(t,...r)}else typeof e==`function`&&n.use(e);n.use(Zk),n.use(Yu),n.use(Ku);let o=hd,s=o.default??o;n.use(s),n.use(Gu),n.use(Wu),n.core.ruler.after(`block`,`mark_fence_closed`,e=>{let t=e,n=t.src,r=!!t.env?.__markstreamFinal,i;for(let e of t.tokens){if(e.type!==`fence`||!e.map||!e.markup)continue;let t=e.map[0],a=e.map[1],o=e.markup,s=o[0],c=o.length,l=Math.max(0,a-1);i??=n.split(/\r?\n/);let u=i[l]??``,d=0;for(;d<u.length&&(u[d]===` `||u[d]===` `);)d++;let f=0;for(;d+f<u.length&&u[d+f]===s;)f++;let p=d+f;for(;p<u.length&&(u[p]===` `||u[p]===` `);)p++;let m=r?!0:a>t+1&&f>=c&&p===u.length,h=e;h.meta=h.meta??{},h.meta.unclosed=!m,h.meta.closed=!!m}}),n.renderer.rules.fence=(t,n)=>{let r=t[n],i=String(r.info??``).trim(),o=String(r.content??``),s=btoa(unescape(encodeURIComponent(o))),c=IA(i),l=FA(c),u=LA(`editor-${e}-${n}-${c}`),d=FA(a(`common.copy`));return`<div class="code-block" data-code="${s}" data-lang="${l}" id="${u}">
168
+ <div class="code-header">
169
+ <span class="code-lang">${FA(c.toUpperCase())}</span>
170
+ <button class="copy-button" data-code="${s}">${d}</button>
171
+ </div>
172
+ <div class="code-editor"></div>
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 zA=/<\/?([A-Z][\w:-]*)(?:\s[^<>]*)?>/gi;function BA(e,t,n){let r=qy(n),i=new Set(r);if(!t||i.size===0||!Array.isArray(e)||e.length===0)return Array.isArray(e)?e.slice():[];let a=VA(t,i);if(a.length===0)return e.slice();let o=0,s=e.map(e=>GA(e)),c=e=>{if(!e||typeof e!=`object`)return;let t=WA(e,i);if(t){let n=UA(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 VA(e,t){let n=[],r=[],i;for(zA.lastIndex=0;(i=zA.exec(e))!==null;){let a=i[0],o=Ky(i[1]);if(!o||!t.has(o))continue;if(!a.startsWith(`</`)){n.push({tag:o,start:i.index,openEnd:zA.lastIndex});continue}let s=HA(n,o);if(s<0)continue;let[c]=n.splice(s,1),l=i.index,u=zA.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 HA(e,t){for(let n=e.length-1;n>=0;--n)if(e[n]?.tag===t)return n;return-1}function UA(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 WA(e,t){let n=Ky(e.tag);if(n&&t.has(n))return n;let r=Ky(e.type);return r&&t.has(r)?r:``}function GA(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?e.map(e=>GA(e)):{...e};if(!Array.isArray(t))for(let[e,n]of Object.entries(t))Array.isArray(n)&&(t[e]=n.map(e=>GA(e)));return t}var KA=new Map,qA=new Set([`table`,`code_block`,`html_block`,`blockquote`,`list`,`list_item`,`definition_list`,`footnote`,`admonition`,`thematic_break`,`math_block`,`thinking`,`vmr_container`]);function JA(e,t={},n,r){let i=qy([...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 YA(e){if(Array.isArray(e.nodes))return e.nodes;let t=ZA(e.content);if(!t)return[];let n=qy([...e.customHtmlTags||[],...e.parseOptions?.customHtmlTags||[]]),r=`${e.customId||`markstream-svelte`}::${n.join(`,`)}`,i=KA.get(r);i||(i=RA(r,{customHtmlTags:n}),KA.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),BA(Wk(t,a,o),t,n)}function XA(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function ZA(e){return typeof e==`string`?e:e==null?``:String(e)}function QA(e){return ZA(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function $A(e){return QA(e).replace(/`/g,`&#96;`)}function ej(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function tj(e){let t=Math.trunc(Number(e)||1);return Math.min(6,Math.max(1,t))}function nj(e){return String(String(e??``).split(/\s+/g)[0]??``).toLowerCase().replace(/[^\w-]/g,``)||`plaintext`}function rj(e){return nj(e?.language)}function ij(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 aj(e){let t=[],n=[],r=()=>{n.length&&=(t.push({kind:`inline`,nodes:n.slice()}),0)};for(let i of e)qA.has(String(i?.type||``))?(r(),t.push({kind:`block`,node:i})):n.push(i);return r(),t}function oj(e,t,n){return cA(e,t,n)}function sj(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||my.has(l.toLowerCase())?`self_closing`:`tag_open`,tagName:l,attrs:d}),n=i+1}return t}function cj(e){return String(e??``).trim().toLowerCase()}function lj(e){let t=Object.entries(e);return t.length===0?``:t.map(([e,t])=>t===``?` ${e}`:` ${e}="${$A(t)}"`).join(``)}function uj(e){let t=String(e.tagName??``).trim();if(!t)return``;if(e.type===`tag_close`)return`&lt;/${QA(t)}&gt;`;let n=Object.entries(e.attrs??{}).map(([e,t])=>t===``?` ${QA(e)}`:` ${QA(e)}="${$A(t)}"`).join(``);return e.type===`self_closing`?`&lt;${QA(t)}${n} /&gt;`:`&lt;${QA(t)}${n}&gt;`}function dj(e,t=`safe`){if(!e)return``;if(t===`escape`)return QA(e);let n=sj(e),r=[],i=[],a=0;for(let e of n){if(e.type===`text`){a===0&&i.push(QA(e.content??``));continue}let n=cj(e.tagName);if(!n)continue;if(yy.has(n)||rA(n,t)){e.type===`tag_open`?a+=1:e.type===`tag_close`&&a>0&&--a;continue}if(a>0)continue;if(t===`safe`&&nA(n,t)){i.push(uj(e));continue}if(e.type===`self_closing`){i.push(`<${n}${lj(oj(e.attrs??{},t,n))}>`);continue}if(e.type===`tag_open`){i.push(`<${n}${lj(oj(e.attrs??{},t,n))}>`),my.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 fj=`markstream-svelte-html`,pj=`div`,mj=new Map,hj=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 gj(e,t={}){return yj(e,_j(t))}function _j(e){let t=qy(e.customHtmlTags),n=`${e.cacheKey||fj}::${t.join(`,`)}`,r=mj.get(n);return r||(r=RA(n,{customHtmlTags:t}),mj.set(n,r)),{markdown:r,options:{allowHtml:e.allowHtml!==!1,htmlPolicy:e.htmlPolicy??`safe`,customNodeTag:Ky(e.customNodeTag)||pj,customNodeClass:e.customNodeClass}}}function vj(e,t){return(Array.isArray(e)?e:[]).map(e=>yj(e,t)).join(``)}function yj(e,t){if(!e||typeof e!=`object`)return``;switch(e.type){case`text`:return bj(e);case`paragraph`:return`<p>${vj(Gj(e.children),t)}</p>`;case`strong`:return`<strong>${vj(Gj(e.children),t)}</strong>`;case`emphasis`:return`<em>${vj(Gj(e.children),t)}</em>`;case`strikethrough`:return`<del>${vj(Gj(e.children),t)}</del>`;case`highlight`:return`<mark>${vj(Gj(e.children),t)}</mark>`;case`insert`:return`<ins>${vj(Gj(e.children),t)}</ins>`;case`subscript`:return`<sub>${vj(Gj(e.children),t)}</sub>`;case`superscript`:return`<sup>${vj(Gj(e.children),t)}</sup>`;case`inline_code`:return`<code>${Yj(Kj(e.code))}</code>`;case`hardbreak`:return`<br>`;case`link`:return xj(e,t);case`image`:return wj(e);case`list`:return Tj(e,t);case`list_item`:return`<li>${vj(Gj(e.children),t)}</li>`;case`blockquote`:return`<blockquote>${vj(Gj(e.children),t)}</blockquote>`;case`heading`:return Ej(e,t);case`code_block`:return Dj(e);case`thematic_break`:return`<hr>`;case`table`:return Oj(e,t);case`table_row`:return kj(e,t);case`table_cell`:return Aj(e,t);case`definition_list`:return jj(e,t);case`definition_item`:return Mj(e,t);case`footnote`:return Nj(e,t);case`footnote_reference`:return Pj(e);case`footnote_anchor`:return Fj(e);case`admonition`:return Ij(e,t);case`checkbox`:case`checkbox_input`:return`<input type="checkbox" disabled${e.checked?` checked`:``}>`;case`emoji`:return Yj(Kj(e.raw||e.markup||e.content||e.name));case`math_inline`:return Sj(e);case`math_block`:return Cj(e);case`reference`:return`<span class="markstream-nested-reference">${Yj(Kj(e.id))}</span>`;case`html_inline`:case`html_block`:return Lj(e,t);default:return Rj(e,t)}}function bj(e){let t=Kj(e.content),n=Yj(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 xj(e,t){let n=Kj(e.href),r=Kj(e.title),i=Gj(e.children).length>0?vj(Gj(e.children),t):Yj(Kj(e.text||n)),a=r?` title="${Xj(r)}"`:``,o=n&&!Ny(n)?n:``;return`<a${o?` href="${Xj(o)}"`:``}${a}${Py(o)?` target="_blank" rel="noreferrer noopener"`:``}>${i}</a>`}function Sj(e){return`<span class="markstream-nested-math" data-display="inline"><span class="markstream-nested-math__source">${Yj(Kj(e.content||e.markup||e.raw))}</span><span class="markstream-nested-math__render" aria-hidden="true"></span></span>`}function Cj(e){return`<div class="markstream-nested-math-block"><pre class="markstream-nested-math-block__source"><code>${Yj(Kj(e.content||e.markup||e.raw))}</code></pre><div class="markstream-nested-math-block__render" aria-hidden="true"></div></div>`}function wj(e){let t=Iy(e.src);if(!t)return``;let n=Kj(e.alt),r=Kj(e.title),i=r?` title="${Xj(r)}"`:``;return`<img src="${Xj(t)}" alt="${Xj(n)}"${i}>`}function Tj(e,t){let n=e.ordered?`ol`:`ul`;return`<${n}${e.ordered&&Number.isFinite(e.start)?` start="${Number(e.start)}"`:``}>${vj(Gj(e.items),t)}</${n}>`}function Ej(e,t){let n=Jj(e.level);return`<h${n}>${vj(Gj(e.children),t)}</h${n}>`}function Dj(e){let t=Kj(e.language).trim(),n=qj(t),r=n?` class="language-${n}"`:``,i=!!e.diff,a=Kj(e.code),o=e.loading===!0;return o&&!a.trim()?``:`<pre ${[`data-markstream-code-block="1"`,t?`data-markstream-language="${Xj(t)}"`:``,o?`data-markstream-loading="1"`:``,i?`data-markstream-diff="1"`:``,i?`data-markstream-original="${Xj(Qj(Kj(e.originalCode)))}"`:``,i?`data-markstream-updated="${Xj(Qj(Kj(e.updatedCode)))}"`:``,o?`aria-busy="true"`:``].filter(Boolean).join(` `)}><code${r}>${Yj(a)}</code></pre>`}function Oj(e,t){let n=e.header?kj(e.header,t,!0):``,r=vj(Gj(e.rows),t);return`<table>${n?`<thead>${n}</thead>`:``}${r?`<tbody>${r}</tbody>`:``}</table>`}function kj(e,t,n=!1){return`<tr>${Gj(e.cells).map(e=>Aj(e,t,n)).join(``)}</tr>`}function Aj(e,t,n=!1){let r=n||e.header?`th`:`td`,i=Kj(e.align);return`<${r}${i?` style="text-align:${Xj(i)}"`:``}>${vj(Gj(e.children),t)}</${r}>`}function jj(e,t){return`<dl>${Gj(e.items).map(e=>Mj(e,t)).join(``)}</dl>`}function Mj(e,t){return`<dt>${vj(Gj(e.term),t)}</dt><dd>${vj(Gj(e.definition),t)}</dd>`}function Nj(e,t){let n=Xj(Kj(e.id));return`<div${n?` id="fnref--${n}"`:``} class="footnote-node markstream-nested-footnote"><div class="footnote-node__content">${vj(Gj(e.children),t)}</div></div>`}function Pj(e){let t=Kj(e.id),n=Yj(t),r=Xj(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 Fj(e){let t=Xj(Kj(e.id));return`<a class="footnote-anchor"${t?` href="#fnref-${t}"`:``}${t?` title="返回引用 ${t}"`:``} aria-label="${t?`返回引用 ${t}`:`返回引用`}">↩︎</a>`}function Ij(e,t){let n=qj(Kj(e.kind||`note`))||`note`;return`<div class="markstream-nested-admonition markstream-nested-admonition--${n}"><div class="markstream-nested-admonition__title">${Yj(Kj(e.title)||Zj(n))}</div><div class="markstream-nested-admonition__content">${vj(Gj(e.children),t)}</div></div>`}function Lj(e,t){let n=Kj(e.content)||Kj(e.raw),r=Kj(e.tag).trim().toLowerCase(),i=Gj(e.children);return!t.options.allowHtml||t.options.htmlPolicy===`escape`||e.loading&&!e.autoClosed?Yj(n):r&&i.length>0&&!by.has(r)&&!nA(r,t.options.htmlPolicy)?`<${r}${Uj(e.attrs,``,t.options.htmlPolicy,r)}>${vj(i,t)}</${r}>`:dj(n,t.options.htmlPolicy)}function Rj(e,t){let n=Kj(e.tag||e.type);if(!n||hj.has(n))return Yj(Kj(e.content||e.raw));let r=[`markstream-nested-custom`,`markstream-nested-custom--${qj(n)||`node`}`,Vj(e,t.options.customNodeClass)].filter(Boolean).join(` `),i=Uj(e.attrs,r,t.options.htmlPolicy),a=zj(e,t),o=t.options.customNodeTag;return`<${o}${i} data-markstream-custom-tag="${Xj(n)}">${a}</${o}>`}function zj(e,t){let n=Gj(e.children);if(n.length>0)return vj(n,t);let r=Kj(e.content);return r?Bj(r,t):Yj(Kj(e.raw))}function Bj(e,t){return e?t.markdown.render(e):``}function Vj(e,t){return t?Hj(typeof t==`function`?t(e):t):``}function Hj(e){return Array.isArray(e)?e.map(e=>Hj(e)).filter(Boolean).join(` `):typeof e==`string`?e.trim():``}function Uj(e,t=``,n=`safe`,r){let i=Wj(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(cA(a,n,r)).map(([e,t])=>t===``?` ${e}`:` ${e}="${Xj(String(t))}"`),c=o.map(e=>e.trim()).filter(Boolean).join(` `);return c&&s.unshift(` class="${Xj(c)}"`),s.join(``)}function Wj(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 Gj(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function Kj(e){return typeof e==`string`?e:e==null?``:String(e)}function qj(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Jj(e){let t=Math.trunc(Number(e)||1);return Math.min(6,Math.max(1,t))}function Yj(e){return Kj(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Xj(e){return Yj(e).replace(/`/g,`&#96;`)}function Zj(e){return e?`${e[0].toUpperCase()}${e.slice(1)}`:``}function Qj(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 $j(e,t){return gj(e,{cacheKey:t?.customId?`markstream-svelte-${t.customId}`:`markstream-svelte-node`,customHtmlTags:t?.customHtmlTags,allowHtml:t?.allowHtml!==!1,htmlPolicy:t?.htmlPolicy??`safe`})}function eM(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>$j(t.node,n()));var a=X(),o=J(a);ae(o,()=>E(r)),y(e,a),x()}var tM=`__global__`,nM=`__MARKSTREAM_SVELTE_CUSTOM_COMPONENTS_STORE__`,rM=(()=>{let e=globalThis;if(e[nM])return e[nM];let t={scopedComponents:{},revision:0,listeners:new Set};return e[nM]=t,t})();function iM(e){return rM.listeners.add(e),()=>{rM.listeners.delete(e)}}function aM(e){let t=rM.scopedComponents[tM]||{};if(!e)return t;let n=rM.scopedComponents[e]||{};return!t||Object.keys(t).length===0?n:!n||Object.keys(n).length===0?t:{...t,...n}}var oM=r(`<input class="checkbox-node" type="checkbox" disabled=""/>`);function sM(e,t){i(t,!0);var n=oM();le(n),H(e=>L(n,e),[()=>!!t.node?.checked]),y(e,n),x()}function cM(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 lM={"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 uM(){return{t(e){return lM[e]??cM(e)}}}var dM=null,fM=!1,pM=null,mM=!1;function hM(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 gM(e){mM||(mM=!0,typeof e?.preloadStreamDiffs==`function`&&await e.preloadStreamDiffs())}async function _M(){if(dM)return dM;if(pM)return await pM;if(fM)return null;pM=(async()=>{try{let e=hM(await _e(()=>import(`../chunks/BEsyQXpe.js`),[],import.meta.url));return e?(dM=e,await gM(dM),dM):null}catch{return fM=!0,null}})();try{return await pM}finally{pM=null}}var vM=null,yM=null,bM=null,xM=null,SM=null,CM=null;function wM(){xM&&=(clearTimeout(xM),null),SM&&=(clearTimeout(SM),null)}function TM(){return vM||typeof document>`u`?vM:(vM=document.createElement(`div`),vM.className=`ms-tooltip`,vM.setAttribute(`role`,`tooltip`),vM.dataset.visible=`false`,vM.style.position=`fixed`,vM.style.left=`0px`,vM.style.top=`0px`,vM.style.transform=`translate3d(0,0,0)`,document.body.appendChild(vM),vM)}function EM(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 DM(e){if(!vM||!yM)return;let{x:t,y:n}=await ba(yM,vM,{placement:e,middleware:[pa(8),ha(),ma({padding:8})],strategy:`fixed`});vM.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function OM(e,t,n=`top`,r=!1,i,a){if(!e||typeof document>`u`||(TM(),!vM))return;wM();let o=async()=>{if(vM){yM=e,vM.textContent=t,vM.dataset.placement=n,vM.dataset.dark=EM(a)?`true`:`false`,vM.dataset.visible=`false`,CM=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,vM.id=CM;try{e.setAttribute(`aria-describedby`,CM)}catch{}await DM(n),vM.dataset.visible=`true`,bM?.(),bM=fa(e,vM,()=>{DM(n)})}};r?o():xM=setTimeout(o,80)}function kM(e=!1){if(!vM)return;wM();let t=()=>{if(vM){if(vM.dataset.visible=`false`,yM&&CM)try{yM.removeAttribute(`aria-describedby`)}catch{}yM=null,CM=null,bM&&=(bM(),null)}};e?t():SM=setTimeout(t,120)}var AM=`
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
+ <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
+ <path d="M8 11l-3 3l3 3" />
178
+ <path d="M16 11l3 3l-3 3" />
179
+ <path d="M13 9l-2 10" />
180
+ </svg>`,jM=`
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
+ <rect x="3" y="4" width="7" height="5" rx="1.5" />
183
+ <rect x="14" y="4" width="7" height="5" rx="1.5" />
184
+ <rect x="8.5" y="15" width="7" height="5" rx="1.5" />
185
+ <path d="M10 6.5h4" />
186
+ <path d="M12 9v2.5" />
187
+ <path d="M12 11.5l-3.5 3.5" />
188
+ <path d="M12 11.5l3.5 3.5" />
189
+ </svg>`,MM=`
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
+ <path d="M8 7l-4 5l4 5" />
192
+ <path d="M16 7l4 5l-4 5" />
193
+ <path d="M14 4l-4 16" />
194
+ </svg>`,NM=`
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
+ <rect x="3" y="4" width="18" height="16" rx="2" />
197
+ <path d="M7 15V9l3 3l3-3v6" />
198
+ <path d="M16 9v6" />
199
+ <path d="M14 13l2 2l2-2" />
200
+ </svg>`,PM=`
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
+ <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
+ <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>`,FM=`
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
+ <path d="M5 6h14" />
207
+ <path d="M12 6v12" />
208
+ <path d="M8 18h8" />
209
+ </svg>`,IM={"":``,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`},LM={"":`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={"":FM,html:MM,javascript:AM,json:PM,jsx:AM,markdown:NM,mermaid:jM,plain:FM,python:AM,shell:AM,svg:MM,tsx:AM,typescript:AM},zM=Array.from(new Set([...Object.keys(IM),...Object.keys(LM),...Object.keys(RM),`bash`,`c`,`cpp`,`csharp`,`diff`,`go`,`java`,`php`,`ruby`,`rust`,`sql`,`yaml`,`zsh`]));function BM(e){if(!e)return``;let t=e.trim();if(!t)return``;let[n]=t.split(/\s+/),[r]=n.split(`:`);return r.toLowerCase()}function VM(e){let t=BM(e);return IM[t]??t}function HM(e){let t=VM(e);return!t||t===`plain`?`plaintext`:t===`shell`?`zsh`:t===`objectivec`?`objective-c`:t===`objectivecpp`?`objective-cpp`:t}function UM(e){let t=BM(e);return!t||zM.includes(t)?!1:zM.some(e=>e.startsWith(t))}function WM(e){return RM[VM(e)]||AM}var GM=LM,KM=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 qM(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=KM();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 JM=r(`<span class="markstream-pre__line-numbers" aria-hidden="true"><span class="markstream-pre__line-numbers-text"> </span></span>`),YM=r(`<pre data-markstream-pre="1"><!><code class="markstream-pre__code" translate="no"> </code></pre>`);function XM(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(()=>ZA(t.node?.language).trim()),u=I(()=>ej(E(l))),d=I(()=>ZA(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
+ `?t++:e[n]===`\r`&&(t++,e[n+1]===`
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=X(),O=J(D),A=e=>{var r=YM();let i;var s=W(r),d=e=>{var t=JM(),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)?ij(ZA(t.node?.originalCode)):void 0,()=>E(f)?ij(ZA(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 ZM(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 QM(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function $M(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 eN(e,t){return e==null||e===``?t??null:typeof e==`number`?`${e}px`:String(e)}var tN=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>`),nN=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>`),rN=r(`<button type="button" class="code-action-btn"><!></button>`),iN=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),aN=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>`),oN=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>`),sN=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>`),cN=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>`),lN=r(`<div></div>`),uN=r(`<div><!> <div><!></div></div>`),dN=r(`<div data-markstream-code-block="1"><!> <!> <!></div>`);function fN(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}=uM(),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&&UM(t)?t:``}function R(e){let t=ie(e);if(t){F(he,t,!0),F(me,!1),U(t);return}F(he,E(He),!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(Fe))return;let t=()=>{if(F(Fe,null),E(xe)){if(E(He)!==e&&!UM(E(He))&&!oe(E(He))&&!E(dt)&&!E(pt)){F(he,``),Mt();return}F(Fe,setTimeout(t,50),!0)}};F(Fe,setTimeout(t,50),!0)}let le=V(null),G=V(null),q=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),Se=V(!1),Ce=V(!1),we=V(!1),Te=V(!1),Ee=V(12),De=V(null),Oe=V(0),ke=V(null),Ae=V(de([])),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(()=>ZA(t.node?.language).trim()),Ue=I(()=>VM(E(He))),Z=I(()=>HM(E(Ue)||E(He)||`plaintext`)),We=I(()=>vt(t.node)),Ge=I(()=>!!t.node?.diff),Ke=I(()=>ZA(t.node?.originalCode)),qe=I(()=>ZA(t.node?.updatedCode)),Je=I(()=>t.node?.loading===!0),Ye=I(()=>o()??E(Je)),Xe=I(()=>s()??r()?.codeBlockStream??!0),Q=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(()=>eN(_()??E(Ze)?.minWidth)),at=I(()=>eN(b()??E(Ze)?.maxWidth)),ot=I(()=>[E(it)?`min-width: ${E(it)}`:``,E(at)?`max-width: ${E(at)}`:``].filter(Boolean).join(`; `)),st=I(()=>WM(E(Ue)||E(He)||`plain`)),ct=I(()=>GM[E(Ue)]||(E(He)?E(He).toUpperCase():GM[``])),lt=I(()=>S()!==!1&&(E(Ue)===`html`||E(Ue)===`svg`)),ut=I(()=>E(Ue)===`svg`?L(`artifacts.svgPreviewTitle`):L(`artifacts.htmlPreviewTitle`)),dt=I(()=>E(Xe)===!1&&E(Ye)),ft=I(()=>r()?.final===!1||E(Ye)),pt=I(()=>E(Xe)!==!1&&E(ft)&&(UM(E(He))||oe(E(He)))),mt=I(()=>!(E(Ye)&&!E(We).trim())),ht=I(()=>({...t.node,code:E(We),loading:E(Ye)})),gt=I(wt),_t=I(()=>E(Ge)?`${E(Z)}\0${E(Ke)}\0${E(qe)||E(We)}`:`${E(Z)}\0${E(We)}`);K(()=>{E(me)&&E(he)&&E(He)!==E(he)&&UM(E(he))&&(F(me,!1),F(he,``))}),K(()=>{E(xe),E(Ye),E(_t),E(dt),E(pt),E(xe)&&E(Ye)===!1&&!E(dt)&&!E(pt)&&E(_t)!==E(Re)&&(F(Re,E(_t),!0),zt())}),K(()=>{E(xe),E(le),E(mt),E(Se),E(dt),E(pt),E(Ge),E(We),E(Ke),E(qe),E(Z),E(nt),E(tt),E(Qe),E(et),E(Ee),E(Ce),E(xe)&&(Pe!==E(et)&&(Pe=E(et),F(Ee,E(rt),!0),Vt()),Mt())}),ue(()=>{F(xe,!0),F(Ee,E(rt),!0)}),ce(()=>{F(xe,!1),F(Oe,E(Oe)+1),E(De)&&clearTimeout(E(De)),E(Fe)&&clearTimeout(E(Fe)),E(Le)&&clearTimeout(E(Le)),Jt(),Vt()});function vt(e){return e?.diff?ZA(e?.updatedCode??e?.code):ZA(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(Ee)===12?18:Math.max(12,Math.round(E(Ee)*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(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(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(Q)?d().dark:d().light:(E(Q)?p():m())||(g()?E(Q)?g()[0]:g()[1]:(E(Q)?E(Ze)?.darkTheme:E(Ze)?.lightTheme)||(E(Ze)?.themes?E(Q)?E(Ze).themes[0]:E(Ze).themes[1]:E(Q)?`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(Ce)?900:E(Qe)?.maxHeight??500,fontFamily:Ct(),fontSize:E(Ee),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(Q)?`dark`:`light`,onThemeChange(){Ut(),Gt()}}}function kt(){let e={...E(tt),theme:E(nt)};if(!E(q))return F(q,e,!0),E(q);for(let t of Object.keys(E(q)))t in e||delete E(q)[t];return Object.assign(E(q),e),E(q)}async function At(){if(E(G)||E(me)||typeof window>`u`)return;if(E(fe))return E(fe);let e=E(Oe),t=(async()=>{let t=await _M();if(E(xe)&&E(Oe)===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(Oe)===e&&F(Ne,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(Ne)&&(F(Ne,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(Se)||E(dt)||E(pt))return;let e=E(Oe);try{await At()}catch(t){E(xe)&&E(Oe)===e&&R(t);return}if(!E(xe)||E(Oe)!==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(Oe);try{E(Ge)&&typeof E(G).updateDiff==`function`?await Promise.resolve(E(G).updateDiff(E(Ke),E(qe)||E(We),E(Z))):typeof E(G).updateCode==`function`&&(await Promise.resolve(E(G).updateCode(E(We),E(Z))),qt()),!E(pe)&&await It(t,E(Oe))&&(F(ve,!0),F(ye,!0),F(pe,!0)),jt(),Ht(),Gt()}catch(e){E(xe)&&E(Oe)===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(Oe)!==t)return!1;if(Qt(!0),await Bt(),Ft(e))return Qt(!0),await Bt(),Ft(e)}return!!(E(xe)&&E(le)&&E(Oe)===t&&Ft(e))}async function Lt(e){if(!E(le)||!E(G)||E(be))return E(be);let t=E(G),n=ne(Oe);F(pe,!1);let r=(async()=>{try{if(Vt(!1),!E(xe)||!E(le)||E(Oe)!==n||E(G)!==t)return;if(E(le).replaceChildren(),F(je,null),F(Me,null),F(_e,!1),e===`diff`&&typeof t.createDiffEditor==`function`){if(await t.createDiffEditor(E(le),E(Ke),E(qe)||E(We),E(Z)),!E(xe)||E(Oe)!==n||E(G)!==t||(await Promise.resolve(t.updateDiff?.(E(Ke),E(qe)||E(We),E(Z))),!E(xe)||E(Oe)!==n||E(G)!==t))return;F(ge,`diff`)}else{if(await t.createEditor(E(le),E(We),E(Z)),!E(xe)||E(Oe)!==n||E(G)!==t||(await Promise.resolve(t.updateCode?.(E(We),E(Z))),!E(xe)||E(Oe)!==n||E(G)!==t))return;F(ge,`single`)}if(Ht(),Xt(),jt(),!await It(e,n))return;F(ve,!0),F(ye,!0),F(pe,!0),Gt()}catch(e){E(xe)&&E(Oe)===n&&E(G)===t&&R(e)}})().finally(()=>{E(be)===r&&F(be,null)});return F(be,r,!0),r}function Rt(){return E(Ie)||F(Ie,(async()=>{if(await v(),await Bt(),E(be))try{await E(be)}catch{}if(!E(xe)||!E(mt)||!E(le)||E(Se)||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(qe)||E(We),E(Z))),E(G).refreshDiffPresentation?.(),Ht(),Gt();return}await Promise.resolve(E(G).updateCode?.(E(We),E(Z))),qt(140,!0),Ht(),Gt()}})().finally(()=>{F(Ie,null)}),!0),E(Ie)}function zt(){E(Le)&&clearTimeout(E(Le)),F(Le,setTimeout(()=>{F(Le,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(Oe,E(Oe)+1),F(be,null),F(fe,null)),Zt(),Kt();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(je,null),F(Me,null),e&&(F(G,null),F(q,null),F(fe,null),F(Ne,``))}function Ht(){(E(Ge)?E(G)?.getDiffEditorView?.():E(G)?.getEditorView?.())?.updateOptions?.({fontSize:E(Ee)}),Ut(),Gt()}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 Wt(){return E(Qe)?.maxHeight??500}function Gt(){typeof window>`u`||!E(le)||!E(pe)||(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(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 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(Ge)){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(pe)&&!e||E(Se))return;let t=Wt(),n=E(Ge)?nn(E(le))??tn():tn();if(!n||n<=0)return;let r=$t(),i=E(Ce)||!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(Ce)||!Number.isFinite(t)?`none`:`${Math.ceil(t)}px`,E(le).style.overflow=E(Ge)?`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(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 tn(){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 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 ZM(E(We)),r()?.events?.onCopy?.(E(We)),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),Ht())}function on(){C()&&(F(Ee,E(rt),!0),Ht())}function sn(){C()&&(F(Ee,Math.min(24,E(Ee)+1),!0),Ht())}function cn(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||OM(n,t,`top`,!1,void 0,E(Q))}function ln(e){cn(e,E(we)?L(`common.copied`)||`Copied`:L(`common.copy`)||`Copy`)}var un=X(),dn=J(un),$=e=>{var t=dN();let r;var i=W(t),a=e=>{var t=cN(),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=rN(),r=W(t),i=e=>{var t=tN();y(e,t)},a=e=>{var t=nN();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,()=>kM()),l(`click`,t,rn),f(`focus`,t,ln),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,ln),y(e,t)};h(u,e=>{T()&&e(d)});var p=z(u,2),m=e=>{var t=iN(),n=J(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,()=>kM()),l(`click`,n,an),f(`focus`,n,e=>cn(e,L(`common.decrease`)||`Decrease`)),f(`mouseleave`,n,()=>kM()),f(`mouseenter`,n,e=>cn(e,L(`common.decrease`)||`Decrease`)),f(`blur`,r,()=>kM()),l(`click`,r,on),f(`focus`,r,e=>cn(e,L(`common.reset`)||`Reset`)),f(`mouseleave`,r,()=>kM()),f(`mouseenter`,r,e=>cn(e,L(`common.reset`)||`Reset`)),f(`blur`,i,()=>kM()),l(`click`,i,sn),f(`focus`,i,e=>cn(e,L(`common.increase`)||`Increase`)),f(`mouseleave`,i,()=>kM()),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=aN();H(e=>B(t,`aria-label`,e),[()=>L(`common.preview`)]),f(`blur`,t,()=>kM()),l(`click`,t,()=>F(Te,!E(Te))),f(`focus`,t,e=>cn(e,L(`common.preview`)||`Preview`)),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,e=>cn(e,L(`common.preview`)||`Preview`)),y(e,t)};h(g,e=>{E(lt)&&O()&&e(_)});var v=z(g,2),b=e=>{var t=oN(),r=W(t),i=M(r);n(t),H(e=>{B(t,`aria-pressed`,E(Ce)),B(t,`aria-label`,e),B(i,`d`,E(Ce)?`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`)},[()=>E(Ce)?L(`common.collapse`):L(`common.expand`)]),f(`blur`,t,()=>kM()),l(`click`,t,()=>F(Ce,!E(Ce))),f(`focus`,t,e=>cn(e,E(Ce)?L(`common.collapse`)||`Collapse`:L(`common.expand`)||`Expand`)),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,e=>cn(e,E(Ce)?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=sN(),r=W(t);let i;n(t),H(e=>{B(t,`aria-pressed`,E(Se)),B(t,`aria-label`,e),i=j(r,``,i,{rotate:E(Se)?`0deg`:`90deg`})},[()=>E(Se)?L(`common.expand`):L(`common.collapse`)]),f(`blur`,t,()=>kM()),l(`click`,t,()=>F(Se,!E(Se))),f(`focus`,t,e=>cn(e,E(Se)?L(`common.expand`)||`Expand`:L(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,e=>cn(e,E(Se)?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=uN();let r;var i=W(t),a=e=>{var t=lN();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;XM(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(Ce)}),s=Y(o,1,`code-editor-fallback-surface`,null,s,{"is-hidden":E(ye)})}),y(e,t)};h(o,e=>{E(Se)||e(s)});var u=z(o,2),d=e=>{qM(e,{get code(){return E(We)},get title(){return E(ut)},get isDark(){return E(Q)},get htmlPreviewAllowScripts(){return N()},get htmlPreviewSandbox(){return P()},onClose:()=>F(Te,!1)})};h(u,e=>{E(Te)&&E(lt)&&e(d)}),n(t),H(()=>{r=Y(t,1,`code-block-container`,null,r,{"is-dark":E(Q),"is-plain-text":E(Z)===`plaintext`,"is-rendering":E(Ye),"is-diff":E(Ge)}),B(t,`data-markstream-enhanced`,E(pe)&&!E(me)?`true`:`false`),j(t,E(ot))}),y(e,t)};h(dn,e=>{E(mt)&&e($)}),y(e,un),x()}T([`click`]);var pN=()=>_e(()=>import(`../chunks/Y--VMh3y.js`),[],import.meta.url),mN=null,hN=pN,gN=null;function _N(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 vN(){if(mN)return mN;if(gN)return await gN;let e=hN;if(!e)return null;gN=(async()=>{let t;try{t=await e()}catch(t){throw e===pN?Error(`Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.`):t}return t?(mN=_N(t),mN):null})();try{return await gN}finally{gN=null}}var yN=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],bN=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function xN(e){return e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function SN(e){if(!e)return``;let t=e.trim();return bN.test(t)?t:``}function CN(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&&yN.some(e=>e.test(t.value))){e.removeAttribute(n);continue}if((n===`href`||n===`xlink:href`)&&t.value){let r=SN(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}function wN(e){if(typeof DOMParser>`u`||!e)return``;let t=xN(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return CN(r),r.outerHTML}function TN(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}var EN=r(`<div class="d2-mode-toggle"><button type="button"> </button> <button type="button"> </button></div>`),DN=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>`),ON=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>`),kN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><!></button>`),AN=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>`),jN=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>`),MN=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>`),NN=r(`<p class="d2-error"> </p>`),PN=r(`<div class="d2-source"><pre class="d2-code"><code> </code></pre> <!></div>`),FN=r(`<div class="d2-render"><div class="d2-svg"></div> <!></div>`),IN=r(`<div class="markstream-svelte-enhanced-block__body d2-block-body"><!></div>`),LN=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}=uM(),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(()=>ZA(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)),q=I(()=>s()?`max-height: ${s()}; --ms-d2-render-max-height: ${s()}`:``);ue(()=>{F(w,!0),de(!0)}),K(()=>{E(w)&&(fe(),E(re),E(ie),e(()=>{de()}))}),ce(()=>{F(w,!1),F(T,E(T)+1),R&&clearTimeout(R)});async function de(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 vN();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=wN(TN(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),de(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 ZM(E(oe)),o()?.events?.onCopy?.(E(oe)),F(L,!0),R&&clearTimeout(R),R=setTimeout(()=>{F(L,!1)},1e3)}function he(){E(A)&&$M(E(A),`d2-diagram-${Date.now()}.svg`)}function ge(e){F(ie,e===`source`),E(ie)||de(!0)}function _e(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||OM(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=J(ye),xe=e=>{var t=LN();let r;var i=W(t),a=e=>{var t=MN(),r=z(W(t),2),i=W(r),a=e=>{var t=EN(),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,()=>kM()),l(`click`,r,()=>ge(`preview`)),f(`focus`,r,e=>_e(e,C(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>kM()),f(`mouseenter`,r,e=>_e(e,C(`common.preview`)||`Preview`)),f(`blur`,o,()=>kM()),l(`click`,o,()=>ge(`source`)),f(`focus`,o,e=>_e(e,C(`common.source`)||`Source`)),f(`mouseleave`,o,()=>kM()),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=kN(),r=W(t),i=e=>{var t=DN();y(e,t)},a=e=>{var t=ON();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,()=>kM()),l(`click`,t,me),f(`focus`,t,ve),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,ve),y(e,t)};h(o,e=>{v()&&e(s)});var u=z(o,2),d=e=>{var t=AN();H(e=>B(t,`aria-label`,e),[()=>C(`common.export`)||`Export`]),f(`blur`,t,()=>kM()),l(`click`,t,he),f(`focus`,t,e=>_e(e,C(`common.export`)||`Export`)),f(`mouseleave`,t,()=>kM()),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=jN(),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,()=>kM()),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,()=>kM()),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=IN(),r=W(t),i=e=>{var t=PN(),r=W(t),i=W(r),a=M(i,!0);n(r);var o=z(r,2),s=e=>{var t=NN(),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=FN(),r=W(t);ae(r,()=>E(A),!0),n(r);var i=z(r,2),a=e=>{var t=NN(),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(q))),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 zN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>$j(t.node,n()));var a=X(),o=J(a);ae(o,()=>E(r)),y(e,a),x()}var BN=r(`<span class="emoji-node"> </span>`);function VN(e,t){i(t,!0);let n=I(()=>ZA(t.node?.raw||t.node?.markup||t.node?.content||t.node?.name));var r=BN(),a=M(r,!0);H(()=>c(a,E(n))),y(e,r),x()}function HN(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=J(o);s(c,a,!1,(e,i)=>{{let e=I(()=>XA(t.node?.children)),o=I(()=>String(r()??a())+`-`+a());JI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(o)}})}}),y(e,o),x()}function UN(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);HN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`em`})}function WN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>$j(t.node,n()));var a=X(),o=J(a);ae(o,()=>E(r)),y(e,a),x()}var GN=r(`<a class="footnote-anchor">↩︎</a>`);function KN(e,t){i(t,!0);let n=I(()=>ZA(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=GN();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 qN=r(`<div class="footnote-node"><div class="footnote-node__content"><!></div></div>`);function JN(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>ZA(t.node?.id)),s=I(()=>XA(t.node?.children)),c=I(()=>`footnote-${a()??(E(o)||`node`)}`);var l=qN(),u=W(l);JI(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 YN=r(`<sup class="footnote-reference"><span> </span></sup>`);function XN(e,t){i(t,!0);let r=I(()=>ZA(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=YN(),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 ZN=r(`<br/>`);function QN(e){var t=ZN();y(e,t)}function $N(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),a=I(()=>tj(t.node?.level)),o=I(()=>`h`+E(a));var c=X(),l=J(c);s(l,()=>E(o),!1,(e,i)=>{P(e,()=>({class:`heading-node heading-${E(a)??``}`}));{let e=I(()=>XA(t.node?.children)),a=I(()=>String(r()??`heading`)+`-heading`);JI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(a)}})}}),y(e,c),x()}function eP(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);HN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`mark`})}function tP(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>$j(t.node,n()));var a=X(),o=J(a);ae(o,()=>E(r)),y(e,a),x()}function nP(e,t){i(t,!0);let n=I(()=>$j(t.node,t.context));var r=X(),a=J(r);ae(a,()=>E(n)),y(e,r),x()}var rP=r(`<img/>`),iP=r(`<span class="image-shimmer"></span>`),aP=r(`<span class="image-node__raw-text"> </span>`),oP=r(`<span class="image-placeholder"><!></span>`),sP=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>`),cP=r(`<span class="image-node-container"><!></span>`);function lP(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}=uM();function u(e,t,n){return n||e?{src:e,stage:`primary`}:t?{src:t,stage:`fallback`}:{src:``,stage:`failed`}}let p=I(()=>Iy(r.node?.src)),m=I(()=>Iy(a())),g=I(()=>ZA(r.node?.alt)),_=I(()=>ZA(r.node?.title)),v=I(()=>ZA(r.node?.raw)),b=I(()=>!!r.node?.loading),S=I(()=>!o()),C=e(()=>Iy(r.node?.src)),w=e(()=>Iy(a())),T=e(()=>!!r.node?.loading),D=u(C,w,T),O=V(de(C)),A=V(de(w)),j=V(de(T)),ee=V(de(D.src)),te=V(de(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=cP(),R=W(ie),ae=e=>{var t=rP();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=oP(),r=W(t),i=e=>{var t=iP();y(e,t)},a=e=>{var t=aP(),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=sP(),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 uP=null,dP=null;async function fP(){return dP||(uP||=_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),dP=n,n}),[],import.meta.url).catch(e=>(console.warn(`[markstream-svelte] Failed to load @antv/infographic`,e),null)),await uP)}function pP(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function mP(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 hP(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`%%`)),n=Math.max(1,t.length),r=mP(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 gP(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 _P(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function vP(e,t){return pP(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??t}var yP=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>`),bP=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>`),xP=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>`),SP=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>`),CP=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><!></button>`),wP=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>`),TP=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>`),EP=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>`),DP=r(`<div class="infographic-source"><pre class="infographic-source-code"><code> </code></pre></div>`),OP=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>`),kP=r(`<pre class="infographic-source-code infographic-pending-source"><code> </code></pre>`),AP=r(`<p class="d2-error"> </p>`),jP=r(`<!> <div class="infographic-render"><!> <div></div> <!></div>`,1),MP=r(`<div class="markstream-svelte-enhanced-block__body infographic-block-body"><!></div>`),NP=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>`),PP=r(`<div data-markstream-infographic="1"><!> <!> <!></div>`);function FP(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}=uM(),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),q=V(!1),de=V(!1),fe=V(!1),me=V(!1),he=V(``),ge=V(1),_e=null,ve=I(()=>ZA(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),Se=I(()=>E(be)!==!1||E(xe)===!1),Ce=I(()=>d()??a()?.isDark??!1),we=I(()=>o()===`none`?null:pP(o())),Te=I(()=>_P(pP(s())??gP(E(ve)),vP(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(ge)}); transform-origin: center center;`),Oe=I(()=>!(E(be)&&!E(ve).trim()));ue(()=>{F(O,!0),ke(!0)}),K(()=>{E(O)&&(`${E(ve)}${E(Ce)}${E(xe)}${E(Se)}`,E(de),E(fe),e(()=>{ke()}))}),ce(()=>{F(O,!1),F(A,E(A)+1),je(),F(ee,``),_e&&clearTimeout(_e)});function ke(e=!1){E(O)&&E(T)&&!E(de)&&!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),Ae(e)})))}async function Ae(e=!1){if(!E(O)||!E(T)||E(de)||E(fe))return;if(!E(ve).trim()){je(),E(T)&&QM(E(T)),F(G,!1),F(L,``),F(ee,``),F(N,``);return}let t=E(ve),n=E(xe),r=`${t}\n${E(Ce)}\n${n}\n${E(Se)}`;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(Se);F(re,!0),a&&F(L,``);let o=null,s=null;try{let e=await fP();if(!E(O)||i!==E(A)||E(de)||E(fe)||!E(T))return;if(!e)throw Error(`Infographic renderer is not available.`);if(!(r===`${E(ve)}\n${E(Ce)}\n${E(xe)}\n${E(Se)}`||!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(Ce)}\n${E(xe)}\n${E(Se)}`;a&&r===t?(F(N,``),je(),QM(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)&&QM(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 ZM(E(ve)),a()?.events?.onCopy?.(E(ve)),F(q,!0),_e&&clearTimeout(_e),_e=setTimeout(()=>{F(q,!1)},1e3)}function Pe(){let e=E(T)?.querySelector(`svg`);return e?wN(e.outerHTML):``}function Fe(){let e=Pe();e&&$M(e,`infographic-${Date.now()}.svg`)}function Ie(){F(he,E(T)?.innerHTML||``,!0),E(he)&&F(me,!0)}async function Le(e){let t=e===`source`;E(fe)!==t&&(F(fe,t),Me(),E(fe)||(await v(),ke(!0)))}async function Re(){F(de,!E(de)),Me(),E(de)||(await v(),ke(!0))}function ze(){F(ge,Math.min(3,Math.round((E(ge)+.1)*10)/10),!0)}function Be(){F(ge,Math.max(.5,Math.round((E(ge)-.1)*10)/10),!0)}function Ve(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||OM(n,t,`top`,!1,void 0,E(Ce))}function He(e){Ve(e,E(q)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`)}function Ue(e){return document.body.appendChild(e),{destroy(){e.remove()}}}function Z(){F(me,!1)}function We(e){e.target===e.currentTarget&&Z()}function Ge(e){e.key===`Escape`&&Z()}var Ke=X(),qe=J(Ke),Je=e=>{var t=PP();let r;var i=W(t),a=e=>{var t=EP(),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=yP(),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,()=>kM()),l(`click`,r,()=>Le(`preview`)),f(`focus`,r,e=>Ve(e,w(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>kM()),f(`mouseenter`,r,e=>Ve(e,w(`common.preview`)||`Preview`)),f(`blur`,u,()=>kM()),l(`click`,u,()=>Le(`source`)),f(`focus`,u,e=>Ve(e,w(`common.source`)||`Source`)),f(`mouseleave`,u,()=>kM()),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=bP(),r=W(t);let i;n(t),H(e=>{B(t,`aria-label`,e),B(t,`aria-pressed`,E(de)),i=j(r,``,i,{transform:E(de)?`rotate(0deg)`:`rotate(90deg)`})},[()=>E(de)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`]),f(`blur`,t,()=>kM()),l(`click`,t,Re),f(`focus`,t,e=>Ve(e,E(de)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,e=>Ve(e,E(de)?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=CP(),r=W(t),i=e=>{var t=xP();y(e,t)},a=e=>{var t=SP();y(e,t)};h(r,e=>{E(q)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(q)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`]),f(`blur`,t,()=>kM()),l(`click`,t,Ne),f(`focus`,t,He),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,He),y(e,t)};h(p,e=>{g()&&e(v)});var x=z(p,2),C=e=>{var t=wP();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(fe)||E(de)},[()=>w(`common.export`)||`Export`]),f(`blur`,t,()=>kM()),l(`click`,t,Fe),f(`focus`,t,e=>Ve(e,w(`common.export`)||`Export`)),f(`mouseleave`,t,()=>kM()),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=TP();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(fe)||E(de)},[()=>w(`common.open`)||`Open`]),f(`blur`,t,()=>kM()),l(`click`,t,Ie),f(`focus`,t,e=>Ve(e,w(`common.open`)||`Open`)),f(`mouseleave`,t,()=>kM()),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=MP(),r=W(t),i=e=>{var t=DP(),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=jP(),r=J(t),i=e=>{var t=OP(),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,()=>kM()),l(`click`,r,ze),f(`focus`,r,e=>Ve(e,w(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>kM()),f(`mouseenter`,r,e=>Ve(e,w(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>kM()),l(`click`,i,Be),f(`focus`,i,e=>Ve(e,w(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>kM()),f(`mouseenter`,i,e=>Ve(e,w(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>kM()),l(`click`,a,()=>F(ge,1)),f(`focus`,a,e=>Ve(e,w(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>kM()),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=kP(),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=AP(),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(fe)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(de)||e(s)});var u=z(o,2),d=e=>{var t=NP();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=>Ue?.(e)),H((e,n,i,a,o)=>{r=Y(t,1,`markstream-svelte markstream-svelte-modal-root`,null,r,{dark:E(Ce)}),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,ze),l(`click`,u,Be),l(`click`,d,()=>F(ge,1)),l(`click`,p,Z),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(Ce),"is-rendering":E(re)||E(be)}),B(t,`data-markstream-mode`,E(fe)?`source`:E(G)?`preview`:`fallback`)}),y(e,t)};h(qe,e=>{E(Oe)&&e(Je)}),y(t,Ke),x()}T([`click`,`keydown`]);function IP({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 LP(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 zP=2048;function BP(){return typeof performance<`u`?performance.now():Date.now()}var VP=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=BP();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=BP();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=GP(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=zP}=e;this.minCharsPerSecond=LP(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,LP(r,1e3,1)),this.normalizedTargetLatencyMs=LP(i,900,1),this.normalizedCatchUpLatencyMs=LP(a,350,1),this.normalizedCatchUpThreshold=RP(o,600),this.normalizedStartDelayMs=RP(c,80),this.maxCommitFps=Math.trunc(LP(s,30,1)),this.maxCharsPerCommit=Math.trunc(LP(l,80,1)),this.flushOnFinish=u,this.burstInitialContent=d===!0,this.burstRevealThresholdChars=Math.max(1,Math.trunc(LP(f,zP,1))),this.segmenter=UP(),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
+ `){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 WP(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 WP(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 HP(e={},t){let n=new VP(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 UP(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function WP(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||!qP(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&&qP(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 GP(e,t,n){return Math.min(n,Math.max(t,e))}function KP(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 qP(e){return e<=127||KP(e)}var JP=r(`<span> </span>`),YP=r(`<code class="inline-code-node"> <!></code>`);function XP(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(()=>ZA(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=IP({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=YP(),g=W(m),_=z(g),v=e=>{var t=JP(),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 ZP(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);HN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`ins`})}var QP=r(`<span class="link-loading-indicator"></span>`),$P=r(`<a><span class="link-text-wrapper"><span class="link-text"><!></span><!></span></a>`);function eF(e,t){i(t,!0);let r=I(()=>cA({href:ZA(t.node?.href)},`safe`,`a`).href??``),a=I(()=>ZA(t.node?.title||E(r))),o=I(()=>XA(t.node?.children)),s=I(()=>t.showTooltip??t.context?.showTooltips??!0),u=I(()=>E(r).startsWith(`#`)&&E(r).length>1),d=I(()=>Py(E(r)));function p(e){E(s)&&E(a)&&OM(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 _=$P();let v;var b=W(_),S=W(b),w=W(S),T=e=>{{let n=I(()=>String(t.indexKey??`link`)+`-link`);JI(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),[()=>ZA(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=QP();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`,_,()=>kM()),l(`click`,_,m),f(`focus`,_,p),f(`mouseleave`,_,()=>kM()),f(`mouseenter`,_,p),y(e,_),x()}T([`click`]);var tF=r(`<li><!></li>`);function nF(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0);var o=tF(),s=W(o);{let e=I(()=>XA(t.node?.children)),n=I(()=>String(a()??`li`)+`-li`);JI(s,{get nodes(){return E(e)},get context(){return r()},get prefix(){return E(n)}})}n(o),y(e,o),x()}var rF=r(`<ol><!></ol>`),iF=r(`<ul><!></ul>`);function aF(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=J(o),c=e=>{var r=rF(),i=W(r);{let e=I(()=>XA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);JI(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=iF(),i=W(r);{let e=I(()=>XA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);JI(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 oF=null,sF=!1,cF=null,lF=fF;function uF(e){let t=e?.default??e;return t&&typeof t.renderToString==`function`?t:null}function dF(){try{return uF(globalThis?.katex)}catch{return null}}function fF(){return(async()=>{let e=dF();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 uF(t)})()}function pF(){return typeof lF==`function`}async function mF(){let e=dF();if(e)return oF=e,oF;if(oF)return oF;if(cF)return await cF;if(sF)return null;let t=lF;if(!t)return sF=!0,null;cF=(async()=>{try{let e=await t(),n=uF(e)??e;if(n)return oF=n,oF}catch{}return sF=!0,null})();try{return await cF}finally{cF=null}}function hF(e){return e?e.replace(/·/g,`⋅`).replace(/℃/g,`°C`):``}var gF=`WORKER_BUSY`,_F=null,vF=new Map,yF=new Map,bF=200,xF=new Set,SF=5;function CF(){if(vF.size>=SF||xF.size===0)return;let e=Array.from(xF);xF.clear();for(let t of e)try{t()}catch{}}function wF(e,t,n){if(yF.set(`${t?`d`:`i`}:${e}`,n),yF.size>bF){let e=yF.keys().next().value;e&&yF.delete(e)}}function TF(){return _F=Error(`[markstream-svelte:katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),_F.name=`WorkerInitError`,_F.code=`WORKER_INIT_ERROR`,null}async function EF(e,t=!0,n=2e3,r){let i=hF(e);if(!pF()){let e=Error(`KaTeX rendering disabled`);return e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,Promise.reject(e)}if(_F)return Promise.reject(_F);let a=`${t?`d`:`i`}:${i}`,o=yF.get(a);if(o)return o;let s=TF();if(!s)return Promise.reject(_F);if(vF.size>=SF){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=gF,e.busy=!0,e.inFlight=vF.size,e.max=SF,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(()=>{vF.delete(o),CF();let e=Error(`Worker render timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,a(e)},n),l=()=>{globalThis.clearTimeout(c),vF.delete(o)&&CF();let e=Error(`Aborted`);e.name=`AbortError`,a(e)};r?.addEventListener(`abort`,l,{once:!0}),vF.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 DF(e,t=!0,n){wF(hF(e),t,n)}function OF(e=2e3,t){return vF.size<SF?Promise.resolve():new Promise((n,r)=>{let i=!1,a=null,o=()=>{i||(i=!0,a&&clearTimeout(a),xF.delete(o),n())};if(xF.add(o),a=setTimeout(()=>{if(i)return;i=!0,xF.delete(o);let e=Error(`Wait for worker slot timed out`);e.name=`WorkerBusyTimeout`,e.code=`WORKER_BUSY_TIMEOUT`,r(e)},e),queueMicrotask(()=>CF()),t){let e=()=>{if(i)return;i=!0,a&&clearTimeout(a),xF.delete(o);let e=Error(`Aborted`);e.name=`AbortError`,r(e)};t.aborted?e():t.addEventListener(`abort`,e,{once:!0})}})}var kF={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1},AF=8;async function jF(e,t=!0,n={}){if(!pF()){let e=Error(`KaTeX rendering disabled`);throw e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,e}let r=n.timeout??kF.timeout,i=n.waitTimeout??kF.waitTimeout,a=n.backoffMs??kF.backoffMs,o=n.maxRetries??kF.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),AF)):kF.maxRetries,c=0;for(;;){if(n.signal?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return await EF(e,t,r,n.signal)}catch(e){if(e?.code!==`WORKER_BUSY`||c>=s)throw e;c+=1,await OF(i,n.signal).catch(()=>{}),a>0&&await new Promise(e=>globalThis.setTimeout(e,a*c))}}}var MF=r(`<div class="math-block markstream-nested-math-block" data-markstream-katex-managed="1"><div></div></div>`);function NF(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>ZA(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>ZA(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0);K(()=>{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=hF(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 jF(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 mF();if(!n)return null;try{let r=n.renderToString(e,{throwOnError:t,displayMode:!0});return DF(e,!0,r),r}catch{return null}}var m=MF(),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 PF=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>`),FF=r(`<span class="math-inline-wrapper markstream-nested-math" data-display="inline" data-markstream-katex-managed="1"><span></span> <!></span>`);function IF(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>ZA(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>ZA(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0),f=I(()=>String(t.node?.markup||``)===`$$`);K(()=>{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=hF(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 jF(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 mF();if(!r)return null;try{let i=r.renderToString(e,{throwOnError:n,displayMode:t});return DF(e,t,i),i}catch{return null}}var g=FF(),_=W(g);let v;se(_,e=>F(r,e),()=>E(r));var b=z(_,2),S=e=>{var t=PF();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 LF=()=>_e(()=>import(`../chunks/J36u8XLO.js`),[],import.meta.url),RF=`__MARKSTREAM_ANGULAR_MERMAID__`,zF=null,BF=!1,VF=null,HF=null,UF=LF;function WF(e){return`${String(e?.securityLevel??`strict`)}|htmlLabels:${e?.flowchart?.htmlLabels===!1?`0`:`1`}`}function GF(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 KF(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 qF(e,t){if(!e||!t)return;let n=WF(t);if(VF!==n)try{typeof e.initialize==`function`?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),VF=n}catch{}}function JF(){try{let e=globalThis;return GF(e?.[RF]??e?.mermaid)}catch{return null}}function YF(e){try{globalThis[RF]=e}catch{}}function XF(){return typeof UF==`function`}async function ZF(e){if(zF)return qF(zF,e),zF;let t=JF();if(t)return KF(t),zF=t,YF(zF),qF(zF,e),zF;if(HF){let t=await HF;return t&&qF(t,e),t}if(BF)return null;let n=UF;if(!n)return BF=!0,null;HF=(async()=>{try{let e=GF(await n());return e?(KF(e),zF=e,YF(zF),zF):(BF=!0,null)}catch{return BF=!0,null}})();try{let t=await HF;return t&&qF(t,e),t}finally{HF=null}}var QF=null,$F=new Map,eI=5,tI=`WORKER_BUSY`,nI=`MERMAID_DISABLED`;function rI(){return QF=Error(`[markstream-svelte:mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),QF.name=`WorkerInitError`,QF.code=`WORKER_INIT_ERROR`,null}function iI(e,t,n=1400){if(!XF()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=nI,Promise.reject(e)}if(QF)return Promise.reject(QF);let r=rI();if(!r)return Promise.reject(QF);if($F.size>=eI){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=tI,e.inFlight=$F.size,e.max=eI,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),$F.delete(o))};$F.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){$F.delete(o),a(e);return}c=setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,$F.get(o)?.reject(e)},n)})}async function aI(e,t,n=1400){return await iI(`canParse`,{code:e,theme:t},n)}async function oI(e,t,n=1400){return await iI(`findPrefix`,{code:e,theme:t},n)}var sI=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>`),cI=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>`),lI=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>`),uI=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>`),dI=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><!></button>`),fI=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>`),pI=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>`),mI=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>`),hI=r(`<pre class="mermaid-source"><code> </code></pre>`),gI=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>`),_I=r(`<div class="mermaid-loading"><span class="mermaid-spinner"></span> </div>`),vI=r(`<div class="mermaid-error"> </div>`),yI=r(`<!> <div class="mermaid-preview markstream-svelte-mermaid"><!></div> <!>`,1),bI=r(`<div class="mermaid-body"><!></div>`),xI=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>`),SI=r(`<div data-markstream-mermaid="1"><!> <!> <!></div>`);function CI(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}=uM(),P=WM(`mermaid`),L=V(!1),re=V(0),ie=V(``),R=V(``),ce=V(``),U=V(``),le=V(de({})),G=V(``),q=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),Se=V(null),Ce=V(null),we=null,Te=I(()=>ze(ZA(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:pP(o())),Ne=I(()=>_P(pP(s())??hP(E(Te)),vP(E(ye),360),E(Me)??void 0)),Pe=I(()=>[`min-height: ${E(Ne)}px`,o()&&o()!==`none`?`max-height: ${o()}`:``,`transform: scale(${E(ve)})`].filter(Boolean).join(`; `)),Fe=I(()=>!(E(De)&&!E(Te).trim())),Ie=I(()=>!(!E(U)||E(ge)));ue(()=>(F(L,!0),Re(!0),()=>{F(L,!1),F(re,E(re)+1),Le(),E(Ce)&&clearTimeout(E(Ce))})),K(()=>{E(L)&&(qe(),E(ge),E(he),e(()=>Re()))}),K(()=>{E(L)&&E(_e)&&E(U)&&E(xe)&&te()&&e(()=>void v().then(()=>Ye(E(xe))))});function Le(){E(Se)&&(clearTimeout(E(Se)),F(Se,null))}function Re(e=!1){if(!E(L)||E(ge)||E(he))return;let t=qe();if(t===E(ie)&&E(q)||!e&&t===E(ie)&&(E(U)||E(G)||E(R)===t)||(e&&Le(),E(Se)))return;let n=e||!E(je)?0:Math.max(0,b());F(Se,setTimeout(()=>{F(Se,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(ge)||E(he))return;if(!E(Te).trim()){F(U,``),F(G,``),F(ce,``),F(R,``),F(fe,!1),F(le,{},!0);return}let t=Ke(E(Te)),n=qe();if(n===E(ie)&&E(q)||!e&&n===E(ie)&&(E(U)||E(G)||E(R)===n))return;let r=ne(re);F(ie,n,!0),F(q,!0),E(je)||F(G,``);try{let e=await ZF({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(fe)&&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(fe))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=MA(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(fe,!0),F(ce,t,!0),E(le)[E(ke)]=s),te()&&typeof o!=`string`&&(await v(),E(L)&&r===E(re)&&(Ye(E(be)),E(_e)&&Ye(E(xe))))}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(q,!1)}}async function He(e,t,n){try{if(await aI(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(mP(e)===`gantt`){let r=Ge(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=Ge(e);if(!r.trim()||r===e)return{fullOk:!1,prefixOk:!1};try{let n=await oI(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 Z(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(Z(e))break;t.pop()}return t.some(Z)?t.join(`
216
+ `):``}function Ge(e){if(mP(e)===`gantt`)return We(e);let t=e.split(`
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 ZM(E(Te)),a()?.events?.onCopy?.(E(Te)),F(me,!0),E(Ce)&&clearTimeout(E(Ce)),F(Ce,setTimeout(()=>{F(me,!1)},1e3),!0)}function Q(){E(U)&&$M(E(U),`mermaid-diagram-${Date.now()}.svg`)}function Ze(e){F(ge,e===`source`),E(ge)||Ve()}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||OM(r,t,n,!1,void 0,E(Oe))}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=J(ot),ct=e=>{var t=SI();let r;var i=W(t),a=e=>{var t=mI(),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=sI(),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,()=>kM()),l(`click`,r,()=>Ze(`preview`)),f(`focus`,r,e=>et(e,N(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>kM()),f(`mouseenter`,r,e=>et(e,N(`common.preview`)||`Preview`)),f(`blur`,u,()=>kM()),l(`click`,u,()=>Ze(`source`)),f(`focus`,u,e=>et(e,N(`common.source`)||`Source`)),f(`mouseleave`,u,()=>kM()),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=cI(),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,()=>kM()),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,()=>kM()),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=dI(),r=W(t),i=e=>{var t=lI();y(e,t)},a=e=>{var t=uI();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,()=>kM()),l(`click`,t,Xe),f(`focus`,t,tt),f(`mouseleave`,t,()=>kM()),f(`mouseenter`,t,tt),y(e,t)};h(p,e=>{w()&&e(m)});var g=z(p,2),_=e=>{var t=fI();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(ge)||E(he)},[()=>N(`common.export`)]),f(`blur`,t,()=>kM()),l(`click`,t,Q),f(`focus`,t,e=>et(e,N(`common.export`)||`Export`)),f(`mouseleave`,t,()=>kM()),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=pI();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(ge)||E(he)},[()=>N(`common.open`)]),f(`blur`,t,()=>kM()),l(`click`,t,()=>F(_e,!0)),f(`focus`,t,e=>et(e,N(`common.open`)||`Open`)),f(`mouseleave`,t,()=>kM()),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=bI(),r=W(t),i=e=>{var t=hI(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(Te))),y(e,t)},a=e=>{var t=yI(),r=J(t),i=e=>{var t=gI(),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,()=>kM()),l(`click`,r,Qe),f(`focus`,r,e=>et(e,N(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>kM()),f(`mouseenter`,r,e=>et(e,N(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>kM()),l(`click`,i,$e),f(`focus`,i,e=>et(e,N(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>kM()),f(`mouseenter`,i,e=>et(e,N(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>kM()),l(`click`,a,()=>F(ve,1)),f(`focus`,a,e=>et(e,N(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>kM()),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=J(t);ae(n,()=>E(U)),y(e,t)},u=e=>{var t=hI(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(Te))),y(e,t)},d=e=>{var t=_I(),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=vI(),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(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=xI();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(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(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(Oe),"is-rendering":E(De)||E(q)}),B(t,`data-markstream-mode`,E(ge)?`source`:E(Ie)?`preview`:`fallback`)}),y(e,t)};h(st,e=>{E(Fe)&&e(ct)}),y(t,ot),x()}T([`click`,`keydown`]);var wI=r(`<p class="paragraph-node"><!></p>`);function TI(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(()=>aj(XA(r.node?.children)));var l=X(),u=J(l);t(u,19,()=>E(c),(e,t)=>E(s)+`-`+t,(e,t,r)=>{var i=X(),o=J(i),c=e=>{var i=wI(),o=W(i);{let e=I(()=>E(s)+`-`+E(r));JI(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));qI(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 EI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>$j(t.node,n()));var a=X(),o=J(a);ae(o,()=>E(r)),y(e,a),x()}function DI(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);HN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`del`})}function OI(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);HN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`strong`})}function kI(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);HN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sub`})}function AI(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);HN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sup`})}function jI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>$j(t.node,n()));var a=X(),o=J(a);ae(o,()=>E(r)),y(e,a),x()}var MI=r(`<span> </span>`),NI=r(`<span> <!></span>`);function PI(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(()=>ZA(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=IP({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=NI();let _;var v=W(g,!0),b=z(v),S=e=>{var t=MI(),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 FI=r(`<hr/>`);function II(e){var t=FI();y(e,t)}function LI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>$j(t.node,n()));var a=X(),o=J(a);ae(o,()=>E(r)),y(e,a),x()}function RI(e,t){if(t?.renderCodeBlocksAsPre)return`pre`;let n=rj(e);return n===`d2`||n===`d2lang`?`d2`:n===`infographic`?`infographic`:n===`mermaid`?`mermaid`:`code`}function zI(e){return String(e?.tag||``).trim().toLowerCase()||Jy(e?.content)}function BI(e){let t=zI(e);return t?{...e,type:t,tag:t,content:Xy(e?.content,t)}:e}function VI(e,t){let n=zI(e);return n?{...e,type:t,tag:n}:e}function HI(e,t){if(String(e?.type||``)!==`code_block`)return null;let n=RI(e,t);return n===`mermaid`?WI(t?.mermaidProps,hP(UI(e))):n===`d2`?t?.d2Props??null:n===`infographic`?WI(t?.infographicProps,gP(UI(e))):t?.codeBlockProps??null}function UI(e){return String(e?.code??``)}function WI(e,t){let n={...e||{}};return pP(n.estimatedPreviewHeightPx)??(n.estimatedPreviewHeightPx=_P(t,void 0,n.maxHeight===`none`?null:pP(n.maxHeight)??void 0)),n}function GI(e,t,n){let r=n??t?.customComponents??null,i=String(e?.type||``);if(i===`code_block`){let n=rj(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=zI(e);return o&&r?.[o]?r[o]:null}var KI=r(`<span hidden=""></span>`);function qI(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||aM(n()?.customId)),c=I(()=>GI(t.node,n(),E(s))),l=I(()=>BI(t.node)),u=I(()=>HI(t.node,n())||{}),d=I(()=>RI(t.node,n())),f=I(()=>zI(t.node)),m=I(C),g=I(()=>VI(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))||gy.has(E(f))?!1:!Yy(t.node?.content??t.node?.raw,E(f))}var w=X(),T=J(w),D=e=>{var t=X(),i=J(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,q({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);PI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get typewriter(){return E(i)}})}},A=e=>{TI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},j=e=>{$N(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ee=e=>{XI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},te=e=>{aF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},M=e=>{nF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},N=e=>{jI(e,{get node(){return t.node},get context(){return n()}})},P=e=>{zN(e,{get node(){return t.node},get context(){return n()}})},F=e=>{JN(e,{get node(){return t.node},get context(){return n()}})},L=e=>{XN(e,{get node(){return t.node}})},ne=e=>{KN(e,{get node(){return t.node}})},re=e=>{eM(e,{get node(){return t.node},get context(){return n()}})},ie=e=>{QN(e,{})},R=e=>{{let i=I(()=>typeof n()?.showTooltips==`boolean`?n()?.showTooltips:void 0);eF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get showTooltip(){return E(i)}})}},ae=e=>{lP(e,{get node(){return t.node}})},oe=e=>{XP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},se=e=>{OI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},z=e=>{UN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},B=e=>{DI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},V=e=>{eP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ce=e=>{ZP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},H=e=>{kI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},U=e=>{AI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},W=e=>{sM(e,{get node(){return t.node}})},le=e=>{VN(e,{get node(){return t.node}})},G=e=>{EI(e,{get node(){return t.node},get context(){return n()}})},ue=e=>{var t=X(),i=J(t),a=e=>{PI(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{tP(e,{get node(){return E(g)},get context(){return n()}})};h(i,e=>{E(m)?e(a):e(o,-1)}),y(e,t)},K=e=>{var t=X(),i=J(t),a=e=>{PI(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{nP(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=>{LI(e,{get node(){return t.node},get context(){return n()}})},fe=e=>{II(e,{})},pe=e=>{IF(e,{get node(){return t.node}})},me=e=>{NF(e,{get node(){return t.node}})},Y=e=>{var r=X(),i=J(r),a=e=>{CI(e,q({get node(){return t.node},get context(){return n()}},()=>E(u)))},o=e=>{RN(e,q({get node(){return t.node},get context(){return n()}},()=>E(u)))},s=e=>{FP(e,q({get node(){return t.node},get context(){return n()}},()=>E(u)))},c=e=>{XM(e,{get node(){return t.node},get showLineNumbers(){return E(v)},get style(){return E(b)}})},l=e=>{var r=X(),i=J(r);p(i,()=>E(_),e=>{{let r=I(()=>n()?.codeBlockOptions);fN(e,q({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=KI();y(e,t)},ge=e=>{WN(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(K,28):E(o)===`vmr_container`?e(de,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 JI(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=J(o);t(s,19,()=>r()||[],(e,t)=>a()+`-`+t,(e,t,n)=>{{let r=I(()=>a()+`-`+E(n));qI(e,{get node(){return E(t)},get context(){return i()},get indexKey(){return E(r)}})}}),y(e,o)}var YI=r(`<blockquote class="blockquote blockquote-node" dir="auto"><!></blockquote>`);function XI(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>ZA(t.node?.cite));var s=YI(),c=W(s);{let e=I(()=>XA(t.node?.children)),n=I(()=>String(a()??`blockquote`)+`-blockquote`);JI(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 ZI=0,QI=new WeakMap,$I={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`},eL={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 tL(e,t={}){nL(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{}QI.get(e)===a&&QI.delete(e)}}};return QI.set(e,a),!i()||(await cL(e,i),!i())||(await uL(e,n,t,i),!i())||t.final!==!1&&(await gL(e,n,t,i),!i()||(await _L(e,n,t,i),!i())||(t.renderCodeBlocksAsPre||await vL(e,n,t,i),!i()))||!i()||(AL(e,n),!i())||kL(e,n,t),a}function nL(e){e&&QI.get(e)?.dispose()}function rL(e,t){let n=e.querySelector(t);return{sourceElement:n,source:(n?.textContent||(n?``:e.textContent)||``).trim()}}function iL(e,t){return e.querySelector(t)}function aL(e,t){return!!(iL(e,t)||e).querySelector(`.katex, .katex-display`)}function oL(e,t,n,r={}){t?t.innerHTML=n:e.innerHTML=n,e.dataset.markstreamKatex=`1`,r.renderedClass&&e.classList.add(r.renderedClass)}function sL(e,t,n={}){t&&(t.innerHTML=``),delete e.dataset.markstreamKatex,delete e.dataset.markstreamKatexSource,n.renderedClass&&e.classList.remove(n.renderedClass)}async function cL(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}=rL(e,`.markstream-nested-math__source`),r=iL(e,`.markstream-nested-math__render`);if(!n){sL(e,r);continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&aL(e,`.markstream-nested-math__render`)))try{oL(e,r,await lL(n,e.dataset.display===`block`)),e.dataset.markstreamKatexSource=n}catch{sL(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}=rL(e,`.markstream-nested-math-block__source`),r=iL(e,`.markstream-nested-math-block__render`);if(!n){sL(e,r,{renderedClass:`markstream-nested-math-block--rendered`});continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&aL(e,`.markstream-nested-math-block__render`)))try{oL(e,r,await lL(n,!0),{renderedClass:`markstream-nested-math-block--rendered`}),e.dataset.markstreamKatexSource=n}catch{sL(e,r,{renderedClass:`markstream-nested-math-block--rendered`})}}}async function lL(e,t){let n=hF(e);try{return await jF(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 mF();if(!r)throw Error(`KaTeX renderer is not available.`);let i=r.renderToString(n,{displayMode:t,throwOnError:!1});return DF(n,t,i),i}async function uL(e,t,n,r){var i;let a=n.mermaidProps?.isStrict!==!1,o=await ZF({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=DL(`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 fL(s,e,o,n)}catch(t){if(t?.name===`AbortError`)return;let i=await pL(s,e,n);if(!r())return;if(!i){l.wrapper.replaceWith(c);continue}a=i}let u=`markstream-svelte-mermaid-${++ZI}`,d=await hL(()=>Promise.resolve(o.render(u,dL(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=MA(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 dL(e,t){return e.trimStart().startsWith(`%%{`)?e:`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n${e}`}async function fL(e,t,n,r){let i=Number(r.mermaidProps?.workerTimeoutMs??1400),a=Number(r.mermaidProps?.parseTimeoutMs??1800);try{if(await aI(e,t,i))return!0}catch(e){if(e?.name===`AbortError`)throw e}let o=dL(e,t);if(typeof n?.parse==`function`)return await hL(()=>Promise.resolve(n.parse(o)),a),!0;let s=`markstream-svelte-mermaid-parse-${++ZI}`;return await hL(()=>Promise.resolve(n.render(s,o)),a),!0}async function pL(e,t,n){let r=Number(n.mermaidProps?.workerTimeoutMs??1400);try{let n=await oI(e,t,r);if(n)return n}catch(e){if(e?.name===`AbortError`)throw e}return mL(e)}function mL(e){let t=e.split(`
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 hL(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 gL(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 fP();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=DL(`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 _L(e,t,n,r){let i=await vN();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=DL(`d2`,`D2`,o,!0,n,{showHeader:n.d2Props?.showHeader!==!1});a.replaceWith(c.wrapper);try{let e=yL(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={...$I,...e||{}}}let m=await e.render(l,p);if(!r())return;let h=wN(TN(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 vL(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=bL(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 _M();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=bL(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=EL(e.dataset.markstreamOriginal),f=EL(e.dataset.markstreamUpdated),p=xL(a),m=DL(`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=SL(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 TL(),!r()){y();return}if(!CL(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 yL(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 bL(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 xL(e){let t=e.trim().toLowerCase();return eL[t]||t||`plaintext`}function SL(e,t){let n=Math.max(1,e.split(`
222
+ `).length);return Math.min(520,(t?180:96)+n*(t?20:18))}function CL(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=wL(e.textContent||``),o=wL(i);return a.includes(o)}function wL(e){return e.replace(/\s+/g,``)}async function TL(){typeof window>`u`||typeof window.requestAnimationFrame!=`function`||await new Promise(e=>window.requestAnimationFrame(()=>e()))}function EL(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 DL(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(OL(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 OL(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;jL(e),(n=t.onCopy)==null||n.call(t,e)}),n.appendChild(r),n}function kL(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=()=>OM(e,i,`top`,!1,void 0,n.isDark),o=()=>kM();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&&kM(!0),r!=null&&e.getAttribute(`title`)==null&&e.setAttribute(`title`,r)})}}function AL(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 jL(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 ML(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=HP(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 NL=`markstreamSmoothStreaming`,PL=r(`<div class="node-slot"><div><!></div></div>`),FL=r(`<span class="typewriter-cursor" aria-hidden="true"></span>`),IL=r(`<div><!> <!></div>`);function LL(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),q=k(r,`renderBatchIdleTimeoutMs`,3,120),J=k(r,`deferNodesUntilVisible`,3,!0),de=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),Se=V(null),Ce=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=ML(()=>X()),Le=I(()=>he()===!0||E(Fe)),Re=I(()=>Array.isArray(o())),ze=ee(NL),Be=I(()=>he()===!1||E(Re)||he()!==!0&&ze?.()?!1:he()===!0||ie()===!0||(de()??0)<=0),Ve=I(()=>E(Le)&&E(Be));me(NL,()=>E(Ve));let He=I(()=>E(Ve)?Ie.visible:a()??``),Ue=I(()=>a()??``),Z=I(()=>E(Re)||Ie.source===E(Ue)),We=I(()=>{let e=c()??{};return s()??e.final}),Ge=I(()=>E(Ve)&&E(We)!=null?!!(E(We)&&E(Z)&&Ie.caughtUp):E(We));ue(()=>{F(Fe,!0)}),K(()=>{let e=a()??``;if(E(Re)){Ie.reset(``);return}if(!E(Ve)){Ie.reset(e),E(We)&&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(We)&&Ie.finish()});let Ke=I(()=>({content:E(He),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:q(),deferNodesUntilVisible:J(),maxLiveNodes:de(),liveNodeBuffer:fe(),allowHtml:pe(),smoothStreaming:he(),smoothStreamingOptions:X()}));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=YA(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(Ce);let e=aM(L()),t=te()?{...e,...te()}:e;return JA({...E(Ke),customComponents:t},{onCopy:_e(),onHandleArtifactClick:ve()},Pe,E(we))});K(()=>{E(qe).length,ae(),oe(),U(),le(),G(),q(),E(Ge),E(ke),Q()});let Ye=I(()=>E(qe).slice(0,Math.min(E(ke),E(qe).length)));K(()=>{E(Se),E(Ge),E(qe),E(Ye),P(),S(),T(),D(),_(),b(),N(),O(),A(),j(),M(),_e(),$e()}),ue(()=>iM(()=>{F(Ce,E(Ce)+1)})),ce(()=>{De+=1,Qe(),Oe?.dispose(),Oe=null,nL(E(Se)),ut()});function Xe(e,t){let n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):t}function Q(){let e=E(qe).length,t=Math.min(e,Xe(oe(),40));if(!(E(Ge)!==!1&&ae()!==!1&&e>t)){Qe(),E(ke)!==e&&F(ke,e,!0);return}(E(ke)<=0||E(ke)>e||E(ke)<t)&&F(ke,t,!0),Ze()}function Ze(){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(q())||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 Qe(){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 $e(){if(!E(Se)||typeof window>`u`)return;let e=typeof E(Ge)==`boolean`?E(Ge):!et(E(qe));if(!e){De+=1,Oe?.dispose(),Oe=null;return}let t=++De;if(await v(),t!==De||!E(Se))return;Oe?.dispose();let n=await tL(E(Se),{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!==De});if(t!==De){n.dispose();return}Oe=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(qe)[E(qe).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(Se)||!E(tt))return;let e=E(Se),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`}K(()=>{if(E(He),o(),ie(),E(qe).length,E(Ge),typeof window>`u`||E(Re))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)}),K(()=>{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=IL();let gt;var _t=W(ht);t(_t,19,()=>E(Ye),(e,t)=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+t,(e,t,r)=>{var i=PL(),a=W(i);let o;var s=W(a);{let e=I(()=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+E(r));qI(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=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=FL();se(t,e=>F(tt,e),()=>E(tt)),y(e,t)};h(vt,e=>{E(nt)&&e(yt)}),n(ht),se(ht,e=>F(Se,e),()=>E(Se)),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 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>`),zL=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>`),BL=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>`),VL=r(`<span class="turn-pill"> </span>`),HL=r(`<div class="flow-item flex h-5 items-center gap-1.5"><!></div>`),UL=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>`),WL=r(`<div class="flow-item px-1 text-[11px] text-muted-foreground"> </div>`),GL=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>`),KL=r(`<div class="flow-item flex h-6 items-center gap-2 px-3 text-[10px] text-muted-foreground" role="status"><span class="h-px flex-1 bg-border"></span> <!> <span class="rounded bg-muted px-1 uppercase">agent</span> <span class="truncate"> </span> <span class="rounded bg-primary/10 px-1 text-primary"> </span> <span class="h-px flex-1 bg-border"></span></div>`),qL=r(`<img alt="" class="h-16 w-16 rounded-xl border border-border object-cover"/>`),JL=r(`<div class="mb-1 flex flex-wrap justify-end gap-1"></div>`),YL=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>`),XL=r(`<div class="bubble-user max-h-40 overflow-y-auto px-3.5 py-2 text-[13px] leading-5 whitespace-pre-wrap"> </div>`),ZL=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>`),QL=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>`),eR=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>`),tR=r(`<div class="flow-item"><!></div>`),nR=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>`),rR=r(`<!> <!>`,1),iR=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>`),aR=r(`<div class="relative min-h-0 flex-1"><div class="h-full overflow-y-auto px-4 py-3"><!></div> <!></div>`);function oR(e,r){i(r,!0);let a=V(null),o=V(de({})),s=V(null),u=V(!1),d=0;K(()=>{Z.items.length,Z.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);K(()=>{if(Z.status!==`running`){F(p,0);return}let e=()=>{let e=Z.turnStartedAt?Date.parse(Z.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{be(`Copy failed — clipboard unavailable.`)}}function g(e){Fe(e),document.querySelector(`aside[aria-label="Agent panel"] textarea`)?.focus()}function _(e){Z.sending||Ue(e)}let v=I(()=>{for(let e=Z.items.length-1;e>=0;e--){let t=Z.items[e];if(t?.kind===`user`)return t.seq}return null}),b=I(()=>{for(let e=Z.items.length-1;e>=0;e--){let t=Z.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 Mt.find(t=>t.id===e)?.label??e}function w(e){return[e.usage?`↑ ${wu(e.usage.inputTokens)}`:``,e.usage?`↓ ${wu(e.usage.outputTokens)}`:``,e.elapsedMs===void 0?``:Tu(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=aR(),k=W(O),A=W(k),j=e=>{var r=zL(),i=z(W(r),2);t(i,21,()=>Mt,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(()=>{Y(r,1,`w-full rounded-md border p-2 text-left transition-colors ${Z.pendingMode===E(t).id?`border-primary/60 bg-primary/5`:`border-border hover:border-primary/50 hover:bg-primary/5`}`),B(r,`aria-pressed`,Z.pendingMode===E(t).id),r.disabled=Z.sending,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>Z.pendingMode=E(t).id),y(e,r)}),n(i),n(r),y(e,r)},ee=e=>{var r=rR(),i=J(r);t(i,17,()=>Z.items,e=>e.seq,(e,r)=>{var i=X(),a=J(i),u=e=>{var t=BL(),i=z(W(t));oe(),n(t),H(()=>c(i,` ${E(r).label??`Turn`??``} `)),y(e,t)},d=e=>{var t=HL(),i=W(t),a=e=>{var t=VL(),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=VL(),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=UL(),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=WL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)},x=e=>{var t=GL(),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 t=KL(),i=z(W(t),2);Tl(i,{class:`h-3 w-3 shrink-0`,"aria-hidden":`true`});var a=z(i,4),o=M(a,!0),s=z(a,2),l=M(s,!0);oe(2),n(t),H(()=>{B(t,`aria-label`,`Subagent spawned: ${E(r).label} (${E(r).mode})`),c(o,E(r).label),c(l,E(r).mode)}),y(e,t)},O=e=>{var i=ZL(),a=W(i),o=e=>{var i=JL();t(i,21,()=>E(r).images,ie,(e,t)=>{var n=qL();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=JL();t(i,21,()=>E(r).files,ie,(e,t)=>{var i=YL(),a=W(i),o=e=>{xl(e,{class:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`})},s=I(()=>E(r).imageChipNames?.includes(E(t))),l=e=>{yl(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=XL(),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=>{mc(e,{class:`h-3.5 w-3.5 text-primary`})},w=e=>{_l(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);ot(D,{class:`h-3.5 w-3.5`}),n(T);var O=z(T,2),k=W(O);ur(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=Z.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)},k=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);Vl(i,{get icon(){return lr},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=QL(),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)},A=e=>{var t=eR(),i=W(t),a=W(i);{let e=I(()=>!E(r).streaming);LL(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=>{mc(e,{class:`h-3.5 w-3.5 text-primary`})},f=e=>{_l(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)},j=e=>{{let t=I(()=>E(r).phase===`calling`&&Z.status===`running`);Cu(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}})}},ee=e=>{var t=tR();Pl(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===`subagent`?e(D,5):E(r).kind===`user`?e(O,6):E(r).kind===`reasoning`?e(k,7):E(r).kind===`assistant`?e(A,8):E(r).kind===`tool`?e(j,9):E(r).kind===`approval`&&e(ee,10)}),y(e,i)});var a=z(i,2),u=e=>{var t=nR(),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=>{Z.status===`running`&&e(u)}),y(e,r)};h(A,e=>{Z.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=iR();Cl(W(t),{class:`h-3.5 w-3.5`}),n(t),l(`click`,t,D),y(e,t)};h(te,e=>{E(u)&&Z.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 sR=new Set([`$$slots`,`$$events`,`$$legacy`]);function cR(e,t){let n=U(t,sR),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,q({name:`file-up`},()=>n,{get iconNode(){return r}}))}var lR=r(`<div class="pointer-events-none fixed inset-0 z-50 flex items-center justify-center bg-primary/5 backdrop-blur-[1px]" role="status" aria-label="Drop files to attach"><div class="flex flex-col items-center gap-2 rounded-2xl border-2 border-dashed border-primary/50 bg-background/90 px-8 py-6 shadow-lg"><!> <p class="text-sm font-medium text-foreground">Drop to attach</p> <p class="text-xs text-muted-foreground">Images and files go to this message</p></div></div>`);function uR(e,t){i(t,!0);let r=V(!1),a=0;function o(e){return[...e.dataTransfer?.types??[]].includes(`Files`)}ue(()=>{let e=e=>{o(e)&&(e.preventDefault(),a+=1,F(r,!0))},t=e=>{o(e)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))},n=e=>{o(e)&&(a=Math.max(0,a-1),a===0&&F(r,!1))},i=e=>{o(e)&&(e.preventDefault(),a=0,F(r,!1),Oe(e))};return document.addEventListener(`dragenter`,e),document.addEventListener(`dragover`,t),document.addEventListener(`dragleave`,n),document.addEventListener(`drop`,i),()=>{document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragover`,t),document.removeEventListener(`dragleave`,n),document.removeEventListener(`drop`,i)}});var s=X(),c=J(s),l=e=>{var t=lR(),r=W(t);cR(W(r),{class:`h-7 w-7 text-primary`,"aria-hidden":`true`}),oe(4),n(r),n(t),y(e,t)};h(c,e=>{E(r)&&e(l)}),y(e,s),x()}var dR=r(`<li><span aria-hidden="true"></span> <span class="min-w-0 break-words"> </span></li>`),fR=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>`),pR=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 mR(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=pR(),s=W(o),u=W(s),d=W(u);ir(d,{class:`h-3.5 w-3.5`}),n(u);var f=z(u,6),p=M(f),m=z(f,2);fr(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=fR();t(i,21,()=>r.todos,ie,(e,t)=>{var r=dR(),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 hR(e){let t=0;for(let n of e)t=(t*31+n.charCodeAt(0))%360;return t}function gR(e){return`hsl(${hR(e)} 55% 45%)`}var _R=`sc-letter-avatar`;function vR(e){return e.includes(_R)}function yR(e,t){return e.iconSuppressed===!0?null:e.icon??t?.icon??null}function bR(e,t){return e.iconLetter!==void 0&&e.iconLetter.length>0?e.iconLetter:(t||e.provider).slice(0,1).toUpperCase()}function xR(e){return e.iconColor??gR(e.provider)}var SR={svg:`image/svg+xml`,png:`image/png`,webp:`image/webp`};function CR(e,t){let n=e.indexOf(`,`);return!e.startsWith(`data:`)||n<0?null:`data:${t};base64,${e.slice(n+1)}`}var wR=new Set([`$$slots`,`$$events`,`$$legacy`]);function TR(e,t){let n=U(t,wR),r=[[`path`,{d:`M16 5H3`}],[`path`,{d:`M11 12H3`}],[`path`,{d:`M16 19H3`}],[`path`,{d:`M18 9v6`}],[`path`,{d:`M21 12h-6`}]];ye(e,q({name:`list-plus`},()=>n,{get iconNode(){return r}}))}var ER=new Set([`$$slots`,`$$events`,`$$legacy`]);function DR(e,t){let n=U(t,ER),r=[[`path`,{d:`M16 3h5v5`}],[`path`,{d:`M8 3H3v5`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`}],[`path`,{d:`m15 9 6-6`}]];ye(e,q({name:`split`},()=>n,{get iconNode(){return r}}))}var OR=new Set([`$$slots`,`$$events`,`$$legacy`]);function kR(e,t){let n=U(t,OR),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];ye(e,q({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var AR=new Set([`$$slots`,`$$events`,`$$legacy`]);function jR(e,t){let n=U(t,AR),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];ye(e,q({name:`square`},()=>n,{get iconNode(){return r}}))}var MR=new Set([`$$slots`,`$$events`,`$$legacy`]);function NR(e,t){let n=U(t,MR),r=[[`path`,{d:`m6 9 6 6 6-6`}]];ye(e,q({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var PR=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function FR(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=U(t,PR);var o=X(),s=J(o);a(s,()=>ks,(e,t)=>{t(e,q(()=>r,{get open(){return n()},set open(e){n(e)}}))}),y(e,o),x()}var IR=new Set([`$$slots`,`$$events`,`$$legacy`]);function LR(e,t){let n=U(t,IR);var r=X(),i=J(r);a(i,()=>an,(e,t)=>{t(e,q(()=>n))}),y(e,r)}var RR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`sideOffset`,`align`,`portalProps`,`class`]);function zR(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,RR);LR(e,q(()=>t.portalProps,{children:(e,i)=>{var c=X(),l=J(c);{let e=I(()=>Zn(`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,()=>Ms,(t,i)=>{i(t,q({"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 BR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function VR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,BR);var o=X(),s=J(o);a(s,()=>Ss,(e,t)=>{t(e,q({"data-slot":`dropdown-menu-group`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var HR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`variant`]);function UR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`variant`,3,`default`),o=U(t,HR);var s=X(),c=J(s);{let e=I(()=>Zn(`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,()=>ys,(i,a)=>{a(i,q({"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 WR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`children`]),GR=r(`<div><!></div>`);function KR(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,WR);var o=GR();P(o,e=>({"data-slot":`dropdown-menu-label`,"data-inset":t.inset,class:e,...a}),[()=>Zn(`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 qR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function JR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,qR);var o=X(),s=J(o);{let e=I(()=>Zn(`bg-border/50 -mx-1 my-1 h-px`,t.class));a(s,()=>Os,(t,i)=>{i(t,q({"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 YR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function XR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,YR);var o=X(),s=J(o);a(s,()=>Fs,(e,t)=>{t(e,q({"data-slot":`dropdown-menu-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var ZR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`]);function QR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,ZR);var o=X(),s=J(o);{let e=I(()=>Zn(`px-2 py-1.5 text-sm font-semibold data-[inset]:ps-8`,t.class));a(s,()=>Ts,(i,a)=>{a(i,q({"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 $R=/[\uE100-\uE11D\uFFFC]/g,ez=/[\uE100-\uE11D\uFFFC]/;function tz(e,t,n=Date.now()){return!!(e.isComposing||e.keyCode===229||t!==null&&n-t<10)}function nz(e){return e.replace($R,``)}function rz(e){return ez.test(e)}function iz(e){return e.owner!==void 0&&e.owner!==null&&e.owner.length>0?e.owner:e.disconnected?`Reconnecting…`:e.unavailable?`Agent unavailable`:e.modeLabel?`Message the ${e.modeLabel.toLowerCase()} agent…`:`Message the agent…`}function az(e){return!e.startsWith(`/`)||e.startsWith(`//`)||(e.split(/\s/,1)[0]??``).includes(`://`)?``:e}function oz(e,t){return e===null?null:t.startsWith(e.token)?e:null}function sz(e,t){let n=e.split(/\s/,1)[0]??``;if(!n.startsWith(`/`))return null;let r=`${n} `;return t.includes(r)&&e.startsWith(r)?{token:r}:null}function cz(e,t){return t===null||!e.startsWith(t.token)?e:e.slice(t.token.length)}function lz(e,t){return t===0||/\s/.test(e[t-1]??``)}function uz(e,t){let n=new Map;for(let e of t){let t=n.get(e.token)??[];t.push(e),n.set(e.token,t)}let r=[...n.keys()],i=[],a=0;for(;a<e.length;){if(!lz(e,a)){a+=1;continue}let t=r.find(t=>e.startsWith(t,a));if(t===void 0){a+=1;continue}let o=n.get(t)?.shift();o!==void 0&&i.push({reference:o,start:a,end:a+t.length}),a+=t.length}return i}function dz(e,t){return uz(e,t).map(e=>e.reference)}function fz(e,t,n=[]){let r=[...[...t].sort((e,t)=>e.start-t.start).map(t=>({start:t.start,end:t.end,segment:{kind:`chip`,text:e.slice(t.start,t.end),reference:t.reference}})),...[...n].sort((e,t)=>e.start-t.start).map(t=>({start:t.start,end:t.end,segment:{kind:`skill`,text:e.slice(t.start,t.end),name:t.name}}))].sort((e,t)=>e.start-t.start),i=[],a=0;for(let t of r)t.start<a||(t.start>a&&i.push({kind:`plain`,text:e.slice(a,t.start)}),i.push(t.segment),a=t.end);return a<e.length&&i.push({kind:`plain`,text:e.slice(a)}),i}function pz(e,t,n){return n.find(e=>e.end===t)??null}function mz(e,t){if(t.length===0)return[];let n=[...new Set(t)].sort((e,t)=>t.length-e.length),r=[],i=0;for(;i<e.length;){if(!lz(e,i)||e[i]!==`/`){i+=1;continue}let t=n.find(t=>e.startsWith(`/${t}`,i)&&(i+t.length+1===e.length||/\s/.test(e[i+t.length+1]??``)));if(t===void 0){i+=1;continue}r.push({start:i,end:i+t.length+1,name:t}),i+=t.length+1}return r}var hz=r(`<div class="px-2.5 pt-1 text-[10px] text-muted-foreground" data-menu-source="true"> </div>`),gz=r(`<li class="cursor-default px-2.5 py-1.5 text-[11px] text-muted-foreground"> </li>`),_z=r(`<li><button type="button" data-menu-pinned="true"><span class="shrink-0 font-medium"> </span></button></li>`),vz=r(`<li class="px-2.5 pt-1.5 pb-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground"> </li>`),yz=r(`<span class="truncate text-muted-foreground"> </span>`),bz=r(`<!> <li><button type="button"><span class="shrink-0 font-medium"> </span> <!></button></li>`,1),xz=r(`<!> <!>`,1),Sz=r(`<ul class="absolute bottom-full left-3 z-20 mb-1.5 max-h-64 w-72 overflow-y-auto rounded-lg border border-border bg-popover py-1 shadow-md"><!> <!></ul>`);function Cz(e,r){i(r,!0);let a=k(r,`suppress`,3,!1),o=k(r,`forcedOpen`,3,!1),s=V(null),u=V(0),d=I(()=>r.text.startsWith(r.trigger)?r.text.split(`
225
+ `,1)[0]??``:``),f=I(()=>o()&&E(d).length===0?r.trigger:E(d)),p=I(()=>{if(E(f).length===0)return[];if(r.matcher!==void 0)return r.entries.filter(e=>r.matcher(E(f),e));let e=E(f).toLowerCase();return r.entries.filter(t=>t.value.toLowerCase().startsWith(e))}),m=I(()=>r.entries.length===0&&r.emptyMessage!==void 0),g=I(()=>!a()&&r.caretOnFirstLine&&E(s)!==r.text&&(o()&&(E(p).length>0||E(m))||E(d).length>0&&(E(p).length>0||E(m)||r.pinned!==void 0&&E(d).includes(`/`)))),_=I(()=>E(p).length+(r.pinned===void 0?0:1)),v=I(()=>Math.min(E(u),Math.max(0,E(_)-1))),b=I(()=>E(p).map((e,t)=>({entry:e,index:t,header:e.group!==void 0&&e.group!==E(p)[t-1]?.group})));function S(e){e.preventDefault(),e.stopPropagation()}function C(e){if(!E(g))return!1;if(e.key===`Escape`)return S(e),F(s,r.text,!0),r.onForceClose?.(),!0;if(E(_)===0)return e.key===`Enter`&&(S(e),!0);if(e.key===`ArrowDown`)return S(e),F(u,(E(v)+1)%E(_)),!0;if(e.key===`ArrowUp`)return S(e),F(u,(E(v)-1+E(_))%E(_)),!0;if(e.key===`Enter`||e.key===`Tab`&&o()){if(S(e),r.pinned!==void 0&&E(v)===0)r.onSelect(r.pinned.value),r.onForceClose?.();else{let e=E(p)[E(v)-(r.pinned===void 0?0:1)];e&&(r.onSelect(e.value,e),r.onForceClose?.())}return!0}return!1}var w={handleKeydown:C},T=X(),D=J(T),O=e=>{var i=Sz(),a=W(i),o=e=>{var t=hz(),n=M(t,!0);H(()=>c(n,r.sourceLabel)),y(e,t)};h(a,e=>{r.sourceLabel&&e(o)});var s=z(a,2),u=e=>{var t=gz(),n=M(t,!0);H(()=>c(n,r.emptyMessage)),y(e,t)},d=e=>{var i=xz(),a=J(i),o=e=>{var t=_z(),i=W(t),a=W(i),o=M(a,!0);n(i),n(t),H(()=>{Y(i,1,`flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-[11px] ${E(v)===0?`bg-primary/15 text-foreground`:`text-muted-foreground`} hover:bg-accent/50`),B(i,`aria-current`,E(v)===0?`true`:void 0),c(o,r.pinned.label)}),l(`click`,i,()=>{r.onSelect(r.pinned.value),r.onForceClose?.()}),y(e,t)};h(a,e=>{r.pinned&&e(o)});var s=z(a,2);t(s,17,()=>E(b),e=>e.entry.key??e.entry.value,(e,t)=>{var i=bz(),a=J(i),o=e=>{var n=vz(),r=M(n,!0);H(()=>{B(n,`data-menu-group`,E(t).entry.group),c(r,E(t).entry.group)}),y(e,n)};h(a,e=>{E(t).header&&E(t).entry.group&&e(o)});var s=z(a,2),u=W(s),d=W(u),f=M(d,!0),p=z(d,2),m=e=>{var n=yz(),r=M(n,!0);H(()=>c(r,E(t).entry.description)),y(e,n)};h(p,e=>{E(t).entry.description&&e(m)}),n(u),n(s),H(()=>{Y(u,1,`flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-[11px] ${E(t).index+(r.pinned===void 0?0:1)===E(v)?`bg-primary/15 text-foreground`:`text-foreground`} hover:bg-accent/50`),B(u,`aria-current`,E(t).index+(r.pinned===void 0?0:1)===E(v)?`true`:void 0),c(f,E(t).entry.value)}),l(`click`,u,()=>{r.onSelect(E(t).entry.value,E(t).entry),r.onForceClose?.()}),y(e,i)}),y(e,i)};h(s,e=>{E(p).length===0&&r.pinned===void 0?e(u):e(d,-1)}),n(i),H(()=>{B(i,`data-slot`,r.dataSlot),B(i,`aria-label`,r.menuLabel)}),y(e,i)};return h(D,e=>{E(g)&&e(O)}),y(e,T),x(w)}T([`click`]);var wz=[{command:`/compact`,description:`Summarize the transcript to reclaim context`},{command:`/queue`,description:`While busy, Enter queues after the current turn`},{command:`/steer`,description:`While busy, Enter steers the current turn`}],Tz=wz.filter(e=>e.kind===`input-taking`).map(e=>`${e.command} `);function Ez(e,t){i(t,!0);let n=k(t,`suppress`,3,!1),r=k(t,`forcedOpen`,3,!1),a=I(()=>{let e=wz.map(e=>({value:e.command,group:`Commands`,...e.description.length>0?{description:e.description}:{}})),t=Xt.skills.map(e=>({value:`/${e.name}`,group:`Skills`,...e.description.length>0?{description:e.description}:{}}));return[...e,...t]}),o=I(()=>Xt.target?`skills from provider: ${Xt.target.providerId}`:`Open a Workspace provider to load skills`),s=I(()=>t.text.startsWith(`/`)&&az(t.text.split(`
226
+ `,1)[0]??``)===``),c=V(null);function l(e){return E(c)?.handleKeydown(e)??!1}function u(e){if(wz.some(t=>t.command===e)){t.onExecute(e);return}t.onInsertSkill(e)}var d={handleKeydown:l};{let i=I(()=>n()||E(s));se(Cz(e,{trigger:`/`,get entries(){return E(a)},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},get suppress(){return E(i)},get forcedOpen(){return r()},get onForceClose(){return t.onForceClose},menuLabel:`Slash commands and skills`,get sourceLabel(){return E(o)},dataSlot:`slash-menu`,emptyMessage:`No matching command or skill`,onSelect:u}),e=>F(c,e,!0),()=>E(c))}return x(d)}var Dz=de({open:!1,section:`general`});function Oz(e=`general`){Dz.section=e,Dz.open=!0}function kz(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 Az=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),jz=r(`<div class="text-muted-foreground">No turns yet.</div>`),Mz=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>`),Nz=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 Pz(e,t){i(t,!0);let r=V(!1),a=V(null),o=I(()=>Z.lastUsage),s=I(()=>kz(Xe.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 ${wu(E(o).inputTokens)} in / ${wu(E(o).outputTokens)} out`:`No turns yet — context usage appears after the first turn`);function S(){Z.sending||Z.status===`running`||(F(r,!1),Ue(`/compact`))}function C(e){E(r)&&E(a)!==null&&e.target instanceof Node&&!E(a).contains(e.target)&&F(r,!1)}var w=Nz();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=Mz(),r=z(W(t),2),i=e=>{var t=Az(),r=J(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`:``}`)},[()=>wu(E(o).inputTokens),()=>wu(E(o).outputTokens),()=>wu(E(u))]),y(e,t)},a=e=>{var t=jz();y(e,t)};h(r,e=>{E(o)?e(i):e(a,-1)});var d=z(r,2);n(t),H(()=>d.disabled=Z.sending||Z.status===`running`||!Z.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=!Z.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 Fz=new Set([`$$slots`,`$$events`,`$$legacy`]);function Iz(e,t){let n=U(t,Fz),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,q({name:`pencil`},()=>n,{get iconNode(){return r}}))}var Lz=r(`<input class="min-w-0 flex-1 rounded border border-border bg-background px-1.5 py-0.5 text-[11px] outline-none focus:border-primary" aria-label="Edit queued message"/>`),Rz=r(`<span class="truncate text-foreground/80"> </span>`),zz=r(`<span class="shrink-0 rounded border border-border bg-background px-1 text-[10px] text-muted-foreground"> </span>`),Bz=r(`<span class="shrink-0 rounded border border-border bg-background px-1 text-[10px] text-primary" title="Steers the running turn at the next step boundary">steer</span>`),Vz=r(`<button type="button" class="relative flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground" aria-label="Edit queued message" title="Edit this queued message"><!></button> <button type="button" class="relative flex h-6 w-6 shrink-0 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:pointer-events-none disabled:opacity-40" aria-label="Steer with this message"><!></button>`,1),Hz=r(`<li class="flex items-center gap-1 px-2.5 py-1 text-[11px]"><!> <!> <!> <span class="flex-1"></span> <!> <button type="button" class="relative flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-destructive" aria-label="Remove queued message" title="Remove from queue"><!></button></li>`),Uz=r(`<li class="flex items-center gap-1 px-2.5 py-1 text-[11px]"><span class="truncate text-muted-foreground/70"> </span> <span class="flex-1"></span> <span class="shrink-0 text-[10px] text-muted-foreground/60">sending…</span></li>`),Wz=r(`<ul class="border-t border-border"></ul>`),Gz=r(`<div class="mx-2.5 mt-2.5 shrink-0 rounded-lg border border-border bg-muted/30" aria-label="Queued messages"><button type="button" class="flex w-full items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-muted-foreground hover:text-foreground"><!> <span class="font-medium">Queued</span> <span class="rounded border border-border bg-background px-1 text-primary"> </span> <span class="flex-1"></span> <!></button> <!></div>`);function Kz(e,r){i(r,!0);let a=V(!1),o=I(()=>{let e=new Set(it.items.map(e=>e.text)),t=ft.items.filter(t=>!e.has(t.text)).map(e=>({kind:`optimistic`,text:e.text}));return[...it.items.map(e=>({kind:`kernel`,item:e})),...t]}),s=V(null),u=V(``),d=I(()=>Z.status===`running`);function p(e,t){F(s,e,!0),F(u,t,!0)}async function m(e){let t=E(u).trim();if(F(s,null),t.length===0)return;let n=await lt({messageId:e,action:`edit`,text:t});n&&`error`in n&&be(`Queue edit failed: ${n.error}`)}async function g(e){let t=await lt({messageId:e,action:`remove`});t&&`error`in t&&be(`Queue remove failed: ${t.error}`)}async function _(e){let t=await lt({messageId:e,action:`steer`});t&&`error`in t&&be(`Queue steer failed: ${t.error}`)}function v(e,t){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),F(s,null);return}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.stopPropagation(),m(t))}var b=X(),S=J(b),C=e=>{var r=Gz(),i=W(r),b=W(i);TR(b,{class:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`});var x=z(b,4),S=M(x,!0),C=z(x,4);{let e=I(()=>E(a)?``:`rotate-180`);NR(C,{get class(){return`h-3 w-3 transition-transform ${E(e)??``}`},"aria-hidden":`true`})}n(i);var w=z(i,2),T=e=>{var r=Wz();t(r,23,()=>E(o),(e,t)=>e.kind===`kernel`?e.item.messageId:`optimistic-${t}`,(e,t)=>{var r=X(),i=J(r),a=e=>{var r=Hz(),i=W(r),a=e=>{var n=Lz();le(n),l(`keydown`,n,e=>v(e,E(t).item.messageId)),f(`blur`,n,()=>void m(E(t).item.messageId)),N(n,()=>E(u),e=>F(u,e)),y(e,n)},o=e=>{var n=Rz(),r=M(n,!0);H(()=>{B(n,`title`,E(t).item.text),c(r,E(t).item.text)}),y(e,n)};h(i,e=>{E(s)===E(t).item.messageId?e(a):e(o,-1)});var b=z(i,2),x=e=>{var n=zz(),r=M(n);H(()=>{B(n,`title`,`${E(t).item.attachments??``} attachment(s)`),c(r,`+${E(t).item.attachments??``}`)}),y(e,n)};h(b,e=>{E(t).item.attachments>0&&e(x)});var S=z(b,2),C=e=>{var t=Bz();y(e,t)};h(S,e=>{E(t).item.target===`next-step`&&e(C)});var w=z(S,4),T=e=>{var r=Vz(),i=J(r);Iz(W(i),{class:`h-3 w-3`,"aria-hidden":`true`}),n(i);var a=z(i,2);DR(W(a),{class:`h-3 w-3`,"aria-hidden":`true`}),n(a),H(()=>{B(a,`title`,E(d)?`Steer the current turn with this message`:`Steering unlocks while a turn is running`),a.disabled=!E(d)||E(t).item.target!==`next-turn`}),l(`click`,i,()=>p(E(t).item.messageId,E(t).item.text)),l(`click`,a,()=>void _(E(t).item.messageId)),y(e,r)};h(w,e=>{E(s)!==E(t).item.messageId&&e(T)});var D=z(w,2),O=W(D);tr(O,{class:`h-3 w-3`,"aria-hidden":`true`}),n(D),n(r),H(()=>B(r,`data-queue-target`,E(t).item.target)),l(`click`,D,()=>void g(E(t).item.messageId)),y(e,r)},o=e=>{var r=Uz(),i=W(r),a=M(i,!0);oe(4),n(r),H(()=>{B(i,`title`,E(t).text),c(a,E(t).text)}),y(e,r)};h(i,e=>{E(t).kind===`kernel`?e(a):e(o,-1)}),y(e,r)}),n(r),y(e,r)};h(w,e=>{E(a)||e(T)}),n(r),H(()=>{B(i,`aria-expanded`,!E(a)),c(S,E(o).length)}),l(`click`,i,()=>F(a,!E(a))),y(e,r)};h(S,e=>{E(o).length>0&&e(C)}),y(e,b),x()}T([`click`,`keydown`]);var qz=r(`<span class="rounded-[4px] bg-primary/15 [box-decoration-break:clone]"> </span>`),Jz=r(`<span class="rounded-[4px] bg-muted [box-decoration-break:clone]" data-composer-chip="skill"> </span>`),Yz=r(`<span> </span>`),Xz=r(`<div aria-hidden="true" class="msg-body pointer-events-none absolute inset-x-0 top-0 z-0 overflow-hidden whitespace-pre-wrap break-words px-3.5 py-2.5 text-transparent"></div>`);function Zz(e,r){i(r,!0);let a=k(r,`skillSpans`,19,()=>[]),o=I(()=>fz(r.text,r.occurrences,a()));var s=Xz();t(s,21,()=>E(o),ie,(e,t)=>{var n=X(),r=J(n),i=e=>{var n=qz(),r=M(n,!0);H(()=>{B(n,`data-composer-chip`,E(t).reference.kind),B(n,`title`,E(t).reference.kind===`file`?E(t).reference.target:`session: ${E(t).reference.label}`),c(r,E(t).text)}),y(e,n)},a=e=>{var n=Jz(),r=M(n,!0);H(()=>{B(n,`title`,`skill: ${E(t).name}`),c(r,E(t).text)}),y(e,n)},o=e=>{var n=Yz(),r=M(n,!0);H(()=>c(r,E(t).text)),y(e,n)};h(r,e=>{E(t).kind===`chip`?e(i):E(t).kind===`skill`?e(a,1):e(o,-1)}),y(e,n)}),n(s),H(()=>j(s,`height: ${r.heightPx??``}px`)),y(e,s),x()}function Qz(e,t){i(t,!0);function n(e,t){return{token:e,reference:{...t,token:e}}}let r=k(t,`suppress`,3,!1),a=I(()=>t.text.startsWith(`@`)?t.text.split(`
227
+ `,1)[0]??``:``),o=I(()=>{let e=E(a).lastIndexOf(`/`);return e>=0?E(a).slice(0,e+1):`@`}),s=I(()=>E(o)!==`@`);function c(e,t){let n=e.trim().length>0?e.trim():t.slice(0,12);return n.length>40?`${n.slice(0,39)}…`:n}let l=I(()=>{if(E(s))return[];let e=[];for(let t of tt.sessions){if(t.sessionId===Z.sessionId)continue;let n=c(t.title,t.sessionId);e.push({value:`@${n}`,group:`Sessions`})}return e}),u=V(de(new Map)),d=V(!1),f=V(null);K(()=>{if(!E(a).startsWith(`@`))return;let e=E(o),t=E(f);if(E(u),E(u).get(e)!==void 0||E(d))return;let n=Lt();if(n===null)return;let r=e.slice(1).split(`/`).filter(Boolean),i=t===null||r.length===0?null:[t,...r].join(`/`);F(d,!0),n.agent.files.list(i===null?{}:{dir:i}).then(n=>{if(t===null){F(f,n.dir,!0);return}if(e!==E(o))return;let r=new Map(E(u));r.set(e,{dir:n.dir,entries:n.entries}),F(u,r,!0)}).catch(()=>{if(e!==E(o))return;let t=new Map(E(u));t.set(e,{dir:i??``,entries:[]}),F(u,t,!0)}).finally(()=>{F(d,!1)})}),K(()=>{E(a).startsWith(`@`)&&!tt.loading&&(tt.loaded?tt.error!==null&&nt():nt())});let p=I(()=>{let e=E(u).get(E(o));if(e===void 0)return[];let t=[];for(let n of e.entries)t.push({value:n.kind===`dir`?`${E(o)}${n.name}/`:`${E(o)}${n.name}`,group:`Files`});return t}),m=I(()=>[...E(l),...E(p)]),h=I(()=>{if(!E(s))return;let e=E(o).slice(0,-1),t=e.lastIndexOf(`/`);return{value:`${e.slice(0,t+1)}`,label:`..`}}),g=I(()=>{if(E(d))return`Loading directory…`;let e=E(u).get(E(o));return e===void 0||e.dir.length===0?Lt()===null?`Not connected`:`Files from: home`:`Files from: ${e.dir}`}),_=V(null);function v(e){return E(_)?.handleKeydown(e)??!1}function y(e){if(e.endsWith(`/`)){t.onNavigate(e);return}let r=E(l).find(t=>t.value===e);if(r!==void 0){let e=r.value.slice(1),i=tt.sessions.find(t=>c(t.title,t.sessionId)===e&&t.sessionId!==Z.sessionId);if(i!==void 0){t.onPick(n(r.value,{kind:`session`,target:i.sessionId,label:e}));return}}let i=E(u).get(E(o)),a=e.slice(E(o).length),s=i?.entries.find(e=>e.kind===`file`&&e.name===a);if(i!==void 0&&s!==void 0){let e=i.dir.includes(`\\`)?`\\`:`/`;t.onPick(n(`@${a}`,{kind:`file`,target:`${i.dir}${e}${a}`,label:a}))}}var b={handleKeydown:v};return se(Cz(e,{trigger:`@`,get entries(){return E(m)},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},get suppress(){return r()},get pinned(){return E(h)},menuLabel:`References — files and sessions`,get sourceLabel(){return E(g)},dataSlot:`reference-menu`,emptyMessage:`No matching file or session`,onSelect:y}),e=>F(_,e,!0),()=>E(_)),x(b)}function $z(e,t){i(t,!0);let n=k(t,`suppress`,3,!1),r=I(()=>t.text.startsWith(`$`)?t.text.split(`
228
+ `,1)[0]??``:``),a=I(()=>E(r).startsWith(`$`)?E(r).slice(1).trim():``),o=V(null),s=0,c=!1;K(()=>{let e=E(a);if(!e){c&&=(Jt(),!1),s+=1,F(o,E(r).startsWith(`$`)&&Lt()===null?`Not connected`:null,!0);return}c=!0;let t=s;if(Lt()===null){F(o,`Not connected`);return}F(o,null);let n=setTimeout(()=>{t===s&&Yt(e)},150);return()=>clearTimeout(n)}),K(()=>()=>Jt());let l=I(()=>Kt.query===E(a)),u=I(()=>E(o)??(E(l)?Kt.error:null)),d=I(()=>E(a)!==``&&E(u)===null&&(!E(l)||Kt.searching)),f=I(()=>{if(!E(a)||!E(l))return[];let e=[];for(let t of Kt.results)for(let n of t.installations){let r=`${n.workspaceId}:${n.providerId}:${t.id}`,i=`$${t.name}`;e.push({key:r,name:t.name,token:i,entry:{value:i,description:t.description,group:qt(n.workspaceId,n.providerId),key:r},target:{workspaceId:n.workspaceId,providerId:n.providerId,skillId:t.id}})}return e}),p=I(()=>E(f).map(e=>e.entry));function m(e,n){let r=E(f).find(t=>n?.key===void 0?t.entry.value===e:t.key===n.key);r!==void 0&&t.onPick({token:r.token,reference:{kind:`skill`,token:r.token,target:r.target.skillId,label:r.name,skill:r.target}})}let h=V(null);function g(e){return E(h)?.handleKeydown(e)??!1}let _=I(()=>{if(!E(a))return`输入关键词检索技能`;if(E(u)!==null)return E(u);if(E(d))return`Searching skills…`;if(E(l)&&Kt.results.length>0){let e=new Set(E(f).map(e=>e.entry.group)).size;return`${Kt.results.length} skills · ${e} provider groups`}return`Skills across workspaces`});var v={handleKeydown:g};{let r=I(()=>E(u)===null?E(d)?`Searching skills…`:E(a)?`No matching skill`:`输入关键词检索技能…`:`Search unavailable`);se(Cz(e,{trigger:`$`,get entries(){return E(p)},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},get suppress(){return n()},matcher:e=>!/\s/.test(e.slice(1)),menuLabel:`Skills — across workspaces`,get sourceLabel(){return E(_)},dataSlot:`skill-menu`,get emptyMessage(){return E(r)},onSelect:m}),e=>F(h,e,!0),()=>E(h))}return x(v)}var eB=null;function tB(){if(eB!==null)return eB;let e=Lt();return e?(eB=e.agent.models.catalog({}).then(e=>Object.fromEntries(e.providers.map(e=>[e.provider,e.label]))).catch(()=>(eB=null,{})),eB):Promise.resolve({})}var nB=r(`<img class="h-full w-full object-cover"/>`),rB=r(`<div class="flex h-full w-full items-center justify-center bg-muted/40"><!></div>`),iB=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>`),aB=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>`),oB=r(`<div class="flex flex-wrap gap-1.5 px-3 pt-3" aria-label="Pending attachments"><!> <!></div>`),sB=r(`<textarea class="msg-body relative z-10 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>`),cB=r(`<span class="truncate"> </span> <!>`,1),lB=r(`<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center"><!></span> <span class="truncate"> </span>`,1),uB=r(`<!> <!>`,1),dB=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-primary"></span>`),fB=r(`<span class="truncate"> </span> <!> <!>`,1),pB=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),mB=r(`<!> <!> <!>`,1),hB=r(`<div class="relative mx-3 mb-3 flex shrink-0 flex-col rounded-[22px] border border-border bg-card shadow-sm"><!> <!> <!> <!> <!> <div class="relative w-full"><!> <!></div> <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="Commands and skills" aria-label="Commands and skills"><!></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 images (paste or pick, ≤4 MiB each)" aria-label="Attach images (paste or pick, ≤4 MiB each)"><span class="relative flex items-center justify-center"><!> <!></span></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)"><span class="relative flex items-center justify-center"><!> <!></span></button> <div class="flex-1"></div> <!> <!> <button type="button"><!></button></div></div>`);function gB(e,r){i(r,!0);let o=V(null),s=V(null),u=V(null),d=V(null),m=V(!0),g=I(()=>uz(Q.text,Q.references)),_=I(()=>mz(Q.text,Xt.skills.map(e=>e.name))),v=V(null);K(()=>{Q.text,F(v,oz(E(v),Q.text)??sz(Q.text,Tz),!0)});let b=V(!1),S=V(44);K(()=>{Q.text;let e=E(o);e&&(e.style.height=`auto`,F(S,Math.min(160,Math.max(44,e.scrollHeight)),!0),e.style.height=`${E(S)}px`)}),K(()=>{Q.text,F(m,w(),!0)});function w(){return!Q.text.slice(0,E(o)?.selectionStart??0).includes(`
229
+ `)}let T=I(()=>Z.status===`running`),D=I(()=>Q.text.trim().length>0||Q.images.length>0||Q.files.length>0),k=I(()=>Q.editing!==null),A=I(()=>E(T)&&!E(D)?`stop`:E(T)?Re()===`steer`?`steer`:`queue`:`send`),ee=I(()=>Z.sessionId?Z.mode:Z.pendingMode),te=I(()=>Mt.find(e=>e.id===E(ee))?.label),P=I(()=>iz({owner:E(k)?`Edit your message — sending will resend it as a new message`:null,disconnected:zt.status===`disconnected`,unavailable:Z.error!==null&&Z.sessionId===null,modeLabel:E(te)??null})),L=I(()=>{let e=Xe.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}}),ne=V(de({})),re=V(!1),R=V(!1);K(()=>{tB().then(e=>F(ne,e,!0))});let ae=I(()=>{let e=Xe.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(ne)[e.provider]??e.provider;return{provider:e.provider,label:r,letter:e.iconLetter??r.slice(0,1).toUpperCase(),color:e.iconColor??`hsl(${hR(e.provider)} 55% 45%)`,models:n}})});function ce(e,t){let n=Xe.view;return n!==null&&n.settings.model.provider===e&&n.settings.model.model===t}async function U(e,t){let n=Xe.view?.settings.model.reasoningEffort,r=await ze({model:{provider:e,model:t,...n!==void 0&&n.length>0?{reasoningEffort:n}:{}}});if(r){if(r.outcome===`rejected`){be(`${r.code}: ${r.detail}`);return}if(r.outcome===`error`){be(r.message);return}be(`Active model → ${e} · ${t}`)}}function le(e=!1){let t=cz(Q.text.trim(),E(v)).trim();if(t.length===0&&Q.images.length===0&&Q.files.length===0||Z.sending)return;if(Pe.pending>0){be(`Attachments are still being read — try again in a moment.`);return}let n=Z.status===`running`?we(e,Re()):`queue`,r=dz(Q.text,Q.references);ue=!0,Ue(t,Q.images,Q.files,n,r)}let G=V(0),ue=!1;K(()=>{ue&&Q.text===``&&(ue=!1,F(G,E(G)+1))});let q=V(null);async function fe(e){if(E(q)===null){F(q,e,!0);try{let t=await Ye(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`?(Ce(n),qe(n)):Ze(n)}finally{F(q,null)}}}function pe(e){if(!Z.sessionId){Z.pendingMode=e;return}ut(e)}function me(e){if(F(b,!1),e===`/queue`||e===`/steer`){let t=e===`/queue`?`queue`:`steer`;Ve(t),be(`Busy-Enter preference → ${t}`),Q.text=``;return}Z.sending||(Q.text=``,Q.images=[],Q.files=[],Le(),Ue(e))}function he(e){F(b,!1);let t=E(o),n=Math.min(t?.selectionStart??Q.text.length,Q.text.length);Q.text=`${e} ${Q.text.slice(n)}`;let r=Math.min(e.length+1,Q.text.length);requestAnimationFrame(()=>{t?.setSelectionRange(r,r),F(m,w(),!0)})}function ge(e){let t=E(o),n=Math.min(t?.selectionStart??Q.text.length,Q.text.length);Q.text=e+Q.text.slice(n);let r=Math.min(e.length,Q.text.length);requestAnimationFrame(()=>{t?.setSelectionRange(r,r),F(m,w(),!0)})}function _e(e){ge(e)}function ve(e){ge(`${e.token} `),Ie(e.reference)}function ye(e){if(!E(u)?.handleKeydown(e)&&!E(d)?.handleKeydown(e)&&!E(s)?.handleKeydown(e)){if(e.key===`Backspace`&&!E(Se)){let t=E(o);if(t&&t.selectionStart===t.selectionEnd){let n=pz(Q.text,t.selectionStart,E(g));if(n){e.preventDefault(),Q.text=Q.text.slice(0,n.start)+Q.text.slice(n.end),je(n.reference.uid);let r=n.start;requestAnimationFrame(()=>t.setSelectionRange(r,r));return}}}if(e.key===`Enter`&&!e.shiftKey){if(e.repeat){e.preventDefault();return}if(tz(e,xe)){e.preventDefault();return}e.preventDefault(),le(e.metaKey||e.ctrlKey)}}}let xe=null,Se=V(!1);function Te(){F(Se,!0)}function Oe(){F(Se,!1),xe=Date.now()}function ke(){F(m,w(),!0)}function Ae(e){let t=[...e.clipboardData?.files??[]];if(t.length>0){e.preventDefault();let n=t.filter(e=>e.type.startsWith(`image/`)),r=t.filter(e=>!e.type.startsWith(`image/`));n.length>0&&Ee(n),r.length>0&&De(r);return}let n=e.clipboardData?.getData(`text/plain`)??``;rz(n)&&(e.preventDefault(),Me(nz(n)))}function Me(e){let t=E(o);if(!t){Q.text=nz(Q.text+e);return}let n=t.selectionStart??Q.text.length,r=t.selectionEnd??n;Q.text=Q.text.slice(0,n)+e+Q.text.slice(r);let i=n+e.length;requestAnimationFrame(()=>t?.setSelectionRange(i,i))}var Ne=hB(),Fe=W(Ne);Kz(Fe,{});var Be=z(Fe,2);{let e=I(()=>E(v)!==null);se(Qz(Be,{get text(){return Q.text},get caretOnFirstLine(){return E(m)},onNavigate:_e,onPick:ve,get suppress(){return E(e)}}),e=>F(u,e,!0),()=>E(u))}var He=z(Be,2);{let e=I(()=>E(v)!==null);se($z(He,{get text(){return Q.text},get caretOnFirstLine(){return E(m)},onPick:ve,get suppress(){return E(e)}}),e=>F(d,e,!0),()=>E(d))}var We=z(He,2);{let e=I(()=>E(v)!==null);se(Ez(We,{get text(){return Q.text},get caretOnFirstLine(){return E(m)},onExecute:me,onInsertSkill:he,get suppress(){return E(e)},get forcedOpen(){return E(b)},onForceClose:()=>F(b,!1)}),e=>F(s,e,!0),()=>E(s))}var Ge=z(We,2),Ke=e=>{var r=oB(),i=W(r);t(i,17,()=>Q.images,ie,(e,t,r)=>{var i=iB(),a=W(i),o=e=>{var n=nB();H(()=>{B(n,`src`,E(t).preview),B(n,`alt`,E(t).name??`image`)}),y(e,n)},s=e=>{var r=rB();xl(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);tr(u,{class:`h-2.5 w-2.5`}),n(c),n(i),l(`click`,c,()=>Q.images=Q.images.filter((e,t)=>t!==r)),y(e,i)});var a=z(i,2);t(a,17,()=>Q.files,ie,(e,t,r)=>{var i=aB(),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,()=>Q.files=Q.files.filter((e,t)=>t!==r)),y(e,i)}),n(r),y(e,r)};h(Ge,e=>{(Q.files.length>0||Q.images.length>0)&&e(Ke)});var Je=z(Ge,2),$e=W(Je);Zz($e,{get text(){return Q.text},get occurrences(){return E(g)},get skillSpans(){return E(_)},get heightPx(){return E(S)}});var et=z($e,2);p(et,()=>E(G),e=>{var t=sB();O(t),B(t,`rows`,1),B(t,`maxlength`,2e4),se(t,e=>F(o,e),()=>E(o)),H(()=>{B(t,`placeholder`,E(P)),B(t,`data-composer-composing`,E(Se)?`true`:void 0)}),l(`keydown`,t,ye),l(`keyup`,t,ke),l(`click`,t,ke),f(`select`,t,ke),f(`paste`,t,Ae),f(`compositionstart`,t,Te),f(`compositionend`,t,Oe),N(t,()=>Q.text,e=>Q.text=e),y(e,t)}),n(Je);var tt=z(Je,2),nt=W(tt);a(nt,()=>FR,(e,r)=>{r(e,{get open(){return E(R)},set open(e){F(R,e,!0)},children:(e,r)=>{var i=uB(),o=J(i);{let e=I(()=>E(T)?`Switch after the current turn ends`:Z.sessionId?`Switch this session's mode`:`Pick the mode for your next session`);a(o,()=>XR,(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(T)},onkeydown:e=>{e.key===`Escape`&&E(R)&&(e.stopPropagation(),F(R,!1))},children:(e,t)=>{var n=cB(),r=J(n),i=M(r,!0);NR(z(r,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(te)??`Mode`)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2),l=e=>{var r=X(),i=J(r);a(i,()=>zR,(e,r)=>{r(e,{align:`start`,class:`max-h-72 w-44 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(R,!1))},children:(e,r)=>{var i=X(),o=J(i);t(o,17,()=>Mt,e=>e.id,(e,t)=>{var r=X(),i=J(r);{let e=I(()=>E(ee)===E(t).id?`true`:void 0);a(i,()=>UR,(r,i)=>{i(r,{get"data-mode-active"(){return E(e)},class:`gap-1.5`,onclick:()=>pe(E(t).id),children:(e,r)=>{var i=lB(),a=J(i),o=W(a),s=e=>{mc(e,{class:`h-3 w-3`,"aria-hidden":`true`})};h(o,e=>{E(ee)===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(R)&&e(l)}),y(e,i)},$$slots:{default:!0}})});var rt=z(nt,2),it=W(rt);or(it,{class:`h-4 w-4`}),n(rt);var at=z(rt,2),ot=W(at),st=W(ot);{let e=I(()=>E(q)===`image`?`opacity-0`:``);xl(st,{get class(){return`h-4 w-4 ${E(e)??``}`}})}var ct=z(st,2),lt=e=>{er(e,{class:`absolute inset-0 m-auto h-4 w-4 animate-spin`,"aria-hidden":`true`})};h(ct,e=>{E(q)===`image`&&e(lt)}),n(ot),n(at);var dt=z(at,2),ft=W(dt),pt=W(ft);{let e=I(()=>E(q)===`file`?`opacity-0`:``);cR(pt,{get class(){return`h-4 w-4 ${E(e)??``}`}})}var mt=z(pt,2),ht=e=>{er(e,{class:`absolute inset-0 m-auto h-4 w-4 animate-spin`,"aria-hidden":`true`})};h(mt,e=>{E(q)===`file`&&e(ht)}),n(ft),n(dt);var gt=z(dt,4),_t=e=>{var r=X(),i=J(r);a(i,()=>FR,(e,r)=>{r(e,{get open(){return E(re)},set open(e){F(re,e,!0)},children:(e,r)=>{var i=uB(),o=J(i);{let e=I(()=>E(L).dangling?`border-amber-500/60 text-amber-600 dark:text-amber-400`:`border-border text-muted-foreground hover:text-foreground`),t=I(()=>E(T)?`Switch after the current turn ends`:`Switch the active model — route configuration lives in Settings → Model`);a(o,()=>XR,(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(T)},onkeydown:e=>{e.key===`Escape`&&E(re)&&(e.stopPropagation(),F(re,!1))},children:(e,t)=>{var n=fB(),r=J(n),i=M(r,!0),a=z(r,2),o=e=>{var t=dB();H(()=>B(t,`title`,`Reasoning effort: ${E(L).effort}`)),y(e,t)};h(a,e=>{E(L).effort&&e(o)}),NR(z(a,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(L).label)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2);a(s,()=>zR,(e,r)=>{r(e,{align:`end`,class:`max-h-72 w-56 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(re,!1))},children:(e,r)=>{var i=mB(),o=J(i),s=e=>{var t=uB(),n=J(t);a(n,()=>KR,(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(L).label??``} — outside Routes`)),y(e,n)},$$slots:{default:!0}})});var r=z(n,2);a(r,()=>JR,(e,t)=>{t(e,{})}),y(e,t)};h(o,e=>{E(L).dangling&&e(s)});var l=z(o,2);t(l,17,()=>E(ae),e=>e.provider,(e,r)=>{var i=uB(),o=J(i);a(o,()=>VR,(e,i)=>{i(e,{children:(e,i)=>{var o=uB(),s=J(o);a(s,()=>QR,(e,t)=>{t(e,{class:`flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium`,children:(e,t)=>{var n=pB(),i=J(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=J(i);{let e=I(()=>ce(E(r).provider,t)?`true`:void 0);a(o,()=>UR,(i,a)=>{a(i,{get"data-model-active"(){return E(e)},class:`gap-1.5`,onclick:()=>void U(E(r).provider,t),children:(e,i)=>{var a=lB(),o=J(a),s=W(o),l=e=>{mc(e,{class:`h-3 w-3`,"aria-hidden":`true`})},u=I(()=>ce(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,()=>JR,(e,t)=>{t(e,{})}),y(e,i)});var u=z(l,2);a(u,()=>UR,(e,t)=>{t(e,{onclick:()=>Oz(`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(gt,e=>{E(L)&&e(_t)});var vt=z(gt,2);Pz(vt,{});var yt=z(vt,2),bt=W(yt),xt=e=>{jR(e,{class:`h-3 w-3`})},St=e=>{TR(e,{class:`h-4 w-4`})},Ct=e=>{DR(e,{class:`h-4 w-4`})},wt=e=>{kR(e,{class:`h-4 w-4`})};h(bt,e=>{E(A)===`stop`?e(xt):E(A)===`queue`?e(St,1):E(A)===`steer`?e(Ct,2):e(wt,-1)}),n(yt),n(tt),n(Ne),H(()=>{B(rt,`aria-expanded`,E(b)),B(at,`aria-busy`,E(q)===`image`),at.disabled=E(q)!==null,B(dt,`aria-busy`,E(q)===`file`),dt.disabled=E(q)!==null,Y(yt,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(A)===`stop`?`bg-destructive text-white hover:bg-destructive/90`:E(A)===`queue`||E(A)===`steer`?`bg-primary/85 text-primary-foreground hover:bg-primary`:`bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50`}`),B(yt,`aria-label`,E(A)===`stop`?`Cancel current activity`:E(A)===`queue`?`Queue message after the current turn`:E(A)===`steer`?`Steer the current turn with this message`:`Send message`),B(yt,`title`,E(A)===`stop`?`Cancel current activity`:E(A)===`queue`?`Queue (Enter) · Steer (⌘/Ctrl+Enter)`:E(A)===`steer`?`Steer (Enter) · Queue (⌘/Ctrl+Enter)`:`Send (Enter)`),yt.disabled=E(A)!==`stop`&&(!E(D)||Z.sending)}),l(`click`,rt,()=>{F(b,!E(b)),E(o)?.focus()}),l(`click`,at,()=>void fe(`image`)),l(`click`,dt,()=>void fe(`file`)),l(`click`,yt,()=>E(A)===`stop`?void Qe():le(E(A)===`steer`&&Re()===`queue`)),y(e,Ne),x()}T([`click`,`keydown`,`keyup`]);var _B=r(`<div class="border-t border-destructive/30 bg-destructive/8 px-3 py-1.5 text-xs text-destructive" role="alert"> </div>`),vB=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>`),yB=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 bB(e,t){i(t,!0),K(()=>{et.open&&zt.status===`connected`&&Xe.view===null&&!Xe.loading&&$e()}),K(()=>{if(et.seedPrompt){let e=et.seedPrompt;et.seedPrompt=null,Q.text.length===0&&(Q.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=et.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=yB();f(`keydown`,A,e=>{e.key===`Escape`&&et.open&&!document.querySelector(`[role='dialog']`)&&dt(!1)}),f(`pointermove`,A,e=>{E(r)&&We(o+(a-e.clientX))}),f(`pointerup`,A,u),f(`pointercancel`,A,u);var p=W(d);uR(p,{});var m=z(p,2),g=z(m,2);hl(g,{});var _=z(g,2);oR(_,{});var v=z(_,2),b=e=>{var t=_B(),n=M(t,!0);H(()=>c(n,Z.promptError??Z.error)),y(e,t)};h(v,e=>{(Z.promptError??Z.error)&&e(b)});var S=z(v,2),C=e=>{mR(e,{get todos(){return Z.todos}})};h(S,e=>{Z.sessionId&&Z.todos.length>0&&e(C)});var w=z(S,2),T=e=>{var t=vB(),r=z(W(t),2),i=W(r);tr(i,{class:`h-3 w-3`}),n(r),n(t),l(`click`,r,()=>{Q.editing!==null&&(Q.text=``),Q.editing=null}),y(e,t)};h(w,e=>{Q.editing!==null&&e(T)}),gB(z(w,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]`} ${et.open?`border-l border-border`:`border-l-0 max-[720px]:translate-x-full max-[720px]:invisible`}`),j(d,`--agent-panel-width: ${(et.open?et.width:0)??``}px`)}),l(`pointerdown`,m,s),y(e,d),x()}T([`pointerdown`,`click`]);var xB=new Set([`$$slots`,`$$events`,`$$legacy`]);function SB(e,t){let n=U(t,xB),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,q({name:`settings-2`},()=>n,{get iconNode(){return r}}))}var CB=new Set([`$$slots`,`$$events`,`$$legacy`]);function wB(e,t){let n=U(t,CB),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,q({name:`cpu`},()=>n,{get iconNode(){return r}}))}var TB=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>`),EB=r(`<button> </button>`),DB=r(`<button> <span class="ml-1 text-[9px] text-muted-foreground"> </span></button>`),OB=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> <div class="space-y-1" aria-label="Busy Enter"><span class="text-[10px] text-muted-foreground">Busy Enter — what a plain Enter does while the agent is working</span> <div class="flex gap-1.5"></div></div></section>`,1),kB=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),AB=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground">Agent settings unavailable <!></div>`),jB=r(`<div class="text-xs text-destructive" role="alert"> </div>`),MB=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 NB(e,r){i(r,!0);let a=V(null),o=[`deterministic`,`live`],s=[`ask`,`never`],u=[{mode:`queue`,label:`Queue`,hint:`after the current turn`},{mode:`steer`,label:`Steer`,hint:`into the current turn`}],d=I(()=>Xe.view);async function f(e){let t=await ze(e);t&&(t.outcome===`rejected`?F(a,`${t.code}: ${t.detail}`):t.outcome===`error`?F(a,t.message,!0):F(a,null))}var p=MB(),m=z(W(p),2),g=e=>{var r=OB(),i=J(r),a=z(W(i),2);t(a,21,()=>Mt,e=>e.id,(e,t)=>{var r=TB(),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(d).settings.defaultMode===E(t).id?`border-primary bg-primary/10`:`border-border hover:bg-muted`}`),B(r,`aria-pressed`,E(d).settings.defaultMode===E(t).id),r.disabled=Xe.updating,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>void f({defaultMode:E(t).id})),y(e,r)}),n(a),n(i);var p=z(i,2),m=z(W(p),2),h=z(W(m),2);t(h,20,()=>o,e=>e,(e,t)=>{var n=EB(),r=M(n,!0);H(()=>{Y(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(d).settings.preset===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(d).settings.preset===t),n.disabled=Xe.updating,c(r,t)}),l(`click`,n,()=>void f({preset:t})),y(e,n)}),n(h),n(m);var g=z(m,2),_=z(W(g),2);t(_,20,()=>s,e=>e,(e,t)=>{var n=EB(),r=M(n,!0);H(()=>{Y(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(d).settings.permissions.approvalPolicy===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(d).settings.permissions.approvalPolicy===t),n.disabled=Xe.updating,c(r,t)}),l(`click`,n,()=>void f({permissions:{approvalPolicy:t}})),y(e,n)}),n(_),n(g);var v=z(g,2),b=z(W(v),2);t(b,21,()=>u,e=>e.mode,(e,t)=>{var r=DB(),i=W(r),a=z(i),o=M(a,!0);n(r),H(()=>{Y(r,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${Ne.mode===E(t).mode?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(r,`aria-pressed`,Ne.mode===E(t).mode),c(i,`${E(t).label??``} `),c(o,E(t).hint)}),l(`click`,r,()=>Ve(E(t).mode)),y(e,r)}),n(b),n(v),n(p),y(e,r)},_=e=>{var t=kB();y(e,t)},v=e=>{var t=AB(),r=z(W(t));Qn(r,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void $e(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),y(e,t)};h(m,e=>{E(d)?e(g):Xe.loading?e(_,1):e(v,-1)});var b=z(m,2),S=e=>{var t=jB(),n=M(t,!0);H(()=>c(n,E(a))),y(e,t)};h(b,e=>{E(a)&&e(S)}),n(p),y(e,p),x()}T([`click`]);var PB=new Set([`$$slots`,`$$events`,`$$legacy`]);function FB(e,t){let n=U(t,PB),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,q({name:`plug-zap`},()=>n,{get iconNode(){return r}}))}var IB=new Set([`$$slots`,`$$events`,`$$legacy`]);function LB(e,t){let n=U(t,IB),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,q({name:`plug`},()=>n,{get iconNode(){return r}}))}var RB=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),zB=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>`),BB=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 VB(e,t){i(t,!0);let r=I(()=>{switch(zt.status){case`connected`:return`Connected`;case`connecting`:return`Connecting…`;case`disconnected`:return`Disconnected`;default:return`Idle`}});var a=BB(),o=z(W(a),2),s=z(W(o),2),l=W(s),u=e=>{FB(e,{class:`h-4 w-4 text-primary`})},d=e=>{{let t=I(()=>zt.status===`disconnected`?`text-destructive`:`text-muted-foreground`);LB(e,{get class(){return`h-4 w-4 ${E(t)??``}`}})}};h(l,e=>{zt.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=RB(),n=M(t,!0);H(()=>c(n,zt.error)),y(e,t)},_=e=>{var t=zB();y(e,t)};h(m,e=>{zt.status===`disconnected`?e(g):e(_,-1)}),n(o),n(a),H(()=>{Y(f,1,`text-xs ${zt.status===`connected`?`text-primary`:zt.status===`disconnected`?`text-destructive`:`text-muted-foreground`}`),c(p,E(r))}),y(e,a),x()}var HB=new Set([`$$slots`,`$$events`,`$$legacy`]);function UB(e,t){let n=U(t,HB),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,q({name:`eye-off`},()=>n,{get iconNode(){return r}}))}var WB=new Set([`$$slots`,`$$events`,`$$legacy`]);function GB(e,t){let n=U(t,WB),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,q({name:`upload`},()=>n,{get iconNode(){return r}}))}var KB=r(`<img alt=""/>`),qB=r(`<span class="flex h-5 w-5 items-center justify-center rounded text-[10px] font-semibold text-white" aria-hidden="true"> </span>`),JB=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>`),YB=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>`),XB=r(`<p class="text-[9px] text-muted-foreground">Duplicate catalog icons are merged; hover shows sharing providers.</p>`),ZB=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>`),QB=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>`),$B=r(`<button type="button"><span class="h-4 w-4 rounded" aria-hidden="true"></span></button>`),eV=r(`<span class="text-[9px] text-destructive" role="alert">invalid hex</span>`),tV=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>`),nV=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>`),rV=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>`),iV=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 aV(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);K(()=>{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=SR[r]??``;if(i.length===0){be(`Unsupported icon type “${n.type||r||n.name}” — use .svg, .png or .webp.`);return}let a=new FileReader;a.onerror=()=>{be(`Could not read “${n.name}” — try another file.`)},a.onload=()=>{let e=typeof a.result==`string`?a.result:``;if(e.length===0){be(`Could not read “${n.name}” — try another file.`);return}let t=e.startsWith(`data:${i}`)?e:CR(e,i);if(t===null){be(`Could not read “${n.name}” as an image.`);return}if(t.length>65536){be(`Icon too large — pick an image under 64 KiB.`);return}T(t)},a.readAsDataURL(n)}var P=iV();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=KB();H(e=>{B(t,`src`,a()),Y(t,1,`h-5 w-5 object-contain ${e??``}`)},[()=>vR(a())?``:`dark:invert`]),y(e,t)},ie=e=>{var t=qB(),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);Iz(W(R),{class:`h-2.5 w-2.5`}),n(R),n(L);var ae=z(L,2),ce=e=>{var i=rV(),s=W(i),p=W(s),g=e=>{var t=KB();H(e=>{B(t,`src`,a()),Y(t,1,`h-12 w-12 shrink-0 object-contain ${e??``}`)},[()=>vR(a())?``:`dark:invert`]),y(e,t)},x=e=>{var t=JB(),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=ZB(),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=YB(),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=XB();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=QB(),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);GB(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=tV(),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=$B(),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=eV();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===gR(r.provider)?`border-primary/50 bg-primary/5`:`border-border hover:bg-muted`,()=>gR(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=nV(),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()?vR(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 oV=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>`),sV=r(`<span class="shrink-0 rounded bg-primary/10 px-1 text-[9px] text-primary">vision</span>`),cV=r(`<li><button role="option"><span class="min-w-0 flex-1 truncate"> <span class="text-muted-foreground"> </span></span> <!></button></li>`),lV=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>`),uV=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 dV(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=uV(),b=W(v),S=W(b);le(S);var C=z(S,2);t(C,16,()=>r.selected,e=>e,(e,t)=>{var r=oV(),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=lV();t(r,23,()=>E(p),e=>e.id,(e,t,r)=>{var i=cV(),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=sV();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 fV(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 pV(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 mV(e){return e.includes(`/`)||e.includes(`@`)}function hV(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 gV=(e,t)=>e.id<t.id?-1:+(e.id>t.id);function _V(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,hV(t)),r.delete(t.id);else if(!n.has(t.id)&&!r.has(t.id)){if(mV(t.id))continue;r.set(t.id,hV(t))}}return[...n.values()].sort(gV).concat([...r.values()].sort(gV))}var vV=[`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],yV=[`low`,`high`,`max`],bV=`Catalog marks this model as not supporting reasoning effort`;function xV(e,t){if(t?.supportsReasoningEffort===!1)return{candidates:[],hint:bV};let n=new Set(vV);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 SV(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:[...yV]}}var CV=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500" title="Unsaved changes" aria-label="Unsaved changes"></span>`),wV=r(`<span data-header-status="true"><!></span>`),TV=r(`<option> </option>`),EV=r(`<p class="text-[10px] text-muted-foreground" role="note"> </p>`),DV=r(`<p class="text-[10px] text-destructive" role="alert">Invalid token value — use numbers, or shorthand like 253k / 0.5M.</p>`),OV=r(`<button type="button"> </button>`),kV=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),AV=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 jV(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(de(r.model.id)),v=V(de(r.model.name??fV(r.model.id))),b=V(de(r.model.contextWindow===void 0?``:pV(r.model.contextWindow))),S=V(de(r.model.maxOutputTokens===void 0?``:pV(r.model.maxOutputTokens))),w=V(!1),T=V(!1),D=V(de((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(de(r.model.id)),ne=V(``),re=V(de(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(()=>xV(a(),E(se))),U=I(()=>E(ne).trim()),le=I(()=>r.model.name??(r.model.id.length>0?fV(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);K(()=>{r.onvalidity(E(R))});function ue(e){r.onchange({...r.model,...e})}function q(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,fV(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??fV(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,pV(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,pV(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=[...yV])),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=Nt(t);if(r===null){n(!0);return}n(!1),e===`contextWindow`?(F(b,pV(r),!0),F(O,!0)):(F(S,pV(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 Te({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=AV(),ve=W(_e),ye=W(ve),be=W(ye),xe=e=>{var t=CV();y(e,t)};h(be,e=>{d()&&e(xe)});var Se=z(be,2),Ce=M(Se,!0),we=z(Se,2),Ee=e=>{var t=wV(),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(we,e=>{E(re)||e(Ee)}),n(ye);var De=z(ye,2),Oe=W(De);FB(W(Oe),{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe);var ke=z(Oe,2);Iz(W(ke),{class:`h-4 w-4`,"aria-hidden":`true`}),n(ke);var Ae=z(ke,2),je=W(Ae);Wn(je,{class:`h-4 w-4`,"aria-hidden":`true`}),n(Ae),n(De),n(ve);var Me=z(ve,2),Ne=e=>{var i=kV(),a=J(i),o=W(a),s=z(W(o),2);rr(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=>q(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=TV(),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(()=>fV(E(_).trim()||r.model.id));rr(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})));dV(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=EV(),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`:``);rr(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`:``);rr(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=DV();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=OV(),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 K=z(U,2),de=z(W(K),4);n(K),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)},Se=e=>{var t=C(`Probing with the route key above (saved on add).`);y(e,t)},Ce=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(ye,e=>{E(P)?.outcome===`ok`?e(be):E(P)?.outcome===`failed`?e(xe,1):E(p)?e(Se,2):r.apiKeyConfigured?e(we,-1):e(Ce,3)}),n(ve);var Te=z(ve,2),Ee=W(Te),De=e=>{rr(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)`);Qn(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 ge(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(N)?`Testing…`:`Test connection`)),y(e,n)},$$slots:{default:!0}})}n(Te),n(_e),H((e,t)=>{B(d,`id`,g),Y(de,1,`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${e??``}`),B(de,`aria-pressed`,t),de.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`,de,()=>X(`image`)),y(e,i)};h(Me,e=>{E(re)&&e(Ne)}),n(_e),H(()=>{B(_e,`aria-label`,`Model ${r.model.id??``}`),B(Se,`title`,r.model.id),c(Ce,E(le)),B(Oe,`aria-label`,`Test connection for ${(r.model.id||`new model`)??``}`),B(Oe,`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)`),Oe.disabled=E(G),B(ke,`aria-label`,`Edit model ${(r.model.id||`new model`)??``}`),B(ke,`title`,E(re)?`Collapse model form`:`Edit model fields`),ke.disabled=u(),B(Ae,`aria-label`,`Remove model ${r.model.id??``}`),Ae.disabled=u()}),l(`click`,Oe,()=>void ge()),l(`click`,ke,()=>F(re,!E(re))),l(`click`,Ae,()=>r.onremove()),y(e,_e),x()}T([`click`]);var MV=/^(.*)-(\d+)$/;function NV(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=MV.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 PV(e){let t=MV.exec(e);if(t===null)return null;let n=Number(t[2]);return!Number.isInteger(n)||n<2?null:{base:t[1],n}}function FV(e,t){let n=PV(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 IV=`skill-creator.providerPresets.v1`,LV=Tt({provider:Et().min(1),label:Et().min(1),api:Et().min(1).optional(),baseURL:Et().min(1),models:Ct(Et().min(1)).min(1),icon:Et().min(1).optional(),iconLetter:Et().min(1).max(2).optional(),iconColor:Et().min(1).optional(),iconSuppressed:Ut().optional()}),RV=de({list:[]});function zV(){if(typeof localStorage>`u`)return[];let e=null;try{e=localStorage.getItem(IV)}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=LV.safeParse(e);t.success&&n.push(t.data)}return n}function BV(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(IV,JSON.stringify(e))}catch{}}function VV(){return RV.list=zV(),RV.list}function HV(e){let t=RV.list.filter(t=>t.provider!==e);RV.list=t,BV(t)}var UV=r(`<p class="text-xs text-destructive" role="alert"> </p>`),WV=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),GV=r(`<p class="py-3 text-center text-[10px] text-muted-foreground"> </p>`),KV=r(`<img alt="" class="h-7 w-7 shrink-0 rounded-md bg-background object-contain p-0.5 dark:invert"/>`),qV=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>`),JV=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>`),YV=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>`),XV=r(`<span class="rounded bg-primary/10 px-1 text-[9px] text-primary"> </span>`),ZV=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>`),QV=r(`<p class="col-span-full py-3 text-center text-[10px] text-muted-foreground"> </p>`),$V=r(`<div class="space-y-2"><!> <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>`),eH=r(`<div class="space-y-2"><div class="flex items-center gap-2"><!> <!> <!></div> <!> <!></div>`),tH=r(`<p class="text-[10px] text-amber-700" role="alert"> </p>`),nH=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs a name.</p>`),rH=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs an http(s) base URL.</p>`),iH=r(`<option> </option>`),aH=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>`),oH=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 sH(e,r){i(r,!0);let a=k(r,`seed`,3,null),o=`anthropic-messages`,s=V(de(r.initialMode)),u=V(``),d=V(de(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(de(a()?.models?a().models.map(e=>ge(e)):[])),O=V(de(a()?.models?a().models.map(()=>!0):[])),A=V(!1),ee=V(!1),te=V(null),N=I(()=>Xe.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(()=>_V(r.catalog,PV(E(ne))?.base??E(ne))),R=I(()=>FV({provider:E(ne)},r.catalog)),ae=I(()=>bR({provider:E(ne),iconLetter:E(m)},E(R))),se=I(()=>E(p)??gR(E(ne)||`route`)),ce=I(()=>{if(E(g)===!0)return null;if(E(f)!==void 0)return E(f);let e=PV(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)),q=I(()=>E(ne).length>0&&!E(le)&&E(G)&&E(T).length>0&&E(ue)&&!Xe.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?RV.list:RV.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||PV(t.provider)?.base===e).length}function ge(e){let t=PV(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:[...yV]}:SV(n)}VV(),K(()=>{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 ze({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){Xe.updating||await ve({provider:NV(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=>SV(e)),...e.icon?{icon:e.icon}:{}})}async function be(e){Xe.updating||await ve({provider:NV(e.provider,E(P)),baseURL:e.baseURL,api:e.api??o,models:e.models.map(e=>({id:e,efforts:[...yV]})),...e.icon?{icon:e.icon}:{},...e.iconColor?{iconColor:e.iconColor}:{},...e.iconLetter?{iconLetter:e.iconLetter}:{},...e.iconSuppressed?{iconSuppressed:!0}:{}})}function xe(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:[...yV]}],!0),F(O,[...E(O),!1],!0)}async function Te(){if(E(q)){if(E(S).length>0){let e=await ct(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=J(Ee),Oe=e=>{var i=eH(),a=W(i),o=W(a);rr(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=>{Qn(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);Qn(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=UV(),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=WV(),n=M(t,!0);H(()=>c(n,r.catalogError)),y(e,t)},v=e=>{var t=GV(),n=M(t,!0);H(()=>c(n,r.catalogLoading?`Loading catalog…`:`Catalog unavailable.`)),y(e,t)},b=e=>{var i=$V(),a=W(i),o=e=>{var r=YV(),i=z(W(r),2);t(i,21,()=>E(Y),e=>e.provider,(e,t)=>{var r=JV(),i=W(r),a=W(i),o=e=>{var n=KV();H(()=>B(n,`src`,E(t).icon)),y(e,n)},s=e=>{var n=qV(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>E(t).iconColor??gR(E(t).provider),()=>bR({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=Xe.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,()=>HV(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=ZV(),o=W(a),s=e=>{var n=KV();H(()=>B(n,`src`,E(t).icon)),y(e,n)},u=e=>{var n=qV(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>gR(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=XV(),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=Xe.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=QV(),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=oH(),i=W(r),a=W(i);{let e=I(()=>E(ne)||`route`);aV(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 Xe.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);rr(u,{class:`h-8 text-xs`,"aria-label":`Route name`,placeholder:`my-provider`,get disabled(){return Xe.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=tH(),n=M(t);H(()=>c(n,`Route “${E(ne)??``}” already exists.`)),y(e,t)},k=e=>{var t=nH();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);rr(N,{class:`h-8 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Xe.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=rH();y(e,t)};h(P,e=>{E(A)&&!E(G)&&e(V)});var ue=z(P,2),K=z(W(ue),2);t(K,20,()=>Rt,e=>e,(e,t)=>{var n=iH(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(K),fe(K),n(ue);var J=z(ue,2),de=z(W(J),2),me=W(de);{let e=I(()=>E(b)?`text`:`password`),t=I(()=>E(pe)?`stored — this key overrides for add & test`:`API key`);rr(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 Xe.updating},get value(){return E(v)},set value(e){F(v,e,!0)}})}var Y=z(me,2),he=W(Y),X=e=>{UB(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},ge=e=>{pr(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(he,e=>{E(b)?e(X):e(ge,-1)}),n(Y),n(de),n(J);var _e=z(J,2),ve=W(_e),ye=z(W(ve),2);Qn(ye,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Xe.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),Ee=e=>{var t=aH();y(e,t)};h(be,e=>{E(T).length===0&&e(Ee)});var De=z(be,2);t(De,21,()=>E(T),ie,(e,t,n)=>{{let r=I(()=>E(_).trim()),i=I(()=>E(t).id===``);jV(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 Xe.updating},get initialExpanded(){return E(i)},onchange:e=>xe(n,e),onremove:()=>Ce(n),onvalidity:e=>Se(n,e)})}}),n(De),n(_e);var Oe=z(_e,2),ke=e=>{var t=UV(),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);Qn(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(q));Qn(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(()=>{K.disabled=Xe.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=Xe.updating}),D(K,()=>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 cH=r(`<option> </option>`),lH=r(`<p class="text-[11px] font-medium text-primary"> </p>`),uH=r(`<span class="text-[10px] text-amber-700">A route needs at least one model id.</span>`),dH=r(`<div><!></div>`),fH=r(`<p class="text-xs text-destructive" role="alert"> </p>`),pH=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 mH(e,r){i(r,!0);let a=k(r,`autoFocusCredential`,3,!1),o=`anthropic-messages`,s=I(()=>Xe.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(()=>_V(r.catalog,PV(r.route.provider)?.base??r.route.provider)),g=I(()=>yR(r.route,E(f))),_=I(()=>FV(r.route,r.catalog)),b=I(()=>bR(r.route,E(_))),S=I(()=>xR(r.route)),w=I(()=>E(s)?.providers.some(e=>e.provider===r.route.provider&&e.configured)??!1),T=V(de(r.route.baseURL)),O=V(de(r.route.api??E(f)?.api??o)),A=V(de(r.route.models.map(e=>({...e})))),j=V(de(r.route.models.map(()=>!0))),ee=I(()=>E(s)?.providers.find(e=>e.provider===r.route.provider)?.apiKey??null),te=V(de(E(ee)??``)),N=V(!1),P=V(de(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||Xe.updating);K(()=>{a()&&E(L)!==null&&(E(L).focus(),r.onCredentialFocused?.())}),K(()=>()=>{R!==null&&clearTimeout(R)});async function ue(e){if(E(s)===null)return!1;let t=await ze({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 q(e){await ue({...r.route,...e})}async function J(){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:[...yV]}],!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 ct(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 Ke(r.route.provider),F(te,``)}var ve=pH(),ye=W(ve),be=W(ye);aV(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 Xe.updating},onPick:e=>void q({icon:e,iconSuppressed:!1}),onSuppress:()=>void q({icon:void 0,iconSuppressed:!0}),onColor:e=>void q({iconColor:e}),onLetter:e=>void q({iconLetter:e})});var xe=z(be,2),Se=W(xe),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);Wn(ke,{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe);var Ae=z(Oe,2);Qn(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 J(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(re)?`Saved ✓`:`Save`)),y(e,n)},$$slots:{default:!0}}),n(De),n(xe),n(ye);var je=z(ye,2),Me=z(W(je),2),Ne=W(Me);rr(Ne,{class:`h-8 flex-1 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Xe.updating},get value(){return E(T)},set value(e){F(T,e,!0)}}),n(Me);var Pe=z(Me,2),Fe=z(W(Pe),2);t(Fe,20,()=>Rt,e=>e,(e,t)=>{var n=cH(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(Fe),fe(Fe),n(Pe),n(je);var Ie=z(je,2),Le=W(Ie),Re=e=>{var t=lH(),n=M(t);H(()=>c(n,`Route “${r.route.provider??``}” added — paste its API key to finish connecting.`)),y(e,t)};h(Le,e=>{E(P)&&e(Re)});var Be=z(Le,2),Ve=W(Be),He=W(Ve);{let e=I(()=>E(N)?`text`:`password`);rr(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 Xe.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),Z=W(Ue),We=e=>{UB(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},Ge=e=>{pr(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(Z,e=>{E(N)?e(We):e(Ge,-1)}),n(Ue),n(Ve);var qe=z(Ve,2),Je=e=>{Qn(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 Xe.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(Ie);var Ye=z(Ie,2),Q=W(Ye),Ze=z(W(Q),2),Qe=W(Ze),$e=e=>{var t=uH();y(e,t)};h(Qe,e=>{E(A).length===0&&e($e)});var et=z(Qe,2);Qn(et,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Xe.updating},onclick:()=>void X(),children:(e,t)=>{oe();var n=C(`+ Add model`);y(e,n)},$$slots:{default:!0}}),n(Ze),n(Q);var tt=z(Q,2);t(tt,21,()=>E(A),ie,(e,t,i)=>{var a=dH(),o=W(a);{let e=I(()=>E(T).trim()),n=I(()=>he(i)),a=I(()=>E(t).id===``);jV(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 Xe.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(tt),n(Ye);var nt=z(Ye,2),rt=e=>{var t=fH(),n=M(t,!0);H(()=>c(n,E(ne))),y(e,t)};h(nt,e=>{E(ne)&&e(rt)}),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??``}
230
+ ${r.route.models.length===1?`model`:`models`}`),Oe.disabled=Xe.updating,Fe.disabled=Xe.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=Xe.updating},[()=>r.route.baseURL.replace(/^https?:\/\//,``)]),l(`click`,Oe,()=>r.onremove?.()),D(Fe,()=>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 hH=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>`),gH=r(`<p class="text-[10px] text-amber-700"> </p>`),_H=r(`<span class="absolute -right-1 -top-0.5 h-1 w-1 rounded-full bg-amber-500" title="API key missing"></span>`),vH=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>`),yH=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>`),bH=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>`),xH=r(`<button type="button" role="tab"><!> <span class="max-w-[120px] truncate"> </span> <!></button>`),SH=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>`),CH=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>`),wH=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
231
+ custom OpenAI/Anthropic-compatible endpoint.</p> <div class="mt-1 flex gap-2"><!> <!></div></div>`),TH=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),EH=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),DH=r(`<div class="text-xs text-muted-foreground">Model settings unavailable</div>`),OH=r(`<div class="text-xs text-destructive" role="alert"> </div>`),kH=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 AH(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=Vt(kt),k=I(()=>Xe.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));K(()=>{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))}),K(()=>{E(w)===null&&E(T)===null&&!E(D)&&N()});async function N(){let e=O.issue();F(D,!0);try{let t=Lt();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 ze(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=de({});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)}K(()=>{let e=E(ae);if(!e)return;let t=t=>{Math.abs(t.deltaY)<=Math.abs(t.deltaX)||e.scrollWidth<=e.clientWidth||(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()}}),K(()=>{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 q=kH(),fe=J(q),pe=W(fe),me=z(W(pe),2),he=e=>{var t=hH();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=gH(),n=M(t);H(()=>c(n,`${E(k).settings.model.provider??``} · ${E(k).settings.model.model??``} (outside Routes) — env-provided; add
232
+ 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=TH(),i=J(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(()=>yR(E(t),E(i))),u=I(()=>FV(E(t),E(w))),d=I(()=>bR(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=xH(),g=W(m),_=e=>{var r=vH(),i=W(r),a=M(i),o=z(i,2),c=e=>{var t=_H();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??``}`)},[()=>xR(E(t)),()=>vR(E(s))?``:`dark:invert`]),y(e,r)},v=e=>{var r=yH(),i=W(r),a=z(i),o=e=>{var t=_H();y(e,t)};h(a,e=>{E(f)||e(o)}),n(r),H(e=>{j(r,`background: ${e??``}`),c(i,`${E(d)??``} `)},[()=>xR(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=bH();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=SH();y(e,t)};h(v,e=>{E(ce)&&e(b)});var x=z(v,2),S=e=>{var t=CH();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=J(t);p(n,()=>E(d),e=>{sH(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=J(t);p(n,()=>E(ee).provider,e=>{{let t=I(()=>E(m)===E(ee).provider);mH(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=wH(),r=z(W(t),4),i=W(r);Qn(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);Qn(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=EH();y(e,t)},xe=e=>{var t=DH();y(e,t)};h(ve,e=>{E(k)?e(ye):Xe.loading?e(be,1):e(xe,-1)});var Se=z(ve,2),Ce=e=>{var t=OH(),n=M(t,!0);H(()=>c(n,Xe.error)),y(e,t)};h(Se,e=>{Xe.error&&e(Ce)});var we=z(Se,2),Te=e=>{var t=OH(),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)??``);Rn(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,q),x()}T([`click`,`keydown`]);var jH=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),MH=r(`<p class="text-[10px] text-primary" role="status"> </p>`),NH=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),PH=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground"><span class="text-destructive" role="alert"> </span> <!></div>`),FH=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
233
+ or removed individually.</p>`),IH=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>`),LH=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>`),RH=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground"> </span> <ul class="space-y-1"></ul></div>`),zH=r(`<div class="text-xs text-destructive" role="alert"> </div>`),BH=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).
234
+ 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 VH(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;K(()=>{v||(v=!0,nt())}),K(()=>{let e=Xe.view?.settings.session.sessionCleanupDays;e!==void 0&&!E(o)&&F(a,e,!0)});let b=I(()=>{let e=[...tt.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 Mt.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 ze({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 st({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 st({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=BH(),te=J(ee),N=z(W(te),2),P=z(W(N),2),L=W(P),ne=z(W(L),2);rr(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);Qn(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=jH(),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);Qn(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=MH(),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=NH();y(e,t)},q=e=>{var t=PH(),r=W(t),i=M(r,!0),a=z(r,2);Qn(a,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void nt(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),H(()=>c(i,tt.error)),y(e,t)},de=e=>{var t=FH();y(e,t)},fe=e=>{var r=X(),i=J(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=RH(),l=W(s),u=M(l,!0),d=z(l,2);t(d,21,o,e=>e.sessionId,(e,t)=>{var r=LH(),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=IH();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(_));Qn(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)=>{Wn(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=>{tt.loading&&!tt.loaded?e(ue):tt.error?e(q,1):E(b).length===0?e(de,2):e(fe,-1)}),n(ae);var pe=z(ae,2),me=e=>{var t=zH(),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??``));Rn(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 HH=r(`<button><!> </button>`),UH=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><!></div>`,1);function WH(e,r){i(r,!0);let o=[{id:`general`,label:`General`,icon:SB},{id:`model`,label:`Model`,icon:wB},{id:`agent`,label:`Agent`,icon:Tl},{id:`sessions`,label:`Sessions`,icon:dr}],s=V(!1);K(()=>{Dz.open=E(s)}),K(()=>{Dz.open&&F(s,!0)}),K(()=>{E(s)&&$e()});var u=X(),d=J(u);a(d,()=>Un,(e,r)=>{r(e,{get open(){return E(s)},set open(e){F(s,e,!0)},children:(e,r)=>{var i=X(),s=J(i);a(s,()=>Nn,(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=UH(),s=J(i),u=W(s);a(u,()=>zn,(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=HH(),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 ${Dz.section===E(t).id?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`),B(i,`aria-current`,Dz.section===E(t).id?`true`:void 0),c(s,` ${E(t).label??``}`)}),l(`click`,i,()=>Dz.section=E(t).id),y(e,i)}),n(d),n(s);var f=z(s,2),p=W(f),m=e=>{VB(e,{})},g=e=>{AH(e,{})},_=e=>{VH(e,{})},v=e=>{NB(e,{})};h(p,e=>{Dz.section===`general`?e(m):Dz.section===`model`?e(g,1):Dz.section===`sessions`?e(_,2):e(v,-1)}),n(f),H(()=>Y(f,1,`min-w-0 p-4 ${Dz.section===`model`?`overflow-hidden`:`overflow-y-auto`}`)),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,u),x()}T([`click`]);var GH=r(`<link rel="icon" href="/icons/monochrome-mini.png" type="image/png"/> <link rel="apple-touch-icon" href="/icons/monochrome-mini.png"/>`,1),KH=r(`<span class="px-1 text-xs font-medium text-muted-foreground">Skill Creator</span>`),qH=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),JH=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>`),YH=r(`<button><!></button>`),XH=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>`),ZH=r(`<!> <!> <!> <!> <!>`,1);function QH(e,r){i(r,!0),ue(()=>(jt(),ve.url.pathname===`/`&&ge(`/workspaces`,{replaceState:!0}),vt({navigate(e,t){t===`REPLACE`?ge(e,{replaceState:!0,keepFocus:!0,noScroll:!0}):ge(e)}}),It(),Pt));let o=I(()=>ve.url.pathname);K(()=>{E(o).startsWith(`/creator`)?al(il):al(rl)});let s=I(()=>zt.status===`connected`);K(()=>{E(s)&&Qt()});let u=I(()=>ht.list()),d=I(()=>_t(ve.url.pathname)?.app??null);function f(e){ge(`/${e}`)}var p=ZH();S(`12qhfyh`,e=>{var t=GH();oe(2),y(e,t)});var m=J(p);tl(m,{children:(e,i)=>{var o=XH(),s=W(o);xr(s,{variant:`main`,left:e=>{var t=KH();y(e,t)},right:e=>{var t=qH(),r=J(t);sl(W(r),{class:`h-3.5 w-3.5`}),n(r);var i=z(r,2),a=W(i);ur(a,{class:`h-3.5 w-3.5`}),n(i);var o=z(i,2),s=W(o);Ae(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 ${et.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`} max-[720px]:h-11 max-[720px]:w-11`),B(o,`aria-pressed`,et.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,()=>dt(!et.open)),y(e,t)},$$slots:{left:!0,right:!0}});var p=z(s,2),m=e=>{var t=JH(),n=M(t,!0);H(()=>c(n,zt.error)),y(e,t)};h(p,e=>{zt.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=YH(),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-accent text-primary ring-1 ring-inset ring-primary/25`:`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);Be(S,{class:`h-5 w-5`}),n(x);var C=z(x,2);ll(W(C),{class:`h-5 w-5`}),n(C),n(v);var w=z(v,2),T=W(w);bt(T,{});var D=z(T,2);_(D,()=>r.children??R),n(w);var O=z(w,2);bB(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 ${Dz.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`}`),B(C,`aria-pressed`,Dz.open),Y(O,1,`agent-panel-layer shrink-0 max-[720px]:absolute max-[720px]:inset-0 max-[720px]:z-40 ${et.open?``:`pointer-events-none`}`)}),l(`click`,x,()=>Me()),l(`click`,C,()=>Oz()),y(e,o)},$$slots:{default:!0}});var g=z(m,2);ec(g,{});var v=z(g,2);WH(v,{});var b=z(v,2);Yc(b,{}),$c(z(b,2),{}),y(e,p),x()}T([`pointerdown`,`click`]);export{QH as component,mr as universal};