srcly 0.1.33__tar.gz → 0.1.34__tar.gz

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 (86) hide show
  1. {srcly-0.1.33 → srcly-0.1.34}/PKG-INFO +1 -1
  2. srcly-0.1.33/app/static/assets/CodeModal-BTuzjRYW.js → srcly-0.1.34/app/static/assets/CodeModal-BBkwbpez.js +1 -1
  3. srcly-0.1.33/app/static/assets/DependencyGraph-BDOVlmXZ.js → srcly-0.1.34/app/static/assets/DependencyGraph-9gIcsNut.js +1 -1
  4. srcly-0.1.34/app/static/assets/index-CPpALji7.js +2 -0
  5. {srcly-0.1.33 → srcly-0.1.34}/app/static/index.html +1 -1
  6. {srcly-0.1.33 → srcly-0.1.34}/pyproject.toml +1 -1
  7. srcly-0.1.33/app/static/assets/index-DLVq5iVO.js +0 -2
  8. {srcly-0.1.33 → srcly-0.1.34}/.gitignore +0 -0
  9. {srcly-0.1.33 → srcly-0.1.34}/README.md +0 -0
  10. {srcly-0.1.33 → srcly-0.1.34}/app/.gitignore +0 -0
  11. {srcly-0.1.33 → srcly-0.1.34}/app/__init__.py +0 -0
  12. {srcly-0.1.33 → srcly-0.1.34}/app/config.py +0 -0
  13. {srcly-0.1.33 → srcly-0.1.34}/app/main.py +0 -0
  14. {srcly-0.1.33 → srcly-0.1.34}/app/models.py +0 -0
  15. {srcly-0.1.33 → srcly-0.1.34}/app/routers/analysis.py +0 -0
  16. {srcly-0.1.33 → srcly-0.1.34}/app/routers/files.py +0 -0
  17. {srcly-0.1.33 → srcly-0.1.34}/app/routers/scans.py +0 -0
  18. {srcly-0.1.33 → srcly-0.1.34}/app/run.py +0 -0
  19. {srcly-0.1.33 → srcly-0.1.34}/app/services/analysis.py +0 -0
  20. {srcly-0.1.33 → srcly-0.1.34}/app/services/analysis_types.py +0 -0
  21. {srcly-0.1.33 → srcly-0.1.34}/app/services/cache.py +0 -0
  22. {srcly-0.1.33 → srcly-0.1.34}/app/services/css/css_analysis.py +0 -0
  23. {srcly-0.1.33 → srcly-0.1.34}/app/services/ipynb/ipynb_analysis.py +0 -0
  24. {srcly-0.1.33 → srcly-0.1.34}/app/services/markdown/markdown_analysis.py +0 -0
  25. {srcly-0.1.33 → srcly-0.1.34}/app/services/python/python_analysis.py +0 -0
  26. {srcly-0.1.33 → srcly-0.1.34}/app/services/reporting.py +0 -0
  27. {srcly-0.1.33 → srcly-0.1.34}/app/services/scan_jobs.py +0 -0
  28. {srcly-0.1.33 → srcly-0.1.34}/app/services/scan_progress.py +0 -0
  29. {srcly-0.1.33 → srcly-0.1.34}/app/services/scan_workers.py +0 -0
  30. {srcly-0.1.33 → srcly-0.1.34}/app/services/typescript/typescript_analysis.py +0 -0
  31. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/bash-DgJyDXW6.js +0 -0
  32. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/css-PZBBrkI0.js +0 -0
  33. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/dependencyForce.worker-WVMkyynK.js +0 -0
  34. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/elk-worker.min-DGCccKuH.js +0 -0
  35. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/github-light-Rcb2q3L5.js +0 -0
  36. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/highlight.worker-C64dOQ1-.js +0 -0
  37. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/html-DOf0XnR2.js +0 -0
  38. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  39. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  40. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  41. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  42. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  43. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  44. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  45. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  46. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  47. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  48. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  49. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  50. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  51. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  52. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  53. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  54. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  55. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  56. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  57. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  58. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  59. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  60. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  61. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  62. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  63. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  64. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  65. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  66. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  67. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  68. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/index-64jBfyHS.css +0 -0
  69. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  70. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  71. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  72. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  73. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  74. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  75. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  76. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/javascript-WyGyM1wV.js +0 -0
  77. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/json-B8JryHcM.js +0 -0
  78. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/jsx-8cLv2Six.js +0 -0
  79. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/markdown-DX-TNHnc.js +0 -0
  80. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/python-B6Ihcp-E.js +0 -0
  81. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/toml-Ms459DBw.js +0 -0
  82. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/tsx-D6116Ycy.js +0 -0
  83. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/typescript-BqvgUolh.js +0 -0
  84. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/wasm-CG6Dc4jp.js +0 -0
  85. {srcly-0.1.33 → srcly-0.1.34}/app/static/assets/yaml-Bopit2L3.js +0 -0
  86. {srcly-0.1.33 → srcly-0.1.34}/app/static/favicon.svg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: srcly
3
- Version: 0.1.33
3
+ Version: 0.1.34
4
4
  Summary: Interactive codebase treemap and metrics viewer.
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: fastapi>=0.121.3
@@ -1,4 +1,4 @@
1
- import{c as A,y as Be,I as pt,j as Z,l as Fe,o as Pn,t as G,b as M,m as Le,e as J,B as gn,C as qi,n as Vi,f as Te,s as kr,k as sn,F as Ye,g as dt,x as mt,u as Gn,L as Wi,E as Qi,$ as Re,z as Ki,A as Ft,D as Zn,G as Yi,M as Dt,J as br,K as Xi,N as Gi,H as Zi,O as Ji,q as el,P as nl,Q as tl,R as rl,U as il}from"./index-DLVq5iVO.js";var wr={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};wr.node;var ll=e=>A(pt,Be(e,{icon:wr})),ol=ll,Sr={name:"dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]};Sr.node;var al=e=>A(pt,Be(e,{icon:Sr})),ul=al,Cr={name:"square-function",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]],aliases:["function-square"]};Cr.node;var sl=e=>A(pt,Be(e,{icon:Cr})),cl=sl;function fl(e){const[t,n]=Z(!1),r=()=>n(!1);return Fe(()=>{e.contentKey();const i=e.isOpen(),o=e.viewMode(),l=e.hasSelection(),a=e.loading();if(!i||o!=="preview"||!l||a){n(!1);return}t()||queueMicrotask(()=>{const u=e.contentContainerEl();if(!u)return;const s=u.querySelector(".md-selected-range");s&&(n(!0),s.scrollIntoView({block:"center"}))})}),{resetAutoScroll:r}}async function hl(e){const n=await(e.fetchImpl??fetch)(`/api/files/content?path=${encodeURIComponent(e.path)}`,{signal:e.signal});if(!n.ok)throw new Error(`Failed to load file: ${n.status} ${n.statusText}`);return await n.text()}function pl(e){const[t,n]=Z(""),[r,i]=Z(!1),[o,l]=Z(null),[a,u]=Z(null),[s,f]=Z(0),c=()=>f(p=>p+1);return Fe(()=>{if(s(),!e.isOpen()||!e.filePath()){n(""),l(null),i(!1),u(null);return}const p=e.filePath(),h=new AbortController;i(!0),l(null),n(""),u(null),(async()=>{try{const d=await hl({path:p,fetchImpl:e.fetchImpl,signal:h.signal});if(h.signal.aborted)return;n(d),u(d.split(/\r?\n/).length)}catch(d){if(d?.name==="AbortError")return;l(d.message??String(d))}finally{h.signal.aborted||i(!1)}})(),Pn(()=>h.abort())}),{rawCode:t,loading:r,error:o,totalLines:a,reload:c}}function Jn(e){const t=e.toLowerCase();return t.endsWith(".tsx")?"tsx":t.endsWith(".ts")?"ts":t.endsWith(".jsx")?"jsx":t.endsWith(".js")?"js":t.endsWith(".json")?"json":t.endsWith(".py")||t.endsWith(".ipynb")?"python":t.endsWith(".md")?"md":t.endsWith(".html")||t.endsWith(".htm")?"html":t.endsWith(".css")?"css":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":t.endsWith(".toml")?"toml":t.endsWith(".sh")||t.endsWith(".bash")||t.endsWith(".zsh")?"bash":"txt"}function dl(e){const[t,n]=Z(""),[r,i]=Z(null),[o,l]=Z(null),[a,u]=Z(!1),[s,f]=Z(null);let c,p=0;const h=()=>c||(c=new Worker(new URL("/assets/highlight.worker-C64dOQ1-.js",import.meta.url),{type:"module"}),c.onmessage=d=>{const x=d.data;if(x.id===p){if(x.error){f(`Could not highlight this file: ${x.error}`),n("");return}f(null),n(x.html??""),i(x.start??null),l(x.end??null),u(!!x.wasIndentationReduced)}},c.onerror=d=>{p++,c?.terminate(),c=void 0,f(`Syntax highlighting failed: ${d.message}`),n("")},c);return Fe(()=>{const d=e.rawCode(),x=e.filePath(),S=e.lineFilterEnabled(),y=e.lineOffset(),C=e.reduceIndentation(),v=e.targetStart(),_=e.targetEnd(),F=++p;if(f(null),!d||!x){n(""),i(null),l(null),u(!1);return}const b=typeof v=="number"&&typeof _=="number"?{start:v,end:_}:null;try{h().postMessage({id:F,text:d,language:Jn(x),useLineFilter:S,offset:y,target:b,reduceIndentation:C})}catch(N){f(`Could not start syntax highlighting: ${String(N)}`)}}),Pn(()=>{p++,c?.terminate()}),{highlightedHtml:t,displayStartLine:r,displayEndLine:o,wasIndentationReduced:a,highlightError:s}}function Ce(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);if(Number.isFinite(t))return t}return null}function We(e){const t=e;return t?.name==="(body)"||t?.type==="function_body"||t?.type==="file_body"}function Sn(e){const t=e;if(!t||!Array.isArray(t.children))return[];const n=t.children.filter(r=>!We(r));if(n.length===0){const r=t.children.find(i=>We(i)&&Array.isArray(i.children)&&i.children.length>0);if(r)return r.children.filter(i=>!We(i))}return n}function vr(e,t){if(!e)return[];if(!t)return[e];const n=t.start,r=t.end,i=[e];let o=e,l=0;for(;l<100;){l++;const a=Sn(o);if(!a?.length)break;const u=a.reduce((x,S)=>{const y=Ce(S?.start_line),C=Ce(S?.end_line);if(!S||y===null||C===null||!(y<=n&&C>=r))return x;if(!x)return S;const _=Ce(x?.start_line),F=Ce(x?.end_line);if(_===null||F===null)return S;const b=F-_,N=C-y;if(N<b)return S;if(N>b)return x;const W=_===n&&F===r,j=y===n&&C===r;return j!==W&&j?S:x},null);if(!u)break;const s=Ce(o?.start_line),f=Ce(o?.end_line),c=Ce(u?.start_line),p=Ce(u?.end_line),h=s!==null&&f!==null?f-s:Number.POSITIVE_INFINITY,d=c!==null&&p!==null?p-c:Number.POSITIVE_INFINITY;if(d>h||d===h&&!Sn(u).some(y=>{const C=Ce(y?.start_line),v=Ce(y?.end_line);return!y||C===null||v===null||!(C<=n&&v>=r)?!1:v-C<d}))break;i.push(u),o=u}return i}function ml(e,t){return e.length>0?e[e.length-1]:t}var gl=G('<div class="ml-4 flex items-center rounded-md border border-[var(--plc-border)] bg-[var(--plc-surface-muted)] p-0.5">'),yl=G('<span class="ml-4 text-[10px] text-[var(--plc-warning)] italic animate-pulse">Indentation reduced'),xl=G('<label class="ml-3 flex items-center gap-1 text-[11px] text-[var(--plc-on-muted)]"><input type=checkbox><span>Limit to selection</span><span class="ml-2 flex items-center gap-1"><span>±</span><span>lines'),kl=G('<header class="flex min-h-12 items-center justify-between border-b border-[var(--plc-border)] bg-[var(--plc-surface)] px-4 py-2 text-sm"><div class="flex min-w-0 flex-col"><span class="truncate font-semibold text-[var(--plc-on-surface)]"></span><span class="truncate text-[11px] text-[var(--plc-on-subtle)]"></span></div><div class="flex items-center"><a class="ml-2 inline-flex h-7 items-center justify-center gap-1 rounded-md border border-[var(--plc-success-border)] bg-[var(--plc-success-subtle)] px-2 text-xs font-semibold text-[var(--plc-success)] no-underline transition-colors hover:border-[var(--plc-success)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--plc-border-focus)]"target=_blank>Open'),bl=G('<span class="truncate text-[10px] text-[var(--plc-on-disabled)]">');function wl(e){return(()=>{var t=kl(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,o=n.nextSibling,l=o.firstChild;return M(r,()=>e.baseName),M(i,()=>e.filePath),M(n,A(J,{get when(){return Le(()=>!!e.hasLineRange())()&&e.rangeLabel()},children:a=>(()=>{var u=bl();return M(u,a),u})()}),null),M(t,A(gn,{class:"ml-4",get onClick(){return e.onClose},children:"Close"}),o),M(t,A(gn,{variant:"primary",class:"ml-2",onClick:()=>{navigator.clipboard.writeText(e.rawCode())},children:"Copy"}),o),M(t,A(J,{get when(){return e.isMarkdown()},get children(){var a=gl();return M(a,A(gn,{variant:"tab",size:"xs",get active(){return e.viewMode()==="code"},class:"rounded-sm px-3 font-semibold",onClick:()=>e.setViewMode("code"),children:"Code"}),null),M(a,A(gn,{variant:"tab",size:"xs",get active(){return e.viewMode()==="preview"},class:"rounded-sm px-3 font-semibold",onClick:()=>e.setViewMode("preview"),children:"Preview"}),null),a}}),o),M(o,A(J,{get when(){return e.wasIndentationReduced()},get children(){return yl()}}),l),M(o,A(qi,{class:"ml-3 text-[11px]",get checked(){return e.reduceIndentation()},get onChange(){return e.setReduceIndentation},title:"Strip common indentation to save horizontal space",label:"Reduce indent"}),l),M(o,A(J,{get when(){return e.hasLineRange()},get children(){var a=xl(),u=a.firstChild,s=u.nextSibling,f=s.nextSibling,c=f.firstChild,p=c.nextSibling;return u.addEventListener("change",h=>e.setLineFilterEnabled(h.currentTarget.checked)),M(f,A(Vi,{type:"number",min:"0",size:"sm",class:"w-12 px-1 text-[11px]",get value(){return e.lineOffset()},onInput:h=>{const d=Number(h.currentTarget.value);e.setLineOffset(Number.isNaN(d)?0:d)}}),p),Te(()=>u.checked=e.lineFilterEnabled()),a}}),l),Te(()=>kr(l,"href",`vscode://file/${e.filePath}`)),t})()}var Sl=G('<div class="sticky top-0 z-20 border-b border-[var(--plc-border)] bg-[var(--plc-surface)]/95 backdrop-blur px-3 py-2"><div class="flex items-center gap-1 min-w-0"><div class=flex-1></div><span class="text-[10px] text-[var(--plc-on-subtle)] font-mono tabular-nums">L'),Cl=G("<button>"),vl=G('<span class="text-[var(--plc-on-disabled)] text-[11px] select-none px-1">›');function Il(e){if(!e)return"";const t=e.split(/[\\/]/);return t[t.length-1]||e}function Dn(e){return e?`${e?.type??""}|${e?.name??""}|${e?.start_line??""}|${e?.end_line??""}`:""}function El(e,t){return!e||!t?!1:e===t?!0:Dn(e)!==""&&Dn(e)===Dn(t)}function Al(e,t){if(!e||!t)return null;const n=[],r=new Set,i=l=>{if(!l||r.has(l))return!1;if(r.add(l),El(l,t))return n.push(l),!0;const a=Sn(l);for(const u of a)if(i(u))return n.push(l),!0;return!1};return i(e)?n.reverse():null}function Pl(e){const t=sn(()=>{const i=e.root(),o=e.selectedNode?.()??null;return!i||!o?null:Al(i,o)}),n=sn(()=>{const i=t();if(i&&i.length)return i.filter(s=>!We(s));const o=e.root(),l=e.selection?.()??null,a=e.currentLine();if(!o||typeof a!="number"||a<=0)return[];const u=l&&typeof l.start=="number"&&typeof l.end=="number"?l:{start:a,end:a};return!o||typeof u.start!="number"||typeof u.end!="number"?[]:vr(o,u).filter(s=>!We(s))}),r=()=>Il(e.filePath());return A(J,{get when(){return n().length>0},get children(){var i=Sl(),o=i.firstChild,l=o.firstChild,a=l.nextSibling;return a.firstChild,M(o,A(Ye,{get each(){return n()},children:(u,s)=>{const f=()=>u,c=()=>s()===n().length-1,p=()=>s()===0?r()||f().name||"file":f().name;return[(()=>{var h=Cl();return h.$$click=()=>{if(c())return;const d=s()===0?null:f();e.onSelectScope(d)},M(h,p),Te(d=>{var x=`text-[11px] truncate max-w-[260px] ${c()?"text-[var(--plc-on-surface)] font-semibold cursor-default":"text-[var(--plc-accent)] hover:text-[var(--plc-accent-hover)] hover:underline"}`,S=p();return x!==d.e&&dt(h,d.e=x),S!==d.t&&kr(h,"title",d.t=S),d},{e:void 0,t:void 0}),h})(),A(J,{get when(){return!c()},get children(){return vl()}})]}}),l),M(a,()=>e.currentLine(),null),i}})}mt(["click"]);var Tl=G("<div class=code-modal-content>"),Ll=G('<div class="flex h-full min-h-0"><div class="flex-1 min-w-0 overflow-auto"><div class="sticky top-0 z-20">');function zl(e){const[t,n]=Z(1);let r,i;const o=()=>!e.loading()&&!e.error()&&e.highlightedHtml(),l=()=>{const a=r;if(!a)return;const u=a.querySelectorAll("span.line");if(!u.length)return;const f=u[0].getBoundingClientRect().height||16,c=i?.offsetHeight??0,p=a.getBoundingClientRect().top+c+2;let h=Math.floor(a.scrollTop/f);h=Math.max(0,Math.min(u.length-1,h));const d=Math.max(0,h-30),x=Math.min(u.length-1,h+30);let S=h;for(let y=d;y<=x;y++)if(u[y].getBoundingClientRect().bottom>p){S=y;break}n(e.displayStartLine()+S)};return Fe(()=>{e.highlightedHtml(),queueMicrotask(()=>l())}),Fe(()=>{e.displayStartLine(),queueMicrotask(()=>l())}),Fe(()=>{const a=r;if(!a)return;let u=0;const s=()=>{u||(u=requestAnimationFrame(()=>{u=0,l()}))};a.addEventListener("scroll",s,{passive:!0}),Pn(()=>{a.removeEventListener("scroll",s),u&&cancelAnimationFrame(u)})}),(()=>{var a=Ll(),u=a.firstChild,s=u.firstChild;return Gn(f=>r=f,u),Gn(f=>i=f,s),M(s,A(Pl,{get root(){return e.fileNode},get selectedNode(){return e.selectedScopeNode},get filePath(){return e.filePath},currentLine:t,selection:()=>{const f=e.targetStartLine?.(),c=e.targetEndLine?.();return typeof f=="number"&&typeof c=="number"?{start:f,end:c}:null},get onSelectScope(){return e.onSelectScope}})),M(u,A(J,{get when(){return e.loading()||!e.highlightedHtml()&&!e.error()},get children(){return A(Wi,{label:"Loading file..."})}}),null),M(u,A(J,{get when(){return Le(()=>!e.loading())()&&e.error()},get children(){return A(Qi,{get message(){return e.error()},class:"min-h-32"})}}),null),M(u,A(J,{get when(){return o()},get children(){var f=Tl();return Te(()=>f.innerHTML=e.highlightedHtml()),f}}),null),a})()}const _l={};function gt(e,t){const n=_l,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ir(e,r,i)}function Ir(e,t,n){if(Fl(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Ot(e.children,t,n)}return Array.isArray(e)?Ot(e,t,n):""}function Ot(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ir(e[i],t,n);return r.join("")}function Fl(e){return!!(e&&typeof e=="object")}const Mt=document.createElement("i");function yt(e){const t="&"+e+";";Mt.innerHTML=t;const n=Mt.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function pe(e,t,n,r){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function xe(e,t){return e.length>0?(pe(e,e.length,0,t),e):t}const Nt={}.hasOwnProperty;function Er(e){const t={};let n=-1;for(;++n<e.length;)Dl(t,e[n]);return t}function Dl(e,t){let n;for(n in t){const i=(Nt.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){Nt.call(i,l)||(i[l]=[]);const a=o[l];Ol(i[l],Array.isArray(a)?a:a?[a]:[])}}}function Ol(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);pe(e,0,0,r)}function Ar(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function we(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const oe=Oe(/[A-Za-z]/),ie=Oe(/[\dA-Za-z]/),Ml=Oe(/[#-'*+\--9=?A-Z^-~]/);function Cn(e){return e!==null&&(e<32||e===127)}const et=Oe(/\d/),Nl=Oe(/[\dA-Fa-f]/),Rl=Oe(/[!-/:-@[-`{-~]/);function z(e){return e!==null&&e<-2}function Y(e){return e!==null&&(e<0||e===32)}function $(e){return e===-2||e===-1||e===32}const Tn=Oe(new RegExp("\\p{P}|\\p{S}","u")),$e=Oe(/\s/);function Oe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ze(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&ie(e.charCodeAt(n+1))&&ie(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(l=String.fromCharCode(o,a),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function H(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(u){return $(u)?(e.enter(n),a(u)):t(u)}function a(u){return $(u)&&o++<i?(e.consume(u),a):(e.exit(n),t(u))}}const $l={tokenize:Bl};function Bl(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),H(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(a)}function l(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return z(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),l)}}const jl={tokenize:Hl},Rt={tokenize:Ul};function Hl(e){const t=this,n=[];let r=0,i,o,l;return a;function a(v){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,u,s)(v)}return s(v)}function u(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&C();const _=t.events.length;let F=_,b;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){b=t.events[F][1].end;break}y(r);let N=_;for(;N<t.events.length;)t.events[N][1].end={...b},N++;return pe(t.events,F+1,0,t.events.slice(_)),t.events.length=N,s(v)}return a(v)}function s(v){if(r===n.length){if(!i)return p(v);if(i.currentConstruct&&i.currentConstruct.concrete)return d(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Rt,f,c)(v)}function f(v){return i&&C(),y(r),p(v)}function c(v){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,d(v)}function p(v){return t.containerState={},e.attempt(Rt,h,d)(v)}function h(v){return r++,n.push([t.currentConstruct,t.containerState]),p(v)}function d(v){if(v===null){i&&C(),y(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),x(v)}function x(v){if(v===null){S(e.exit("chunkFlow"),!0),y(0),e.consume(v);return}return z(v)?(e.consume(v),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),x)}function S(v,_){const F=t.sliceStream(v);if(_&&F.push(null),v.previous=o,o&&(o.next=v),o=v,i.defineSkip(v.start),i.write(F),t.parser.lazy[v.start.line]){let b=i.events.length;for(;b--;)if(i.events[b][1].start.offset<l&&(!i.events[b][1].end||i.events[b][1].end.offset>l))return;const N=t.events.length;let W=N,j,k;for(;W--;)if(t.events[W][0]==="exit"&&t.events[W][1].type==="chunkFlow"){if(j){k=t.events[W][1].end;break}j=!0}for(y(r),b=N;b<t.events.length;)t.events[b][1].end={...k},b++;pe(t.events,W+1,0,t.events.slice(N)),t.events.length=b}}function y(v){let _=n.length;for(;_-- >v;){const F=n[_];t.containerState=F[1],F[0].exit.call(t,e)}n.length=v}function C(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ul(e,t,n){return H(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xe(e){if(e===null||Y(e)||$e(e))return 1;if(Tn(e))return 2}function Ln(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const nt={name:"attention",resolveAll:ql,tokenize:Vl};function ql(e,t){let n=-1,r,i,o,l,a,u,s,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};$t(c,-u),$t(p,u),l={type:u>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...a.end}},e[r][1].end={...l.start},e[n][1].start={...a.end},s=[],e[r][1].end.offset-e[r][1].start.offset&&(s=xe(s,[["enter",e[r][1],t],["exit",e[r][1],t]])),s=xe(s,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),s=xe(s,Ln(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),s=xe(s,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,s=xe(s,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,pe(e,r-1,n-r+3,s),n=r+s.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Vl(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Xe(r);let o;return l;function l(u){return o=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===o)return e.consume(u),a;const s=e.exit("attentionSequence"),f=Xe(u),c=!f||f===2&&i||n.includes(u),p=!i||i===2&&f||n.includes(r);return s._open=!!(o===42?c:c&&(i||!p)),s._close=!!(o===42?p:p&&(f||!c)),t(u)}}function $t(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Wl={name:"autolink",tokenize:Ql};function Ql(e,t,n){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(h){return oe(h)?(e.consume(h),l):h===64?n(h):s(h)}function l(h){return h===43||h===45||h===46||ie(h)?(r=1,a(h)):s(h)}function a(h){return h===58?(e.consume(h),r=0,u):(h===43||h===45||h===46||ie(h))&&r++<32?(e.consume(h),a):(r=0,s(h))}function u(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||Cn(h)?n(h):(e.consume(h),u)}function s(h){return h===64?(e.consume(h),f):Ml(h)?(e.consume(h),s):n(h)}function f(h){return ie(h)?c(h):n(h)}function c(h){return h===46?(e.consume(h),r=0,f):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||ie(h))&&r++<63){const d=h===45?p:c;return e.consume(h),d}return n(h)}}const hn={partial:!0,tokenize:Kl};function Kl(e,t,n){return r;function r(o){return $(o)?H(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||z(o)?t(o):n(o)}}const Pr={continuation:{tokenize:Xl},exit:Gl,name:"blockQuote",tokenize:Yl};function Yl(e,t,n){const r=this;return i;function i(l){if(l===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return $(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function Xl(e,t,n){const r=this;return i;function i(l){return $(l)?H(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(Pr,t,n)(l)}}function Gl(e){e.exit("blockQuote")}const Tr={name:"characterEscape",tokenize:Zl};function Zl(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return Rl(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Lr={name:"characterReference",tokenize:Jl};function Jl(e,t,n){const r=this;let i=0,o,l;return a;function a(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),u}function u(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),o=31,l=ie,f(c))}function s(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=Nl,f):(e.enter("characterReferenceValue"),o=7,l=et,f(c))}function f(c){if(c===59&&i){const p=e.exit("characterReferenceValue");return l===ie&&!yt(r.sliceSerialize(p))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(c)&&i++<o?(e.consume(c),f):n(c)}}const Bt={partial:!0,tokenize:no},jt={concrete:!0,name:"codeFenced",tokenize:eo};function eo(e,t,n){const r=this,i={partial:!0,tokenize:F};let o=0,l=0,a;return u;function u(b){return s(b)}function s(b){const N=r.events[r.events.length-1];return o=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(b)}function f(b){return b===a?(l++,e.consume(b),f):l<3?n(b):(e.exit("codeFencedFenceSequence"),$(b)?H(e,c,"whitespace")(b):c(b))}function c(b){return b===null||z(b)?(e.exit("codeFencedFence"),r.interrupt?t(b):e.check(Bt,x,_)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===null||z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(b)):$(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),H(e,h,"whitespace")(b)):b===96&&b===a?n(b):(e.consume(b),p)}function h(b){return b===null||z(b)?c(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(b))}function d(b){return b===null||z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(b)):b===96&&b===a?n(b):(e.consume(b),d)}function x(b){return e.attempt(i,_,S)(b)}function S(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y}function y(b){return o>0&&$(b)?H(e,C,"linePrefix",o+1)(b):C(b)}function C(b){return b===null||z(b)?e.check(Bt,x,_)(b):(e.enter("codeFlowValue"),v(b))}function v(b){return b===null||z(b)?(e.exit("codeFlowValue"),C(b)):(e.consume(b),v)}function _(b){return e.exit("codeFenced"),t(b)}function F(b,N,W){let j=0;return k;function k(R){return b.enter("lineEnding"),b.consume(R),b.exit("lineEnding"),T}function T(R){return b.enter("codeFencedFence"),$(R)?H(b,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):L(R)}function L(R){return R===a?(b.enter("codeFencedFenceSequence"),V(R)):W(R)}function V(R){return R===a?(j++,b.consume(R),V):j>=l?(b.exit("codeFencedFenceSequence"),$(R)?H(b,Q,"whitespace")(R):Q(R)):W(R)}function Q(R){return R===null||z(R)?(b.exit("codeFencedFence"),N(R)):W(R)}}}function no(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const On={name:"codeIndented",tokenize:ro},to={partial:!0,tokenize:io};function ro(e,t,n){const r=this;return i;function i(s){return e.enter("codeIndented"),H(e,o,"linePrefix",5)(s)}function o(s){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(s):n(s)}function l(s){return s===null?u(s):z(s)?e.attempt(to,l,u)(s):(e.enter("codeFlowValue"),a(s))}function a(s){return s===null||z(s)?(e.exit("codeFlowValue"),l(s)):(e.consume(s),a)}function u(s){return e.exit("codeIndented"),t(s)}}function io(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):z(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):H(e,o,"linePrefix",5)(l)}function o(l){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(l):z(l)?i(l):n(l)}}const lo={name:"codeText",previous:ao,resolve:oo,tokenize:uo};function oo(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ao(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uo(e,t,n){let r=0,i,o;return l;function l(c){return e.enter("codeText"),e.enter("codeTextSequence"),a(c)}function a(c){return c===96?(e.consume(c),r++,a):(e.exit("codeTextSequence"),u(c))}function u(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),u):c===96?(o=e.enter("codeTextSequence"),i=0,f(c)):z(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):(e.enter("codeTextData"),s(c))}function s(c){return c===null||c===32||c===96||z(c)?(e.exit("codeTextData"),u(c)):(e.consume(c),s)}function f(c){return c===96?(e.consume(c),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(o.type="codeTextData",s(c))}}class so{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&tn(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),tn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),tn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);tn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);tn(this.left,n.reverse())}}}function tn(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zr(e){const t={};let n=-1,r,i,o,l,a,u,s;const f=new so(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,co(f,n)),n=t[n],s=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(l=f.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},a=f.slice(i,n),a.unshift(r),f.splice(i,n-i+1,a))}}return pe(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!s}function co(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const a=l.events,u=[],s={};let f,c,p=-1,h=n,d=0,x=0;const S=[x];for(;h;){for(;e.get(++i)[1]!==h;);o.push(i),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),c&&l.defineSkip(h.start),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(f),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),c=h,h=h.next}for(h=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(x=p+1,S.push(x),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(l.events=[],h?(h._tokenizer=void 0,h.previous=void 0):S.pop(),p=S.length;p--;){const y=a.slice(S[p],S[p+1]),C=o.pop();u.push([C,C+y.length-1]),e.splice(C,2,y)}for(u.reverse(),p=-1;++p<u.length;)s[d+u[p][0]]=d+u[p][1],d+=u[p][1]-u[p][0]-1;return s}const fo={resolve:po,tokenize:mo},ho={partial:!0,tokenize:go};function po(e){return zr(e),e}function mo(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):z(a)?e.check(ho,l,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function l(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function go(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),H(e,o,"linePrefix")}function o(l){if(l===null||z(l))return n(l);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function _r(e,t,n,r,i,o,l,a,u){const s=u||Number.POSITIVE_INFINITY;let f=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(y),e.exit(o),p):y===null||y===32||y===41||Cn(y)?n(y):(e.enter(r),e.enter(l),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(a),p(y)):y===null||y===60||z(y)?n(y):(e.consume(y),y===92?d:h)}function d(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function x(y){return!f&&(y===null||y===41||Y(y))?(e.exit("chunkString"),e.exit(a),e.exit(l),e.exit(r),t(y)):f<s&&y===40?(e.consume(y),f++,x):y===41?(e.consume(y),f--,x):y===null||y===32||y===40||Cn(y)?n(y):(e.consume(y),y===92?S:x)}function S(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function Fr(e,t,n,r,i,o){const l=this;let a=0,u;return s;function s(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(o),f}function f(h){return a>999||h===null||h===91||h===93&&!u||h===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?n(h):h===93?(e.exit(o),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):z(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===null||h===91||h===93||z(h)||a++>999?(e.exit("chunkString"),f(h)):(e.consume(h),u||(u=!$(h)),h===92?p:c)}function p(h){return h===91||h===92||h===93?(e.consume(h),a++,c):c(h)}}function Dr(e,t,n,r,i,o){let l;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,u):n(p)}function u(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(o),s(p))}function s(p){return p===l?(e.exit(o),u(l)):p===null?n(p):z(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),H(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===l||p===null||z(p)?(e.exit("chunkString"),s(p)):(e.consume(p),p===92?c:f)}function c(p){return p===l||p===92?(e.consume(p),f):f(p)}}function on(e,t){let n;return r;function r(i){return z(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):$(i)?H(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const yo={name:"definition",tokenize:ko},xo={partial:!0,tokenize:bo};function ko(e,t,n){const r=this;let i;return o;function o(h){return e.enter("definition"),l(h)}function l(h){return Fr.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=we(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),u):n(h)}function u(h){return Y(h)?on(e,s)(h):s(h)}function s(h){return _r(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(xo,c,c)(h)}function c(h){return $(h)?H(e,p,"whitespace")(h):p(h)}function p(h){return h===null||z(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function bo(e,t,n){return r;function r(a){return Y(a)?on(e,i)(a):n(a)}function i(a){return Dr(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return $(a)?H(e,l,"whitespace")(a):l(a)}function l(a){return a===null||z(a)?t(a):n(a)}}const wo={name:"hardBreakEscape",tokenize:So};function So(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return z(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const Co={name:"headingAtx",resolve:vo,tokenize:Io};function vo(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},pe(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function Io(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),o(f)}function o(f){return e.enter("atxHeadingSequence"),l(f)}function l(f){return f===35&&r++<6?(e.consume(f),l):f===null||Y(f)?(e.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),u(f)):f===null||z(f)?(e.exit("atxHeading"),t(f)):$(f)?H(e,a,"whitespace")(f):(e.enter("atxHeadingText"),s(f))}function u(f){return f===35?(e.consume(f),u):(e.exit("atxHeadingSequence"),a(f))}function s(f){return f===null||f===35||Y(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),s)}}const Eo=["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"],Ht=["pre","script","style","textarea"],Ao={concrete:!0,name:"htmlFlow",resolveTo:Lo,tokenize:zo},Po={partial:!0,tokenize:Fo},To={partial:!0,tokenize:_o};function Lo(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function zo(e,t,n){const r=this;let i,o,l,a,u;return s;function s(g){return f(g)}function f(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),p):g===47?(e.consume(g),o=!0,x):g===63?(e.consume(g),i=3,r.interrupt?t:m):oe(g)?(e.consume(g),l=String.fromCharCode(g),S):n(g)}function p(g){return g===45?(e.consume(g),i=2,h):g===91?(e.consume(g),i=5,a=0,d):oe(g)?(e.consume(g),i=4,r.interrupt?t:m):n(g)}function h(g){return g===45?(e.consume(g),r.interrupt?t:m):n(g)}function d(g){const P="CDATA[";return g===P.charCodeAt(a++)?(e.consume(g),a===P.length?r.interrupt?t:L:d):n(g)}function x(g){return oe(g)?(e.consume(g),l=String.fromCharCode(g),S):n(g)}function S(g){if(g===null||g===47||g===62||Y(g)){const P=g===47,U=l.toLowerCase();return!P&&!o&&Ht.includes(U)?(i=1,r.interrupt?t(g):L(g)):Eo.includes(l.toLowerCase())?(i=6,P?(e.consume(g),y):r.interrupt?t(g):L(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):o?C(g):v(g))}return g===45||ie(g)?(e.consume(g),l+=String.fromCharCode(g),S):n(g)}function y(g){return g===62?(e.consume(g),r.interrupt?t:L):n(g)}function C(g){return $(g)?(e.consume(g),C):k(g)}function v(g){return g===47?(e.consume(g),k):g===58||g===95||oe(g)?(e.consume(g),_):$(g)?(e.consume(g),v):k(g)}function _(g){return g===45||g===46||g===58||g===95||ie(g)?(e.consume(g),_):F(g)}function F(g){return g===61?(e.consume(g),b):$(g)?(e.consume(g),F):v(g)}function b(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),u=g,N):$(g)?(e.consume(g),b):W(g)}function N(g){return g===u?(e.consume(g),u=null,j):g===null||z(g)?n(g):(e.consume(g),N)}function W(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||Y(g)?F(g):(e.consume(g),W)}function j(g){return g===47||g===62||$(g)?v(g):n(g)}function k(g){return g===62?(e.consume(g),T):n(g)}function T(g){return g===null||z(g)?L(g):$(g)?(e.consume(g),T):n(g)}function L(g){return g===45&&i===2?(e.consume(g),ne):g===60&&i===1?(e.consume(g),te):g===62&&i===4?(e.consume(g),ce):g===63&&i===3?(e.consume(g),m):g===93&&i===5?(e.consume(g),de):z(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Po,me,V)(g)):g===null||z(g)?(e.exit("htmlFlowData"),V(g)):(e.consume(g),L)}function V(g){return e.check(To,Q,me)(g)}function Q(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),R}function R(g){return g===null||z(g)?V(g):(e.enter("htmlFlowData"),L(g))}function ne(g){return g===45?(e.consume(g),m):L(g)}function te(g){return g===47?(e.consume(g),l="",ae):L(g)}function ae(g){if(g===62){const P=l.toLowerCase();return Ht.includes(P)?(e.consume(g),ce):L(g)}return oe(g)&&l.length<8?(e.consume(g),l+=String.fromCharCode(g),ae):L(g)}function de(g){return g===93?(e.consume(g),m):L(g)}function m(g){return g===62?(e.consume(g),ce):g===45&&i===2?(e.consume(g),m):L(g)}function ce(g){return g===null||z(g)?(e.exit("htmlFlowData"),me(g)):(e.consume(g),ce)}function me(g){return e.exit("htmlFlow"),t(g)}}function _o(e,t,n){const r=this;return i;function i(l){return z(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function Fo(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(hn,t,n)}}const Do={name:"htmlText",tokenize:Oo};function Oo(e,t,n){const r=this;let i,o,l;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),s):m===47?(e.consume(m),F):m===63?(e.consume(m),v):oe(m)?(e.consume(m),W):n(m)}function s(m){return m===45?(e.consume(m),f):m===91?(e.consume(m),o=0,d):oe(m)?(e.consume(m),C):n(m)}function f(m){return m===45?(e.consume(m),h):n(m)}function c(m){return m===null?n(m):m===45?(e.consume(m),p):z(m)?(l=c,te(m)):(e.consume(m),c)}function p(m){return m===45?(e.consume(m),h):c(m)}function h(m){return m===62?ne(m):m===45?p(m):c(m)}function d(m){const ce="CDATA[";return m===ce.charCodeAt(o++)?(e.consume(m),o===ce.length?x:d):n(m)}function x(m){return m===null?n(m):m===93?(e.consume(m),S):z(m)?(l=x,te(m)):(e.consume(m),x)}function S(m){return m===93?(e.consume(m),y):x(m)}function y(m){return m===62?ne(m):m===93?(e.consume(m),y):x(m)}function C(m){return m===null||m===62?ne(m):z(m)?(l=C,te(m)):(e.consume(m),C)}function v(m){return m===null?n(m):m===63?(e.consume(m),_):z(m)?(l=v,te(m)):(e.consume(m),v)}function _(m){return m===62?ne(m):v(m)}function F(m){return oe(m)?(e.consume(m),b):n(m)}function b(m){return m===45||ie(m)?(e.consume(m),b):N(m)}function N(m){return z(m)?(l=N,te(m)):$(m)?(e.consume(m),N):ne(m)}function W(m){return m===45||ie(m)?(e.consume(m),W):m===47||m===62||Y(m)?j(m):n(m)}function j(m){return m===47?(e.consume(m),ne):m===58||m===95||oe(m)?(e.consume(m),k):z(m)?(l=j,te(m)):$(m)?(e.consume(m),j):ne(m)}function k(m){return m===45||m===46||m===58||m===95||ie(m)?(e.consume(m),k):T(m)}function T(m){return m===61?(e.consume(m),L):z(m)?(l=T,te(m)):$(m)?(e.consume(m),T):j(m)}function L(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,V):z(m)?(l=L,te(m)):$(m)?(e.consume(m),L):(e.consume(m),Q)}function V(m){return m===i?(e.consume(m),i=void 0,R):m===null?n(m):z(m)?(l=V,te(m)):(e.consume(m),V)}function Q(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||Y(m)?j(m):(e.consume(m),Q)}function R(m){return m===47||m===62||Y(m)?j(m):n(m)}function ne(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function te(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ae}function ae(m){return $(m)?H(e,de,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):de(m)}function de(m){return e.enter("htmlTextData"),l(m)}}const xt={name:"labelEnd",resolveAll:$o,resolveTo:Bo,tokenize:jo},Mo={tokenize:Ho},No={tokenize:Uo},Ro={tokenize:qo};function $o(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&pe(e,0,e.length,n),e}function Bo(e,t){let n=e.length,r=0,i,o,l,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},s={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},f={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return a=[["enter",u,t],["enter",s,t]],a=xe(a,e.slice(o+1,o+r+3)),a=xe(a,[["enter",f,t]]),a=xe(a,Ln(t.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),t)),a=xe(a,[["exit",f,t],e[l-2],e[l-1],["exit",s,t]]),a=xe(a,e.slice(l+1)),a=xe(a,[["exit",u,t]]),pe(e,o,e.length,a),e}function jo(e,t,n){const r=this;let i=r.events.length,o,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(p){return o?o._inactive?c(p):(l=r.parser.defined.includes(we(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),u):n(p)}function u(p){return p===40?e.attempt(Mo,f,l?f:c)(p):p===91?e.attempt(No,f,l?s:c)(p):l?f(p):c(p)}function s(p){return e.attempt(Ro,f,c)(p)}function f(p){return t(p)}function c(p){return o._balanced=!0,n(p)}}function Ho(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return Y(c)?on(e,o)(c):o(c)}function o(c){return c===41?f(c):_r(e,l,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function l(c){return Y(c)?on(e,u)(c):f(c)}function a(c){return n(c)}function u(c){return c===34||c===39||c===40?Dr(e,s,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):f(c)}function s(c){return Y(c)?on(e,f)(c):f(c)}function f(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Uo(e,t,n){const r=this;return i;function i(a){return Fr.call(r,e,o,l,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(we(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function l(a){return n(a)}}function qo(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const Vo={name:"labelStartImage",resolveAll:xt.resolveAll,tokenize:Wo};function Wo(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),l):n(a)}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Qo={name:"labelStartLink",resolveAll:xt.resolveAll,tokenize:Ko};function Ko(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Mn={name:"lineEnding",tokenize:Yo};function Yo(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),H(e,t,"linePrefix")}}const wn={name:"thematicBreak",tokenize:Xo};function Xo(e,t,n){let r=0,i;return o;function o(s){return e.enter("thematicBreak"),l(s)}function l(s){return i=s,a(s)}function a(s){return s===i?(e.enter("thematicBreakSequence"),u(s)):r>=3&&(s===null||z(s))?(e.exit("thematicBreak"),t(s)):n(s)}function u(s){return s===i?(e.consume(s),r++,u):(e.exit("thematicBreakSequence"),$(s)?H(e,a,"whitespace")(s):a(s))}}const ue={continuation:{tokenize:ea},exit:ta,name:"list",tokenize:Jo},Go={partial:!0,tokenize:ra},Zo={partial:!0,tokenize:na};function Jo(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return a;function a(h){const d=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(d==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:et(h)){if(r.containerState.type||(r.containerState.type=d,e.enter(d,{_container:!0})),d==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(wn,n,s)(h):s(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(h)}return n(h)}function u(h){return et(h)&&++l<10?(e.consume(h),u):(!r.interrupt||l<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),s(h)):n(h)}function s(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(hn,r.interrupt?n:f,e.attempt(Go,p,c))}function f(h){return r.containerState.initialBlankLine=!0,o++,p(h)}function c(h){return $(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function ea(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(hn,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,H(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!$(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Zo,t,l)(a))}function l(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,H(e,e.attempt(ue,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function na(e,t,n){const r=this;return H(e,i,"listItemIndent",r.containerState.size+1);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function ta(e){e.exit(this.containerState.type)}function ra(e,t,n){const r=this;return H(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!$(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Ut={name:"setextUnderline",resolveTo:ia,tokenize:la};function ia(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function la(e,t,n){const r=this;let i;return o;function o(s){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=s,l(s)):n(s)}function l(s){return e.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===i?(e.consume(s),a):(e.exit("setextHeadingLineSequence"),$(s)?H(e,u,"lineSuffix")(s):u(s))}function u(s){return s===null||z(s)?(e.exit("setextHeadingLine"),t(s)):n(s)}}const oa={tokenize:aa};function aa(e){const t=this,n=e.attempt(hn,r,e.attempt(this.parser.constructs.flowInitial,i,H(e,e.attempt(this.parser.constructs.flow,i,e.attempt(fo,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ua={resolveAll:Mr()},sa=Or("string"),ca=Or("text");function Or(e){return{resolveAll:Mr(e==="text"?fa:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,l,a);return l;function l(f){return s(f)?o(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return s(f)?(n.exit("data"),o(f)):(n.consume(f),u)}function s(f){if(f===null)return!0;const c=i[f];let p=-1;if(c)for(;++p<c.length;){const h=c[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Mr(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function fa(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,l=-1,a=0,u;for(;o--;){const s=i[o];if(typeof s=="string"){for(l=s.length;s.charCodeAt(l-1)===32;)a++,l--;if(l)break;l=-1}else if(s===-2)u=!0,a++;else if(s!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const s={type:n===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...s.start},r.start.offset===r.end.offset?Object.assign(r,s):(e.splice(n,0,["enter",s,t],["exit",s,t]),n+=2)}n++}return e}const ha={42:ue,43:ue,45:ue,48:ue,49:ue,50:ue,51:ue,52:ue,53:ue,54:ue,55:ue,56:ue,57:ue,62:Pr},pa={91:yo},da={[-2]:On,[-1]:On,32:On},ma={35:Co,42:wn,45:[Ut,wn],60:Ao,61:Ut,95:wn,96:jt,126:jt},ga={38:Lr,92:Tr},ya={[-5]:Mn,[-4]:Mn,[-3]:Mn,33:Vo,38:Lr,42:nt,60:[Wl,Do],91:Qo,92:[wo,Tr],93:xt,95:nt,96:lo},xa={null:[nt,ua]},ka={null:[42,95]},ba={null:[]},wa=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ka,contentInitial:pa,disable:ba,document:ha,flow:ma,flowInitial:da,insideSpan:xa,string:ga,text:ya},Symbol.toStringTag,{value:"Module"}));function Sa(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let l=[],a=[];const u={attempt:N(F),check:N(b),consume:C,enter:v,exit:_,interrupt:N(b,{interrupt:!0})},s={code:null,containerState:{},defineSkip:x,events:[],now:d,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:c};let f=t.tokenize.call(s,u);return t.resolveAll&&o.push(t),s;function c(T){return l=xe(l,T),S(),l[l.length-1]!==null?[]:(W(t,0),s.events=Ln(o,s.events,s),s.events)}function p(T,L){return va(h(T),L)}function h(T){return Ca(l,T)}function d(){const{_bufferIndex:T,_index:L,line:V,column:Q,offset:R}=r;return{_bufferIndex:T,_index:L,line:V,column:Q,offset:R}}function x(T){i[T.line]=T.column,k()}function S(){let T;for(;r._index<l.length;){const L=l[r._index];if(typeof L=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<L.length;)y(L.charCodeAt(r._bufferIndex));else y(L)}}function y(T){f=f(T)}function C(T){z(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,k()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=T}function v(T,L){const V=L||{};return V.type=T,V.start=d(),s.events.push(["enter",V,s]),a.push(V),V}function _(T){const L=a.pop();return L.end=d(),s.events.push(["exit",L,s]),L}function F(T,L){W(T,L.from)}function b(T,L){L.restore()}function N(T,L){return V;function V(Q,R,ne){let te,ae,de,m;return Array.isArray(Q)?me(Q):"tokenize"in Q?me([Q]):ce(Q);function ce(q){return re;function re(le){const Se=le!==null&&q[le],ge=le!==null&&q.null,mn=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return me(mn)(le)}}function me(q){return te=q,ae=0,q.length===0?ne:g(q[ae])}function g(q){return re;function re(le){return m=j(),de=q,q.partial||(s.currentConstruct=q),q.name&&s.parser.constructs.disable.null.includes(q.name)?U():q.tokenize.call(L?Object.assign(Object.create(s),L):s,u,P,U)(le)}}function P(q){return T(de,m),R}function U(q){return m.restore(),++ae<te.length?g(te[ae]):ne}}}function W(T,L){T.resolveAll&&!o.includes(T)&&o.push(T),T.resolve&&pe(s.events,L,s.events.length-L,T.resolve(s.events.slice(L),s)),T.resolveTo&&(s.events=T.resolveTo(s.events,s))}function j(){const T=d(),L=s.previous,V=s.currentConstruct,Q=s.events.length,R=Array.from(a);return{from:Q,restore:ne};function ne(){r=T,s.previous=L,s.currentConstruct=V,s.events.length=Q,a=R,k()}}function k(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ca(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,o)];else{if(l=e.slice(n,i),r>-1){const a=l[0];typeof a=="string"?l[0]=a.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function va(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
1
+ import{c as A,y as Be,I as pt,j as Z,l as Fe,o as Pn,t as G,b as M,m as Le,e as J,B as gn,C as qi,n as Vi,f as Te,s as kr,k as sn,F as Ye,g as dt,x as mt,u as Gn,L as Wi,E as Qi,$ as Re,z as Ki,A as Ft,D as Zn,G as Yi,M as Dt,J as br,K as Xi,N as Gi,H as Zi,O as Ji,q as el,P as nl,Q as tl,R as rl,U as il}from"./index-CPpALji7.js";var wr={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};wr.node;var ll=e=>A(pt,Be(e,{icon:wr})),ol=ll,Sr={name:"dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]};Sr.node;var al=e=>A(pt,Be(e,{icon:Sr})),ul=al,Cr={name:"square-function",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]],aliases:["function-square"]};Cr.node;var sl=e=>A(pt,Be(e,{icon:Cr})),cl=sl;function fl(e){const[t,n]=Z(!1),r=()=>n(!1);return Fe(()=>{e.contentKey();const i=e.isOpen(),o=e.viewMode(),l=e.hasSelection(),a=e.loading();if(!i||o!=="preview"||!l||a){n(!1);return}t()||queueMicrotask(()=>{const u=e.contentContainerEl();if(!u)return;const s=u.querySelector(".md-selected-range");s&&(n(!0),s.scrollIntoView({block:"center"}))})}),{resetAutoScroll:r}}async function hl(e){const n=await(e.fetchImpl??fetch)(`/api/files/content?path=${encodeURIComponent(e.path)}`,{signal:e.signal});if(!n.ok)throw new Error(`Failed to load file: ${n.status} ${n.statusText}`);return await n.text()}function pl(e){const[t,n]=Z(""),[r,i]=Z(!1),[o,l]=Z(null),[a,u]=Z(null),[s,f]=Z(0),c=()=>f(p=>p+1);return Fe(()=>{if(s(),!e.isOpen()||!e.filePath()){n(""),l(null),i(!1),u(null);return}const p=e.filePath(),h=new AbortController;i(!0),l(null),n(""),u(null),(async()=>{try{const d=await hl({path:p,fetchImpl:e.fetchImpl,signal:h.signal});if(h.signal.aborted)return;n(d),u(d.split(/\r?\n/).length)}catch(d){if(d?.name==="AbortError")return;l(d.message??String(d))}finally{h.signal.aborted||i(!1)}})(),Pn(()=>h.abort())}),{rawCode:t,loading:r,error:o,totalLines:a,reload:c}}function Jn(e){const t=e.toLowerCase();return t.endsWith(".tsx")?"tsx":t.endsWith(".ts")?"ts":t.endsWith(".jsx")?"jsx":t.endsWith(".js")?"js":t.endsWith(".json")?"json":t.endsWith(".py")||t.endsWith(".ipynb")?"python":t.endsWith(".md")?"md":t.endsWith(".html")||t.endsWith(".htm")?"html":t.endsWith(".css")?"css":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":t.endsWith(".toml")?"toml":t.endsWith(".sh")||t.endsWith(".bash")||t.endsWith(".zsh")?"bash":"txt"}function dl(e){const[t,n]=Z(""),[r,i]=Z(null),[o,l]=Z(null),[a,u]=Z(!1),[s,f]=Z(null);let c,p=0;const h=()=>c||(c=new Worker(new URL("/assets/highlight.worker-C64dOQ1-.js",import.meta.url),{type:"module"}),c.onmessage=d=>{const x=d.data;if(x.id===p){if(x.error){f(`Could not highlight this file: ${x.error}`),n("");return}f(null),n(x.html??""),i(x.start??null),l(x.end??null),u(!!x.wasIndentationReduced)}},c.onerror=d=>{p++,c?.terminate(),c=void 0,f(`Syntax highlighting failed: ${d.message}`),n("")},c);return Fe(()=>{const d=e.rawCode(),x=e.filePath(),S=e.lineFilterEnabled(),y=e.lineOffset(),C=e.reduceIndentation(),v=e.targetStart(),_=e.targetEnd(),F=++p;if(f(null),!d||!x){n(""),i(null),l(null),u(!1);return}const b=typeof v=="number"&&typeof _=="number"?{start:v,end:_}:null;try{h().postMessage({id:F,text:d,language:Jn(x),useLineFilter:S,offset:y,target:b,reduceIndentation:C})}catch(N){f(`Could not start syntax highlighting: ${String(N)}`)}}),Pn(()=>{p++,c?.terminate()}),{highlightedHtml:t,displayStartLine:r,displayEndLine:o,wasIndentationReduced:a,highlightError:s}}function Ce(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);if(Number.isFinite(t))return t}return null}function We(e){const t=e;return t?.name==="(body)"||t?.type==="function_body"||t?.type==="file_body"}function Sn(e){const t=e;if(!t||!Array.isArray(t.children))return[];const n=t.children.filter(r=>!We(r));if(n.length===0){const r=t.children.find(i=>We(i)&&Array.isArray(i.children)&&i.children.length>0);if(r)return r.children.filter(i=>!We(i))}return n}function vr(e,t){if(!e)return[];if(!t)return[e];const n=t.start,r=t.end,i=[e];let o=e,l=0;for(;l<100;){l++;const a=Sn(o);if(!a?.length)break;const u=a.reduce((x,S)=>{const y=Ce(S?.start_line),C=Ce(S?.end_line);if(!S||y===null||C===null||!(y<=n&&C>=r))return x;if(!x)return S;const _=Ce(x?.start_line),F=Ce(x?.end_line);if(_===null||F===null)return S;const b=F-_,N=C-y;if(N<b)return S;if(N>b)return x;const W=_===n&&F===r,j=y===n&&C===r;return j!==W&&j?S:x},null);if(!u)break;const s=Ce(o?.start_line),f=Ce(o?.end_line),c=Ce(u?.start_line),p=Ce(u?.end_line),h=s!==null&&f!==null?f-s:Number.POSITIVE_INFINITY,d=c!==null&&p!==null?p-c:Number.POSITIVE_INFINITY;if(d>h||d===h&&!Sn(u).some(y=>{const C=Ce(y?.start_line),v=Ce(y?.end_line);return!y||C===null||v===null||!(C<=n&&v>=r)?!1:v-C<d}))break;i.push(u),o=u}return i}function ml(e,t){return e.length>0?e[e.length-1]:t}var gl=G('<div class="ml-4 flex items-center rounded-md border border-[var(--plc-border)] bg-[var(--plc-surface-muted)] p-0.5">'),yl=G('<span class="ml-4 text-[10px] text-[var(--plc-warning)] italic animate-pulse">Indentation reduced'),xl=G('<label class="ml-3 flex items-center gap-1 text-[11px] text-[var(--plc-on-muted)]"><input type=checkbox><span>Limit to selection</span><span class="ml-2 flex items-center gap-1"><span>±</span><span>lines'),kl=G('<header class="flex min-h-12 items-center justify-between border-b border-[var(--plc-border)] bg-[var(--plc-surface)] px-4 py-2 text-sm"><div class="flex min-w-0 flex-col"><span class="truncate font-semibold text-[var(--plc-on-surface)]"></span><span class="truncate text-[11px] text-[var(--plc-on-subtle)]"></span></div><div class="flex items-center"><a class="ml-2 inline-flex h-7 items-center justify-center gap-1 rounded-md border border-[var(--plc-success-border)] bg-[var(--plc-success-subtle)] px-2 text-xs font-semibold text-[var(--plc-success)] no-underline transition-colors hover:border-[var(--plc-success)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--plc-border-focus)]"target=_blank>Open'),bl=G('<span class="truncate text-[10px] text-[var(--plc-on-disabled)]">');function wl(e){return(()=>{var t=kl(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,o=n.nextSibling,l=o.firstChild;return M(r,()=>e.baseName),M(i,()=>e.filePath),M(n,A(J,{get when(){return Le(()=>!!e.hasLineRange())()&&e.rangeLabel()},children:a=>(()=>{var u=bl();return M(u,a),u})()}),null),M(t,A(gn,{class:"ml-4",get onClick(){return e.onClose},children:"Close"}),o),M(t,A(gn,{variant:"primary",class:"ml-2",onClick:()=>{navigator.clipboard.writeText(e.rawCode())},children:"Copy"}),o),M(t,A(J,{get when(){return e.isMarkdown()},get children(){var a=gl();return M(a,A(gn,{variant:"tab",size:"xs",get active(){return e.viewMode()==="code"},class:"rounded-sm px-3 font-semibold",onClick:()=>e.setViewMode("code"),children:"Code"}),null),M(a,A(gn,{variant:"tab",size:"xs",get active(){return e.viewMode()==="preview"},class:"rounded-sm px-3 font-semibold",onClick:()=>e.setViewMode("preview"),children:"Preview"}),null),a}}),o),M(o,A(J,{get when(){return e.wasIndentationReduced()},get children(){return yl()}}),l),M(o,A(qi,{class:"ml-3 text-[11px]",get checked(){return e.reduceIndentation()},get onChange(){return e.setReduceIndentation},title:"Strip common indentation to save horizontal space",label:"Reduce indent"}),l),M(o,A(J,{get when(){return e.hasLineRange()},get children(){var a=xl(),u=a.firstChild,s=u.nextSibling,f=s.nextSibling,c=f.firstChild,p=c.nextSibling;return u.addEventListener("change",h=>e.setLineFilterEnabled(h.currentTarget.checked)),M(f,A(Vi,{type:"number",min:"0",size:"sm",class:"w-12 px-1 text-[11px]",get value(){return e.lineOffset()},onInput:h=>{const d=Number(h.currentTarget.value);e.setLineOffset(Number.isNaN(d)?0:d)}}),p),Te(()=>u.checked=e.lineFilterEnabled()),a}}),l),Te(()=>kr(l,"href",`vscode://file/${e.filePath}`)),t})()}var Sl=G('<div class="sticky top-0 z-20 border-b border-[var(--plc-border)] bg-[var(--plc-surface)]/95 backdrop-blur px-3 py-2"><div class="flex items-center gap-1 min-w-0"><div class=flex-1></div><span class="text-[10px] text-[var(--plc-on-subtle)] font-mono tabular-nums">L'),Cl=G("<button>"),vl=G('<span class="text-[var(--plc-on-disabled)] text-[11px] select-none px-1">›');function Il(e){if(!e)return"";const t=e.split(/[\\/]/);return t[t.length-1]||e}function Dn(e){return e?`${e?.type??""}|${e?.name??""}|${e?.start_line??""}|${e?.end_line??""}`:""}function El(e,t){return!e||!t?!1:e===t?!0:Dn(e)!==""&&Dn(e)===Dn(t)}function Al(e,t){if(!e||!t)return null;const n=[],r=new Set,i=l=>{if(!l||r.has(l))return!1;if(r.add(l),El(l,t))return n.push(l),!0;const a=Sn(l);for(const u of a)if(i(u))return n.push(l),!0;return!1};return i(e)?n.reverse():null}function Pl(e){const t=sn(()=>{const i=e.root(),o=e.selectedNode?.()??null;return!i||!o?null:Al(i,o)}),n=sn(()=>{const i=t();if(i&&i.length)return i.filter(s=>!We(s));const o=e.root(),l=e.selection?.()??null,a=e.currentLine();if(!o||typeof a!="number"||a<=0)return[];const u=l&&typeof l.start=="number"&&typeof l.end=="number"?l:{start:a,end:a};return!o||typeof u.start!="number"||typeof u.end!="number"?[]:vr(o,u).filter(s=>!We(s))}),r=()=>Il(e.filePath());return A(J,{get when(){return n().length>0},get children(){var i=Sl(),o=i.firstChild,l=o.firstChild,a=l.nextSibling;return a.firstChild,M(o,A(Ye,{get each(){return n()},children:(u,s)=>{const f=()=>u,c=()=>s()===n().length-1,p=()=>s()===0?r()||f().name||"file":f().name;return[(()=>{var h=Cl();return h.$$click=()=>{if(c())return;const d=s()===0?null:f();e.onSelectScope(d)},M(h,p),Te(d=>{var x=`text-[11px] truncate max-w-[260px] ${c()?"text-[var(--plc-on-surface)] font-semibold cursor-default":"text-[var(--plc-accent)] hover:text-[var(--plc-accent-hover)] hover:underline"}`,S=p();return x!==d.e&&dt(h,d.e=x),S!==d.t&&kr(h,"title",d.t=S),d},{e:void 0,t:void 0}),h})(),A(J,{get when(){return!c()},get children(){return vl()}})]}}),l),M(a,()=>e.currentLine(),null),i}})}mt(["click"]);var Tl=G("<div class=code-modal-content>"),Ll=G('<div class="flex h-full min-h-0"><div class="flex-1 min-w-0 overflow-auto"><div class="sticky top-0 z-20">');function zl(e){const[t,n]=Z(1);let r,i;const o=()=>!e.loading()&&!e.error()&&e.highlightedHtml(),l=()=>{const a=r;if(!a)return;const u=a.querySelectorAll("span.line");if(!u.length)return;const f=u[0].getBoundingClientRect().height||16,c=i?.offsetHeight??0,p=a.getBoundingClientRect().top+c+2;let h=Math.floor(a.scrollTop/f);h=Math.max(0,Math.min(u.length-1,h));const d=Math.max(0,h-30),x=Math.min(u.length-1,h+30);let S=h;for(let y=d;y<=x;y++)if(u[y].getBoundingClientRect().bottom>p){S=y;break}n(e.displayStartLine()+S)};return Fe(()=>{e.highlightedHtml(),queueMicrotask(()=>l())}),Fe(()=>{e.displayStartLine(),queueMicrotask(()=>l())}),Fe(()=>{const a=r;if(!a)return;let u=0;const s=()=>{u||(u=requestAnimationFrame(()=>{u=0,l()}))};a.addEventListener("scroll",s,{passive:!0}),Pn(()=>{a.removeEventListener("scroll",s),u&&cancelAnimationFrame(u)})}),(()=>{var a=Ll(),u=a.firstChild,s=u.firstChild;return Gn(f=>r=f,u),Gn(f=>i=f,s),M(s,A(Pl,{get root(){return e.fileNode},get selectedNode(){return e.selectedScopeNode},get filePath(){return e.filePath},currentLine:t,selection:()=>{const f=e.targetStartLine?.(),c=e.targetEndLine?.();return typeof f=="number"&&typeof c=="number"?{start:f,end:c}:null},get onSelectScope(){return e.onSelectScope}})),M(u,A(J,{get when(){return e.loading()||!e.highlightedHtml()&&!e.error()},get children(){return A(Wi,{label:"Loading file..."})}}),null),M(u,A(J,{get when(){return Le(()=>!e.loading())()&&e.error()},get children(){return A(Qi,{get message(){return e.error()},class:"min-h-32"})}}),null),M(u,A(J,{get when(){return o()},get children(){var f=Tl();return Te(()=>f.innerHTML=e.highlightedHtml()),f}}),null),a})()}const _l={};function gt(e,t){const n=_l,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ir(e,r,i)}function Ir(e,t,n){if(Fl(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Ot(e.children,t,n)}return Array.isArray(e)?Ot(e,t,n):""}function Ot(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ir(e[i],t,n);return r.join("")}function Fl(e){return!!(e&&typeof e=="object")}const Mt=document.createElement("i");function yt(e){const t="&"+e+";";Mt.innerHTML=t;const n=Mt.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function pe(e,t,n,r){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function xe(e,t){return e.length>0?(pe(e,e.length,0,t),e):t}const Nt={}.hasOwnProperty;function Er(e){const t={};let n=-1;for(;++n<e.length;)Dl(t,e[n]);return t}function Dl(e,t){let n;for(n in t){const i=(Nt.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){Nt.call(i,l)||(i[l]=[]);const a=o[l];Ol(i[l],Array.isArray(a)?a:a?[a]:[])}}}function Ol(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);pe(e,0,0,r)}function Ar(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function we(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const oe=Oe(/[A-Za-z]/),ie=Oe(/[\dA-Za-z]/),Ml=Oe(/[#-'*+\--9=?A-Z^-~]/);function Cn(e){return e!==null&&(e<32||e===127)}const et=Oe(/\d/),Nl=Oe(/[\dA-Fa-f]/),Rl=Oe(/[!-/:-@[-`{-~]/);function z(e){return e!==null&&e<-2}function Y(e){return e!==null&&(e<0||e===32)}function $(e){return e===-2||e===-1||e===32}const Tn=Oe(new RegExp("\\p{P}|\\p{S}","u")),$e=Oe(/\s/);function Oe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ze(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&ie(e.charCodeAt(n+1))&&ie(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(l=String.fromCharCode(o,a),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function H(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(u){return $(u)?(e.enter(n),a(u)):t(u)}function a(u){return $(u)&&o++<i?(e.consume(u),a):(e.exit(n),t(u))}}const $l={tokenize:Bl};function Bl(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),H(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(a)}function l(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return z(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),l)}}const jl={tokenize:Hl},Rt={tokenize:Ul};function Hl(e){const t=this,n=[];let r=0,i,o,l;return a;function a(v){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,u,s)(v)}return s(v)}function u(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&C();const _=t.events.length;let F=_,b;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){b=t.events[F][1].end;break}y(r);let N=_;for(;N<t.events.length;)t.events[N][1].end={...b},N++;return pe(t.events,F+1,0,t.events.slice(_)),t.events.length=N,s(v)}return a(v)}function s(v){if(r===n.length){if(!i)return p(v);if(i.currentConstruct&&i.currentConstruct.concrete)return d(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Rt,f,c)(v)}function f(v){return i&&C(),y(r),p(v)}function c(v){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,d(v)}function p(v){return t.containerState={},e.attempt(Rt,h,d)(v)}function h(v){return r++,n.push([t.currentConstruct,t.containerState]),p(v)}function d(v){if(v===null){i&&C(),y(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),x(v)}function x(v){if(v===null){S(e.exit("chunkFlow"),!0),y(0),e.consume(v);return}return z(v)?(e.consume(v),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),x)}function S(v,_){const F=t.sliceStream(v);if(_&&F.push(null),v.previous=o,o&&(o.next=v),o=v,i.defineSkip(v.start),i.write(F),t.parser.lazy[v.start.line]){let b=i.events.length;for(;b--;)if(i.events[b][1].start.offset<l&&(!i.events[b][1].end||i.events[b][1].end.offset>l))return;const N=t.events.length;let W=N,j,k;for(;W--;)if(t.events[W][0]==="exit"&&t.events[W][1].type==="chunkFlow"){if(j){k=t.events[W][1].end;break}j=!0}for(y(r),b=N;b<t.events.length;)t.events[b][1].end={...k},b++;pe(t.events,W+1,0,t.events.slice(N)),t.events.length=b}}function y(v){let _=n.length;for(;_-- >v;){const F=n[_];t.containerState=F[1],F[0].exit.call(t,e)}n.length=v}function C(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ul(e,t,n){return H(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xe(e){if(e===null||Y(e)||$e(e))return 1;if(Tn(e))return 2}function Ln(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const nt={name:"attention",resolveAll:ql,tokenize:Vl};function ql(e,t){let n=-1,r,i,o,l,a,u,s,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};$t(c,-u),$t(p,u),l={type:u>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...a.end}},e[r][1].end={...l.start},e[n][1].start={...a.end},s=[],e[r][1].end.offset-e[r][1].start.offset&&(s=xe(s,[["enter",e[r][1],t],["exit",e[r][1],t]])),s=xe(s,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),s=xe(s,Ln(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),s=xe(s,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,s=xe(s,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,pe(e,r-1,n-r+3,s),n=r+s.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Vl(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Xe(r);let o;return l;function l(u){return o=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===o)return e.consume(u),a;const s=e.exit("attentionSequence"),f=Xe(u),c=!f||f===2&&i||n.includes(u),p=!i||i===2&&f||n.includes(r);return s._open=!!(o===42?c:c&&(i||!p)),s._close=!!(o===42?p:p&&(f||!c)),t(u)}}function $t(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Wl={name:"autolink",tokenize:Ql};function Ql(e,t,n){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(h){return oe(h)?(e.consume(h),l):h===64?n(h):s(h)}function l(h){return h===43||h===45||h===46||ie(h)?(r=1,a(h)):s(h)}function a(h){return h===58?(e.consume(h),r=0,u):(h===43||h===45||h===46||ie(h))&&r++<32?(e.consume(h),a):(r=0,s(h))}function u(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||Cn(h)?n(h):(e.consume(h),u)}function s(h){return h===64?(e.consume(h),f):Ml(h)?(e.consume(h),s):n(h)}function f(h){return ie(h)?c(h):n(h)}function c(h){return h===46?(e.consume(h),r=0,f):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||ie(h))&&r++<63){const d=h===45?p:c;return e.consume(h),d}return n(h)}}const hn={partial:!0,tokenize:Kl};function Kl(e,t,n){return r;function r(o){return $(o)?H(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||z(o)?t(o):n(o)}}const Pr={continuation:{tokenize:Xl},exit:Gl,name:"blockQuote",tokenize:Yl};function Yl(e,t,n){const r=this;return i;function i(l){if(l===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return $(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function Xl(e,t,n){const r=this;return i;function i(l){return $(l)?H(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(Pr,t,n)(l)}}function Gl(e){e.exit("blockQuote")}const Tr={name:"characterEscape",tokenize:Zl};function Zl(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return Rl(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Lr={name:"characterReference",tokenize:Jl};function Jl(e,t,n){const r=this;let i=0,o,l;return a;function a(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),u}function u(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),o=31,l=ie,f(c))}function s(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=Nl,f):(e.enter("characterReferenceValue"),o=7,l=et,f(c))}function f(c){if(c===59&&i){const p=e.exit("characterReferenceValue");return l===ie&&!yt(r.sliceSerialize(p))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(c)&&i++<o?(e.consume(c),f):n(c)}}const Bt={partial:!0,tokenize:no},jt={concrete:!0,name:"codeFenced",tokenize:eo};function eo(e,t,n){const r=this,i={partial:!0,tokenize:F};let o=0,l=0,a;return u;function u(b){return s(b)}function s(b){const N=r.events[r.events.length-1];return o=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(b)}function f(b){return b===a?(l++,e.consume(b),f):l<3?n(b):(e.exit("codeFencedFenceSequence"),$(b)?H(e,c,"whitespace")(b):c(b))}function c(b){return b===null||z(b)?(e.exit("codeFencedFence"),r.interrupt?t(b):e.check(Bt,x,_)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===null||z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(b)):$(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),H(e,h,"whitespace")(b)):b===96&&b===a?n(b):(e.consume(b),p)}function h(b){return b===null||z(b)?c(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(b))}function d(b){return b===null||z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(b)):b===96&&b===a?n(b):(e.consume(b),d)}function x(b){return e.attempt(i,_,S)(b)}function S(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y}function y(b){return o>0&&$(b)?H(e,C,"linePrefix",o+1)(b):C(b)}function C(b){return b===null||z(b)?e.check(Bt,x,_)(b):(e.enter("codeFlowValue"),v(b))}function v(b){return b===null||z(b)?(e.exit("codeFlowValue"),C(b)):(e.consume(b),v)}function _(b){return e.exit("codeFenced"),t(b)}function F(b,N,W){let j=0;return k;function k(R){return b.enter("lineEnding"),b.consume(R),b.exit("lineEnding"),T}function T(R){return b.enter("codeFencedFence"),$(R)?H(b,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):L(R)}function L(R){return R===a?(b.enter("codeFencedFenceSequence"),V(R)):W(R)}function V(R){return R===a?(j++,b.consume(R),V):j>=l?(b.exit("codeFencedFenceSequence"),$(R)?H(b,Q,"whitespace")(R):Q(R)):W(R)}function Q(R){return R===null||z(R)?(b.exit("codeFencedFence"),N(R)):W(R)}}}function no(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const On={name:"codeIndented",tokenize:ro},to={partial:!0,tokenize:io};function ro(e,t,n){const r=this;return i;function i(s){return e.enter("codeIndented"),H(e,o,"linePrefix",5)(s)}function o(s){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(s):n(s)}function l(s){return s===null?u(s):z(s)?e.attempt(to,l,u)(s):(e.enter("codeFlowValue"),a(s))}function a(s){return s===null||z(s)?(e.exit("codeFlowValue"),l(s)):(e.consume(s),a)}function u(s){return e.exit("codeIndented"),t(s)}}function io(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):z(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):H(e,o,"linePrefix",5)(l)}function o(l){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(l):z(l)?i(l):n(l)}}const lo={name:"codeText",previous:ao,resolve:oo,tokenize:uo};function oo(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ao(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uo(e,t,n){let r=0,i,o;return l;function l(c){return e.enter("codeText"),e.enter("codeTextSequence"),a(c)}function a(c){return c===96?(e.consume(c),r++,a):(e.exit("codeTextSequence"),u(c))}function u(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),u):c===96?(o=e.enter("codeTextSequence"),i=0,f(c)):z(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):(e.enter("codeTextData"),s(c))}function s(c){return c===null||c===32||c===96||z(c)?(e.exit("codeTextData"),u(c)):(e.consume(c),s)}function f(c){return c===96?(e.consume(c),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(o.type="codeTextData",s(c))}}class so{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&tn(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),tn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),tn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);tn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);tn(this.left,n.reverse())}}}function tn(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zr(e){const t={};let n=-1,r,i,o,l,a,u,s;const f=new so(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,co(f,n)),n=t[n],s=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(l=f.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},a=f.slice(i,n),a.unshift(r),f.splice(i,n-i+1,a))}}return pe(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!s}function co(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const a=l.events,u=[],s={};let f,c,p=-1,h=n,d=0,x=0;const S=[x];for(;h;){for(;e.get(++i)[1]!==h;);o.push(i),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),c&&l.defineSkip(h.start),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(f),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),c=h,h=h.next}for(h=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(x=p+1,S.push(x),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(l.events=[],h?(h._tokenizer=void 0,h.previous=void 0):S.pop(),p=S.length;p--;){const y=a.slice(S[p],S[p+1]),C=o.pop();u.push([C,C+y.length-1]),e.splice(C,2,y)}for(u.reverse(),p=-1;++p<u.length;)s[d+u[p][0]]=d+u[p][1],d+=u[p][1]-u[p][0]-1;return s}const fo={resolve:po,tokenize:mo},ho={partial:!0,tokenize:go};function po(e){return zr(e),e}function mo(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):z(a)?e.check(ho,l,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function l(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function go(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),H(e,o,"linePrefix")}function o(l){if(l===null||z(l))return n(l);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function _r(e,t,n,r,i,o,l,a,u){const s=u||Number.POSITIVE_INFINITY;let f=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(y),e.exit(o),p):y===null||y===32||y===41||Cn(y)?n(y):(e.enter(r),e.enter(l),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(a),p(y)):y===null||y===60||z(y)?n(y):(e.consume(y),y===92?d:h)}function d(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function x(y){return!f&&(y===null||y===41||Y(y))?(e.exit("chunkString"),e.exit(a),e.exit(l),e.exit(r),t(y)):f<s&&y===40?(e.consume(y),f++,x):y===41?(e.consume(y),f--,x):y===null||y===32||y===40||Cn(y)?n(y):(e.consume(y),y===92?S:x)}function S(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function Fr(e,t,n,r,i,o){const l=this;let a=0,u;return s;function s(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(o),f}function f(h){return a>999||h===null||h===91||h===93&&!u||h===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?n(h):h===93?(e.exit(o),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):z(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===null||h===91||h===93||z(h)||a++>999?(e.exit("chunkString"),f(h)):(e.consume(h),u||(u=!$(h)),h===92?p:c)}function p(h){return h===91||h===92||h===93?(e.consume(h),a++,c):c(h)}}function Dr(e,t,n,r,i,o){let l;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,u):n(p)}function u(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(o),s(p))}function s(p){return p===l?(e.exit(o),u(l)):p===null?n(p):z(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),H(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===l||p===null||z(p)?(e.exit("chunkString"),s(p)):(e.consume(p),p===92?c:f)}function c(p){return p===l||p===92?(e.consume(p),f):f(p)}}function on(e,t){let n;return r;function r(i){return z(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):$(i)?H(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const yo={name:"definition",tokenize:ko},xo={partial:!0,tokenize:bo};function ko(e,t,n){const r=this;let i;return o;function o(h){return e.enter("definition"),l(h)}function l(h){return Fr.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=we(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),u):n(h)}function u(h){return Y(h)?on(e,s)(h):s(h)}function s(h){return _r(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(xo,c,c)(h)}function c(h){return $(h)?H(e,p,"whitespace")(h):p(h)}function p(h){return h===null||z(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function bo(e,t,n){return r;function r(a){return Y(a)?on(e,i)(a):n(a)}function i(a){return Dr(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return $(a)?H(e,l,"whitespace")(a):l(a)}function l(a){return a===null||z(a)?t(a):n(a)}}const wo={name:"hardBreakEscape",tokenize:So};function So(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return z(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const Co={name:"headingAtx",resolve:vo,tokenize:Io};function vo(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},pe(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function Io(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),o(f)}function o(f){return e.enter("atxHeadingSequence"),l(f)}function l(f){return f===35&&r++<6?(e.consume(f),l):f===null||Y(f)?(e.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),u(f)):f===null||z(f)?(e.exit("atxHeading"),t(f)):$(f)?H(e,a,"whitespace")(f):(e.enter("atxHeadingText"),s(f))}function u(f){return f===35?(e.consume(f),u):(e.exit("atxHeadingSequence"),a(f))}function s(f){return f===null||f===35||Y(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),s)}}const Eo=["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"],Ht=["pre","script","style","textarea"],Ao={concrete:!0,name:"htmlFlow",resolveTo:Lo,tokenize:zo},Po={partial:!0,tokenize:Fo},To={partial:!0,tokenize:_o};function Lo(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function zo(e,t,n){const r=this;let i,o,l,a,u;return s;function s(g){return f(g)}function f(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),p):g===47?(e.consume(g),o=!0,x):g===63?(e.consume(g),i=3,r.interrupt?t:m):oe(g)?(e.consume(g),l=String.fromCharCode(g),S):n(g)}function p(g){return g===45?(e.consume(g),i=2,h):g===91?(e.consume(g),i=5,a=0,d):oe(g)?(e.consume(g),i=4,r.interrupt?t:m):n(g)}function h(g){return g===45?(e.consume(g),r.interrupt?t:m):n(g)}function d(g){const P="CDATA[";return g===P.charCodeAt(a++)?(e.consume(g),a===P.length?r.interrupt?t:L:d):n(g)}function x(g){return oe(g)?(e.consume(g),l=String.fromCharCode(g),S):n(g)}function S(g){if(g===null||g===47||g===62||Y(g)){const P=g===47,U=l.toLowerCase();return!P&&!o&&Ht.includes(U)?(i=1,r.interrupt?t(g):L(g)):Eo.includes(l.toLowerCase())?(i=6,P?(e.consume(g),y):r.interrupt?t(g):L(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):o?C(g):v(g))}return g===45||ie(g)?(e.consume(g),l+=String.fromCharCode(g),S):n(g)}function y(g){return g===62?(e.consume(g),r.interrupt?t:L):n(g)}function C(g){return $(g)?(e.consume(g),C):k(g)}function v(g){return g===47?(e.consume(g),k):g===58||g===95||oe(g)?(e.consume(g),_):$(g)?(e.consume(g),v):k(g)}function _(g){return g===45||g===46||g===58||g===95||ie(g)?(e.consume(g),_):F(g)}function F(g){return g===61?(e.consume(g),b):$(g)?(e.consume(g),F):v(g)}function b(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),u=g,N):$(g)?(e.consume(g),b):W(g)}function N(g){return g===u?(e.consume(g),u=null,j):g===null||z(g)?n(g):(e.consume(g),N)}function W(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||Y(g)?F(g):(e.consume(g),W)}function j(g){return g===47||g===62||$(g)?v(g):n(g)}function k(g){return g===62?(e.consume(g),T):n(g)}function T(g){return g===null||z(g)?L(g):$(g)?(e.consume(g),T):n(g)}function L(g){return g===45&&i===2?(e.consume(g),ne):g===60&&i===1?(e.consume(g),te):g===62&&i===4?(e.consume(g),ce):g===63&&i===3?(e.consume(g),m):g===93&&i===5?(e.consume(g),de):z(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Po,me,V)(g)):g===null||z(g)?(e.exit("htmlFlowData"),V(g)):(e.consume(g),L)}function V(g){return e.check(To,Q,me)(g)}function Q(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),R}function R(g){return g===null||z(g)?V(g):(e.enter("htmlFlowData"),L(g))}function ne(g){return g===45?(e.consume(g),m):L(g)}function te(g){return g===47?(e.consume(g),l="",ae):L(g)}function ae(g){if(g===62){const P=l.toLowerCase();return Ht.includes(P)?(e.consume(g),ce):L(g)}return oe(g)&&l.length<8?(e.consume(g),l+=String.fromCharCode(g),ae):L(g)}function de(g){return g===93?(e.consume(g),m):L(g)}function m(g){return g===62?(e.consume(g),ce):g===45&&i===2?(e.consume(g),m):L(g)}function ce(g){return g===null||z(g)?(e.exit("htmlFlowData"),me(g)):(e.consume(g),ce)}function me(g){return e.exit("htmlFlow"),t(g)}}function _o(e,t,n){const r=this;return i;function i(l){return z(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function Fo(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(hn,t,n)}}const Do={name:"htmlText",tokenize:Oo};function Oo(e,t,n){const r=this;let i,o,l;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),s):m===47?(e.consume(m),F):m===63?(e.consume(m),v):oe(m)?(e.consume(m),W):n(m)}function s(m){return m===45?(e.consume(m),f):m===91?(e.consume(m),o=0,d):oe(m)?(e.consume(m),C):n(m)}function f(m){return m===45?(e.consume(m),h):n(m)}function c(m){return m===null?n(m):m===45?(e.consume(m),p):z(m)?(l=c,te(m)):(e.consume(m),c)}function p(m){return m===45?(e.consume(m),h):c(m)}function h(m){return m===62?ne(m):m===45?p(m):c(m)}function d(m){const ce="CDATA[";return m===ce.charCodeAt(o++)?(e.consume(m),o===ce.length?x:d):n(m)}function x(m){return m===null?n(m):m===93?(e.consume(m),S):z(m)?(l=x,te(m)):(e.consume(m),x)}function S(m){return m===93?(e.consume(m),y):x(m)}function y(m){return m===62?ne(m):m===93?(e.consume(m),y):x(m)}function C(m){return m===null||m===62?ne(m):z(m)?(l=C,te(m)):(e.consume(m),C)}function v(m){return m===null?n(m):m===63?(e.consume(m),_):z(m)?(l=v,te(m)):(e.consume(m),v)}function _(m){return m===62?ne(m):v(m)}function F(m){return oe(m)?(e.consume(m),b):n(m)}function b(m){return m===45||ie(m)?(e.consume(m),b):N(m)}function N(m){return z(m)?(l=N,te(m)):$(m)?(e.consume(m),N):ne(m)}function W(m){return m===45||ie(m)?(e.consume(m),W):m===47||m===62||Y(m)?j(m):n(m)}function j(m){return m===47?(e.consume(m),ne):m===58||m===95||oe(m)?(e.consume(m),k):z(m)?(l=j,te(m)):$(m)?(e.consume(m),j):ne(m)}function k(m){return m===45||m===46||m===58||m===95||ie(m)?(e.consume(m),k):T(m)}function T(m){return m===61?(e.consume(m),L):z(m)?(l=T,te(m)):$(m)?(e.consume(m),T):j(m)}function L(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,V):z(m)?(l=L,te(m)):$(m)?(e.consume(m),L):(e.consume(m),Q)}function V(m){return m===i?(e.consume(m),i=void 0,R):m===null?n(m):z(m)?(l=V,te(m)):(e.consume(m),V)}function Q(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||Y(m)?j(m):(e.consume(m),Q)}function R(m){return m===47||m===62||Y(m)?j(m):n(m)}function ne(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function te(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ae}function ae(m){return $(m)?H(e,de,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):de(m)}function de(m){return e.enter("htmlTextData"),l(m)}}const xt={name:"labelEnd",resolveAll:$o,resolveTo:Bo,tokenize:jo},Mo={tokenize:Ho},No={tokenize:Uo},Ro={tokenize:qo};function $o(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&pe(e,0,e.length,n),e}function Bo(e,t){let n=e.length,r=0,i,o,l,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},s={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},f={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return a=[["enter",u,t],["enter",s,t]],a=xe(a,e.slice(o+1,o+r+3)),a=xe(a,[["enter",f,t]]),a=xe(a,Ln(t.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),t)),a=xe(a,[["exit",f,t],e[l-2],e[l-1],["exit",s,t]]),a=xe(a,e.slice(l+1)),a=xe(a,[["exit",u,t]]),pe(e,o,e.length,a),e}function jo(e,t,n){const r=this;let i=r.events.length,o,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(p){return o?o._inactive?c(p):(l=r.parser.defined.includes(we(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),u):n(p)}function u(p){return p===40?e.attempt(Mo,f,l?f:c)(p):p===91?e.attempt(No,f,l?s:c)(p):l?f(p):c(p)}function s(p){return e.attempt(Ro,f,c)(p)}function f(p){return t(p)}function c(p){return o._balanced=!0,n(p)}}function Ho(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return Y(c)?on(e,o)(c):o(c)}function o(c){return c===41?f(c):_r(e,l,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function l(c){return Y(c)?on(e,u)(c):f(c)}function a(c){return n(c)}function u(c){return c===34||c===39||c===40?Dr(e,s,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):f(c)}function s(c){return Y(c)?on(e,f)(c):f(c)}function f(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Uo(e,t,n){const r=this;return i;function i(a){return Fr.call(r,e,o,l,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(we(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function l(a){return n(a)}}function qo(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const Vo={name:"labelStartImage",resolveAll:xt.resolveAll,tokenize:Wo};function Wo(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),l):n(a)}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Qo={name:"labelStartLink",resolveAll:xt.resolveAll,tokenize:Ko};function Ko(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Mn={name:"lineEnding",tokenize:Yo};function Yo(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),H(e,t,"linePrefix")}}const wn={name:"thematicBreak",tokenize:Xo};function Xo(e,t,n){let r=0,i;return o;function o(s){return e.enter("thematicBreak"),l(s)}function l(s){return i=s,a(s)}function a(s){return s===i?(e.enter("thematicBreakSequence"),u(s)):r>=3&&(s===null||z(s))?(e.exit("thematicBreak"),t(s)):n(s)}function u(s){return s===i?(e.consume(s),r++,u):(e.exit("thematicBreakSequence"),$(s)?H(e,a,"whitespace")(s):a(s))}}const ue={continuation:{tokenize:ea},exit:ta,name:"list",tokenize:Jo},Go={partial:!0,tokenize:ra},Zo={partial:!0,tokenize:na};function Jo(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return a;function a(h){const d=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(d==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:et(h)){if(r.containerState.type||(r.containerState.type=d,e.enter(d,{_container:!0})),d==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(wn,n,s)(h):s(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(h)}return n(h)}function u(h){return et(h)&&++l<10?(e.consume(h),u):(!r.interrupt||l<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),s(h)):n(h)}function s(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(hn,r.interrupt?n:f,e.attempt(Go,p,c))}function f(h){return r.containerState.initialBlankLine=!0,o++,p(h)}function c(h){return $(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function ea(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(hn,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,H(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!$(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Zo,t,l)(a))}function l(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,H(e,e.attempt(ue,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function na(e,t,n){const r=this;return H(e,i,"listItemIndent",r.containerState.size+1);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function ta(e){e.exit(this.containerState.type)}function ra(e,t,n){const r=this;return H(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!$(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Ut={name:"setextUnderline",resolveTo:ia,tokenize:la};function ia(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function la(e,t,n){const r=this;let i;return o;function o(s){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=s,l(s)):n(s)}function l(s){return e.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===i?(e.consume(s),a):(e.exit("setextHeadingLineSequence"),$(s)?H(e,u,"lineSuffix")(s):u(s))}function u(s){return s===null||z(s)?(e.exit("setextHeadingLine"),t(s)):n(s)}}const oa={tokenize:aa};function aa(e){const t=this,n=e.attempt(hn,r,e.attempt(this.parser.constructs.flowInitial,i,H(e,e.attempt(this.parser.constructs.flow,i,e.attempt(fo,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ua={resolveAll:Mr()},sa=Or("string"),ca=Or("text");function Or(e){return{resolveAll:Mr(e==="text"?fa:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,l,a);return l;function l(f){return s(f)?o(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return s(f)?(n.exit("data"),o(f)):(n.consume(f),u)}function s(f){if(f===null)return!0;const c=i[f];let p=-1;if(c)for(;++p<c.length;){const h=c[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Mr(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function fa(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,l=-1,a=0,u;for(;o--;){const s=i[o];if(typeof s=="string"){for(l=s.length;s.charCodeAt(l-1)===32;)a++,l--;if(l)break;l=-1}else if(s===-2)u=!0,a++;else if(s!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const s={type:n===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...s.start},r.start.offset===r.end.offset?Object.assign(r,s):(e.splice(n,0,["enter",s,t],["exit",s,t]),n+=2)}n++}return e}const ha={42:ue,43:ue,45:ue,48:ue,49:ue,50:ue,51:ue,52:ue,53:ue,54:ue,55:ue,56:ue,57:ue,62:Pr},pa={91:yo},da={[-2]:On,[-1]:On,32:On},ma={35:Co,42:wn,45:[Ut,wn],60:Ao,61:Ut,95:wn,96:jt,126:jt},ga={38:Lr,92:Tr},ya={[-5]:Mn,[-4]:Mn,[-3]:Mn,33:Vo,38:Lr,42:nt,60:[Wl,Do],91:Qo,92:[wo,Tr],93:xt,95:nt,96:lo},xa={null:[nt,ua]},ka={null:[42,95]},ba={null:[]},wa=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ka,contentInitial:pa,disable:ba,document:ha,flow:ma,flowInitial:da,insideSpan:xa,string:ga,text:ya},Symbol.toStringTag,{value:"Module"}));function Sa(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let l=[],a=[];const u={attempt:N(F),check:N(b),consume:C,enter:v,exit:_,interrupt:N(b,{interrupt:!0})},s={code:null,containerState:{},defineSkip:x,events:[],now:d,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:c};let f=t.tokenize.call(s,u);return t.resolveAll&&o.push(t),s;function c(T){return l=xe(l,T),S(),l[l.length-1]!==null?[]:(W(t,0),s.events=Ln(o,s.events,s),s.events)}function p(T,L){return va(h(T),L)}function h(T){return Ca(l,T)}function d(){const{_bufferIndex:T,_index:L,line:V,column:Q,offset:R}=r;return{_bufferIndex:T,_index:L,line:V,column:Q,offset:R}}function x(T){i[T.line]=T.column,k()}function S(){let T;for(;r._index<l.length;){const L=l[r._index];if(typeof L=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<L.length;)y(L.charCodeAt(r._bufferIndex));else y(L)}}function y(T){f=f(T)}function C(T){z(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,k()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=T}function v(T,L){const V=L||{};return V.type=T,V.start=d(),s.events.push(["enter",V,s]),a.push(V),V}function _(T){const L=a.pop();return L.end=d(),s.events.push(["exit",L,s]),L}function F(T,L){W(T,L.from)}function b(T,L){L.restore()}function N(T,L){return V;function V(Q,R,ne){let te,ae,de,m;return Array.isArray(Q)?me(Q):"tokenize"in Q?me([Q]):ce(Q);function ce(q){return re;function re(le){const Se=le!==null&&q[le],ge=le!==null&&q.null,mn=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return me(mn)(le)}}function me(q){return te=q,ae=0,q.length===0?ne:g(q[ae])}function g(q){return re;function re(le){return m=j(),de=q,q.partial||(s.currentConstruct=q),q.name&&s.parser.constructs.disable.null.includes(q.name)?U():q.tokenize.call(L?Object.assign(Object.create(s),L):s,u,P,U)(le)}}function P(q){return T(de,m),R}function U(q){return m.restore(),++ae<te.length?g(te[ae]):ne}}}function W(T,L){T.resolveAll&&!o.includes(T)&&o.push(T),T.resolve&&pe(s.events,L,s.events.length-L,T.resolve(s.events.slice(L),s)),T.resolveTo&&(s.events=T.resolveTo(s.events,s))}function j(){const T=d(),L=s.previous,V=s.currentConstruct,Q=s.events.length,R=Array.from(a);return{from:Q,restore:ne};function ne(){r=T,s.previous=L,s.currentConstruct=V,s.events.length=Q,a=R,k()}}function k(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ca(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,o)];else{if(l=e.slice(n,i),r>-1){const a=l[0];typeof a=="string"?l[0]=a.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function va(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
2
2
  `;break}case-3:{l=`\r
3
3
  `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,r.push(l)}return r.join("")}function Ia(e){const r={constructs:Er([wa,...(e||{}).extensions||[]]),content:i($l),defined:[],document:i(jl),flow:i(oa),lazy:{},string:i(sa),text:i(ca)};return r;function i(o){return l;function l(a){return Sa(r,o,a)}}}function Ea(e){for(;!zr(e););return e}const qt=/[\0\t\n\r]/g;function Aa(){let e=1,t="",n=!0,r;return i;function i(o,l,a){const u=[];let s,f,c,p,h;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),c=0,t="",n&&(o.charCodeAt(0)===65279&&c++,n=void 0);c<o.length;){if(qt.lastIndex=c,s=qt.exec(o),p=s&&s.index!==void 0?s.index:o.length,h=o.charCodeAt(p),!s){t=o.slice(c);break}if(h===10&&c===p&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),c<p&&(u.push(o.slice(c,p)),e+=p-c),h){case 0:{u.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,u.push(-2);e++<f;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}c=p+1}return a&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const Pa=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ta(e){return e.replace(Pa,La)}function La(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Ar(n.slice(o?2:1),o?16:10)}return yt(n)||e}function an(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vt(e.position):"start"in e||"end"in e?Vt(e):"line"in e||"column"in e?tt(e):""}function tt(e){return Wt(e&&e.line)+":"+Wt(e&&e.column)}function Vt(e){return tt(e&&e.start)+"-"+tt(e&&e.end)}function Wt(e){return e&&typeof e=="number"?e:1}const Nr={}.hasOwnProperty;function za(e,t,n){return typeof t!="string"&&(n=t,t=void 0),_a(n)(Ea(Ia(n).document().write(Aa()(e,t,!0))))}function _a(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(zt),autolinkProtocol:j,autolinkEmail:j,atxHeading:o(Pt),blockQuote:o(ge),characterEscape:j,characterReference:j,codeFenced:o(mn),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(mn,l),codeText:o(Oi,l),codeTextData:j,data:j,codeFlowValue:j,definition:o(Mi),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(Ni),hardBreakEscape:o(Tt),hardBreakTrailing:o(Tt),htmlFlow:o(Lt,l),htmlFlowData:j,htmlText:o(Lt,l),htmlTextData:j,image:o(Ri),label:l,link:o(zt),listItem:o($i),listItemValue:p,listOrdered:o(_t,c),listUnordered:o(_t),paragraph:o(Bi),reference:g,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(Pt),strong:o(ji),thematicBreak:o(Ui)},exit:{atxHeading:u(),atxHeadingSequence:F,autolink:u(),autolinkEmail:Se,autolinkProtocol:le,blockQuote:u(),characterEscapeValue:k,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:q,characterReference:re,codeFenced:u(S),codeFencedFence:x,codeFencedFenceInfo:h,codeFencedFenceMeta:d,codeFlowValue:k,codeIndented:u(y),codeText:u(R),codeTextData:k,data:k,definition:u(),definitionDestinationString:_,definitionLabelString:C,definitionTitleString:v,emphasis:u(),hardBreakEscape:u(L),hardBreakTrailing:u(L),htmlFlow:u(V),htmlFlowData:k,htmlText:u(Q),htmlTextData:k,image:u(te),label:de,labelText:ae,lineEnding:T,link:u(ne),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:P,resourceDestinationString:m,resourceTitleString:ce,resource:me,setextHeading:u(W),setextHeadingLineSequence:N,setextHeadingText:b,strong:u(),thematicBreak:u()}};Rr(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(w){let E={type:"root",children:[]};const D={stack:[E],tokenStack:[],config:t,enter:a,exit:s,buffer:l,resume:f,data:n},B=[];let K=-1;for(;++K<w.length;)if(w[K][1].type==="listOrdered"||w[K][1].type==="listUnordered")if(w[K][0]==="enter")B.push(K);else{const be=B.pop();K=i(w,be,K)}for(K=-1;++K<w.length;){const be=t[w[K][0]];Nr.call(be,w[K][1].type)&&be[w[K][1].type].call(Object.assign({sliceSerialize:w[K][2].sliceSerialize},D),w[K][1])}if(D.tokenStack.length>0){const be=D.tokenStack[D.tokenStack.length-1];(be[1]||Qt).call(D,void 0,be[0])}for(E.position={start:_e(w.length>0?w[0][1].start:{line:1,column:1,offset:0}),end:_e(w.length>0?w[w.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K<t.transforms.length;)E=t.transforms[K](E)||E;return E}function i(w,E,D){let B=E-1,K=-1,be=!1,Me,Ee,en,nn;for(;++B<=D;){const fe=w[B];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?K++:K--,nn=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(Me&&!nn&&!K&&!en&&(en=B),nn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:nn=void 0}if(!K&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||K===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(Me){let He=B;for(Ee=void 0;He--;){const Ae=w[He];if(Ae[1].type==="lineEnding"||Ae[1].type==="lineEndingBlank"){if(Ae[0]==="exit")continue;Ee&&(w[Ee][1].type="lineEndingBlank",be=!0),Ae[1].type="lineEnding",Ee=He}else if(!(Ae[1].type==="linePrefix"||Ae[1].type==="blockQuotePrefix"||Ae[1].type==="blockQuotePrefixWhitespace"||Ae[1].type==="blockQuoteMarker"||Ae[1].type==="listItemIndent"))break}en&&(!Ee||en<Ee)&&(Me._spread=!0),Me.end=Object.assign({},Ee?w[Ee][1].start:fe[1].end),w.splice(Ee||B,0,["exit",Me,fe[2]]),B++,D++}if(fe[1].type==="listItemPrefix"){const He={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};Me=He,w.splice(B,0,["enter",He,fe[2]]),B++,D++,en=void 0,nn=!0}}}return w[E][1]._spread=be,D}function o(w,E){return D;function D(B){a.call(this,w(B),B),E&&E.call(this,B)}}function l(){this.stack.push({type:"fragment",children:[]})}function a(w,E,D){this.stack[this.stack.length-1].children.push(w),this.stack.push(w),this.tokenStack.push([E,D||void 0]),w.position={start:_e(E.start),end:void 0}}function u(w){return E;function E(D){w&&w.call(this,D),s.call(this,D)}}function s(w,E){const D=this.stack.pop(),B=this.tokenStack.pop();if(B)B[0].type!==w.type&&(E?E.call(this,w,B[0]):(B[1]||Qt).call(this,w,B[0]));else throw new Error("Cannot close `"+w.type+"` ("+an({start:w.start,end:w.end})+"): it’s not open");D.position.end=_e(w.end)}function f(){return gt(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function p(w){if(this.data.expectingFirstListItemValue){const E=this.stack[this.stack.length-2];E.start=Number.parseInt(this.sliceSerialize(w),10),this.data.expectingFirstListItemValue=void 0}}function h(){const w=this.resume(),E=this.stack[this.stack.length-1];E.lang=w}function d(){const w=this.resume(),E=this.stack[this.stack.length-1];E.meta=w}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const w=this.resume(),E=this.stack[this.stack.length-1];E.value=w.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const w=this.resume(),E=this.stack[this.stack.length-1];E.value=w.replace(/(\r?\n|\r)$/g,"")}function C(w){const E=this.resume(),D=this.stack[this.stack.length-1];D.label=E,D.identifier=we(this.sliceSerialize(w)).toLowerCase()}function v(){const w=this.resume(),E=this.stack[this.stack.length-1];E.title=w}function _(){const w=this.resume(),E=this.stack[this.stack.length-1];E.url=w}function F(w){const E=this.stack[this.stack.length-1];if(!E.depth){const D=this.sliceSerialize(w).length;E.depth=D}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function N(w){const E=this.stack[this.stack.length-1];E.depth=this.sliceSerialize(w).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function j(w){const D=this.stack[this.stack.length-1].children;let B=D[D.length-1];(!B||B.type!=="text")&&(B=Hi(),B.position={start:_e(w.start),end:void 0},D.push(B)),this.stack.push(B)}function k(w){const E=this.stack.pop();E.value+=this.sliceSerialize(w),E.position.end=_e(w.end)}function T(w){const E=this.stack[this.stack.length-1];if(this.data.atHardBreak){const D=E.children[E.children.length-1];D.position.end=_e(w.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(E.type)&&(j.call(this,w),k.call(this,w))}function L(){this.data.atHardBreak=!0}function V(){const w=this.resume(),E=this.stack[this.stack.length-1];E.value=w}function Q(){const w=this.resume(),E=this.stack[this.stack.length-1];E.value=w}function R(){const w=this.resume(),E=this.stack[this.stack.length-1];E.value=w}function ne(){const w=this.stack[this.stack.length-1];if(this.data.inReference){const E=this.data.referenceType||"shortcut";w.type+="Reference",w.referenceType=E,delete w.url,delete w.title}else delete w.identifier,delete w.label;this.data.referenceType=void 0}function te(){const w=this.stack[this.stack.length-1];if(this.data.inReference){const E=this.data.referenceType||"shortcut";w.type+="Reference",w.referenceType=E,delete w.url,delete w.title}else delete w.identifier,delete w.label;this.data.referenceType=void 0}function ae(w){const E=this.sliceSerialize(w),D=this.stack[this.stack.length-2];D.label=Ta(E),D.identifier=we(E).toLowerCase()}function de(){const w=this.stack[this.stack.length-1],E=this.resume(),D=this.stack[this.stack.length-1];if(this.data.inReference=!0,D.type==="link"){const B=w.children;D.children=B}else D.alt=E}function m(){const w=this.resume(),E=this.stack[this.stack.length-1];E.url=w}function ce(){const w=this.resume(),E=this.stack[this.stack.length-1];E.title=w}function me(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function P(w){const E=this.resume(),D=this.stack[this.stack.length-1];D.label=E,D.identifier=we(this.sliceSerialize(w)).toLowerCase(),this.data.referenceType="full"}function U(w){this.data.characterReferenceType=w.type}function q(w){const E=this.sliceSerialize(w),D=this.data.characterReferenceType;let B;D?(B=Ar(E,D==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):B=yt(E);const K=this.stack[this.stack.length-1];K.value+=B}function re(w){const E=this.stack.pop();E.position.end=_e(w.end)}function le(w){k.call(this,w);const E=this.stack[this.stack.length-1];E.url=this.sliceSerialize(w)}function Se(w){k.call(this,w);const E=this.stack[this.stack.length-1];E.url="mailto:"+this.sliceSerialize(w)}function ge(){return{type:"blockquote",children:[]}}function mn(){return{type:"code",lang:null,meta:null,value:""}}function Oi(){return{type:"inlineCode",value:""}}function Mi(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ni(){return{type:"emphasis",children:[]}}function Pt(){return{type:"heading",depth:0,children:[]}}function Tt(){return{type:"break"}}function Lt(){return{type:"html",value:""}}function Ri(){return{type:"image",title:null,url:"",alt:null}}function zt(){return{type:"link",title:null,url:"",children:[]}}function _t(w){return{type:"list",ordered:w.type==="listOrdered",start:null,spread:w._spread,children:[]}}function $i(w){return{type:"listItem",spread:w._spread,checked:null,children:[]}}function Bi(){return{type:"paragraph",children:[]}}function ji(){return{type:"strong",children:[]}}function Hi(){return{type:"text",value:""}}function Ui(){return{type:"thematicBreak"}}}function _e(e){return{line:e.line,column:e.column,offset:e.offset}}function Rr(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Rr(e,r):Fa(e,r)}}function Fa(e,t){let n;for(n in t)if(Nr.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Qt(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+an({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+an({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+an({start:t.start,end:t.end})+") is still open")}function Da(e){const t=this;t.parser=n;function n(r){return za(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Oa(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Ma(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
4
4
  `}]}function Na(e,t){const n=t.value?t.value+`
@@ -1 +1 @@
1
- import{S as at,r as Tt,d as zt,i as Re,T as et,a as tt,t as ce,b as K,c as ee,e as Ne,f as Le,g as vt,h as Bt,j as ve,o as ct,k as lt,l as Ue,C as Ae,m as Ge,B as ut,L as Pt,E as Dt,n as Ft,F as He,s as he,u as ft,H as Gt,p as Ke,q as At,v as Ht,w as dt,x as Ot}from"./index-DLVq5iVO.js";import{g as Rt,C as Wt}from"./CodeModal-BTuzjRYW.js";function Me(t){return typeof t=="string"?new at([[document.querySelector(t)]],[document.documentElement]):new at([[t]],Tt)}function jt(t){let s;for(;s=t.sourceEvent;)t=s;return t}function Pe(t,s){if(t=jt(t),s===void 0&&(s=t.currentTarget),s){var i=s.ownerSVGElement||s;if(i.createSVGPoint){var l=i.createSVGPoint();return l.x=t.clientX,l.y=t.clientY,l=l.matrixTransform(s.getScreenCTM().inverse()),[l.x,l.y]}if(s.getBoundingClientRect){var R=s.getBoundingClientRect();return[t.clientX-R.left-s.clientLeft,t.clientY-R.top-s.clientTop]}}return[t.pageX,t.pageY]}const ot={capture:!0,passive:!1};function st(t){t.preventDefault(),t.stopImmediatePropagation()}function Ut(t){var s=t.document.documentElement,i=Me(t).on("dragstart.drag",st,ot);"onselectstart"in s?i.on("selectstart.drag",st,ot):(s.__noselect=s.style.MozUserSelect,s.style.MozUserSelect="none")}function Xt(t,s){var i=t.document.documentElement,l=Me(t).on("dragstart.drag",null);s&&(l.on("click.drag",st,ot),setTimeout(function(){l.on("click.drag",null)},0)),"onselectstart"in i?l.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}var Yt=1e-12;function ht(t){return((t=Math.exp(t))+1/t)/2}function qt(t){return((t=Math.exp(t))-1/t)/2}function Vt(t){return((t=Math.exp(2*t))-1)/(t+1)}const Kt=(function t(s,i,l){function R($,y){var V=$[0],se=$[1],Z=$[2],_e=y[0],ke=y[1],B=y[2],v=_e-V,P=ke-se,L=v*v+P*P,te,x;if(L<Yt)x=Math.log(B/Z)/s,te=function(Ee){return[V+Ee*v,se+Ee*P,Z*Math.exp(s*Ee*x)]};else{var pe=Math.sqrt(L),le=(B*B-Z*Z+l*L)/(2*Z*i*pe),ge=(B*B-Z*Z-l*L)/(2*B*i*pe),de=Math.log(Math.sqrt(le*le+1)-le),xe=Math.log(Math.sqrt(ge*ge+1)-ge);x=(xe-de)/s,te=function(Ee){var ze=Ee*x,Te=ht(de),De=Z/(i*pe)*(Te*Vt(s*ze+de)-qt(de));return[V+De*v,se+De*P,Z*Te/ht(s*ze+de)]}}return te.duration=x*1e3*s/Math.SQRT2,te}return R.rho=function($){var y=Math.max(.001,+$),V=y*y,se=V*V;return t(y,V,se)},R})(Math.SQRT2,2,4),Xe=t=>()=>t;function Zt(t,{sourceEvent:s,target:i,transform:l,dispatch:R}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:s,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:R}})}function nt(t){t.stopImmediatePropagation()}function Oe(t){t.preventDefault(),t.stopImmediatePropagation()}function Jt(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Qt(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function pt(){return this.__zoom||Re}function en(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function tn(){return navigator.maxTouchPoints||"ontouchstart"in this}function nn(t,s,i){var l=t.invertX(s[0][0])-i[0][0],R=t.invertX(s[1][0])-i[1][0],$=t.invertY(s[0][1])-i[0][1],y=t.invertY(s[1][1])-i[1][1];return t.translate(R>l?(l+R)/2:Math.min(0,l)||Math.max(0,R),y>$?($+y)/2:Math.min(0,$)||Math.max(0,y))}function rn(){var t=Jt,s=Qt,i=nn,l=en,R=tn,$=[0,1/0],y=[[-1/0,-1/0],[1/0,1/0]],V=250,se=Kt,Z=zt("start","zoom","end"),_e,ke,B,v=500,P=150,L=0,te=10;function x(e){e.property("__zoom",pt).on("wheel.zoom",ze,{passive:!1}).on("mousedown.zoom",Te).on("dblclick.zoom",De).filter(R).on("touchstart.zoom",We).on("touchmove.zoom",Ze).on("touchend.zoom touchcancel.zoom",je).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(e,p,r,m){var D=e.selection?e.selection():e;D.property("__zoom",pt),e!==D?de(e,p,r,m):D.interrupt().each(function(){xe(this,arguments).event(m).start().zoom(null,typeof p=="function"?p.apply(this,arguments):p).end()})},x.scaleBy=function(e,p,r,m){x.scaleTo(e,function(){var D=this.__zoom.k,S=typeof p=="function"?p.apply(this,arguments):p;return D*S},r,m)},x.scaleTo=function(e,p,r,m){x.transform(e,function(){var D=s.apply(this,arguments),S=this.__zoom,T=r==null?ge(D):typeof r=="function"?r.apply(this,arguments):r,U=S.invert(T),ne=typeof p=="function"?p.apply(this,arguments):p;return i(le(pe(S,ne),T,U),D,y)},r,m)},x.translateBy=function(e,p,r,m){x.transform(e,function(){return i(this.__zoom.translate(typeof p=="function"?p.apply(this,arguments):p,typeof r=="function"?r.apply(this,arguments):r),s.apply(this,arguments),y)},null,m)},x.translateTo=function(e,p,r,m,D){x.transform(e,function(){var S=s.apply(this,arguments),T=this.__zoom,U=m==null?ge(S):typeof m=="function"?m.apply(this,arguments):m;return i(Re.translate(U[0],U[1]).scale(T.k).translate(typeof p=="function"?-p.apply(this,arguments):-p,typeof r=="function"?-r.apply(this,arguments):-r),S,y)},m,D)};function pe(e,p){return p=Math.max($[0],Math.min($[1],p)),p===e.k?e:new et(p,e.x,e.y)}function le(e,p,r){var m=p[0]-r[0]*e.k,D=p[1]-r[1]*e.k;return m===e.x&&D===e.y?e:new et(e.k,m,D)}function ge(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function de(e,p,r,m){e.on("start.zoom",function(){xe(this,arguments).event(m).start()}).on("interrupt.zoom end.zoom",function(){xe(this,arguments).event(m).end()}).tween("zoom",function(){var D=this,S=arguments,T=xe(D,S).event(m),U=s.apply(D,S),ne=r==null?ge(U):typeof r=="function"?r.apply(D,S):r,me=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ue=D.__zoom,be=typeof p=="function"?p.apply(D,S):p,Se=se(ue.invert(ne).concat(me/ue.k),be.invert(ne).concat(me/be.k));return function($e){if($e===1)$e=be;else{var Ce=Se($e),Fe=me/Ce[2];$e=new et(Fe,ne[0]-Ce[0]*Fe,ne[1]-Ce[1]*Fe)}T.zoom(null,$e)}})}function xe(e,p,r){return!r&&e.__zooming||new Ee(e,p)}function Ee(e,p){this.that=e,this.args=p,this.active=0,this.sourceEvent=null,this.extent=s.apply(e,p),this.taps=0}Ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,p){return this.mouse&&e!=="mouse"&&(this.mouse[1]=p.invert(this.mouse[0])),this.touch0&&e!=="touch"&&(this.touch0[1]=p.invert(this.touch0[0])),this.touch1&&e!=="touch"&&(this.touch1[1]=p.invert(this.touch1[0])),this.that.__zoom=p,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var p=Me(this.that).datum();Z.call(e,this.that,new Zt(e,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:Z}),p)}};function ze(e,...p){if(!t.apply(this,arguments))return;var r=xe(this,p).event(e),m=this.__zoom,D=Math.max($[0],Math.min($[1],m.k*Math.pow(2,l.apply(this,arguments)))),S=Pe(e);if(r.wheel)(r.mouse[0][0]!==S[0]||r.mouse[0][1]!==S[1])&&(r.mouse[1]=m.invert(r.mouse[0]=S)),clearTimeout(r.wheel);else{if(m.k===D)return;r.mouse=[S,m.invert(S)],tt(this),r.start()}Oe(e),r.wheel=setTimeout(T,P),r.zoom("mouse",i(le(pe(m,D),r.mouse[0],r.mouse[1]),r.extent,y));function T(){r.wheel=null,r.end()}}function Te(e,...p){if(B||!t.apply(this,arguments))return;var r=e.currentTarget,m=xe(this,p,!0).event(e),D=Me(e.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",me,!0),S=Pe(e,r),T=e.clientX,U=e.clientY;Ut(e.view),nt(e),m.mouse=[S,this.__zoom.invert(S)],tt(this),m.start();function ne(ue){if(Oe(ue),!m.moved){var be=ue.clientX-T,Se=ue.clientY-U;m.moved=be*be+Se*Se>L}m.event(ue).zoom("mouse",i(le(m.that.__zoom,m.mouse[0]=Pe(ue,r),m.mouse[1]),m.extent,y))}function me(ue){D.on("mousemove.zoom mouseup.zoom",null),Xt(ue.view,m.moved),Oe(ue),m.event(ue).end()}}function De(e,...p){if(t.apply(this,arguments)){var r=this.__zoom,m=Pe(e.changedTouches?e.changedTouches[0]:e,this),D=r.invert(m),S=r.k*(e.shiftKey?.5:2),T=i(le(pe(r,S),m,D),s.apply(this,p),y);Oe(e),V>0?Me(this).transition().duration(V).call(de,T,m,e):Me(this).call(x.transform,T,m,e)}}function We(e,...p){if(t.apply(this,arguments)){var r=e.touches,m=r.length,D=xe(this,p,e.changedTouches.length===m).event(e),S,T,U,ne;for(nt(e),T=0;T<m;++T)U=r[T],ne=Pe(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],D.touch0?!D.touch1&&D.touch0[2]!==ne[2]&&(D.touch1=ne,D.taps=0):(D.touch0=ne,S=!0,D.taps=1+!!_e);_e&&(_e=clearTimeout(_e)),S&&(D.taps<2&&(ke=ne[0],_e=setTimeout(function(){_e=null},v)),tt(this),D.start())}}function Ze(e,...p){if(this.__zooming){var r=xe(this,p).event(e),m=e.changedTouches,D=m.length,S,T,U,ne;for(Oe(e),S=0;S<D;++S)T=m[S],U=Pe(T,this),r.touch0&&r.touch0[2]===T.identifier?r.touch0[0]=U:r.touch1&&r.touch1[2]===T.identifier&&(r.touch1[0]=U);if(T=r.that.__zoom,r.touch1){var me=r.touch0[0],ue=r.touch0[1],be=r.touch1[0],Se=r.touch1[1],$e=($e=be[0]-me[0])*$e+($e=be[1]-me[1])*$e,Ce=(Ce=Se[0]-ue[0])*Ce+(Ce=Se[1]-ue[1])*Ce;T=pe(T,Math.sqrt($e/Ce)),U=[(me[0]+be[0])/2,(me[1]+be[1])/2],ne=[(ue[0]+Se[0])/2,(ue[1]+Se[1])/2]}else if(r.touch0)U=r.touch0[0],ne=r.touch0[1];else return;r.zoom("touch",i(le(T,U,ne),r.extent,y))}}function je(e,...p){if(this.__zooming){var r=xe(this,p).event(e),m=e.changedTouches,D=m.length,S,T;for(nt(e),B&&clearTimeout(B),B=setTimeout(function(){B=null},v),S=0;S<D;++S)T=m[S],r.touch0&&r.touch0[2]===T.identifier?delete r.touch0:r.touch1&&r.touch1[2]===T.identifier&&delete r.touch1;if(r.touch1&&!r.touch0&&(r.touch0=r.touch1,delete r.touch1),r.touch0)r.touch0[1]=this.__zoom.invert(r.touch0[0]);else if(r.end(),r.taps===2&&(T=Pe(T,this),Math.hypot(ke[0]-T[0],ke[1]-T[1])<te)){var U=Me(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return x.wheelDelta=function(e){return arguments.length?(l=typeof e=="function"?e:Xe(+e),x):l},x.filter=function(e){return arguments.length?(t=typeof e=="function"?e:Xe(!!e),x):t},x.touchable=function(e){return arguments.length?(R=typeof e=="function"?e:Xe(!!e),x):R},x.extent=function(e){return arguments.length?(s=typeof e=="function"?e:Xe([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),x):s},x.scaleExtent=function(e){return arguments.length?($[0]=+e[0],$[1]=+e[1],x):[$[0],$[1]]},x.translateExtent=function(e){return arguments.length?(y[0][0]=+e[0][0],y[1][0]=+e[1][0],y[0][1]=+e[0][1],y[1][1]=+e[1][1],x):[[y[0][0],y[0][1]],[y[1][0],y[1][1]]]},x.constrain=function(e){return arguments.length?(i=e,x):i},x.duration=function(e){return arguments.length?(V=+e,x):V},x.interpolate=function(e){return arguments.length?(se=e,x):se},x.on=function(){var e=Z.on.apply(Z,arguments);return e===Z?x:e},x.clickDistance=function(e){return arguments.length?(L=(e=+e)*e,x):Math.sqrt(L)},x.tapDistance=function(e){return arguments.length?(te=+e,x):te},x}function Ye(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var rt={exports:{}},gt;function on(){return gt||(gt=1,(function(t,s){(function(i){t.exports=i()})(function(){return(function(){function i(l,R,$){function y(Z,_e){if(!R[Z]){if(!l[Z]){var ke=typeof Ye=="function"&&Ye;if(!_e&&ke)return ke(Z,!0);if(V)return V(Z,!0);var B=new Error("Cannot find module '"+Z+"'");throw B.code="MODULE_NOT_FOUND",B}var v=R[Z]={exports:{}};l[Z][0].call(v.exports,function(P){var L=l[Z][1][P];return y(L||P)},v,v.exports,i,l,R,$)}return R[Z].exports}for(var V=typeof Ye=="function"&&Ye,se=0;se<$.length;se++)y($[se]);return y}return i})()({1:[function(i,l,R){Object.defineProperty(R,"__esModule",{value:!0}),R.default=void 0;function $(B){"@babel/helpers - typeof";return $=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(v){return typeof v}:function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},$(B)}function y(B,v){if(!(B instanceof v))throw new TypeError("Cannot call a class as a function")}function V(B,v){for(var P=0;P<v.length;P++){var L=v[P];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(B,Z(L.key),L)}}function se(B,v,P){return v&&V(B.prototype,v),Object.defineProperty(B,"prototype",{writable:!1}),B}function Z(B){var v=_e(B,"string");return $(v)=="symbol"?v:v+""}function _e(B,v){if($(B)!="object"||!B)return B;var P=B[Symbol.toPrimitive];if(P!==void 0){var L=P.call(B,v);if($(L)!="object")return L;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(B)}R.default=(function(){function B(){var v=this,P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},L=P.defaultLayoutOptions,te=L===void 0?{}:L,x=P.algorithms,pe=x===void 0?["layered","stress","mrtree","radial","force","disco","sporeOverlap","sporeCompaction","rectpacking","vertiflex"]:x,le=P.workerFactory,ge=P.workerUrl;if(y(this,B),this.defaultLayoutOptions=te,this.initialized=!1,typeof ge>"u"&&typeof le>"u")throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.");var de=le;typeof ge<"u"&&typeof le>"u"&&(de=function(ze){return new Worker(ze)});var xe=de(ge);if(typeof xe.postMessage!="function")throw new TypeError("Created worker does not provide the required 'postMessage' function.");this.worker=new ke(xe),this.worker.postMessage({cmd:"register",algorithms:pe}).then(function(Ee){return v.initialized=!0}).catch(console.err)}return se(B,[{key:"layout",value:function(P){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=L.layoutOptions,x=te===void 0?this.defaultLayoutOptions:te,pe=L.logging,le=pe===void 0?!1:pe,ge=L.measureExecutionTime,de=ge===void 0?!1:ge;return P?this.worker.postMessage({cmd:"layout",graph:P,layoutOptions:x,options:{logging:le,measureExecutionTime:de}}):Promise.reject(new Error("Missing mandatory parameter 'graph'."))}},{key:"knownLayoutAlgorithms",value:function(){return this.worker.postMessage({cmd:"algorithms"})}},{key:"knownLayoutOptions",value:function(){return this.worker.postMessage({cmd:"options"})}},{key:"knownLayoutCategories",value:function(){return this.worker.postMessage({cmd:"categories"})}},{key:"terminateWorker",value:function(){this.worker&&this.worker.terminate()}}])})();var ke=(function(){function B(v){var P=this;if(y(this,B),v===void 0)throw new Error("Missing mandatory parameter 'worker'.");this.resolvers={},this.worker=v,this.worker.onmessage=function(L){setTimeout(function(){P.receive(P,L)},0)}}return se(B,[{key:"postMessage",value:function(P){var L=this.id||0;this.id=L+1,P.id=L;var te=this;return new Promise(function(x,pe){te.resolvers[L]=function(le,ge){le?(te.convertGwtStyleError(le),pe(le)):x(ge)},te.worker.postMessage(P)})}},{key:"receive",value:function(P,L){var te=L.data,x=P.resolvers[te.id];x&&(delete P.resolvers[te.id],te.error?x(te.error):x(null,te.data))}},{key:"terminate",value:function(){this.worker&&this.worker.terminate()}},{key:"convertGwtStyleError",value:function(P){if(P){var L=P.__java$exception;L&&(L.cause&&L.cause.backingJsObject&&(P.cause=L.cause.backingJsObject,this.convertGwtStyleError(P.cause)),delete P.__java$exception)}}}])})()},{}],2:[function(i,l,R){var $=i("./elk-api.js").default;Object.defineProperty(l.exports,"__esModule",{value:!0}),l.exports=$,$.default=$},{"./elk-api.js":1}]},{},[2])(2)})})(rt)),rt.exports}var sn=on();const an=Rt(sn),cn="/assets/elk-worker.min-DGCccKuH.js";var ln=ce('<div class="truncate text-sm font-bold text-[var(--plc-on-surface)]">'),un=ce('<div class="truncate text-[11px] text-[var(--plc-on-subtle)]">'),fn=ce('<div class="flex shrink-0 items-center gap-3">'),dn=ce("<div><div class=min-w-0>");function hn(t){return(()=>{var s=dn(),i=s.firstChild;return K(i,ee(Ne,{get when(){return t.title},get children(){var l=ln();return K(l,()=>t.title),l}}),null),K(i,ee(Ne,{get when(){return t.subtitle},get children(){var l=un();return K(l,()=>t.subtitle),l}}),null),K(s,ee(Ne,{get when(){return t.actions},get children(){var l=fn();return K(l,()=>t.actions),l}}),null),Le(()=>vt(s,Bt("flex items-center justify-between gap-4 border-b border-[var(--plc-border)] bg-[var(--plc-surface)] px-4 py-2",t.class))),s})()}var pn=ce('<div class="flex h-full"><div class="w-72 border-r border-[var(--plc-border)] bg-[var(--plc-surface)] text-xs text-[var(--plc-on-surface)] flex flex-col"><div class="px-3 py-2 border-b border-[var(--plc-border)]"><div class="text-[11px] font-semibold uppercase tracking-wide text-[var(--plc-on-muted)]"></div></div><div class="flex-1 overflow-y-auto px-2 py-2 space-y-2"></div></div><div class=flex-1><svg class="w-full h-full cursor-grab active:cursor-grabbing"><defs><marker id=arrowhead markerWidth=10 markerHeight=7 refX=9 refY=3.5 orient=auto><polygon points="0 0, 10 3.5, 0 7"fill=#666></polygon></marker></defs><g>'),gn=ce('<div class="absolute bottom-4 left-4 bg-[var(--plc-surface)] border border-[var(--plc-border-strong)] rounded px-3 py-2 text-xs text-[var(--plc-on-surface)] shadow-[var(--plc-menu-shadow)] max-w-sm"><div class="font-bold text-[var(--plc-on-surface)] text-[11px] mb-1 border-b border-[var(--plc-border)] pb-1">High In-Degree Targets</div><div class="space-y-1 max-h-40 overflow-y-auto">'),mn=ce('<div class="absolute inset-0 bg-[var(--plc-surface)] z-50 flex flex-col"><div class="flex-1 relative overflow-hidden">'),yn=ce('<label class="flex items-center gap-1 text-xs text-[var(--plc-on-muted)]"><span class=text-[var(--plc-on-muted)]>Layout</span><select class="ml-1 rounded border border-[var(--plc-border-strong)] bg-[var(--plc-surface)] px-2 py-1 text-[11px] text-[var(--plc-on-surface)] focus:outline-none focus:ring-1 focus:ring-[var(--plc-border-focus)]"title="Layered (tidy) or Force-directed (tighter clustering)"><option value=layered>Layered</option><option value=force>Force'),vn=ce('<label class="flex items-center gap-2 text-xs text-[var(--plc-on-muted)]"><span class=text-[var(--plc-on-muted)]>Tightness</span><input type=range min=0 max=100>'),xn=ce('<div class="h-4 w-px bg-[var(--plc-border)]">'),wn=ce("<span>Horizontal flow"),bn=ce('<div class="px-1 py-1 text-[11px] text-[var(--plc-on-subtle)]">No matching <!>.'),_n=ce('<div class="space-y-0.5 mt-0.5">'),$n=ce('<div><button type=button class="w-full text-left px-2 py-1 text-[11px] font-semibold text-[var(--plc-on-surface)] truncate hover:bg-[var(--plc-surface-hover)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--plc-border-focus)]">'),kn=ce('<button type=button class="w-full text-left px-4 py-1 rounded text-[11px] hover:bg-[var(--plc-surface-hover)] focus:outline-none focus:ring-1 focus:ring-[var(--plc-border-focus)] truncate">'),En=ce("<title>"),Sn=ce("<svg><g class=cursor-pointer></svg>",!1,!0,!1),Mn=ce("<svg><circle stroke=#111 stroke-width=1.5></svg>",!1,!0,!1),Cn=ce('<svg><text dy=0.35em text-anchor=middle fill=#000 font-size=10px class="pointer-events-none select-none font-mono"></svg>',!1,!0,!1),In=ce("<svg><rect></svg>",!1,!0,!1),Ln=ce('<svg><text dy=0.35em text-anchor=middle class="pointer-events-none select-none"></svg>',!1,!0,!1),Nn=ce("<svg><path stroke=#666 stroke-width=1 fill=none marker-end=url(#arrowhead)></svg>",!1,!0,!1),Tn=ce('<div class="flex items-center gap-2"><div class="w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-mono"style=color:#000></div><span class="truncate max-w-[220px]">');const mt=5,Be=["#ff6b6b","#feca57","#54a0ff","#5f27cd","#1dd1a1","#ff9ff3","#48dbfb","#ffaf40","#00d2d3","#c8d6e5"],qe="ABCDEFGHIJKLMNOPQRSTUVWXYZ";function Ve(t){const s=t.lastIndexOf("/");return s>=0?t.slice(s+1):t}function zn(t,s){const i=String(t??"");return s<=0?"":i.length<=s?i:s<=1?"…":`${i.slice(0,Math.max(1,s-1))}…`}const Bn=Ke().domain([0,10,50]).range(["#dbeafe","#fde68a","#fecaca"]).clamp(!0),Pn=Ke().domain([0,.2,.5]).range(["#ffcccc","#ff9999","#ff0000"]).clamp(!0),Dn=Ke().domain([0,3,8]).range(["#e0f7fa","#bae6fd","#0891b2"]).clamp(!0),Fn=Ke().domain([0,1,5]).range(["#f1f8e9","#bef264","#65a30d"]).clamp(!0),Gn=(t,s=1)=>{const i=dt(t),R=i.l>=.5?.12:.9,$=dt(i.h,i.s*.9,R).rgb();return`rgba(${Math.round($.r)}, ${Math.round($.g)}, ${Math.round($.b)}, ${s})`};function xt(t){const s=t.lastIndexOf("/"),i=s>=0?t.slice(s+1):t,l=i.lastIndexOf(".");return(l>0?i.slice(0,l):i).trim()}function An(t){const s=xt(t).replace(/[\[\]]/g,""),i=s.toUpperCase().match(/[A-Z]/g)??[],l=[];i.length===2&&l.push(i.join(""));const $=s.split(/[-_\s]+/).filter(Boolean).map(y=>(y.match(/[A-Za-z]/)?.[0]??"").toUpperCase()).filter(Boolean);if($.length>=2){const y=`${$[0]}${$[1]}`;l.includes(y)||l.push(y)}if(i.length>=2){const y=`${i[0]}${i[1]}`;l.includes(y)||l.push(y);const V=`${i[0]}${i[i.length-1]}`;l.includes(V)||l.push(V)}else if(i.length===1){const y=`${i[0]}${i[0]}`;l.includes(y)||l.push(y)}for(let y=0;y<i.length&&y<4;y++)for(let V=y+1;V<i.length&&V<y+4;V++){const se=`${i[y]}${i[V]}`;l.includes(se)||l.push(se)}return l}function yt(t,s){const i=An(t);for(const l of i)if(l.length===2&&!s.has(l))return s.add(l),l;for(let l=0;l<qe.length;l++)for(let R=0;R<qe.length;R++){const $=`${qe[l]}${qe[R]}`;if(!s.has($))return s.add($),$}return"??"}function Rn(t){const[s,i]=ve([]),[l,R]=ve([]),[$,y]=ve(!0),[V,se]=ve(null),[Z,_e]=ve(null),[ke,B]=ve(!1),[v,P]=ve(!1),[L,te]=ve(null),[x,pe]=ve(null),[le,ge]=ve(null),[de,xe]=ve(!0),[Ee,ze]=ve(!1),[Te,De]=ve("layered"),[We,Ze]=ve(70),[je,e]=ve([]),[p,r]=ve(!1),[m,D]=ve("");let S,T,U,ne,me=0,ue;const be=()=>{me++,ne?.terminate(),ne=void 0,ue?.(null),ue=void 0};ct(be);const Se=new an({workerUrl:cn});ct(()=>Se.terminateWorker());const $e=()=>t.primaryMetricId||"complexity",Ce=lt(()=>{const a=new Map;for(const C of s())a.set(C.id,C);return a}),Fe=lt(()=>{const a=m().trim().toLowerCase(),C=s(),n=v(),W=[],w=new Map;for(const u of C)if(u.type==="file")W.push(u);else if(n&&u.type==="export"&&u.parent){const b=w.get(u.parent)??[];b.push(u),w.set(u.parent,b)}const N=[...W].sort((u,b)=>String(u.label??u.id).localeCompare(String(b.label??b.id))),I=[];for(const u of N){const b=u.id,f=String(u.label??b),F=f.toLowerCase();if(!n){if(a&&!F.includes(a))continue;I.push({fileId:b,fileLabel:f,exports:[]});continue}const j=[...w.get(b)??[]].sort((d,h)=>String(d.label??"").localeCompare(String(h.label??""))),k=j.filter(d=>a?`${String(d.label??"")} ${f}`.toLowerCase().includes(a):!0);(!a||F.includes(a)||k.length>0)&&I.push({fileId:b,fileLabel:f,exports:a?k:j})}return I});Ue(()=>{wt(t.path)});async function wt(a){y(!0),se(null);try{const C=new URL("/api/analysis/dependencies",window.location.origin);a&&C.searchParams.append("path",a);const n=await fetch(C.toString());if(!n.ok)throw new Error("Failed to fetch dependencies");const W=await n.json();_e(W)}catch(C){se(C.message)}finally{y(!1)}}function bt(a,C,n,W){let w=a.nodes,N=a.edges;if(!C){w=w.filter(u=>u.type!=="external");const I=new Set(w.map(u=>u.id));N=N.filter(u=>I.has(u.source)&&I.has(u.target))}if(n){const I=new Map(w.map(b=>[b.id,b])),u=new Set;for(const b of w)b.type==="export"&&typeof b.parent=="string"&&u.add(b.parent);N=N.filter(b=>{const f=I.get(b.source),F=I.get(b.target);if(!f||!F)return!0;const j=f.type==="file",k=F.type==="file";return!(j&&k&&u.has(F.id))})}else{w=w.filter(u=>u.type!=="export");const I=new Set(w.map(u=>u.id));N=N.filter(u=>I.has(u.source)&&I.has(u.target))}if(W){const I=new Map(w.map(k=>[k.id,k])),u=new Set,b=new Set,f=new Map;for(const k of w)k.type==="export"&&typeof k.parent=="string"&&f.set(k.id,k.parent);for(const k of N){const o=I.get(k.source),d=I.get(k.target);if(!o||!d)continue;const h=o.type,O=d.type;if(h==="file"&&O==="file"){u.add(d.id);continue}if(h==="export"&&O==="file"){b.add(o.id);const c=f.get(o.id);c&&u.add(c)}}const F=t.path;w=w.filter(k=>k.type==="file"?F&&k.id===F?!0:u.has(k.id):k.type==="export"?b.has(k.id):!0);const j=new Set(w.map(k=>k.id));N=N.filter(k=>j.has(k.source)&&j.has(k.target))}return{nodes:w,edges:N}}function _t(a){if(!a.nodes||!a.edges)return{graph:a,assignments:[]};if(v())return{graph:a,assignments:[]};const C=new Map;for(const c of a.edges)!c||typeof c.target!="string"||C.set(c.target,(C.get(c.target)??0)+1);const n=Array.from(C.entries()).filter(([,c])=>c>mt).map(([c])=>c);if(n.length===0)return{graph:a,assignments:[]};const W=new Map(a.nodes.map(c=>[c.id,c])),w=[...n].sort((c,g)=>{const A=W.get(c),z=W.get(g),H=(A?.label??"").toString().toLowerCase(),M=(z?.label??"").toString().toLowerCase();return H.localeCompare(M)}),N=[],I=new Map,u=new Set;if(w.forEach((c,g)=>{const A=W.get(c);if(!A)return;const z=A.label??c,H=yt(z,u),M=Be[g%Be.length]??Be[Be.length-1],X={nodeId:c,label:z,code:H,color:M};N.push(X),I.set(c,X)}),N.length===0)return{graph:a,assignments:[]};const b=new Set(w),f=t.path,j=[...a.nodes.filter(c=>{const g=c.id;return c.type!=="file"||!b.has(g)?!0:!!(f&&g===f)}).map(c=>{const g=I.get(c.id);return g?{...c,assignmentCode:g.code,assignmentColor:g.color,isSuperNode:!0}:c})],k=[],o=new Map;let d=0;for(const c of a.edges){const g=String(c.source),A=String(c.target),z=I.get(A);if(z){if(W.get(g)?.type==="file"){const M=`${g}::${z.nodeId}`;let X=o.get(M);X||(X=`__badge__${z.nodeId}__${g}__${d++}`,o.set(M,X),j.push({id:X,label:z.code,type:"dummy",parent:g,assignmentCode:z.code,assignmentColor:z.color,superNodeId:z.nodeId}))}continue}b.has(g)&&!(f&&g===f)||b.has(A)&&!(f&&A===f)||k.push(c)}const h=new Set(j.map(c=>c.id)),O=k.filter(c=>h.has(String(c.source))&&h.has(String(c.target)));return{graph:{nodes:j,edges:O},assignments:N}}function $t(a,C){if(!C)return _t(a);if(!a.nodes||!a.edges)return{graph:a,assignments:[]};const n=new Map(a.nodes.map(d=>[d.id,d])),W=new Map;for(const d of a.edges){const h=n.get(d.source),O=n.get(d.target);if(!(!h||!O)&&h.type==="export"&&O.type==="file"){const c=h.id;let g=W.get(c);g||(g=new Set,W.set(c,g)),g.add(O.id)}}const w=Array.from(W.entries()).filter(([,d])=>d.size>mt).map(([d])=>d);if(w.length===0)return{graph:a,assignments:[]};const N=[...w].sort((d,h)=>{const O=n.get(d),c=n.get(h),g=(O?.label??"").toString().toLowerCase(),A=(c?.label??"").toString().toLowerCase();return g.localeCompare(A)}),I=[],u=new Map,b=new Set;N.forEach((d,h)=>{const O=n.get(d);if(!O)return;const c=O.label??d,g=O.parent??"",z=(g?n.get(g):void 0)?.label??g,H=z?xt(z):"";let M=c,X=c;c.trim()==="default"&&H?(M=`${H}/default`,X=H):H&&(M=`${c} (${H})`);const ae=yt(X,b),J=Be[h%Be.length]??Be[Be.length-1],fe={nodeId:d,label:M,code:ae,color:J};I.push(fe),u.set(d,fe)});const F=[...a.nodes.map(d=>{const h=u.get(d.id);return h?{...d,assignmentCode:h.code,assignmentColor:h.color,isSuperNode:!0}:d})],j=[],k=new Map;let o=0;for(const d of a.edges){const h=n.get(d.source),O=n.get(d.target);if(h?.type==="export"&&O?.type==="file"&&u.has(h.id)){const c=O.id,g=h.id,A=`${c}::${g}`;let z=k.get(A);if(!z){const H=u.get(g);z=`__dummy_export__${g}__${c}__${o++}`,k.set(A,z),F.push({id:z,label:H.code,type:"dummy",assignmentCode:H.code,assignmentColor:H.color,superNodeId:h.parent??void 0,parent:c})}continue}j.push(d)}return{graph:{nodes:F,edges:j},assignments:I}}async function kt(a,C){const n=de(),W=Ee(),w=new Map,N=new Map;for(const f of a.nodes??[]){const F=f.parent,j=f.type;!F||!j||(j==="export"?w.set(F,(w.get(F)??0)+1):j==="dummy"&&N.set(F,(N.get(F)??0)+1))}const I=new Map,u=[];a.nodes.forEach(f=>{const F=f.type==="dummy",j=f.type==="export";let k=0,o=0;if(F)k=n?20:26,o=n?20:26;else if(j){const d=String(f.label??"");k=Math.max(n?46:60,d.length*(n?6:7)),o=n?20:24}else{const d=String(f.label??""),h=n?Ve(d):d;k=Math.max(n?84:100,h.length*(n?6:8));const O=w.get(f.id)??0,c=N.get(f.id)??0,g=O>0,A=c>0;o=n?36:44,A&&!n&&(o+=28),g&&(o+=n?28:34)}I.set(f.id,{id:f.id,width:k,height:o,labels:F?[]:[{text:String(f.label??"")}],...f,children:[]})}),I.forEach(f=>{f.parent&&I.has(f.parent)?I.get(f.parent).children.push(f):u.push(f)});const b={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":W?"RIGHT":"DOWN","elk.spacing.nodeNode":n?"22":"40","elk.layered.spacing.nodeNodeBetweenLayers":n?"22":"40","elk.spacing.edgeNode":n?"6":"10","elk.layered.spacing.edgeNodeBetweenLayers":n?"6":"10","elk.layered.layerUnzipping.minimizeEdgeLength":"true","elk.hierarchyHandling":"INCLUDE_CHILDREN"},children:u,edges:a.edges.map(f=>({id:f.id,sources:[f.source],targets:[f.target],label:f.label}))};try{let f=function(M,X=0,ae=0){const J=X+(M.x||0),fe=ae+(M.y||0);j.push({...M,x:J,y:fe}),M.children&&M.children.forEach(Ie=>f(Ie,J,fe))};const F=await Se.layout(b);if(C!==me)return;const j=[];F.children&&F.children.forEach(M=>f(M));const k=new Map,o=new Map,d=new Map;for(const M of j)if(M.type==="file")k.set(M.id,M);else if(M.type==="export"&&M.parent){const X=o.get(M.parent)??[];X.push(M),o.set(M.parent,X)}else if(M.type==="dummy"&&M.parent){const X=d.get(M.parent)??[];X.push(M),d.set(M.parent,X)}const h=n?10:16,O=n?6:8,c=n?6:8,g=n?20:24;o.forEach((M,X)=>{const ae=k.get(X);if(!ae)return;const J=ae.x??0,fe=ae.y??0,Ie=ae.width??120,_=ae.height??40;let E=J+h;const Y=fe+_-g-O;for(const q of M){const ie=q.width??80;E+ie+h>J+Ie&&(E=J+h),q.x=E,q.y=Y,E+=ie+c}});const A=n?7:10,z=A*2,H=n?4:6;d.forEach((M,X)=>{const ae=k.get(X);if(!ae)return;const J=ae.x??0,fe=ae.y??0,Ie=ae.width??120,_=ae.height??40;if(n){const E=fe+14;let Y=J+Ie-h-z;for(const q of M){if(Y<J+h)break;q.x=Y,q.y=E-A,q.width=z,q.height=z,Y-=z+H}}else{let E=J+h;const q=Math.min(fe+22+A+6,fe+_-A-6);for(const ie of M)E+z+h>J+Ie&&(E=J+h),ie.x=E,ie.y=q-A,ie.width=z,ie.height=z,E+=z+H}}),i(j),R(F.edges??[]),setTimeout(()=>{C===me&&Qe()},0)}catch(f){if(C!==me)return;console.error("Layout error:",f),se("Failed to layout graph")}}function Je(a,C,n){return a+(C-a)*n}async function Et(a,C){const n=de(),w=Math.max(0,Math.min(100,We()))/100,N=new Map,I=new Map;for(const _ of a.nodes??[]){const E=_.parent,Y=_.type;!E||!Y||(Y==="export"?N.set(E,(N.get(E)??0)+1):Y==="dummy"&&I.set(E,(I.get(E)??0)+1))}const u=new Map,b=[];for(const _ of a.nodes??[]){const E=_.type,Y=E==="dummy",q=E==="export",ie=E==="external";let ye=0,we=0;if(Y)ye=n?20:26,we=n?20:26;else if(q){const oe=String(_.label??"");ye=Math.max(n?46:60,oe.length*(n?6:7)),we=n?20:24}else{const oe=String(_.label??""),Q=n?Ve(oe):oe;ye=Math.max(n?84:100,Q.length*(n?6:8));const Ct=N.get(String(_.id))??0,It=I.get(String(_.id))??0,Lt=Ct>0,Nt=It>0;we=n?36:44,Nt&&!n&&(we+=28),Lt&&(we+=n?28:34)}const G=String(_.id),re={..._,id:G,width:ye,height:we,x:(Math.random()-.5)*60,y:(Math.random()-.5)*60};u.set(G,re),!Y&&!q&&(re.type==="file"||ie)&&b.push(re)}const f=new Set(b.map(_=>_.id)),F=[];for(const _ of a.edges??[]){const E=String(_.source),Y=String(_.target),q=u.get(E),ie=u.get(Y);if(!q||!ie)continue;const ye=q.type==="export"&&q.parent?String(q.parent):E,we=ie.type==="export"&&ie.parent?String(ie.parent):Y;ye!==we&&(!f.has(ye)||!f.has(we)||F.push({source:ye,target:we}))}const j=Je(140,40,w),k=Je(-900,-220,w),o=Je(22,10,w),d=new Worker(new URL("/assets/dependencyForce.worker-WVMkyynK.js",import.meta.url),{type:"module"});ne=d;const h=await new Promise(_=>{ue=_,d.onmessage=E=>{C===me&&(d.terminate(),ne=void 0,ue=void 0,E.data.error?(se(`Force layout failed: ${E.data.error}`),_(null)):_(E.data.positions??[]))},d.onerror=E=>{C===me&&(se(`Force layout failed: ${E.message}`),be())},d.postMessage({id:C,nodes:b.map(({id:E,x:Y,y:q,width:ie,height:ye})=>({id:E,x:Y,y:q,width:ie,height:ye})),links:F,linkDistance:j,chargeStrength:k,collidePad:o,iterations:260})});if(C!==me||!h)return;const O=new Map(h.map(_=>[_.id,_]));for(const _ of b){const E=O.get(_.id);E&&(_.x=E.x,_.y=E.y)}const c=[...u.values()],g=new Map,A=new Map,z=new Map;for(const _ of c)if(_.type==="file")g.set(_.id,_);else if(_.type==="export"&&_.parent){const E=A.get(_.parent)??[];E.push(_),A.set(_.parent,E)}else if(_.type==="dummy"&&_.parent){const E=z.get(_.parent)??[];E.push(_),z.set(_.parent,E)}const H=n?10:16,M=n?6:8,X=n?6:8,ae=n?20:24;A.forEach((_,E)=>{const Y=g.get(E);if(!Y)return;const q=Y.x??0,ie=Y.y??0,ye=Y.width??120,we=Y.height??40;let G=q+H;const re=ie+we-ae-M;for(const oe of _){const Q=oe.width??80;G+Q+H>q+ye&&(G=q+H),oe.x=G,oe.y=re,G+=Q+X}});const J=n?7:10,fe=J*2,Ie=n?4:6;z.forEach((_,E)=>{const Y=g.get(E);if(!Y)return;const q=Y.x??0,ie=Y.y??0,ye=Y.width??120,we=Y.height??40;if(n){const G=ie+14;let re=q+ye-H-fe;for(const oe of _){if(re<q+H)break;oe.x=re,oe.y=G-J,oe.width=fe,oe.height=fe,re-=fe+Ie}}else{let G=q+H;const oe=Math.min(ie+22+J+6,ie+we-J-6);for(const Q of _)G+fe+H>q+ye&&(G=q+H),Q.x=G,Q.y=oe-J,Q.width=fe,Q.height=fe,G+=fe+Ie}}),i(c),R(a.edges??[]),setTimeout(Qe,0)}Ue(()=>{const a=Z();if(be(),!a)return;const C=me,n=ke(),W=v(),w=p(),N=bt(a,n,W,w),{graph:I,assignments:u}=$t(N,W);e(u),Te()==="force"?Et(I,C):kt(I,C)}),Ue(()=>{$e()});function St(){!S||!T||(U=rn().scaleExtent([.1,4]).on("zoom",a=>{Me(T).attr("transform",a.transform)}),Me(S).call(U))}function Qe(){if(!S||!T||s().length===0||!U)return;const a=Me(S),n=Me(T).node()?.getBBox();if(!n)return;const W=a.node()?.parentElement,w=W?.clientWidth||1e3,N=W?.clientHeight||800,I=40,u=Math.min((w-I*2)/n.width,(N-I*2)/n.height),b=Math.min(u,1),f=(w-n.width*b)/2-n.x*b,F=(N-n.height*b)/2-n.y*b,j=Re.translate(f,F).scale(b);a.transition().duration(750).call(U.transform,j)}function it(a){if(!S||!T||!U)return;const C=s().find(o=>o.id===a);if(!C||C.x==null||C.y==null)return;const n=Me(S),W=n.node()?.parentElement,w=W?.clientWidth||1e3,N=W?.clientHeight||800,I=Ht(S)??Re,u=typeof I.k=="number"&&I.k>0?I.k:1,b=(C.x??0)+(C.width??0)/2,f=(C.y??0)+(C.height??0)/2,F=w/2-b*u,j=N/2-f*u,k=Re.translate(F,j).scale(u);n.transition().duration(600).call(U.transform,k),pe(a)}Ue(()=>{!$()&&!V()&&S&&St()});function Mt(a,C){if(a.type==="dummy"){a.superNodeId&&(pe(a.superNodeId),setTimeout(()=>{ge(a.superNodeId)},50));return}a.type==="file"&&(pe(a.id),setTimeout(()=>{ge(a.id)},50))}return(()=>{var a=mn(),C=a.firstChild;return K(a,ee(hn,{get title(){return["Dependency Graph: ",Ge(()=>t.path||"Root")]},get actions(){return[(()=>{var n=yn(),W=n.firstChild,w=W.nextSibling;return w.addEventListener("change",N=>De(N.currentTarget.value)),Le(()=>w.value=Te()),n})(),ee(Ne,{get when(){return Te()==="force"},get children(){var n=vn(),W=n.firstChild,w=W.nextSibling;return w.$$input=N=>Ze(Number(N.currentTarget.value)),Le(()=>w.value=We()),n}}),ee(Ae,{get checked(){return de()},onChange:xe,label:"Compact"}),ee(Ae,{get checked(){return Ee()},onChange:ze,get disabled(){return!de()||Te()==="force"},get title(){return Ge(()=>Te()==="force")()?"Not used in Force layout":de()?"Switch flow direction (can be harder to read)":"Enable Compact first"},get label(){return(()=>{var n=wn();return Le(()=>vt(n,de()?"":"opacity-60")),n})()}}),ee(Ae,{get checked(){return ke()},onChange:B,label:"Show external deps"}),ee(Ae,{get checked(){return v()},onChange:P,label:"Show exports"}),ee(Ae,{get checked(){return p()},onChange:r,label:"Hide unimported"}),xn(),ee(ut,{onClick:Qe,children:"Fit View"}),ee(ut,{variant:"danger",get onClick(){return t.onClose},children:"Close"})]}}),C),K(C,ee(Ne,{get when(){return $()},get children(){return ee(Pt,{label:"Loading dependency graph...",class:"absolute inset-0"})}}),null),K(C,ee(Ne,{get when(){return V()},get children(){return ee(Dt,{get message(){return["Error: ",Ge(V)]},class:"absolute inset-0"})}}),null),K(C,ee(Ne,{get when(){return Ge(()=>!$())()&&!V()},get children(){var n=pn(),W=n.firstChild,w=W.firstChild,N=w.firstChild,I=w.nextSibling,u=W.nextSibling,b=u.firstChild,f=b.firstChild,F=f.nextSibling;K(N,()=>v()?"Files & Exports":"Files"),K(w,ee(Ft,{type:"text",get value(){return m()},onInput:o=>D(o.currentTarget.value),get placeholder(){return v()?"Filter files or exports...":"Filter files..."},size:"sm",class:"mt-1 text-[11px]"}),null),K(I,ee(Ne,{get when(){return Fe().length>0},get fallback(){return(()=>{var o=bn(),d=o.firstChild,h=d.nextSibling;return h.nextSibling,K(o,()=>v()?"files or exports":"files",h),o})()},get children(){return ee(He,{get each(){return Fe()},children:o=>(()=>{var d=$n(),h=d.firstChild;return h.$$click=()=>it(o.fileId),K(h,()=>o.fileLabel),K(d,ee(Ne,{get when(){return Ge(()=>!!v())()&&o.exports.length>0},get children(){var O=_n();return K(O,ee(He,{get each(){return o.exports},children:c=>(()=>{var g=kn();return g.$$click=()=>it(c.id),K(g,()=>String(c.label??"")),Le(()=>he(g,"title",String(c.label??""))),g})()})),O}}),null),Le(()=>he(h,"title",o.fileLabel)),d})()})}}));var j=S;typeof j=="function"?ft(j,b):S=b;var k=T;return typeof k=="function"?ft(k,F):T=F,K(F,ee(He,{get each(){return s()},children:o=>{const d=x()===o.id,h=L()===o.id,O=o.type;return O!=="file"&&O!=="external"&&O!=="dummy"&&O!=="export"?null:(()=>{var c=Sn();return c.addEventListener("mouseleave",()=>{L()===o.id&&te(null)}),c.addEventListener("mouseenter",()=>te(o.id)),c.$$click=g=>Mt(o),K(c,ee(Ne,{get when(){return o.type==="file"||o.type==="export"},get children(){var g=En();return K(g,(()=>{var A=Ge(()=>o.type==="file");return()=>(A(),String(o.label??""))})()),g}}),null),K(c,()=>{const g=o.type==="dummy",A=o.type==="external",z=o.type==="export",H=d||h,M=de();let X;if(!g&&!A&&!z&&t.fileMetricsByName){const G=Ve(String(o.label??""));X=t.fileMetricsByName.get(G)}const ae=$e();let J=null;if(X){let G=X[ae]??0;Gt.find(Q=>Q.id===ae)?.invert&&(G=1-(G||0)),(!isFinite(G)||G<0)&&(G=0);const oe=typeof G=="number"?Math.min(G,50):Number(G)||0;ae==="comment_density"?J=Pn(X.comment_density||0):ae==="max_nesting_depth"?J=Dn(X.max_nesting_depth||0):ae==="todo_count"?J=Fn(X.todo_count||0):J=Bn(oe)}const fe=A?H?"#e2e8f0":"#f1f5f9":z?H?"#dbeafe":"#eff6ff":J||(H?"#dbeafe":"#ffffff"),Ie=A?H?"#64748b":"#cbd5e1":z?H?"var(--plc-accent)":"var(--plc-accent-border)":H?"var(--plc-accent-hover)":"var(--plc-accent)",_=o.isSuperNode&&o.assignmentColor?o.assignmentColor:Ie,E=A?H?"#334155":"#64748b":z?"var(--plc-accent-hover)":J?Gn(J,H?1:.85):H?"var(--plc-on-surface)":"#334155";if(g){const G=Math.min(o.width??20,o.height??20)/2-2,re=(o.width??20)/2,oe=(o.height??20)/2;return[(()=>{var Q=Mn();return he(Q,"cx",re),he(Q,"cy",oe),he(Q,"r",G),Le(()=>he(Q,"fill",o.assignmentColor||"#888")),Q})(),(()=>{var Q=Cn();return he(Q,"x",re),he(Q,"y",oe),K(Q,()=>o.assignmentCode),Q})()]}const Y=o.assignmentCode?`[${o.assignmentCode}] ${o.label}`:o.label,q=o.type==="file"&&M?Ve(String(Y??"")):String(Y??""),ie=o.type==="export"?M?5.5:6.5:M?6:7.5,ye=Math.max(6,Math.floor(((o.width??0)-14)/ie)),we=zn(q,ye);return[(()=>{var G=In();return he(G,"rx",z?"10":"4"),he(G,"fill",fe),he(G,"stroke",_),he(G,"stroke-width",H?"2":"1"),Le(re=>{var oe=o.width,Q=o.height;return oe!==re.e&&he(G,"width",re.e=oe),Q!==re.t&&he(G,"height",re.t=Q),re},{e:void 0,t:void 0}),G})(),(()=>{var G=Ln();return he(G,"fill",E),he(G,"font-size",z?M?"9px":"10px":M?"11px":"12px"),K(G,we),Le(re=>{var oe=(o.width||0)/2,Q=z||A?(o.height||0)/2:14;return oe!==re.e&&he(G,"x",re.e=oe),Q!==re.t&&he(G,"y",re.t=Q),re},{e:void 0,t:void 0}),G})()]},null),Le(()=>he(c,"transform",`translate(${o.x}, ${o.y})`)),c})()}}),null),K(F,ee(He,{get each(){return l()},children:o=>{let d=null;if(o.sections&&o.sections.length>0){const h=o.sections[0];d=`M ${h.startPoint.x} ${h.startPoint.y}`,h.bendPoints&&h.bendPoints.forEach(O=>{d+=` L ${O.x} ${O.y}`}),d+=` L ${h.endPoint.x} ${h.endPoint.y}`}else{const h=Ce(),O=o.source??o.sources?.[0],c=o.target??o.targets?.[0];if(!O||!c)return null;const g=h.get(String(O)),A=h.get(String(c));if(!g||!A)return null;const z=(g.x??0)+(g.width??0)/2,H=(g.y??0)+(g.height??0)/2,M=(A.x??0)+(A.width??0)/2,X=(A.y??0)+(A.height??0)/2;d=`M ${z} ${H} L ${M} ${X}`}return(()=>{var h=Nn();return he(h,"d",d??""),h})()}}),null),n}}),null),K(a,ee(Ne,{get when(){return je().length>0},get children(){var n=gn(),W=n.firstChild,w=W.nextSibling;return K(w,ee(He,{get each(){return je()},children:N=>(()=>{var I=Tn(),u=I.firstChild,b=u.nextSibling;return K(u,()=>N.code),K(b,()=>N.label),Le(f=>{var F=N.color,j=N.label;return F!==f.e&&At(u,"background-color",f.e=F),j!==f.t&&he(b,"title",f.t=j),f},{e:void 0,t:void 0}),I})()})),n}}),null),K(a,ee(Wt,{get isOpen(){return!!le()},get filePath(){return le()},onClose:()=>{ge(null),pe(null)}}),null),a})()}Ot(["input","click"]);export{Rn as default};
1
+ import{S as at,r as Tt,d as zt,i as Re,T as et,a as tt,t as ce,b as K,c as ee,e as Ne,f as Le,g as vt,h as Bt,j as ve,o as ct,k as lt,l as Ue,C as Ae,m as Ge,B as ut,L as Pt,E as Dt,n as Ft,F as He,s as he,u as ft,H as Gt,p as Ke,q as At,v as Ht,w as dt,x as Ot}from"./index-CPpALji7.js";import{g as Rt,C as Wt}from"./CodeModal-BBkwbpez.js";function Me(t){return typeof t=="string"?new at([[document.querySelector(t)]],[document.documentElement]):new at([[t]],Tt)}function jt(t){let s;for(;s=t.sourceEvent;)t=s;return t}function Pe(t,s){if(t=jt(t),s===void 0&&(s=t.currentTarget),s){var i=s.ownerSVGElement||s;if(i.createSVGPoint){var l=i.createSVGPoint();return l.x=t.clientX,l.y=t.clientY,l=l.matrixTransform(s.getScreenCTM().inverse()),[l.x,l.y]}if(s.getBoundingClientRect){var R=s.getBoundingClientRect();return[t.clientX-R.left-s.clientLeft,t.clientY-R.top-s.clientTop]}}return[t.pageX,t.pageY]}const ot={capture:!0,passive:!1};function st(t){t.preventDefault(),t.stopImmediatePropagation()}function Ut(t){var s=t.document.documentElement,i=Me(t).on("dragstart.drag",st,ot);"onselectstart"in s?i.on("selectstart.drag",st,ot):(s.__noselect=s.style.MozUserSelect,s.style.MozUserSelect="none")}function Xt(t,s){var i=t.document.documentElement,l=Me(t).on("dragstart.drag",null);s&&(l.on("click.drag",st,ot),setTimeout(function(){l.on("click.drag",null)},0)),"onselectstart"in i?l.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}var Yt=1e-12;function ht(t){return((t=Math.exp(t))+1/t)/2}function qt(t){return((t=Math.exp(t))-1/t)/2}function Vt(t){return((t=Math.exp(2*t))-1)/(t+1)}const Kt=(function t(s,i,l){function R($,y){var V=$[0],se=$[1],Z=$[2],_e=y[0],ke=y[1],B=y[2],v=_e-V,P=ke-se,L=v*v+P*P,te,x;if(L<Yt)x=Math.log(B/Z)/s,te=function(Ee){return[V+Ee*v,se+Ee*P,Z*Math.exp(s*Ee*x)]};else{var pe=Math.sqrt(L),le=(B*B-Z*Z+l*L)/(2*Z*i*pe),ge=(B*B-Z*Z-l*L)/(2*B*i*pe),de=Math.log(Math.sqrt(le*le+1)-le),xe=Math.log(Math.sqrt(ge*ge+1)-ge);x=(xe-de)/s,te=function(Ee){var ze=Ee*x,Te=ht(de),De=Z/(i*pe)*(Te*Vt(s*ze+de)-qt(de));return[V+De*v,se+De*P,Z*Te/ht(s*ze+de)]}}return te.duration=x*1e3*s/Math.SQRT2,te}return R.rho=function($){var y=Math.max(.001,+$),V=y*y,se=V*V;return t(y,V,se)},R})(Math.SQRT2,2,4),Xe=t=>()=>t;function Zt(t,{sourceEvent:s,target:i,transform:l,dispatch:R}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:s,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:R}})}function nt(t){t.stopImmediatePropagation()}function Oe(t){t.preventDefault(),t.stopImmediatePropagation()}function Jt(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Qt(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function pt(){return this.__zoom||Re}function en(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function tn(){return navigator.maxTouchPoints||"ontouchstart"in this}function nn(t,s,i){var l=t.invertX(s[0][0])-i[0][0],R=t.invertX(s[1][0])-i[1][0],$=t.invertY(s[0][1])-i[0][1],y=t.invertY(s[1][1])-i[1][1];return t.translate(R>l?(l+R)/2:Math.min(0,l)||Math.max(0,R),y>$?($+y)/2:Math.min(0,$)||Math.max(0,y))}function rn(){var t=Jt,s=Qt,i=nn,l=en,R=tn,$=[0,1/0],y=[[-1/0,-1/0],[1/0,1/0]],V=250,se=Kt,Z=zt("start","zoom","end"),_e,ke,B,v=500,P=150,L=0,te=10;function x(e){e.property("__zoom",pt).on("wheel.zoom",ze,{passive:!1}).on("mousedown.zoom",Te).on("dblclick.zoom",De).filter(R).on("touchstart.zoom",We).on("touchmove.zoom",Ze).on("touchend.zoom touchcancel.zoom",je).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(e,p,r,m){var D=e.selection?e.selection():e;D.property("__zoom",pt),e!==D?de(e,p,r,m):D.interrupt().each(function(){xe(this,arguments).event(m).start().zoom(null,typeof p=="function"?p.apply(this,arguments):p).end()})},x.scaleBy=function(e,p,r,m){x.scaleTo(e,function(){var D=this.__zoom.k,S=typeof p=="function"?p.apply(this,arguments):p;return D*S},r,m)},x.scaleTo=function(e,p,r,m){x.transform(e,function(){var D=s.apply(this,arguments),S=this.__zoom,T=r==null?ge(D):typeof r=="function"?r.apply(this,arguments):r,U=S.invert(T),ne=typeof p=="function"?p.apply(this,arguments):p;return i(le(pe(S,ne),T,U),D,y)},r,m)},x.translateBy=function(e,p,r,m){x.transform(e,function(){return i(this.__zoom.translate(typeof p=="function"?p.apply(this,arguments):p,typeof r=="function"?r.apply(this,arguments):r),s.apply(this,arguments),y)},null,m)},x.translateTo=function(e,p,r,m,D){x.transform(e,function(){var S=s.apply(this,arguments),T=this.__zoom,U=m==null?ge(S):typeof m=="function"?m.apply(this,arguments):m;return i(Re.translate(U[0],U[1]).scale(T.k).translate(typeof p=="function"?-p.apply(this,arguments):-p,typeof r=="function"?-r.apply(this,arguments):-r),S,y)},m,D)};function pe(e,p){return p=Math.max($[0],Math.min($[1],p)),p===e.k?e:new et(p,e.x,e.y)}function le(e,p,r){var m=p[0]-r[0]*e.k,D=p[1]-r[1]*e.k;return m===e.x&&D===e.y?e:new et(e.k,m,D)}function ge(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function de(e,p,r,m){e.on("start.zoom",function(){xe(this,arguments).event(m).start()}).on("interrupt.zoom end.zoom",function(){xe(this,arguments).event(m).end()}).tween("zoom",function(){var D=this,S=arguments,T=xe(D,S).event(m),U=s.apply(D,S),ne=r==null?ge(U):typeof r=="function"?r.apply(D,S):r,me=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ue=D.__zoom,be=typeof p=="function"?p.apply(D,S):p,Se=se(ue.invert(ne).concat(me/ue.k),be.invert(ne).concat(me/be.k));return function($e){if($e===1)$e=be;else{var Ce=Se($e),Fe=me/Ce[2];$e=new et(Fe,ne[0]-Ce[0]*Fe,ne[1]-Ce[1]*Fe)}T.zoom(null,$e)}})}function xe(e,p,r){return!r&&e.__zooming||new Ee(e,p)}function Ee(e,p){this.that=e,this.args=p,this.active=0,this.sourceEvent=null,this.extent=s.apply(e,p),this.taps=0}Ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,p){return this.mouse&&e!=="mouse"&&(this.mouse[1]=p.invert(this.mouse[0])),this.touch0&&e!=="touch"&&(this.touch0[1]=p.invert(this.touch0[0])),this.touch1&&e!=="touch"&&(this.touch1[1]=p.invert(this.touch1[0])),this.that.__zoom=p,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var p=Me(this.that).datum();Z.call(e,this.that,new Zt(e,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:Z}),p)}};function ze(e,...p){if(!t.apply(this,arguments))return;var r=xe(this,p).event(e),m=this.__zoom,D=Math.max($[0],Math.min($[1],m.k*Math.pow(2,l.apply(this,arguments)))),S=Pe(e);if(r.wheel)(r.mouse[0][0]!==S[0]||r.mouse[0][1]!==S[1])&&(r.mouse[1]=m.invert(r.mouse[0]=S)),clearTimeout(r.wheel);else{if(m.k===D)return;r.mouse=[S,m.invert(S)],tt(this),r.start()}Oe(e),r.wheel=setTimeout(T,P),r.zoom("mouse",i(le(pe(m,D),r.mouse[0],r.mouse[1]),r.extent,y));function T(){r.wheel=null,r.end()}}function Te(e,...p){if(B||!t.apply(this,arguments))return;var r=e.currentTarget,m=xe(this,p,!0).event(e),D=Me(e.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",me,!0),S=Pe(e,r),T=e.clientX,U=e.clientY;Ut(e.view),nt(e),m.mouse=[S,this.__zoom.invert(S)],tt(this),m.start();function ne(ue){if(Oe(ue),!m.moved){var be=ue.clientX-T,Se=ue.clientY-U;m.moved=be*be+Se*Se>L}m.event(ue).zoom("mouse",i(le(m.that.__zoom,m.mouse[0]=Pe(ue,r),m.mouse[1]),m.extent,y))}function me(ue){D.on("mousemove.zoom mouseup.zoom",null),Xt(ue.view,m.moved),Oe(ue),m.event(ue).end()}}function De(e,...p){if(t.apply(this,arguments)){var r=this.__zoom,m=Pe(e.changedTouches?e.changedTouches[0]:e,this),D=r.invert(m),S=r.k*(e.shiftKey?.5:2),T=i(le(pe(r,S),m,D),s.apply(this,p),y);Oe(e),V>0?Me(this).transition().duration(V).call(de,T,m,e):Me(this).call(x.transform,T,m,e)}}function We(e,...p){if(t.apply(this,arguments)){var r=e.touches,m=r.length,D=xe(this,p,e.changedTouches.length===m).event(e),S,T,U,ne;for(nt(e),T=0;T<m;++T)U=r[T],ne=Pe(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],D.touch0?!D.touch1&&D.touch0[2]!==ne[2]&&(D.touch1=ne,D.taps=0):(D.touch0=ne,S=!0,D.taps=1+!!_e);_e&&(_e=clearTimeout(_e)),S&&(D.taps<2&&(ke=ne[0],_e=setTimeout(function(){_e=null},v)),tt(this),D.start())}}function Ze(e,...p){if(this.__zooming){var r=xe(this,p).event(e),m=e.changedTouches,D=m.length,S,T,U,ne;for(Oe(e),S=0;S<D;++S)T=m[S],U=Pe(T,this),r.touch0&&r.touch0[2]===T.identifier?r.touch0[0]=U:r.touch1&&r.touch1[2]===T.identifier&&(r.touch1[0]=U);if(T=r.that.__zoom,r.touch1){var me=r.touch0[0],ue=r.touch0[1],be=r.touch1[0],Se=r.touch1[1],$e=($e=be[0]-me[0])*$e+($e=be[1]-me[1])*$e,Ce=(Ce=Se[0]-ue[0])*Ce+(Ce=Se[1]-ue[1])*Ce;T=pe(T,Math.sqrt($e/Ce)),U=[(me[0]+be[0])/2,(me[1]+be[1])/2],ne=[(ue[0]+Se[0])/2,(ue[1]+Se[1])/2]}else if(r.touch0)U=r.touch0[0],ne=r.touch0[1];else return;r.zoom("touch",i(le(T,U,ne),r.extent,y))}}function je(e,...p){if(this.__zooming){var r=xe(this,p).event(e),m=e.changedTouches,D=m.length,S,T;for(nt(e),B&&clearTimeout(B),B=setTimeout(function(){B=null},v),S=0;S<D;++S)T=m[S],r.touch0&&r.touch0[2]===T.identifier?delete r.touch0:r.touch1&&r.touch1[2]===T.identifier&&delete r.touch1;if(r.touch1&&!r.touch0&&(r.touch0=r.touch1,delete r.touch1),r.touch0)r.touch0[1]=this.__zoom.invert(r.touch0[0]);else if(r.end(),r.taps===2&&(T=Pe(T,this),Math.hypot(ke[0]-T[0],ke[1]-T[1])<te)){var U=Me(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return x.wheelDelta=function(e){return arguments.length?(l=typeof e=="function"?e:Xe(+e),x):l},x.filter=function(e){return arguments.length?(t=typeof e=="function"?e:Xe(!!e),x):t},x.touchable=function(e){return arguments.length?(R=typeof e=="function"?e:Xe(!!e),x):R},x.extent=function(e){return arguments.length?(s=typeof e=="function"?e:Xe([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),x):s},x.scaleExtent=function(e){return arguments.length?($[0]=+e[0],$[1]=+e[1],x):[$[0],$[1]]},x.translateExtent=function(e){return arguments.length?(y[0][0]=+e[0][0],y[1][0]=+e[1][0],y[0][1]=+e[0][1],y[1][1]=+e[1][1],x):[[y[0][0],y[0][1]],[y[1][0],y[1][1]]]},x.constrain=function(e){return arguments.length?(i=e,x):i},x.duration=function(e){return arguments.length?(V=+e,x):V},x.interpolate=function(e){return arguments.length?(se=e,x):se},x.on=function(){var e=Z.on.apply(Z,arguments);return e===Z?x:e},x.clickDistance=function(e){return arguments.length?(L=(e=+e)*e,x):Math.sqrt(L)},x.tapDistance=function(e){return arguments.length?(te=+e,x):te},x}function Ye(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var rt={exports:{}},gt;function on(){return gt||(gt=1,(function(t,s){(function(i){t.exports=i()})(function(){return(function(){function i(l,R,$){function y(Z,_e){if(!R[Z]){if(!l[Z]){var ke=typeof Ye=="function"&&Ye;if(!_e&&ke)return ke(Z,!0);if(V)return V(Z,!0);var B=new Error("Cannot find module '"+Z+"'");throw B.code="MODULE_NOT_FOUND",B}var v=R[Z]={exports:{}};l[Z][0].call(v.exports,function(P){var L=l[Z][1][P];return y(L||P)},v,v.exports,i,l,R,$)}return R[Z].exports}for(var V=typeof Ye=="function"&&Ye,se=0;se<$.length;se++)y($[se]);return y}return i})()({1:[function(i,l,R){Object.defineProperty(R,"__esModule",{value:!0}),R.default=void 0;function $(B){"@babel/helpers - typeof";return $=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(v){return typeof v}:function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},$(B)}function y(B,v){if(!(B instanceof v))throw new TypeError("Cannot call a class as a function")}function V(B,v){for(var P=0;P<v.length;P++){var L=v[P];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(B,Z(L.key),L)}}function se(B,v,P){return v&&V(B.prototype,v),Object.defineProperty(B,"prototype",{writable:!1}),B}function Z(B){var v=_e(B,"string");return $(v)=="symbol"?v:v+""}function _e(B,v){if($(B)!="object"||!B)return B;var P=B[Symbol.toPrimitive];if(P!==void 0){var L=P.call(B,v);if($(L)!="object")return L;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(B)}R.default=(function(){function B(){var v=this,P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},L=P.defaultLayoutOptions,te=L===void 0?{}:L,x=P.algorithms,pe=x===void 0?["layered","stress","mrtree","radial","force","disco","sporeOverlap","sporeCompaction","rectpacking","vertiflex"]:x,le=P.workerFactory,ge=P.workerUrl;if(y(this,B),this.defaultLayoutOptions=te,this.initialized=!1,typeof ge>"u"&&typeof le>"u")throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.");var de=le;typeof ge<"u"&&typeof le>"u"&&(de=function(ze){return new Worker(ze)});var xe=de(ge);if(typeof xe.postMessage!="function")throw new TypeError("Created worker does not provide the required 'postMessage' function.");this.worker=new ke(xe),this.worker.postMessage({cmd:"register",algorithms:pe}).then(function(Ee){return v.initialized=!0}).catch(console.err)}return se(B,[{key:"layout",value:function(P){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=L.layoutOptions,x=te===void 0?this.defaultLayoutOptions:te,pe=L.logging,le=pe===void 0?!1:pe,ge=L.measureExecutionTime,de=ge===void 0?!1:ge;return P?this.worker.postMessage({cmd:"layout",graph:P,layoutOptions:x,options:{logging:le,measureExecutionTime:de}}):Promise.reject(new Error("Missing mandatory parameter 'graph'."))}},{key:"knownLayoutAlgorithms",value:function(){return this.worker.postMessage({cmd:"algorithms"})}},{key:"knownLayoutOptions",value:function(){return this.worker.postMessage({cmd:"options"})}},{key:"knownLayoutCategories",value:function(){return this.worker.postMessage({cmd:"categories"})}},{key:"terminateWorker",value:function(){this.worker&&this.worker.terminate()}}])})();var ke=(function(){function B(v){var P=this;if(y(this,B),v===void 0)throw new Error("Missing mandatory parameter 'worker'.");this.resolvers={},this.worker=v,this.worker.onmessage=function(L){setTimeout(function(){P.receive(P,L)},0)}}return se(B,[{key:"postMessage",value:function(P){var L=this.id||0;this.id=L+1,P.id=L;var te=this;return new Promise(function(x,pe){te.resolvers[L]=function(le,ge){le?(te.convertGwtStyleError(le),pe(le)):x(ge)},te.worker.postMessage(P)})}},{key:"receive",value:function(P,L){var te=L.data,x=P.resolvers[te.id];x&&(delete P.resolvers[te.id],te.error?x(te.error):x(null,te.data))}},{key:"terminate",value:function(){this.worker&&this.worker.terminate()}},{key:"convertGwtStyleError",value:function(P){if(P){var L=P.__java$exception;L&&(L.cause&&L.cause.backingJsObject&&(P.cause=L.cause.backingJsObject,this.convertGwtStyleError(P.cause)),delete P.__java$exception)}}}])})()},{}],2:[function(i,l,R){var $=i("./elk-api.js").default;Object.defineProperty(l.exports,"__esModule",{value:!0}),l.exports=$,$.default=$},{"./elk-api.js":1}]},{},[2])(2)})})(rt)),rt.exports}var sn=on();const an=Rt(sn),cn="/assets/elk-worker.min-DGCccKuH.js";var ln=ce('<div class="truncate text-sm font-bold text-[var(--plc-on-surface)]">'),un=ce('<div class="truncate text-[11px] text-[var(--plc-on-subtle)]">'),fn=ce('<div class="flex shrink-0 items-center gap-3">'),dn=ce("<div><div class=min-w-0>");function hn(t){return(()=>{var s=dn(),i=s.firstChild;return K(i,ee(Ne,{get when(){return t.title},get children(){var l=ln();return K(l,()=>t.title),l}}),null),K(i,ee(Ne,{get when(){return t.subtitle},get children(){var l=un();return K(l,()=>t.subtitle),l}}),null),K(s,ee(Ne,{get when(){return t.actions},get children(){var l=fn();return K(l,()=>t.actions),l}}),null),Le(()=>vt(s,Bt("flex items-center justify-between gap-4 border-b border-[var(--plc-border)] bg-[var(--plc-surface)] px-4 py-2",t.class))),s})()}var pn=ce('<div class="flex h-full"><div class="w-72 border-r border-[var(--plc-border)] bg-[var(--plc-surface)] text-xs text-[var(--plc-on-surface)] flex flex-col"><div class="px-3 py-2 border-b border-[var(--plc-border)]"><div class="text-[11px] font-semibold uppercase tracking-wide text-[var(--plc-on-muted)]"></div></div><div class="flex-1 overflow-y-auto px-2 py-2 space-y-2"></div></div><div class=flex-1><svg class="w-full h-full cursor-grab active:cursor-grabbing"><defs><marker id=arrowhead markerWidth=10 markerHeight=7 refX=9 refY=3.5 orient=auto><polygon points="0 0, 10 3.5, 0 7"fill=#666></polygon></marker></defs><g>'),gn=ce('<div class="absolute bottom-4 left-4 bg-[var(--plc-surface)] border border-[var(--plc-border-strong)] rounded px-3 py-2 text-xs text-[var(--plc-on-surface)] shadow-[var(--plc-menu-shadow)] max-w-sm"><div class="font-bold text-[var(--plc-on-surface)] text-[11px] mb-1 border-b border-[var(--plc-border)] pb-1">High In-Degree Targets</div><div class="space-y-1 max-h-40 overflow-y-auto">'),mn=ce('<div class="absolute inset-0 bg-[var(--plc-surface)] z-50 flex flex-col"><div class="flex-1 relative overflow-hidden">'),yn=ce('<label class="flex items-center gap-1 text-xs text-[var(--plc-on-muted)]"><span class=text-[var(--plc-on-muted)]>Layout</span><select class="ml-1 rounded border border-[var(--plc-border-strong)] bg-[var(--plc-surface)] px-2 py-1 text-[11px] text-[var(--plc-on-surface)] focus:outline-none focus:ring-1 focus:ring-[var(--plc-border-focus)]"title="Layered (tidy) or Force-directed (tighter clustering)"><option value=layered>Layered</option><option value=force>Force'),vn=ce('<label class="flex items-center gap-2 text-xs text-[var(--plc-on-muted)]"><span class=text-[var(--plc-on-muted)]>Tightness</span><input type=range min=0 max=100>'),xn=ce('<div class="h-4 w-px bg-[var(--plc-border)]">'),wn=ce("<span>Horizontal flow"),bn=ce('<div class="px-1 py-1 text-[11px] text-[var(--plc-on-subtle)]">No matching <!>.'),_n=ce('<div class="space-y-0.5 mt-0.5">'),$n=ce('<div><button type=button class="w-full text-left px-2 py-1 text-[11px] font-semibold text-[var(--plc-on-surface)] truncate hover:bg-[var(--plc-surface-hover)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--plc-border-focus)]">'),kn=ce('<button type=button class="w-full text-left px-4 py-1 rounded text-[11px] hover:bg-[var(--plc-surface-hover)] focus:outline-none focus:ring-1 focus:ring-[var(--plc-border-focus)] truncate">'),En=ce("<title>"),Sn=ce("<svg><g class=cursor-pointer></svg>",!1,!0,!1),Mn=ce("<svg><circle stroke=#111 stroke-width=1.5></svg>",!1,!0,!1),Cn=ce('<svg><text dy=0.35em text-anchor=middle fill=#000 font-size=10px class="pointer-events-none select-none font-mono"></svg>',!1,!0,!1),In=ce("<svg><rect></svg>",!1,!0,!1),Ln=ce('<svg><text dy=0.35em text-anchor=middle class="pointer-events-none select-none"></svg>',!1,!0,!1),Nn=ce("<svg><path stroke=#666 stroke-width=1 fill=none marker-end=url(#arrowhead)></svg>",!1,!0,!1),Tn=ce('<div class="flex items-center gap-2"><div class="w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-mono"style=color:#000></div><span class="truncate max-w-[220px]">');const mt=5,Be=["#ff6b6b","#feca57","#54a0ff","#5f27cd","#1dd1a1","#ff9ff3","#48dbfb","#ffaf40","#00d2d3","#c8d6e5"],qe="ABCDEFGHIJKLMNOPQRSTUVWXYZ";function Ve(t){const s=t.lastIndexOf("/");return s>=0?t.slice(s+1):t}function zn(t,s){const i=String(t??"");return s<=0?"":i.length<=s?i:s<=1?"…":`${i.slice(0,Math.max(1,s-1))}…`}const Bn=Ke().domain([0,10,50]).range(["#dbeafe","#fde68a","#fecaca"]).clamp(!0),Pn=Ke().domain([0,.2,.5]).range(["#ffcccc","#ff9999","#ff0000"]).clamp(!0),Dn=Ke().domain([0,3,8]).range(["#e0f7fa","#bae6fd","#0891b2"]).clamp(!0),Fn=Ke().domain([0,1,5]).range(["#f1f8e9","#bef264","#65a30d"]).clamp(!0),Gn=(t,s=1)=>{const i=dt(t),R=i.l>=.5?.12:.9,$=dt(i.h,i.s*.9,R).rgb();return`rgba(${Math.round($.r)}, ${Math.round($.g)}, ${Math.round($.b)}, ${s})`};function xt(t){const s=t.lastIndexOf("/"),i=s>=0?t.slice(s+1):t,l=i.lastIndexOf(".");return(l>0?i.slice(0,l):i).trim()}function An(t){const s=xt(t).replace(/[\[\]]/g,""),i=s.toUpperCase().match(/[A-Z]/g)??[],l=[];i.length===2&&l.push(i.join(""));const $=s.split(/[-_\s]+/).filter(Boolean).map(y=>(y.match(/[A-Za-z]/)?.[0]??"").toUpperCase()).filter(Boolean);if($.length>=2){const y=`${$[0]}${$[1]}`;l.includes(y)||l.push(y)}if(i.length>=2){const y=`${i[0]}${i[1]}`;l.includes(y)||l.push(y);const V=`${i[0]}${i[i.length-1]}`;l.includes(V)||l.push(V)}else if(i.length===1){const y=`${i[0]}${i[0]}`;l.includes(y)||l.push(y)}for(let y=0;y<i.length&&y<4;y++)for(let V=y+1;V<i.length&&V<y+4;V++){const se=`${i[y]}${i[V]}`;l.includes(se)||l.push(se)}return l}function yt(t,s){const i=An(t);for(const l of i)if(l.length===2&&!s.has(l))return s.add(l),l;for(let l=0;l<qe.length;l++)for(let R=0;R<qe.length;R++){const $=`${qe[l]}${qe[R]}`;if(!s.has($))return s.add($),$}return"??"}function Rn(t){const[s,i]=ve([]),[l,R]=ve([]),[$,y]=ve(!0),[V,se]=ve(null),[Z,_e]=ve(null),[ke,B]=ve(!1),[v,P]=ve(!1),[L,te]=ve(null),[x,pe]=ve(null),[le,ge]=ve(null),[de,xe]=ve(!0),[Ee,ze]=ve(!1),[Te,De]=ve("layered"),[We,Ze]=ve(70),[je,e]=ve([]),[p,r]=ve(!1),[m,D]=ve("");let S,T,U,ne,me=0,ue;const be=()=>{me++,ne?.terminate(),ne=void 0,ue?.(null),ue=void 0};ct(be);const Se=new an({workerUrl:cn});ct(()=>Se.terminateWorker());const $e=()=>t.primaryMetricId||"complexity",Ce=lt(()=>{const a=new Map;for(const C of s())a.set(C.id,C);return a}),Fe=lt(()=>{const a=m().trim().toLowerCase(),C=s(),n=v(),W=[],w=new Map;for(const u of C)if(u.type==="file")W.push(u);else if(n&&u.type==="export"&&u.parent){const b=w.get(u.parent)??[];b.push(u),w.set(u.parent,b)}const N=[...W].sort((u,b)=>String(u.label??u.id).localeCompare(String(b.label??b.id))),I=[];for(const u of N){const b=u.id,f=String(u.label??b),F=f.toLowerCase();if(!n){if(a&&!F.includes(a))continue;I.push({fileId:b,fileLabel:f,exports:[]});continue}const j=[...w.get(b)??[]].sort((d,h)=>String(d.label??"").localeCompare(String(h.label??""))),k=j.filter(d=>a?`${String(d.label??"")} ${f}`.toLowerCase().includes(a):!0);(!a||F.includes(a)||k.length>0)&&I.push({fileId:b,fileLabel:f,exports:a?k:j})}return I});Ue(()=>{wt(t.path)});async function wt(a){y(!0),se(null);try{const C=new URL("/api/analysis/dependencies",window.location.origin);a&&C.searchParams.append("path",a);const n=await fetch(C.toString());if(!n.ok)throw new Error("Failed to fetch dependencies");const W=await n.json();_e(W)}catch(C){se(C.message)}finally{y(!1)}}function bt(a,C,n,W){let w=a.nodes,N=a.edges;if(!C){w=w.filter(u=>u.type!=="external");const I=new Set(w.map(u=>u.id));N=N.filter(u=>I.has(u.source)&&I.has(u.target))}if(n){const I=new Map(w.map(b=>[b.id,b])),u=new Set;for(const b of w)b.type==="export"&&typeof b.parent=="string"&&u.add(b.parent);N=N.filter(b=>{const f=I.get(b.source),F=I.get(b.target);if(!f||!F)return!0;const j=f.type==="file",k=F.type==="file";return!(j&&k&&u.has(F.id))})}else{w=w.filter(u=>u.type!=="export");const I=new Set(w.map(u=>u.id));N=N.filter(u=>I.has(u.source)&&I.has(u.target))}if(W){const I=new Map(w.map(k=>[k.id,k])),u=new Set,b=new Set,f=new Map;for(const k of w)k.type==="export"&&typeof k.parent=="string"&&f.set(k.id,k.parent);for(const k of N){const o=I.get(k.source),d=I.get(k.target);if(!o||!d)continue;const h=o.type,O=d.type;if(h==="file"&&O==="file"){u.add(d.id);continue}if(h==="export"&&O==="file"){b.add(o.id);const c=f.get(o.id);c&&u.add(c)}}const F=t.path;w=w.filter(k=>k.type==="file"?F&&k.id===F?!0:u.has(k.id):k.type==="export"?b.has(k.id):!0);const j=new Set(w.map(k=>k.id));N=N.filter(k=>j.has(k.source)&&j.has(k.target))}return{nodes:w,edges:N}}function _t(a){if(!a.nodes||!a.edges)return{graph:a,assignments:[]};if(v())return{graph:a,assignments:[]};const C=new Map;for(const c of a.edges)!c||typeof c.target!="string"||C.set(c.target,(C.get(c.target)??0)+1);const n=Array.from(C.entries()).filter(([,c])=>c>mt).map(([c])=>c);if(n.length===0)return{graph:a,assignments:[]};const W=new Map(a.nodes.map(c=>[c.id,c])),w=[...n].sort((c,g)=>{const A=W.get(c),z=W.get(g),H=(A?.label??"").toString().toLowerCase(),M=(z?.label??"").toString().toLowerCase();return H.localeCompare(M)}),N=[],I=new Map,u=new Set;if(w.forEach((c,g)=>{const A=W.get(c);if(!A)return;const z=A.label??c,H=yt(z,u),M=Be[g%Be.length]??Be[Be.length-1],X={nodeId:c,label:z,code:H,color:M};N.push(X),I.set(c,X)}),N.length===0)return{graph:a,assignments:[]};const b=new Set(w),f=t.path,j=[...a.nodes.filter(c=>{const g=c.id;return c.type!=="file"||!b.has(g)?!0:!!(f&&g===f)}).map(c=>{const g=I.get(c.id);return g?{...c,assignmentCode:g.code,assignmentColor:g.color,isSuperNode:!0}:c})],k=[],o=new Map;let d=0;for(const c of a.edges){const g=String(c.source),A=String(c.target),z=I.get(A);if(z){if(W.get(g)?.type==="file"){const M=`${g}::${z.nodeId}`;let X=o.get(M);X||(X=`__badge__${z.nodeId}__${g}__${d++}`,o.set(M,X),j.push({id:X,label:z.code,type:"dummy",parent:g,assignmentCode:z.code,assignmentColor:z.color,superNodeId:z.nodeId}))}continue}b.has(g)&&!(f&&g===f)||b.has(A)&&!(f&&A===f)||k.push(c)}const h=new Set(j.map(c=>c.id)),O=k.filter(c=>h.has(String(c.source))&&h.has(String(c.target)));return{graph:{nodes:j,edges:O},assignments:N}}function $t(a,C){if(!C)return _t(a);if(!a.nodes||!a.edges)return{graph:a,assignments:[]};const n=new Map(a.nodes.map(d=>[d.id,d])),W=new Map;for(const d of a.edges){const h=n.get(d.source),O=n.get(d.target);if(!(!h||!O)&&h.type==="export"&&O.type==="file"){const c=h.id;let g=W.get(c);g||(g=new Set,W.set(c,g)),g.add(O.id)}}const w=Array.from(W.entries()).filter(([,d])=>d.size>mt).map(([d])=>d);if(w.length===0)return{graph:a,assignments:[]};const N=[...w].sort((d,h)=>{const O=n.get(d),c=n.get(h),g=(O?.label??"").toString().toLowerCase(),A=(c?.label??"").toString().toLowerCase();return g.localeCompare(A)}),I=[],u=new Map,b=new Set;N.forEach((d,h)=>{const O=n.get(d);if(!O)return;const c=O.label??d,g=O.parent??"",z=(g?n.get(g):void 0)?.label??g,H=z?xt(z):"";let M=c,X=c;c.trim()==="default"&&H?(M=`${H}/default`,X=H):H&&(M=`${c} (${H})`);const ae=yt(X,b),J=Be[h%Be.length]??Be[Be.length-1],fe={nodeId:d,label:M,code:ae,color:J};I.push(fe),u.set(d,fe)});const F=[...a.nodes.map(d=>{const h=u.get(d.id);return h?{...d,assignmentCode:h.code,assignmentColor:h.color,isSuperNode:!0}:d})],j=[],k=new Map;let o=0;for(const d of a.edges){const h=n.get(d.source),O=n.get(d.target);if(h?.type==="export"&&O?.type==="file"&&u.has(h.id)){const c=O.id,g=h.id,A=`${c}::${g}`;let z=k.get(A);if(!z){const H=u.get(g);z=`__dummy_export__${g}__${c}__${o++}`,k.set(A,z),F.push({id:z,label:H.code,type:"dummy",assignmentCode:H.code,assignmentColor:H.color,superNodeId:h.parent??void 0,parent:c})}continue}j.push(d)}return{graph:{nodes:F,edges:j},assignments:I}}async function kt(a,C){const n=de(),W=Ee(),w=new Map,N=new Map;for(const f of a.nodes??[]){const F=f.parent,j=f.type;!F||!j||(j==="export"?w.set(F,(w.get(F)??0)+1):j==="dummy"&&N.set(F,(N.get(F)??0)+1))}const I=new Map,u=[];a.nodes.forEach(f=>{const F=f.type==="dummy",j=f.type==="export";let k=0,o=0;if(F)k=n?20:26,o=n?20:26;else if(j){const d=String(f.label??"");k=Math.max(n?46:60,d.length*(n?6:7)),o=n?20:24}else{const d=String(f.label??""),h=n?Ve(d):d;k=Math.max(n?84:100,h.length*(n?6:8));const O=w.get(f.id)??0,c=N.get(f.id)??0,g=O>0,A=c>0;o=n?36:44,A&&!n&&(o+=28),g&&(o+=n?28:34)}I.set(f.id,{id:f.id,width:k,height:o,labels:F?[]:[{text:String(f.label??"")}],...f,children:[]})}),I.forEach(f=>{f.parent&&I.has(f.parent)?I.get(f.parent).children.push(f):u.push(f)});const b={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":W?"RIGHT":"DOWN","elk.spacing.nodeNode":n?"22":"40","elk.layered.spacing.nodeNodeBetweenLayers":n?"22":"40","elk.spacing.edgeNode":n?"6":"10","elk.layered.spacing.edgeNodeBetweenLayers":n?"6":"10","elk.layered.layerUnzipping.minimizeEdgeLength":"true","elk.hierarchyHandling":"INCLUDE_CHILDREN"},children:u,edges:a.edges.map(f=>({id:f.id,sources:[f.source],targets:[f.target],label:f.label}))};try{let f=function(M,X=0,ae=0){const J=X+(M.x||0),fe=ae+(M.y||0);j.push({...M,x:J,y:fe}),M.children&&M.children.forEach(Ie=>f(Ie,J,fe))};const F=await Se.layout(b);if(C!==me)return;const j=[];F.children&&F.children.forEach(M=>f(M));const k=new Map,o=new Map,d=new Map;for(const M of j)if(M.type==="file")k.set(M.id,M);else if(M.type==="export"&&M.parent){const X=o.get(M.parent)??[];X.push(M),o.set(M.parent,X)}else if(M.type==="dummy"&&M.parent){const X=d.get(M.parent)??[];X.push(M),d.set(M.parent,X)}const h=n?10:16,O=n?6:8,c=n?6:8,g=n?20:24;o.forEach((M,X)=>{const ae=k.get(X);if(!ae)return;const J=ae.x??0,fe=ae.y??0,Ie=ae.width??120,_=ae.height??40;let E=J+h;const Y=fe+_-g-O;for(const q of M){const ie=q.width??80;E+ie+h>J+Ie&&(E=J+h),q.x=E,q.y=Y,E+=ie+c}});const A=n?7:10,z=A*2,H=n?4:6;d.forEach((M,X)=>{const ae=k.get(X);if(!ae)return;const J=ae.x??0,fe=ae.y??0,Ie=ae.width??120,_=ae.height??40;if(n){const E=fe+14;let Y=J+Ie-h-z;for(const q of M){if(Y<J+h)break;q.x=Y,q.y=E-A,q.width=z,q.height=z,Y-=z+H}}else{let E=J+h;const q=Math.min(fe+22+A+6,fe+_-A-6);for(const ie of M)E+z+h>J+Ie&&(E=J+h),ie.x=E,ie.y=q-A,ie.width=z,ie.height=z,E+=z+H}}),i(j),R(F.edges??[]),setTimeout(()=>{C===me&&Qe()},0)}catch(f){if(C!==me)return;console.error("Layout error:",f),se("Failed to layout graph")}}function Je(a,C,n){return a+(C-a)*n}async function Et(a,C){const n=de(),w=Math.max(0,Math.min(100,We()))/100,N=new Map,I=new Map;for(const _ of a.nodes??[]){const E=_.parent,Y=_.type;!E||!Y||(Y==="export"?N.set(E,(N.get(E)??0)+1):Y==="dummy"&&I.set(E,(I.get(E)??0)+1))}const u=new Map,b=[];for(const _ of a.nodes??[]){const E=_.type,Y=E==="dummy",q=E==="export",ie=E==="external";let ye=0,we=0;if(Y)ye=n?20:26,we=n?20:26;else if(q){const oe=String(_.label??"");ye=Math.max(n?46:60,oe.length*(n?6:7)),we=n?20:24}else{const oe=String(_.label??""),Q=n?Ve(oe):oe;ye=Math.max(n?84:100,Q.length*(n?6:8));const Ct=N.get(String(_.id))??0,It=I.get(String(_.id))??0,Lt=Ct>0,Nt=It>0;we=n?36:44,Nt&&!n&&(we+=28),Lt&&(we+=n?28:34)}const G=String(_.id),re={..._,id:G,width:ye,height:we,x:(Math.random()-.5)*60,y:(Math.random()-.5)*60};u.set(G,re),!Y&&!q&&(re.type==="file"||ie)&&b.push(re)}const f=new Set(b.map(_=>_.id)),F=[];for(const _ of a.edges??[]){const E=String(_.source),Y=String(_.target),q=u.get(E),ie=u.get(Y);if(!q||!ie)continue;const ye=q.type==="export"&&q.parent?String(q.parent):E,we=ie.type==="export"&&ie.parent?String(ie.parent):Y;ye!==we&&(!f.has(ye)||!f.has(we)||F.push({source:ye,target:we}))}const j=Je(140,40,w),k=Je(-900,-220,w),o=Je(22,10,w),d=new Worker(new URL("/assets/dependencyForce.worker-WVMkyynK.js",import.meta.url),{type:"module"});ne=d;const h=await new Promise(_=>{ue=_,d.onmessage=E=>{C===me&&(d.terminate(),ne=void 0,ue=void 0,E.data.error?(se(`Force layout failed: ${E.data.error}`),_(null)):_(E.data.positions??[]))},d.onerror=E=>{C===me&&(se(`Force layout failed: ${E.message}`),be())},d.postMessage({id:C,nodes:b.map(({id:E,x:Y,y:q,width:ie,height:ye})=>({id:E,x:Y,y:q,width:ie,height:ye})),links:F,linkDistance:j,chargeStrength:k,collidePad:o,iterations:260})});if(C!==me||!h)return;const O=new Map(h.map(_=>[_.id,_]));for(const _ of b){const E=O.get(_.id);E&&(_.x=E.x,_.y=E.y)}const c=[...u.values()],g=new Map,A=new Map,z=new Map;for(const _ of c)if(_.type==="file")g.set(_.id,_);else if(_.type==="export"&&_.parent){const E=A.get(_.parent)??[];E.push(_),A.set(_.parent,E)}else if(_.type==="dummy"&&_.parent){const E=z.get(_.parent)??[];E.push(_),z.set(_.parent,E)}const H=n?10:16,M=n?6:8,X=n?6:8,ae=n?20:24;A.forEach((_,E)=>{const Y=g.get(E);if(!Y)return;const q=Y.x??0,ie=Y.y??0,ye=Y.width??120,we=Y.height??40;let G=q+H;const re=ie+we-ae-M;for(const oe of _){const Q=oe.width??80;G+Q+H>q+ye&&(G=q+H),oe.x=G,oe.y=re,G+=Q+X}});const J=n?7:10,fe=J*2,Ie=n?4:6;z.forEach((_,E)=>{const Y=g.get(E);if(!Y)return;const q=Y.x??0,ie=Y.y??0,ye=Y.width??120,we=Y.height??40;if(n){const G=ie+14;let re=q+ye-H-fe;for(const oe of _){if(re<q+H)break;oe.x=re,oe.y=G-J,oe.width=fe,oe.height=fe,re-=fe+Ie}}else{let G=q+H;const oe=Math.min(ie+22+J+6,ie+we-J-6);for(const Q of _)G+fe+H>q+ye&&(G=q+H),Q.x=G,Q.y=oe-J,Q.width=fe,Q.height=fe,G+=fe+Ie}}),i(c),R(a.edges??[]),setTimeout(Qe,0)}Ue(()=>{const a=Z();if(be(),!a)return;const C=me,n=ke(),W=v(),w=p(),N=bt(a,n,W,w),{graph:I,assignments:u}=$t(N,W);e(u),Te()==="force"?Et(I,C):kt(I,C)}),Ue(()=>{$e()});function St(){!S||!T||(U=rn().scaleExtent([.1,4]).on("zoom",a=>{Me(T).attr("transform",a.transform)}),Me(S).call(U))}function Qe(){if(!S||!T||s().length===0||!U)return;const a=Me(S),n=Me(T).node()?.getBBox();if(!n)return;const W=a.node()?.parentElement,w=W?.clientWidth||1e3,N=W?.clientHeight||800,I=40,u=Math.min((w-I*2)/n.width,(N-I*2)/n.height),b=Math.min(u,1),f=(w-n.width*b)/2-n.x*b,F=(N-n.height*b)/2-n.y*b,j=Re.translate(f,F).scale(b);a.transition().duration(750).call(U.transform,j)}function it(a){if(!S||!T||!U)return;const C=s().find(o=>o.id===a);if(!C||C.x==null||C.y==null)return;const n=Me(S),W=n.node()?.parentElement,w=W?.clientWidth||1e3,N=W?.clientHeight||800,I=Ht(S)??Re,u=typeof I.k=="number"&&I.k>0?I.k:1,b=(C.x??0)+(C.width??0)/2,f=(C.y??0)+(C.height??0)/2,F=w/2-b*u,j=N/2-f*u,k=Re.translate(F,j).scale(u);n.transition().duration(600).call(U.transform,k),pe(a)}Ue(()=>{!$()&&!V()&&S&&St()});function Mt(a,C){if(a.type==="dummy"){a.superNodeId&&(pe(a.superNodeId),setTimeout(()=>{ge(a.superNodeId)},50));return}a.type==="file"&&(pe(a.id),setTimeout(()=>{ge(a.id)},50))}return(()=>{var a=mn(),C=a.firstChild;return K(a,ee(hn,{get title(){return["Dependency Graph: ",Ge(()=>t.path||"Root")]},get actions(){return[(()=>{var n=yn(),W=n.firstChild,w=W.nextSibling;return w.addEventListener("change",N=>De(N.currentTarget.value)),Le(()=>w.value=Te()),n})(),ee(Ne,{get when(){return Te()==="force"},get children(){var n=vn(),W=n.firstChild,w=W.nextSibling;return w.$$input=N=>Ze(Number(N.currentTarget.value)),Le(()=>w.value=We()),n}}),ee(Ae,{get checked(){return de()},onChange:xe,label:"Compact"}),ee(Ae,{get checked(){return Ee()},onChange:ze,get disabled(){return!de()||Te()==="force"},get title(){return Ge(()=>Te()==="force")()?"Not used in Force layout":de()?"Switch flow direction (can be harder to read)":"Enable Compact first"},get label(){return(()=>{var n=wn();return Le(()=>vt(n,de()?"":"opacity-60")),n})()}}),ee(Ae,{get checked(){return ke()},onChange:B,label:"Show external deps"}),ee(Ae,{get checked(){return v()},onChange:P,label:"Show exports"}),ee(Ae,{get checked(){return p()},onChange:r,label:"Hide unimported"}),xn(),ee(ut,{onClick:Qe,children:"Fit View"}),ee(ut,{variant:"danger",get onClick(){return t.onClose},children:"Close"})]}}),C),K(C,ee(Ne,{get when(){return $()},get children(){return ee(Pt,{label:"Loading dependency graph...",class:"absolute inset-0"})}}),null),K(C,ee(Ne,{get when(){return V()},get children(){return ee(Dt,{get message(){return["Error: ",Ge(V)]},class:"absolute inset-0"})}}),null),K(C,ee(Ne,{get when(){return Ge(()=>!$())()&&!V()},get children(){var n=pn(),W=n.firstChild,w=W.firstChild,N=w.firstChild,I=w.nextSibling,u=W.nextSibling,b=u.firstChild,f=b.firstChild,F=f.nextSibling;K(N,()=>v()?"Files & Exports":"Files"),K(w,ee(Ft,{type:"text",get value(){return m()},onInput:o=>D(o.currentTarget.value),get placeholder(){return v()?"Filter files or exports...":"Filter files..."},size:"sm",class:"mt-1 text-[11px]"}),null),K(I,ee(Ne,{get when(){return Fe().length>0},get fallback(){return(()=>{var o=bn(),d=o.firstChild,h=d.nextSibling;return h.nextSibling,K(o,()=>v()?"files or exports":"files",h),o})()},get children(){return ee(He,{get each(){return Fe()},children:o=>(()=>{var d=$n(),h=d.firstChild;return h.$$click=()=>it(o.fileId),K(h,()=>o.fileLabel),K(d,ee(Ne,{get when(){return Ge(()=>!!v())()&&o.exports.length>0},get children(){var O=_n();return K(O,ee(He,{get each(){return o.exports},children:c=>(()=>{var g=kn();return g.$$click=()=>it(c.id),K(g,()=>String(c.label??"")),Le(()=>he(g,"title",String(c.label??""))),g})()})),O}}),null),Le(()=>he(h,"title",o.fileLabel)),d})()})}}));var j=S;typeof j=="function"?ft(j,b):S=b;var k=T;return typeof k=="function"?ft(k,F):T=F,K(F,ee(He,{get each(){return s()},children:o=>{const d=x()===o.id,h=L()===o.id,O=o.type;return O!=="file"&&O!=="external"&&O!=="dummy"&&O!=="export"?null:(()=>{var c=Sn();return c.addEventListener("mouseleave",()=>{L()===o.id&&te(null)}),c.addEventListener("mouseenter",()=>te(o.id)),c.$$click=g=>Mt(o),K(c,ee(Ne,{get when(){return o.type==="file"||o.type==="export"},get children(){var g=En();return K(g,(()=>{var A=Ge(()=>o.type==="file");return()=>(A(),String(o.label??""))})()),g}}),null),K(c,()=>{const g=o.type==="dummy",A=o.type==="external",z=o.type==="export",H=d||h,M=de();let X;if(!g&&!A&&!z&&t.fileMetricsByName){const G=Ve(String(o.label??""));X=t.fileMetricsByName.get(G)}const ae=$e();let J=null;if(X){let G=X[ae]??0;Gt.find(Q=>Q.id===ae)?.invert&&(G=1-(G||0)),(!isFinite(G)||G<0)&&(G=0);const oe=typeof G=="number"?Math.min(G,50):Number(G)||0;ae==="comment_density"?J=Pn(X.comment_density||0):ae==="max_nesting_depth"?J=Dn(X.max_nesting_depth||0):ae==="todo_count"?J=Fn(X.todo_count||0):J=Bn(oe)}const fe=A?H?"#e2e8f0":"#f1f5f9":z?H?"#dbeafe":"#eff6ff":J||(H?"#dbeafe":"#ffffff"),Ie=A?H?"#64748b":"#cbd5e1":z?H?"var(--plc-accent)":"var(--plc-accent-border)":H?"var(--plc-accent-hover)":"var(--plc-accent)",_=o.isSuperNode&&o.assignmentColor?o.assignmentColor:Ie,E=A?H?"#334155":"#64748b":z?"var(--plc-accent-hover)":J?Gn(J,H?1:.85):H?"var(--plc-on-surface)":"#334155";if(g){const G=Math.min(o.width??20,o.height??20)/2-2,re=(o.width??20)/2,oe=(o.height??20)/2;return[(()=>{var Q=Mn();return he(Q,"cx",re),he(Q,"cy",oe),he(Q,"r",G),Le(()=>he(Q,"fill",o.assignmentColor||"#888")),Q})(),(()=>{var Q=Cn();return he(Q,"x",re),he(Q,"y",oe),K(Q,()=>o.assignmentCode),Q})()]}const Y=o.assignmentCode?`[${o.assignmentCode}] ${o.label}`:o.label,q=o.type==="file"&&M?Ve(String(Y??"")):String(Y??""),ie=o.type==="export"?M?5.5:6.5:M?6:7.5,ye=Math.max(6,Math.floor(((o.width??0)-14)/ie)),we=zn(q,ye);return[(()=>{var G=In();return he(G,"rx",z?"10":"4"),he(G,"fill",fe),he(G,"stroke",_),he(G,"stroke-width",H?"2":"1"),Le(re=>{var oe=o.width,Q=o.height;return oe!==re.e&&he(G,"width",re.e=oe),Q!==re.t&&he(G,"height",re.t=Q),re},{e:void 0,t:void 0}),G})(),(()=>{var G=Ln();return he(G,"fill",E),he(G,"font-size",z?M?"9px":"10px":M?"11px":"12px"),K(G,we),Le(re=>{var oe=(o.width||0)/2,Q=z||A?(o.height||0)/2:14;return oe!==re.e&&he(G,"x",re.e=oe),Q!==re.t&&he(G,"y",re.t=Q),re},{e:void 0,t:void 0}),G})()]},null),Le(()=>he(c,"transform",`translate(${o.x}, ${o.y})`)),c})()}}),null),K(F,ee(He,{get each(){return l()},children:o=>{let d=null;if(o.sections&&o.sections.length>0){const h=o.sections[0];d=`M ${h.startPoint.x} ${h.startPoint.y}`,h.bendPoints&&h.bendPoints.forEach(O=>{d+=` L ${O.x} ${O.y}`}),d+=` L ${h.endPoint.x} ${h.endPoint.y}`}else{const h=Ce(),O=o.source??o.sources?.[0],c=o.target??o.targets?.[0];if(!O||!c)return null;const g=h.get(String(O)),A=h.get(String(c));if(!g||!A)return null;const z=(g.x??0)+(g.width??0)/2,H=(g.y??0)+(g.height??0)/2,M=(A.x??0)+(A.width??0)/2,X=(A.y??0)+(A.height??0)/2;d=`M ${z} ${H} L ${M} ${X}`}return(()=>{var h=Nn();return he(h,"d",d??""),h})()}}),null),n}}),null),K(a,ee(Ne,{get when(){return je().length>0},get children(){var n=gn(),W=n.firstChild,w=W.nextSibling;return K(w,ee(He,{get each(){return je()},children:N=>(()=>{var I=Tn(),u=I.firstChild,b=u.nextSibling;return K(u,()=>N.code),K(b,()=>N.label),Le(f=>{var F=N.color,j=N.label;return F!==f.e&&At(u,"background-color",f.e=F),j!==f.t&&he(b,"title",f.t=j),f},{e:void 0,t:void 0}),I})()})),n}}),null),K(a,ee(Wt,{get isOpen(){return!!le()},get filePath(){return le()},onClose:()=>{ge(null),pe(null)}}),null),a})()}Ot(["input","click"]);export{Rn as default};