@kabmo-labs/kabmo 0.59.0 → 0.59.1

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 (117) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +1 -1
  3. package/dist/client/static/js/{Body-jqq4654r.js → Body-5yedtmnk.js} +1 -1
  4. package/dist/client/static/js/{CsvGrid-avw0taqb.js → CsvGrid-39m8pp1c.js} +1 -1
  5. package/dist/client/static/js/{DocxView-d221vr6g.js → DocxView-vd99cv12.js} +1 -1
  6. package/dist/client/static/js/{DrawioView-gjsy7p01.js → DrawioView-6nq4412n.js} +1 -1
  7. package/dist/client/static/js/{HtmlPreview-949393v1.js → HtmlPreview-cs51gszy.js} +1 -1
  8. package/dist/client/static/js/{ImageView-pan9pqtm.js → ImageView-nc2n0w6s.js} +1 -1
  9. package/dist/client/static/js/{LayoutWrapper-p0qmghgt.js → LayoutWrapper-j7786frq.js} +1 -1
  10. package/dist/client/static/js/MergeDiffView-0rn5zsy5.js +1 -0
  11. package/dist/client/static/js/{Modal-4spmcn44.js → Modal-7ag7a9qq.js} +1 -1
  12. package/dist/client/static/js/{PdfView-dzj2s6rj.js → PdfView-0zab721q.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-b6szjdg5.js → SessionsView-t9rhx472.js} +1 -1
  14. package/dist/client/static/js/{SheetView-jpc178g5.js → SheetView-2wdn5hkd.js} +1 -1
  15. package/dist/client/static/js/{SvgPreview-94fap32p.js → SvgPreview-fmrfxd7z.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-a6eyfzrj.js → abnfDiagram-O67JEVCF-41scfh9v.js} +1 -1
  17. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-pgmyfncy.js → architectureDiagram-NJMV4G6O-fp6etjvt.js} +1 -1
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-rf51jyb2.js → blockDiagram-BEXU5L5S-pespk9mt.js} +1 -1
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-0faj48jp.js → c4Diagram-YGBWAQC7-rt4z91dx.js} +1 -1
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-bvzsws8x.js → classDiagram-v2-NBCMYWYE-6bzaq8sd.js} +1 -1
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-j1amnd3m.js → cose-bilkent-JH36ORCC-z3fhgcba.js} +1 -1
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-f73w6zzz.js → cynefinDiagram-VND7K2PF-8endeh4p.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-a5vgvjsg.js → dagre-6A5THRUB-2a2f32dv.js} +1 -1
  24. package/dist/client/static/js/{diagram-22UHCM2B-6y9efamp.js → diagram-22UHCM2B-wgbyr6b7.js} +1 -1
  25. package/dist/client/static/js/{diagram-3UASUU5V-2mycy7xm.js → diagram-3UASUU5V-5122b41x.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-10zgjb66.js → diagram-ATOU4E4O-1gt9fr7e.js} +1 -1
  27. package/dist/client/static/js/{diagram-CDSNMT55-bewa52yf.js → diagram-CDSNMT55-v6hs59jb.js} +1 -1
  28. package/dist/client/static/js/{diagram-MLGK6HIB-mh3b7gd3.js → diagram-MLGK6HIB-yey2m5nm.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-gvdrbdm5.js → diagram-MPIPVDR6-hg4f3q4d.js} +1 -1
  30. package/dist/client/static/js/{dockerfile-6bn19kg0.js → dockerfile-56tfnp5r.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-2prre93c.js → ebnfDiagram-ZINNZB2B-2mhc9aar.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-9t6t9kc6.js → elk-276RUBZZ-wedtvz9y.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-etcggr5n.js → erDiagram-OPXOYQCR-1kysnby9.js} +1 -1
  34. package/dist/client/static/js/flowDiagram-KWPJA3E3-vd4z6bvy.js +1 -0
  35. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-cdc4mwhs.js → ganttDiagram-FUAMR5RP-j4g65rpm.js} +1 -1
  36. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-55d0fa7x.js → gitGraphDiagram-X574FWY7-vcwmj4b3.js} +1 -1
  37. package/dist/client/static/js/{index-eggbcdwx.js → index-1mkn5fbf.js} +8 -8
  38. package/dist/client/static/js/{index-j1ksa4x2.js → index-2h7xh93h.js} +1 -1
  39. package/dist/client/static/js/{index-2f6afhze.js → index-3kedv94b.js} +1 -1
  40. package/dist/client/static/js/{index-xe447cw3.js → index-42k78whj.js} +1 -1
  41. package/dist/client/static/js/{index-yg38s8t3.js → index-42q5gg7t.js} +1 -1
  42. package/dist/client/static/js/{index-pe5f2gmn.js → index-6vbra7p9.js} +1 -1
  43. package/dist/client/static/js/{index-gcad7b6g.js → index-7enfdvh0.js} +1 -1
  44. package/dist/client/static/js/{index-me0b6wkw.js → index-9mgpbwfr.js} +1 -1
  45. package/dist/client/static/js/{index-fyt8m8ah.js → index-a70sk36c.js} +1 -1
  46. package/dist/client/static/js/{index-pzwf6hwe.js → index-c5401dqs.js} +2 -2
  47. package/dist/client/static/js/{index-a5ecn5yx.js → index-csxnqgzw.js} +1 -1
  48. package/dist/client/static/js/{index-jpvng27a.js → index-d201jvs9.js} +1 -1
  49. package/dist/client/static/js/{index-wwyjzhgs.js → index-dbsy29gn.js} +1 -1
  50. package/dist/client/static/js/{index-rw84kefb.js → index-dw9epydj.js} +1 -1
  51. package/dist/client/static/js/{index-537m8a3x.js → index-e39m185a.js} +1 -1
  52. package/dist/client/static/js/{index-yh7gngsh.js → index-fg0ne74z.js} +1 -1
  53. package/dist/client/static/js/{index-skvfxcd8.js → index-fnaq8baz.js} +1 -1
  54. package/dist/client/static/js/{index-fr91ghwb.js → index-fvphmwkf.js} +1 -1
  55. package/dist/client/static/js/{index-s9ts6qbj.js → index-gajpd90b.js} +1 -1
  56. package/dist/client/static/js/{index-pgy7ree5.js → index-hgzf4ask.js} +1 -1
  57. package/dist/client/static/js/{index-c253x7vt.js → index-hrez92pw.js} +1 -1
  58. package/dist/client/static/js/{index-8z9aqgf3.js → index-jaf968hx.js} +2 -2
  59. package/dist/client/static/js/{index-mx5y9vt9.js → index-kt77dwsg.js} +1 -1
  60. package/dist/client/static/js/{index-27gwghmp.js → index-m62sf9wn.js} +1 -1
  61. package/dist/client/static/js/{index-sx2yz2wx.js → index-n7bmqeqz.js} +1 -1
  62. package/dist/client/static/js/{index-3akjcs82.js → index-pn0ja904.js} +1 -1
  63. package/dist/client/static/js/{index-ax8gaayq.js → index-pr8wsq24.js} +1 -1
  64. package/dist/client/static/js/{index-pa70qj4p.js → index-qc3de995.js} +1 -1
  65. package/dist/client/static/js/{index-9rvjegmy.js → index-r42f3r1p.js} +1 -1
  66. package/dist/client/static/js/{index-f13ern5e.js → index-s7p2wdr1.js} +1 -1
  67. package/dist/client/static/js/{index-y09de44h.js → index-skp6991n.js} +1 -1
  68. package/dist/client/static/js/{index-f6t91mpp.js → index-spnrx2c0.js} +1 -1
  69. package/dist/client/static/js/{index-mngpcca7.js → index-sqyvj03y.js} +1 -1
  70. package/dist/client/static/js/{index-njhrm5qa.js → index-tz5ewsza.js} +1 -1
  71. package/dist/client/static/js/{index-6bsez5n6.js → index-vs3g6njv.js} +1 -1
  72. package/dist/client/static/js/{index-nnwcbp2d.js → index-wkxsypj1.js} +1 -1
  73. package/dist/client/static/js/{index-60cxxnpk.js → index-xqz7bqcn.js} +2 -2
  74. package/dist/client/static/js/{index-trq7bdvk.js → index-y5pkqrga.js} +1 -1
  75. package/dist/client/static/js/{infoDiagram-VRGFBTTK-9xph6cr5.js → infoDiagram-VRGFBTTK-7craq9x2.js} +1 -1
  76. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-3gshs3v8.js → ishikawaDiagram-OU5B5YK6-ncjty2re.js} +1 -1
  77. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-fa8x56mf.js → journeyDiagram-ZHPQQLJL-yx222bzt.js} +1 -1
  78. package/dist/client/static/js/{kanban-definition-PNTS6WVX-fybp2hh4.js → kanban-definition-PNTS6WVX-a2f84qmn.js} +1 -1
  79. package/dist/client/static/js/{mermaid.core-jjh5ggp0.js → mermaid.core-9vfwthw3.js} +2 -2
  80. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-gtfbg619.js → mindmap-definition-NLK3R4M7-fsxysg6f.js} +1 -1
  81. package/dist/client/static/js/one-dark-pro-7v4by00h.js +1 -0
  82. package/dist/client/static/js/one-light-5rfzh8p4.js +1 -0
  83. package/dist/client/static/js/{pegDiagram-GJSIUBJH-1a51sbqv.js → pegDiagram-GJSIUBJH-77wxmp9g.js} +1 -1
  84. package/dist/client/static/js/{pieDiagram-5QR66LMP-zd9svyyn.js → pieDiagram-5QR66LMP-gvgfhez0.js} +1 -1
  85. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-5gtw2m6s.js → quadrantDiagram-O4NWA36T-9zkbt5h8.js} +1 -1
  86. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-3ccwpfzz.js → railroadDiagram-XR7U4H2S-w55bsyw6.js} +1 -1
  87. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-sasndrrp.js → requirementDiagram-PLB6GJNP-828s1e5g.js} +1 -1
  88. package/dist/client/static/js/{rust-n9z2c9m3.js → rust-csv5f258.js} +1 -1
  89. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2ahb4sda.js → sankeyDiagram-IPEJSGJF-34f3fyvg.js} +1 -1
  90. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-bfj90kz1.js → sequenceDiagram-PO4LG4MO-nnta2hn0.js} +1 -1
  91. package/dist/client/static/js/{sizeCapture-INFHLROL-5tygxmtc.js → sizeCapture-INFHLROL-gpcramga.js} +1 -1
  92. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-533xw76e.js → stateDiagram-v2-GCMORJYK-3f2en220.js} +1 -1
  93. package/dist/client/static/js/{swimlanes-2SLR337P-gd3d04pk.js → swimlanes-2SLR337P-jgqt12z9.js} +1 -1
  94. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-xxmvdyg4.js → swimlanesDiagram-TC7HE7FX-xx1z57df.js} +1 -1
  95. package/dist/client/static/js/{timeline-definition-EJHVYXUP-fvqvgqvg.js → timeline-definition-EJHVYXUP-sgchcs11.js} +1 -1
  96. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-tm1f0m4x.js → usecaseDiagram-POWQR4AR-znkg9pkq.js} +1 -1
  97. package/dist/client/static/js/{vennDiagram-UO4OBE2U-2vdvv1hd.js → vennDiagram-UO4OBE2U-dncg96ej.js} +1 -1
  98. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-7avcjznx.js → wardleyDiagram-VNRHLVJA-77xz2d49.js} +1 -1
  99. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-g39y526n.js → xychartDiagram-PMCCYNJV-40j1aqyf.js} +1 -1
  100. package/package.json +1 -1
  101. package/src/client/components/common/session-row/TrailingSlot.tsx +8 -1
  102. package/src/client/components/common/session-row/index.tsx +4 -0
  103. package/src/client/components/common/session-row/session-row.test.tsx +5 -0
  104. package/src/client/components/layout/session-sidebar/modern/RevealRow.tsx +36 -5
  105. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -0
  106. package/src/client/components/layout/session-sidebar/modern/reveal-row.test.tsx +28 -1
  107. package/src/client/components/workspace/model-dropdown/CloseButton.tsx +2 -2
  108. package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +2 -2
  109. package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +10 -1
  110. package/src/client/components/workspace/model-dropdown/Header.tsx +27 -20
  111. package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
  112. package/src/client/components/workspace/model-dropdown/harness-tabs.test.tsx +18 -0
  113. package/src/client/components/workspace/model-dropdown/picker-close.test.tsx +34 -4
  114. package/dist/client/static/js/MergeDiffView-swt467g7.js +0 -1
  115. package/dist/client/static/js/flowDiagram-KWPJA3E3-7c2ncsw7.js +0 -1
  116. package/dist/client/static/js/one-dark-pro-vht9rv39.js +0 -1
  117. package/dist/client/static/js/one-light-arxc5whh.js +0 -1
@@ -1,4 +1,4 @@
1
- import{n,o,K,i,u,a,nt,e,Il,fe,At,Hm,ys,qm,Wm,po,Es,np,xb,wb}from"./index-eggbcdwx.js";import{ke,_t,x,P,Ge,Tr,hn,ie,pe,Nn,ge,dt,Aa,Kr,Ot,N,We,wn,ye,_,xo,Qn,Hi,ld}from"./index-q3k8r0ms.js";import{ph,cd}from"./index-2f6afhze.js";var ai=600,fi=150,Ct=1,St=new Map;function Ep(t){if(!t)return;St.get(t)?.()}function al({tabKey:t,surface:r,ready:s=!0,slot:l=np,element:f}){let h=nt(Il),c=h?.sessionId??null,d=h?.ready??!1,m=i(null),p=i(null),g=i(0),b=i(!1),k=i(0),v=i(!1),w=i(null),D=i(),M=a(()=>{let E=p.current,S=m.current;if(!E||!S)return;if(performance.now()>E.until){p.current=null;return}if(Math.abs(S.scrollTop-E.top)<Ct){k.current=S.scrollTop;return}b.current=!0,S.scrollTop=E.top,b.current=!1,g.current=S.scrollTop,k.current=S.scrollTop},[]),L=a((E)=>{if(m.current=E,E)M()},[M]),F=a((E)=>{if(!t)return;let S=fe(c,l);if((S?.[t]?.[r]??0)===E)return;At(c,l,wb(S,t,r,E))},[c,l,t,r]),R=a(()=>{let E=m.current;if(!E||!t)return;let S=E.scrollTop;if(p.current){if(b.current)return;let B=Math.abs(S-k.current)>=Ct;if(k.current=S,B&&!v.current){M();return}if(Math.abs(S-g.current)<Ct*2)return;p.current=null}k.current=S,v.current=!1,w.current=S,clearTimeout(D.current),D.current=setTimeout(()=>{D.current=void 0;let B=w.current;if(B!==null)F(B)},fi)},[M,F,t]);return o(()=>{if(!f)return;let E=()=>R();return f.addEventListener("scroll",E,{passive:!0}),()=>f.removeEventListener("scroll",E)},[f,R]),o(()=>{let E=f??m.current;if(!E)return;let S=()=>{v.current=!0},B=["wheel","keydown","pointerdown","touchstart"];for(let y of B)E.addEventListener(y,S,{passive:!0});return window.addEventListener("keydown",S,{passive:!0}),()=>{for(let y of B)E.removeEventListener(y,S);window.removeEventListener("keydown",S)}},[f]),K(()=>{p.current=null,w.current=null,v.current=!1;let E=null;if(f!==void 0)m.current=f;let S=m.current;if(s&&d&&t&&S){let B=xb(fe(c,l),t,r);p.current={top:B,until:performance.now()+ai},St.set(S,()=>{p.current=null}),M();let y=S.firstElementChild;if(y&&typeof ResizeObserver<"u")E=new ResizeObserver(()=>M()),E.observe(y)}return()=>{if(S)St.delete(S);E?.disconnect(),clearTimeout(D.current),D.current=void 0;let B=w.current;if(w.current=null,B!==null)F(B)}},[s,d,t,r,c,l,M,F,f]),{ref:L,onScroll:R}}var hi=0;class Ye{constructor(t,r){this.from=t,this.to=r}}class Ee{constructor(t={}){this.id=hi++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw RangeError("Can't add per-node props to node types");if(typeof t!="function")t=Y.match(t);return(r)=>{let s=t(r);return s===void 0?null:[this,s]}}}Ee.closedBy=new Ee({deserialize:(t)=>t.split(" ")});Ee.openedBy=new Ee({deserialize:(t)=>t.split(" ")});Ee.group=new Ee({deserialize:(t)=>t.split(" ")});Ee.isolate=new Ee({deserialize:(t)=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ee.contextHash=new Ee({perNode:!0});Ee.lookAhead=new Ee({perNode:!0});Ee.mounted=new Ee({perNode:!0});class Be{constructor(t,r,s,l=!1){this.tree=t,this.overlay=r,this.parser=s,this.bracketed=l}static get(t){return t&&t.props&&t.props[Ee.mounted.id]}}var ui=Object.create(null);class Y{constructor(t,r,s,l=0){this.name=t,this.props=r,this.id=s,this.flags=l}static define(t){let r=t.props&&t.props.length?Object.create(null):ui,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),l=new Y(t.name||"",r,t.id,s);if(t.props)for(let f of t.props){if(!Array.isArray(f))f=f(l);if(f){if(f[0].perNode)throw RangeError("Can't store a per-node prop on a node type");r[f[0].id]=f[1]}}return l}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Ee.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let s in t)for(let l of s.split(" "))r[l]=t[s];return(s)=>{for(let l=s.prop(Ee.group),f=-1;f<(l?l.length:0);f++){let h=r[f<0?s.name:l[f]];if(h)return h}}}}Y.none=new Y("",Object.create(null),0,8);class et{constructor(t){this.types=t;for(let r=0;r<t.length;r++)if(t[r].id!=r)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let r=[];for(let s of this.types){let l=null;for(let f of t){let h=f(s);if(h){if(!l)l=Object.assign({},s.props);let c=h[1],d=h[0];if(d.combine&&d.id in l)c=d.combine(l[d.id],c);l[d.id]=c}}r.push(l?new Y(s.name,l,s.id,s.flags):s)}return new et(r)}}var Xe=new WeakMap,pr=new WeakMap,U;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(U||(U={}));class W{constructor(t,r,s,l,f){if(this.type=t,this.children=r,this.positions=s,this.length=l,this.props=null,f&&f.length){this.props=Object.create(null);for(let[h,c]of f)this.props[typeof h=="number"?h:h.id]=c}}toString(){let t=Be.get(this);if(t&&!t.overlay)return t.tree.toString();let r="";for(let s of this.children){let l=s.toString();if(l){if(r)r+=",";r+=l}}return!this.type.name?r:(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":"")}cursor(t=0){return new Ze(this.topNode,t)}cursorAt(t,r=0,s=0){let l=Xe.get(this)||this.topNode,f=new Ze(l);return f.moveTo(t,r),Xe.set(this,f._tree),f}get topNode(){return new Z(this,0,0,null)}resolve(t,r=0){let s=Ne(Xe.get(this)||this.topNode,t,r,!1);return Xe.set(this,s),s}resolveInner(t,r=0){let s=Ne(pr.get(this)||this.topNode,t,r,!0);return pr.set(this,s),s}resolveStack(t,r=0){return di(this,t,r)}iterate(t){let{enter:r,leave:s,from:l=0,to:f=this.length}=t,h=t.mode||0,c=(h&U.IncludeAnonymous)>0;for(let d=this.cursor(h|U.IncludeAnonymous);;){let m=!1;if(d.from<=f&&d.to>=l&&(!c&&d.type.isAnonymous||r(d)!==!1)){if(d.firstChild())continue;m=!0}for(;;){if(m&&s&&(c||!d.type.isAnonymous))s(d);if(d.nextSibling())break;if(!d.parent())return;m=!0}}}prop(t){return!t.perNode?this.type.prop(t):this.props?this.props[t.id]:void 0}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:Lt(Y.none,this.children,this.positions,0,this.children.length,0,this.length,(r,s,l)=>new W(this.type,r,s,l,this.propValues),t.makeTree||((r,s,l)=>new W(Y.none,r,s,l)))}static build(t){return mi(t)}}W.empty=new W(Y.none,[],[],0);class Dt{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Dt(this.buffer,this.index)}}class ue{constructor(t,r,s){this.buffer=t,this.length=r,this.set=s}get type(){return Y.none}toString(){let t=[];for(let r=0;r<this.buffer.length;)t.push(this.childString(r)),r=this.buffer[r+3];return t.join(",")}childString(t){let r=this.buffer[t],s=this.buffer[t+3],l=this.set.types[r],f=l.name;if(/\W/.test(f)&&!l.isError)f=JSON.stringify(f);if(t+=4,s==t)return f;let h=[];while(t<s)h.push(this.childString(t)),t=this.buffer[t+3];return f+"("+h.join(",")+")"}findChild(t,r,s,l,f){let{buffer:h}=this,c=-1;for(let d=t;d!=r;d=h[d+3])if(kr(f,l,h[d+1],h[d+2])){if(c=d,s>0)break}return c}slice(t,r,s){let l=this.buffer,f=new Uint16Array(r-t),h=0;for(let c=t,d=0;c<r;){f[d++]=l[c++],f[d++]=l[c++]-s;let m=f[d++]=l[c++]-s;f[d++]=l[c++]-t,h=Math.max(h,m)}return new ue(f,h,this.set)}}function kr(t,r,s,l){switch(t){case-2:return s<r;case-1:return l>=r&&s<r;case 0:return s<r&&l>r;case 1:return s<=r&&l>r;case 2:return l>r;case 4:return!0}}function Ne(t,r,s,l){var f;while(t.from==t.to||(s<1?t.from>=r:t.from>r)||(s>-1?t.to<=r:t.to<r)){let c=!l&&t instanceof Z&&t.index<0?null:t.parent;if(!c)return t;t=c}let h=l?0:U.IgnoreOverlays;if(l){for(let c=t,d=c.parent;d;c=d,d=c.parent)if(c instanceof Z&&c.index<0&&((f=d.enter(r,s,h))===null||f===void 0?void 0:f.from)!=c.from)t=d}for(;;){let c=t.enter(r,s,h);if(!c)return t;t=c}}class Bt{cursor(t=0){return new Ze(this,t)}getChild(t,r=null,s=null){let l=gr(this,t,r,s);return l.length?l[0]:null}getChildren(t,r=null,s=null){return gr(this,t,r,s)}resolve(t,r=0){return Ne(this,t,r,!1)}resolveInner(t,r=0){return Ne(this,t,r,!0)}matchContext(t){return Mt(this.parent,t)}enterUnfinishedNodesBefore(t){let r=this.childBefore(t),s=this;while(r){let l=r.lastChild;if(!l||l.to!=r.to)break;if(l.type.isError&&l.from==l.to)s=r,r=l.prevSibling;else r=l}return s}get node(){return this}get next(){return this.parent}}class Z extends Bt{constructor(t,r,s,l){super();this._tree=t,this.from=r,this.index=s,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,r,s,l,f=0){for(let h=this;;){for(let{children:c,positions:d}=h._tree,m=r>0?c.length:-1;t!=m;t+=r){let p=c[t],g=d[t]+h.from,b;if(!(f&U.EnterBracketed&&p instanceof W&&(b=Be.get(p))&&!b.overlay&&b.bracketed&&s>=g&&s<=g+p.length)&&!kr(l,s,g,g+p.length))continue;if(p instanceof ue){if(f&U.ExcludeBuffers)continue;let k=p.findChild(0,p.buffer.length,r,s-g,l);if(k>-1)return new ce(new xr(h,p,t,g),null,k)}else if(f&U.IncludeAnonymous||(!p.type.isAnonymous||Et(p))){let k;if(!(f&U.IgnoreMounts)&&(k=Be.get(p))&&!k.overlay)return new Z(k.tree,g,t,h);let v=new Z(p,g,t,h);return f&U.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(r<0?p.children.length-1:0,r,s,l,f)}}if(f&U.IncludeAnonymous||!h.type.isAnonymous)return null;if(h.index>=0)t=h.index+r;else t=r<0?-1:h._parent._tree.children.length;if(h=h._parent,!h)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,r,s=0){let l;if(!(s&U.IgnoreOverlays)&&(l=Be.get(this._tree))&&l.overlay){let f=t-this.from,h=s&U.EnterBracketed&&l.bracketed;for(let{from:c,to:d}of l.overlay)if((r>0||h?c<=f:c<f)&&(r<0||h?d>=f:d>f))return new Z(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,s)}nextSignificantParent(){let t=this;while(t.type.isAnonymous&&t._parent)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function gr(t,r,s,l){let f=t.cursor(),h=[];if(!f.firstChild())return h;if(s!=null){for(let c=!1;!c;)if(c=f.type.is(s),!f.nextSibling())return h}for(;;){if(l!=null&&f.type.is(l))return h;if(f.type.is(r))h.push(f.node);if(!f.nextSibling())return l==null?h:[]}}function Mt(t,r,s=r.length-1){for(let l=t;s>=0;l=l.parent){if(!l)return!1;if(!l.type.isAnonymous){if(r[s]&&r[s]!=l.name)return!1;s--}}return!0}class xr{constructor(t,r,s,l){this.parent=t,this.buffer=r,this.index=s,this.start=l}}class ce extends Bt{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,r,s){super();this.context=t,this._parent=r,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,r,s){let{buffer:l}=this.context,f=l.findChild(this.index+4,l.buffer[this.index+3],t,r-this.context.start,s);return f<0?null:new ce(this.context,this,f)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,r,s=0){if(s&U.ExcludeBuffers)return null;let{buffer:l}=this.context,f=l.findChild(this.index+4,l.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return f<0?null:new ce(this.context,this,f)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];if(r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length))return new ce(this.context,this._parent,r);return this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;if(this.index==r)return this.externalSibling(-1);return new ce(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],r=[],{buffer:s}=this.context,l=this.index+4,f=s.buffer[this.index+3];if(f>l){let h=s.buffer[this.index+1];t.push(s.slice(l,f,h)),r.push(0)}return new W(this.type,t,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function vr(t){if(!t.length)return null;let r=0,s=t[0];for(let h=1;h<t.length;h++){let c=t[h];if(c.from>s.from||c.to<s.to)s=c,r=h}let l=s instanceof Z&&s.index<0?null:s.parent,f=t.slice();if(l)f[r]=l;else f.splice(r,1);return new wr(f,s)}class wr{constructor(t,r){this.heads=t,this.node=r}get next(){return vr(this.heads)}}function di(t,r,s){let l=t.resolveInner(r,s),f=null;for(let h=l instanceof Z?l:l.context.parent;h;h=h.parent)if(h.index<0){let c=h.parent;(f||(f=[l])).push(c.resolve(r,s)),h=c}else{let c=Be.get(h.tree);if(c&&c.overlay&&c.overlay[0].from<=r&&c.overlay[c.overlay.length-1].to>=r){let d=new Z(c.tree,c.overlay[0].from+h.from,-1,h);(f||(f=[l])).push(Ne(d,r,s,!1))}}return f?vr(f):l}class Ze{get name(){return this.type.name}constructor(t,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~U.EnterBracketed,t instanceof Z)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){if(!t)return!1;return this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0}yieldBuf(t,r){this.index=t;let{start:s,buffer:l}=this.buffer;return this.type=r||l.set.types[l.buffer[t]],this.from=s+l.buffer[t+1],this.to=s+l.buffer[t+2],!0}yield(t){if(!t)return!1;if(t instanceof Z)return this.buffer=null,this.yieldNode(t);return this.buffer=t.context,this.yieldBuf(t.index,t.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,s,this.mode));let{buffer:l}=this.buffer,f=l.findChild(this.index+4,l.buffer[this.index+3],t,r-this.buffer.start,s);if(f<0)return!1;return this.stack.push(this.index),this.yieldBuf(f)}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,s=this.mode){if(!this.buffer)return this.yield(this._tree.enter(t,r,s));return s&U.ExcludeBuffers?!1:this.enterChild(1,t,r)}parent(){if(!this.buffer)return this.yieldNode(this.mode&U.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&U.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!this._tree._parent?!1:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:r}=this.buffer,s=this.stack.length-1;if(t<0){let l=s<0?0:this.stack[s]+4;if(this.index!=l)return this.yieldBuf(r.findChild(l,this.index,-1,0,4))}else{let l=r.buffer[this.index+3];if(l<(s<0?r.buffer.length:r.buffer[this.stack[s]+3]))return this.yieldBuf(l)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,s,{buffer:l}=this;if(l){if(t>0){if(this.index<l.buffer.buffer.length)return!1}else for(let f=0;f<this.index;f++)if(l.buffer.buffer[f+3]<this.index)return!1;({index:r,parent:s}=l)}else({index:r,_parent:s}=this._tree);for(;s;{index:r,_parent:s}=s)if(r>-1)for(let f=r+t,h=t<0?-1:s._tree.children.length;f!=h;f+=t){let c=s._tree.children[f];if(this.mode&U.IncludeAnonymous||c instanceof ue||!c.type.isAnonymous||Et(c))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){while(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to<t))if(!this.parent())break;while(this.enterChild(1,t,r));return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,r=null,s=0;if(t&&t.context==this.buffer)e:for(let l=this.index,f=this.stack.length;f>=0;){for(let h=t;h;h=h._parent)if(h.index==l){if(l==this.index)return h;r=h,s=f+1;break e}l=this.stack[--f]}for(let l=s;l<this.stack.length;l++)r=new ce(this.buffer,r,this.stack[l]);return this.bufferNode=new ce(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,r){for(let s=0;;){let l=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){s++;continue}if(!this.type.isAnonymous)l=!0}for(;;){if(l&&r)r(this);if(l=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,l=!0}}}matchContext(t){if(!this.buffer)return Mt(this.node.parent,t);let{buffer:r}=this.buffer,{types:s}=r.set;for(let l=t.length-1,f=this.stack.length-1;l>=0;f--){if(f<0)return Mt(this._tree,t,l);let h=s[r.buffer[this.stack[f]]];if(!h.isAnonymous){if(t[l]&&t[l]!=h.name)return!1;l--}}return!0}}function Et(t){return t.children.some((r)=>r instanceof ue||!r.type.isAnonymous||Et(r))}function mi(t){var r;let{buffer:s,nodeSet:l,maxBufferLength:f=1024,reused:h=[],minRepeatType:c=l.types.length}=t,d=Array.isArray(s)?new Dt(s,s.length):s,m=l.types,p=0,g=0;function b(S,B,y,T,V,H){let{id:I,start:O,end:z,size:G}=d,J=g,he=p;if(G<0)if(d.next(),G==-1){let le=h[I];y.push(le),T.push(O-S);return}else if(G==-3){p=I;return}else if(G==-4){g=I;return}else throw RangeError(`Unrecognized record size: ${G}`);let _e=m[I],Je,xe,dr=O-S;if(z-O<=f&&(xe=M(d.pos-B,V))){let le=new Uint16Array(xe.size-xe.skip),Q=d.pos-xe.size,re=le.length;while(d.pos>Q)re=L(xe.start,le,re);Je=new ue(le,z-xe.start,l),dr=xe.start-S}else{let le=d.pos-G;d.next();let Q=[],re=[],ve=I>=c?I:-1,De=0,Ke=z,yt=J;while(d.pos>le)if(ve>=0&&d.id==ve&&d.size>=0){if(d.end<=Ke-f)w(Q,re,O,De,d.end,Ke,ve,yt,he),De=Q.length,Ke=d.end,yt=g;d.next()}else if(H>2500)k(O,le,Q,re);else b(O,le,Q,re,ve,H+1);if(ve>=0&&De>0&&De<Q.length)w(Q,re,O,De,O,Ke,ve,yt,he);if(Q.reverse(),re.reverse(),ve>-1&&De>0){let mr=v(_e,he);Je=Lt(_e,Q,re,0,Q.length,0,z-O,mr,mr)}else Je=D(_e,Q,re,z-O,J-z,he)}y.push(Je),T.push(dr)}function k(S,B,y,T){let V=[],H=0,I=-1;while(d.pos>B){let{id:O,start:z,end:G,size:J}=d;if(J>4)d.next();else if(I>-1&&z<I)break;else{if(I<0)I=G-f;V.push(O,z,G),H++,d.next()}}if(H){let O=new Uint16Array(H*4),z=V[V.length-2];for(let G=V.length-3,J=0;G>=0;G-=3)O[J++]=V[G],O[J++]=V[G+1]-z,O[J++]=V[G+2]-z,O[J++]=J;y.push(new ue(O,V[2]-z,l)),T.push(z-S)}}function v(S,B){return(y,T,V)=>{let H=0,I=y.length-1,O,z;if(I>=0&&(O=y[I])instanceof W){if(!I&&O.type==S&&O.length==V)return O;if(z=O.prop(Ee.lookAhead))H=T[I]+O.length+z-V}return D(S,y,T,V,H,B)}}function w(S,B,y,T,V,H,I,O,z){let G=[],J=[];while(S.length>T)G.push(S.pop()),J.push(B.pop()+y-V);S.push(D(l.types[I],G,J,H-V,O-H,z)),B.push(V-y)}function D(S,B,y,T,V,H,I){if(H){let O=[Ee.contextHash,H];I=I?[O].concat(I):[O]}if(V>25){let O=[Ee.lookAhead,V];I=I?[O].concat(I):[O]}return new W(S,B,y,T,I)}function M(S,B){let y=d.fork(),T=0,V=0,H=0,I=y.end-f,O={size:0,start:0,skip:0};e:for(let z=y.pos-S;y.pos>z;){let G=y.size;if(y.id==B&&G>=0){O.size=T,O.start=V,O.skip=H,H+=4,T+=4,y.next();continue}let J=y.pos-G;if(G<0||J<z||y.start<I)break;let he=y.id>=c?4:0,_e=y.start;y.next();while(y.pos>J){if(y.size<0)if(y.size==-3||y.size==-4)he+=4;else break e;else if(y.id>=c)he+=4;y.next()}V=_e,T+=G,H+=he}if(B<0||T==S)O.size=T,O.start=V,O.skip=H;return O.size>4?O:void 0}function L(S,B,y){let{id:T,start:V,end:H,size:I}=d;if(d.next(),I>=0&&T<c){let O=y;if(I>4){let z=d.pos-(I-4);while(d.pos>z)y=L(S,B,y)}B[--y]=O,B[--y]=H-S,B[--y]=V-S,B[--y]=T}else if(I==-3)p=T;else if(I==-4)g=T;return y}let F=[],R=[];while(d.pos>0)b(t.start||0,t.bufferStart||0,F,R,-1,0);let E=(r=t.length)!==null&&r!==void 0?r:F.length?R[0]+F[0].length:0;return new W(m[t.topID],F.reverse(),R.reverse(),E)}var br=new WeakMap;function Qe(t,r){if(!t.isAnonymous||r instanceof ue||r.type!=t)return 1;let s=br.get(r);if(s==null){s=1;for(let l of r.children){if(l.type!=t||!(l instanceof W)){s=1;break}s+=Qe(t,l)}br.set(r,s)}return s}function Lt(t,r,s,l,f,h,c,d,m){let p=0;for(let w=l;w<f;w++)p+=Qe(t,r[w]);let g=Math.ceil(p*1.5/8),b=[],k=[];function v(w,D,M,L,F){for(let R=M;R<L;){let E=R,S=D[R],B=Qe(t,w[R]);R++;for(;R<L;R++){let y=Qe(t,w[R]);if(B+y>=g)break;B+=y}if(R==E+1){if(B>g){let y=w[E];v(y.children,y.positions,0,y.children.length,D[E]+F);continue}b.push(w[E])}else{let y=D[R-1]+w[R-1].length-S;b.push(Lt(t,w,D,E,R,S,y,null,m))}k.push(S+F-h)}}return v(r,s,l,f,0),(d||m)(b,k,c)}class de{constructor(t,r,s,l,f=!1,h=!1){this.from=t,this.to=r,this.tree=s,this.offset=l,this.open=(f?1:0)|(h?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],s=!1){let l=[new de(0,t.length,t,0,!1,s)];for(let f of r)if(f.to>t.length)l.push(f);return l}static applyChanges(t,r,s=128){if(!r.length)return t;let l=[],f=1,h=t.length?t[0]:null;for(let c=0,d=0,m=0;;c++){let p=c<r.length?r[c]:null,g=p?p.fromA:1e9;if(g-d>=s)while(h&&h.from<g){let b=h;if(d>=b.from||g<=b.to||m){let k=Math.max(b.from,d)-m,v=Math.min(b.to,g)-m;b=k>=v?null:new de(k,v,b.tree,b.offset+m,c>0,!!p)}if(b)l.push(b);if(h.to>g)break;h=f<t.length?t[f++]:null}if(!p)break;d=p.toA,m=p.toA-p.toB}return l}}class tt{startParse(t,r,s){if(typeof t=="string")t=new yr(t);return s=!s?[new Ye(0,t.length)]:s.length?s.map((l)=>new Ye(l.from,l.to)):[new Ye(0,0)],this.createParse(t,r||[],s)}parse(t,r,s){let l=this.startParse(t,r,s);for(;;){let f=l.advance();if(f)return f}}}class yr{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}}var no=new Ee({perNode:!0});var pi=0;class ee{constructor(t,r,s,l){this.name=t,this.set=r,this.base=s,this.modified=l,this.id=pi++}toString(){let{name:t}=this;for(let r of this.modified)if(r.name)t=`${r.name}(${t})`;return t}static define(t,r){let s=typeof t=="string"?t:"?";if(t instanceof ee)r=t;if(r===null||r===void 0?void 0:r.base)throw Error("Can not derive from a modified tag");let l=new ee(s,[],null,[]);if(l.set.push(l),r)for(let f of r.set)l.set.push(f);return l}static defineModifier(t){let r=new ot(t);return(s)=>{if(s.modified.indexOf(r)>-1)return s;return ot.get(s.base||s,s.modified.concat(r).sort((l,f)=>l.id-f.id))}}}var gi=0;class ot{constructor(t){this.name=t,this.instances=[],this.id=gi++}static get(t,r){if(!r.length)return t;let s=r[0].instances.find((c)=>c.base==t&&bi(r,c.modified));if(s)return s;let l=[],f=new ee(t.name,l,t,r);for(let c of r)c.instances.push(f);let h=ki(r);for(let c of t.set)if(!c.modified.length)for(let d of h)l.push(ot.get(c,d));return f}}function bi(t,r){return t.length==r.length&&t.every((s,l)=>s==r[l])}function ki(t){let r=[[]];for(let s=0;s<t.length;s++)for(let l=0,f=r.length;l<f;l++)r.push(r[l].concat(t[s]));return r.sort((s,l)=>l.length-s.length)}function Sr(t){let r=Object.create(null);for(let s in t){let l=t[s];if(!Array.isArray(l))l=[l];for(let f of s.split(" "))if(f){let h=[],c=2,d=f;for(let b=0;;){if(d=="..."&&b>0&&b+3==f.length){c=1;break}let k=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(d);if(!k)throw RangeError("Invalid path: "+f);if(h.push(k[0]=="*"?"":k[0][0]=='"'?JSON.parse(k[0]):k[0]),b+=k[0].length,b==f.length)break;let v=f[b++];if(b==f.length&&v=="!"){c=0;break}if(v!="/")throw RangeError("Invalid path: "+f);d=f.slice(b)}let m=h.length-1,p=h[m];if(!p)throw RangeError("Invalid path: "+f);let g=new Le(l,c,m>0?h.slice(0,m):null);r[p]=g.sort(r[p])}}return Mr.add(r)}var Mr=new Ee({combine(t,r){let s,l,f;while(t||r){if(!t||r&&t.depth<=r.depth)f=r,r=r.next;else f=t,t=t.next;if(s&&s.mode==f.mode&&!f.context&&!s.context)continue;let h=new Le(f.tags,f.mode,f.context);if(s)s.next=h;else l=h;s=h}return l}});class Le{constructor(t,r,s,l){this.tags=t,this.mode=r,this.context=s,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){if(!t||t.depth<this.depth)return this.next=t,this;return t.next=this.sort(t.next),t}get depth(){return this.context?this.context.length:0}}Le.empty=new Le([],2,null);function Pt(t,r){let s=Object.create(null);for(let h of t)if(!Array.isArray(h.tag))s[h.tag.id]=h.class;else for(let c of h.tag)s[c.id]=h.class;let{scope:l,all:f=null}=r||{};return{style:(h)=>{let c=f;for(let d of h)for(let m of d.set){let p=s[m.id];if(p){c=c?c+" "+p:p;break}}return c},scope:l}}function xi(t,r){let s=null;for(let l of t){let f=l.style(r);if(f)s=s?s+" "+f:f}return s}function Rt(t,r,s,l=0,f=t.length){let h=new Dr(l,Array.isArray(r)?r:[r],s);h.highlightRange(t.cursor(),l,f,"",h.highlighters),h.flush(f)}class Dr{constructor(t,r,s){this.at=t,this.highlighters=r,this.span=s,this.class=""}startSpan(t,r){if(r!=this.class){if(this.flush(t),t>this.at)this.at=t;this.class=r}}flush(t){if(t>this.at&&this.class)this.span(this.at,t,this.class)}highlightRange(t,r,s,l,f){let{type:h,from:c,to:d}=t;if(c>=s||d<=r)return;if(h.isTop)f=this.highlighters.filter((k)=>!k.scope||k.scope(h));let m=l,p=vi(t)||Le.empty,g=xi(f,p.tags);if(g){if(m)m+=" ";if(m+=g,p.mode==1)l+=(l?" ":"")+g}if(this.startSpan(Math.max(r,c),m),p.opaque)return;let b=t.tree&&t.tree.prop(Ee.mounted);if(b&&b.overlay){let k=t.node.enter(b.overlay[0].from+c,1),v=this.highlighters.filter((D)=>!D.scope||D.scope(b.tree.type)),w=t.firstChild();for(let D=0,M=c;;D++){let L=D<b.overlay.length?b.overlay[D]:null,F=L?L.from+c:d,R=Math.max(r,M),E=Math.min(s,F);if(R<E&&w){while(t.from<E)if(this.highlightRange(t,R,E,l,f),this.startSpan(Math.min(E,t.to),m),t.to>=F||!t.nextSibling())break}if(!L||F>s)break;if(M=L.to+c,M>r)this.highlightRange(k.cursor(),Math.max(r,L.from+c),Math.min(s,M),"",v),this.startSpan(Math.min(s,M),m)}if(w)t.parent()}else if(t.firstChild()){if(b)l="";do{if(t.to<=r)continue;if(t.from>=s)break;this.highlightRange(t,r,s,l,f),this.startSpan(Math.min(s,t.to),m)}while(t.nextSibling());t.parent()}}}function vi(t){let r=t.type.prop(Mr);while(r&&r.context&&!t.matchContext(r.context))r=r.next;return r||null}var C=ee.define,rt=C(),me=C(),Cr=C(me),Ar=C(me),be=C(),it=C(be),Tt=C(be),oe=C(),we=C(oe),ne=C(),se=C(),It=C(),Fe=C(It),st=C(),A={comment:rt,lineComment:C(rt),blockComment:C(rt),docComment:C(rt),name:me,variableName:C(me),typeName:Cr,tagName:C(Cr),propertyName:Ar,attributeName:C(Ar),className:C(me),labelName:C(me),namespace:C(me),macroName:C(me),literal:be,string:it,docString:C(it),character:C(it),attributeValue:C(it),number:Tt,integer:C(Tt),float:C(Tt),bool:C(be),regexp:C(be),escape:C(be),color:C(be),url:C(be),keyword:ne,self:C(ne),null:C(ne),atom:C(ne),unit:C(ne),modifier:C(ne),operatorKeyword:C(ne),controlKeyword:C(ne),definitionKeyword:C(ne),moduleKeyword:C(ne),operator:se,derefOperator:C(se),arithmeticOperator:C(se),logicOperator:C(se),bitwiseOperator:C(se),compareOperator:C(se),updateOperator:C(se),definitionOperator:C(se),typeOperator:C(se),controlOperator:C(se),punctuation:It,separator:C(It),bracket:Fe,angleBracket:C(Fe),squareBracket:C(Fe),paren:C(Fe),brace:C(Fe),content:oe,heading:we,heading1:C(we),heading2:C(we),heading3:C(we),heading4:C(we),heading5:C(we),heading6:C(we),contentSeparator:C(oe),list:C(oe),quote:C(oe),emphasis:C(oe),strong:C(oe),link:C(oe),monospace:C(oe),strikethrough:C(oe),inserted:C(),deleted:C(),changed:C(),invalid:C(),meta:st,documentMeta:C(st),annotation:C(st),processingInstruction:C(st),definition:ee.defineModifier("definition"),constant:ee.defineModifier("constant"),function:ee.defineModifier("function"),standard:ee.defineModifier("standard"),local:ee.defineModifier("local"),special:ee.defineModifier("special")};for(let t in A){let r=A[t];if(r instanceof ee)r.name=t}var oo=Pt([{tag:A.link,class:"tok-link"},{tag:A.heading,class:"tok-heading"},{tag:A.emphasis,class:"tok-emphasis"},{tag:A.strong,class:"tok-strong"},{tag:A.keyword,class:"tok-keyword"},{tag:A.atom,class:"tok-atom"},{tag:A.bool,class:"tok-bool"},{tag:A.url,class:"tok-url"},{tag:A.labelName,class:"tok-labelName"},{tag:A.inserted,class:"tok-inserted"},{tag:A.deleted,class:"tok-deleted"},{tag:A.literal,class:"tok-literal"},{tag:A.string,class:"tok-string"},{tag:A.number,class:"tok-number"},{tag:[A.regexp,A.escape,A.special(A.string)],class:"tok-string2"},{tag:A.variableName,class:"tok-variableName"},{tag:A.local(A.variableName),class:"tok-variableName tok-local"},{tag:A.definition(A.variableName),class:"tok-variableName tok-definition"},{tag:A.special(A.variableName),class:"tok-variableName2"},{tag:A.definition(A.propertyName),class:"tok-propertyName tok-definition"},{tag:A.typeName,class:"tok-typeName"},{tag:A.namespace,class:"tok-namespace"},{tag:A.className,class:"tok-className"},{tag:A.macroName,class:"tok-macroName"},{tag:A.propertyName,class:"tok-propertyName"},{tag:A.operator,class:"tok-operator"},{tag:A.comment,class:"tok-comment"},{tag:A.meta,class:"tok-meta"},{tag:A.invalid,class:"tok-invalid"},{tag:A.punctuation,class:"tok-punctuation"}]);function Br(t,r,s,l=0,f=0){if(r==null){if(r=t.search(/[^\s\u00a0]/),r==-1)r=t.length}let h=f;for(let c=l;c<r;c++)if(t.charCodeAt(c)==9)h+=s-h%s;else h++;return h}class lt{constructor(t,r,s,l){this.string=t,this.tabSize=r,this.indentUnit=s,this.overrideIndent=l,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(t){let r=this.string.charAt(this.pos),s;if(typeof t=="string")s=r==t;else s=r&&(t instanceof RegExp?t.test(r):t(r));if(s)return++this.pos,r}eatWhile(t){let r=this.pos;while(this.eat(t));return this.pos>r}eatSpace(){let t=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let r=this.string.indexOf(t,this.pos);if(r>-1)return this.pos=r,!0}backUp(t){this.pos-=t}column(){if(this.lastColumnPos<this.start)this.lastColumnValue=Br(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start;return this.lastColumnValue}indentation(){var t;return(t=this.overrideIndent)!==null&&t!==void 0?t:Br(this.string,null,this.tabSize)}match(t,r,s){if(typeof t=="string"){let l=(h)=>s?h.toLowerCase():h,f=this.string.substr(this.pos,t.length);if(l(f)==l(t)){if(r!==!1)this.pos+=t.length;return!0}else return null}else{let l=this.string.slice(this.pos).match(t);if(l&&l.index>0)return null;if(l&&r!==!1)this.pos+=l[0].length;return l}}current(){return this.string.slice(this.start,this.pos)}}var Nt,Oe=new Ee;function wi(t){return P.define({combine:t?(r)=>r.concat(t):void 0})}var yi=new Ee;class te{constructor(t,r,s=[],l=""){if(this.data=t,this.name=l,!pe.prototype.hasOwnProperty("tree"))Object.defineProperty(pe.prototype,"tree",{get(){return zn(this)}});this.parser=r,this.extension=[ko.of(this),pe.languageData.of((f,h,c)=>{let d=Er(f,h,c),m=d.type.prop(Oe);if(!m)return[];let p=f.facet(m),g=d.type.prop(yi);if(g){let b=d.resolve(h-d.from,c);for(let k of g)if(k.test(b,f)){let v=f.facet(k.facet);return k.type=="replace"?v:v.concat(p)}}return p})].concat(s)}isActiveAt(t,r,s=-1){return Er(t,r,s).type.prop(Oe)==this.data}findRegions(t){let r=t.facet(ko);if((r===null||r===void 0?void 0:r.data)==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let s=[],l=(f,h)=>{if(f.prop(Oe)==this.data){s.push({from:h,to:h+f.length});return}let c=f.prop(Ee.mounted);if(c){if(c.tree.prop(Oe)==this.data){if(c.overlay)for(let d of c.overlay)s.push({from:d.from+h,to:d.to+h});else s.push({from:h,to:h+f.length});return}else if(c.overlay){let d=s.length;if(l(c.tree,c.overlay[0].from+h),s.length>d)return}}for(let d=0;d<f.children.length;d++){let m=f.children[d];if(m instanceof W)l(m,f.positions[d]+h)}};return l(zn(t),0),s}get allowsNesting(){return!0}}te.setState=ie.define();function Er(t,r,s){let l=t.facet(ko),f=zn(t).topNode;if(!l||l.allowsNesting){for(let h=f;h;h=h.enter(r,s,U.ExcludeBuffers|U.EnterBracketed))if(h.type.isTop)f=h}return f}function zn(t){let r=t.field(te.state,!1);return r?r.tree:W.empty}class Vr{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,r){let s=this.cursorPos-this.string.length;if(t<s||r>=this.cursorPos)return this.doc.sliceString(t,r);else return this.string.slice(t-s,r-s)}}var Ve=null;class Te{constructor(t,r,s=[],l,f,h,c,d){this.parser=t,this.state=r,this.fragments=s,this.tree=l,this.treeLen=f,this.viewport=h,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(t,r,s){return new Te(t,r,[],W.empty,0,s,[],null)}startParse(){return this.parser.startParse(new Vr(this.state.doc),this.fragments)}work(t,r){if(r!=null&&r>=this.state.doc.length)r=void 0;if(this.tree!=W.empty&&this.isDone(r!==null&&r!==void 0?r:this.state.doc.length))return this.takeTree(),!0;return this.withContext(()=>{var s;if(typeof t=="number"){let l=Date.now()+t;t=()=>Date.now()>l}if(!this.parse)this.parse=this.startParse();if(r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length)this.parse.stopAt(r);for(;;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(de.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(s=this.parse.stoppedAt)!==null&&s!==void 0?s:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(r!==null&&r!==void 0?r:this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,r;if(this.parse&&(t=this.parse.parsedPos)>=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>t)this.parse.stopAt(t);this.withContext(()=>{while(!(r=this.parse.advance()));}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(de.addTree(this.tree,this.fragments,!0)),this.parse=null}}withContext(t){let r=Ve;Ve=this;try{return t()}finally{Ve=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=Lr(t,r.from,r.to);return t}changes(t,r){let{fragments:s,tree:l,treeLen:f,viewport:h,skipped:c}=this;if(this.takeTree(),!t.empty){let d=[];if(t.iterChangedRanges((m,p,g,b)=>d.push({fromA:m,toA:p,fromB:g,toB:b})),s=de.applyChanges(s,d),l=W.empty,f=0,h={from:t.mapPos(h.from,-1),to:t.mapPos(h.to,1)},this.skipped.length){c=[];for(let m of this.skipped){let p=t.mapPos(m.from,1),g=t.mapPos(m.to,-1);if(p<g)c.push({from:p,to:g})}}}return new Te(this.parser,r,s,l,f,h,c,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let r=this.skipped.length;for(let s=0;s<this.skipped.length;s++){let{from:l,to:f}=this.skipped[s];if(l<t.to&&f>t.from)this.fragments=Lr(this.fragments,l,f),this.skipped.splice(s--,1)}if(this.skipped.length>=r)return!1;return this.reset(),!0}reset(){if(this.parse)this.takeTree(),this.parse=null}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends tt{createParse(r,s,l){let f=l[0].from,h=l[l.length-1].to;return{parsedPos:f,advance(){let d=Ve;if(d){for(let m of l)d.tempSkipped.push(m);if(t)d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,t]):t}return this.parsedPos=h,new W(Y.none,[],[],h-f)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return Ve}}function Lr(t,r,s){return de.applyChanges(t,[{fromA:r,toA:s,fromB:r,toB:s}])}class Ie{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),s=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);if(!r.work(20,s))r.takeTree();return new Ie(r)}static init(t){let r=Math.min(3000,t.doc.length),s=Te.create(t.facet(ko).parser,t,{from:0,to:r});if(!s.work(20,r))s.takeTree();return new Ie(s)}}te.state=Ge.define({create:Ie.init,update(t,r){for(let s of r.effects)if(s.is(te.setState))return s.value;if(r.startState.facet(ko)!=r.state.facet(ko))return Ie.init(r.state);return t.apply(r)}});var zr=(t)=>{let r=setTimeout(()=>t(),500);return()=>clearTimeout(r)};if(typeof requestIdleCallback<"u")zr=(t)=>{let r=-1,s=setTimeout(()=>{r=requestIdleCallback(t,{timeout:400})},100);return()=>r<0?clearTimeout(s):cancelIdleCallback(r)};var Ft=typeof navigator<"u"&&((Nt=navigator.scheduling)===null||Nt===void 0?void 0:Nt.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ci=ye.fromClass(class{constructor(r){this.view=r,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(r){let s=this.view.state.field(te.state).context;if(s.updateViewport(r.view.viewport)||this.view.viewport.to>s.treeLen)this.scheduleWork();if(r.docChanged||r.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(s)}scheduleWork(){if(this.working)return;let{state:r}=this.view,s=r.field(te.state);if(s.tree!=s.context.tree||!s.context.isDone(r.doc.length))this.working=zr(this.work)}work(r){this.working=null;let s=Date.now();if(this.chunkEnd<s&&(this.chunkEnd<0||this.view.hasFocus))this.chunkEnd=s+30000,this.chunkBudget=3000;if(this.chunkBudget<=0)return;let{state:l,viewport:{to:f}}=this.view,h=l.field(te.state);if(h.tree==h.context.tree&&h.context.isDone(f+1e5))return;let c=Date.now()+Math.min(this.chunkBudget,100,r&&!Ft?Math.max(25,r.timeRemaining()-5):1e9),d=h.context.treeLen<f&&l.doc.length>f+1000,m=h.context.work(()=>Ft&&Ft()||Date.now()>c,f+(d?0:1e5));if(this.chunkBudget-=Date.now()-s,m||this.chunkBudget<=0)h.context.takeTree(),this.view.dispatch({effects:te.setState.of(new Ie(h.context))});if(this.chunkBudget>0&&!(m&&!d))this.scheduleWork();this.checkAsyncSchedule(h.context)}checkAsyncSchedule(r){if(r.scheduleOn)this.workScheduled++,r.scheduleOn.then(()=>this.scheduleWork()).catch((s)=>wn(this.view.state,s)).then(()=>this.workScheduled--),r.scheduleOn=null}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ko=P.define({combine(t){return t.length?t[0]:null},enables:(t)=>[te.state,Ci,_.contentAttributes.compute([t],(r)=>{let s=r.facet(t);return s&&s.name?{"data-language":s.name}:{}})]});var Bp=P.define(),ji=P.define({combine:(t)=>{if(!t.length)return" ";let r=t[0];if(!r||/\S/.test(r)||Array.from(r).some((s)=>s!=r[0]))throw Error("Invalid indent unit: "+JSON.stringify(t[0]));return r}});function ci(t){let r=t.facet(ji);return r.charCodeAt(0)==9?t.tabSize*r.length:r.length}function ol(t,r){let s="",l=t.tabSize,f=t.facet(ji)[0];if(f=="\t"){while(r>=l)s+="\t",r-=l;f=" "}for(let h=0;h<r;h++)s+=f;return s}function ad(t,r){if(t instanceof pe)t=new il(t);for(let l of t.state.facet(Bp)){let f=l(t,r);if(f!==void 0)return f}let s=zn(t.state);return s.length>=r?Ai(t,s,r):null}class il{constructor(t,r={}){this.state=t,this.options=r,this.unit=ci(t)}lineAt(t,r=1){let s=this.state.doc.lineAt(t),{simulateBreak:l,simulateDoubleBreak:f}=this.options;if(l!=null&&l>=s.from&&l<=s.to)if(f&&l==t)return{text:"",from:t};else if(r<0?l<t:l<=t)return{text:s.text.slice(l-s.from),from:l};else return{text:s.text.slice(0,l-s.from),from:s.from};return s}textAfterPos(t,r=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:s,from:l}=this.lineAt(t,r);return s.slice(t-l,Math.min(s.length,t+100-l))}column(t,r=1){let{text:s,from:l}=this.lineAt(t,r),f=this.countColumn(s,t-l),h=this.options.overrideIndentation?this.options.overrideIndentation(l):-1;if(h>-1)f+=h-this.countColumn(s,s.search(/\S|$/));return f}countColumn(t,r=t.length){return Aa(t,this.state.tabSize,r)}lineIndent(t,r=1){let{text:s,from:l}=this.lineAt(t,r),f=this.options.overrideIndentation;if(f){let h=f(l);if(h>-1)return h}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}var Hr=new Ee;function Ai(t,r,s){let l=r.resolveStack(s),f=r.resolveInner(s,-1).resolve(s,0).enterUnfinishedNodesBefore(s);if(f!=l.node){let h=[];for(let c=f;c&&!(c.from<l.node.from||c.to>l.node.to||c.from==l.node.from&&c.type==l.node.type);c=c.parent)h.push(c);for(let c=h.length-1;c>=0;c--)l={node:h[c],next:l}}return Wr(l,t,s)}function Wr(t,r,s){for(let l=t;l;l=l.next){let f=Mi(l.node);if(f)return f(Wt.create(r,s,l))}return 0}function Si(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Mi(t){let r=t.type.prop(Hr);if(r)return r;let s=t.firstChild,l;if(s&&(l=s.type.prop(Ee.closedBy))){let f=t.lastChild,h=f&&l.indexOf(f.name)>-1;return(c)=>Li(c,!0,1,void 0,h&&!Si(c)?f.from:void 0)}return t.parent==null?Di:null}function Di(){return 0}class Wt extends il{constructor(t,r,s){super(t.state,t.options);this.base=t,this.pos=r,this.context=s}get node(){return this.context.node}static create(t,r,s){return new Wt(t,r,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let r=this.state.doc.lineAt(t.from);for(;;){let s=t.resolve(r.from);while(s.parent&&s.parent.from==s.from)s=s.parent;if(Bi(s,t))break;r=this.state.doc.lineAt(s.from)}return this.lineIndent(r.from)}continue(){return Wr(this.context.next,this.base,this.pos)}}function Bi(t,r){for(let s=r;s;s=s.parent)if(t==s)return!0;return!1}function Ei(t){let r=t.node,s=r.childAfter(r.from),l=r.lastChild;if(!s)return null;let f=t.options.simulateBreak,h=t.state.doc.lineAt(s.from),c=f==null||f<=h.from?h.to:Math.min(h.to,f);for(let d=s.to;;){let m=r.childAfter(d);if(!m||m==l)return null;if(!m.type.isSkipped){if(m.from>=c)return null;let p=/^ */.exec(h.text.slice(s.to-h.from))[0].length;return{from:s.from,to:s.to+p}}d=m.to}}function Li(t,r,s,l,f){let h=t.textAfter,c=h.match(/^\s*/)[0].length,d=l&&h.slice(c,c+l.length)==l||f==t.pos+c,m=r?Ei(t):null;if(m)return d?t.column(m.from):t.column(m.to);return t.baseIndent+(d?0:t.unit*s)}var Oi=200;function _g(){return pe.transactionFilter.of((t)=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let r=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!r.length)return t;let s=t.newDoc,{head:l}=t.newSelection.main,f=s.lineAt(l);if(l>f.from+Oi)return t;let h=s.sliceString(f.from,l);if(!r.some((p)=>p.test(h)))return t;let{state:c}=t,d=-1,m=[];for(let{head:p}of c.selection.ranges){let g=c.doc.lineAt(p);if(g.from==d)continue;d=g.from;let b=ad(c,g.from);if(b==null)continue;let k=/^\s*/.exec(g.text)[0],v=ol(c,b);if(k!=v)m.push({from:g.from,to:g.from+k.length,insert:v})}return m.length?[t,{changes:m,sequential:!0}]:t})}var od=P.define(),Ti=new Ee;function Ii(t,r,s){let l=zn(t);if(l.length<s)return null;let f=l.resolveStack(s,1),h=null;for(let c=f;c;c=c.next){let d=c.node;if(d.to<=s||d.from>s)continue;if(h&&d.from<r)break;let m=d.type.prop(Ti);if(m&&(d.to<l.length-50||l.length==t.doc.length||!Pi(d))){let p=m(d,t);if(p&&p.from<=s&&p.from>=r&&p.to>s)h=p}}return h}function Pi(t){let r=t.lastChild;return r&&r.to==t.to&&r.type.isError}function ft(t,r,s){for(let l of t.facet(od)){let f=l(t,r,s);if(f)return f}return Ii(t,r,s)}function Gr(t,r){let s=r.mapPos(t.from,1),l=r.mapPos(t.to,-1);return s>=l?void 0:{from:s,to:l}}var ct=ie.define({map:Gr}),He=ie.define({map:Gr});function Ur(t){let r=[];for(let{head:s}of t.state.selection.ranges){if(r.some((l)=>l.from<=s&&l.to>=s))continue;r.push(t.lineBlockAt(s))}return r}var Ce=Ge.define({create(){return N.none},update(t,r){if(r.isUserEvent("delete"))r.changes.iterChangedRanges((l,f)=>t=Or(t,l,f));t=t.map(r.changes);let s=[];for(let l of r.effects)if(l.is(ct)&&!Ri(t,l.value.from,l.value.to))s.push(l.value);else if(l.is(He))t=t.update({filter:(f,h)=>l.value.from!=f||l.value.to!=h,filterFrom:l.value.from,filterTo:l.value.to});if(s.length){let{preparePlaceholder:l}=r.state.facet(Gt),f=s.map((h)=>(!l?Ir:N.replace({widget:new Jr(l(r.state,h))})).range(h.from,h.to));t=t.update({add:f})}if(r.selection)t=Or(t,r.selection.main.head);return t},provide:(t)=>_.decorations.from(t),toJSON(t,r){let s=[];return t.between(0,r.doc.length,(l,f)=>{s.push(l,f)}),s},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw RangeError("Invalid JSON for fold state");let r=[];for(let s=0;s<t.length;){let l=t[s++],f=t[s++];if(typeof l!="number"||typeof f!="number")throw RangeError("Invalid JSON for fold state");r.push(Ir.range(l,f))}return N.set(r,!0)}});function Or(t,r,s=r){let l=!1;return t.between(r,s,(f,h)=>{if(f<s&&h>r)l=!0}),!l?t:t.update({filterFrom:r,filterTo:s,filter:(f,h)=>f>=s||h<=r})}function ht(t,r,s){var l;let f=null;return(l=t.field(Ce,!1))===null||l===void 0||l.between(r,s,(h,c)=>{if(!f||f.from>h)f={from:h,to:c}}),f}function Ri(t,r,s){let l=!1;return t.between(r,r,(f,h)=>{if(f==r&&h==s)l=!0}),l}function jr(t,r){return t.field(Ce,!1)?r:r.concat(ie.appendConfig.of(sl()))}var Ip=(t)=>{for(let r of Ur(t)){let s=ft(t.state,r.from,r.to);if(s)return t.dispatch({effects:jr(t.state,[ct.of(s),$r(t,s)])}),!0}return!1},_p=(t)=>{if(!t.state.field(Ce,!1))return!1;let r=[];for(let s of Ur(t)){let l=ht(t.state,s.from,s.to);if(l)r.push(He.of(l),$r(t,l,!1))}if(r.length)t.dispatch({effects:r});return r.length>0};function $r(t,r,s=!0){let l=t.state.doc.lineAt(r.from).number,f=t.state.doc.lineAt(r.to).number;return _.announce.of(`${t.state.phrase(s?"Folded lines":"Unfolded lines")} ${l} ${t.state.phrase("to")} ${f}.`)}var Sp=(t)=>{let{state:r}=t,s=[];for(let l=0;l<r.doc.length;){let f=t.lineBlockAt(l),h=ft(r,f.from,f.to);if(h)s.push(ct.of(h));l=(h?t.lineBlockAt(h.to):f).to+1}if(s.length)t.dispatch({effects:jr(t.state,s)});return!!s.length},Tp=(t)=>{let r=t.state.field(Ce,!1);if(!r||!r.size)return!1;let s=[];return r.between(0,t.state.doc.length,(l,f)=>{s.push(He.of({from:l,to:f}))}),t.dispatch({effects:s}),!0};var ZA=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Ip},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:_p},{key:"Ctrl-Alt-[",run:Sp},{key:"Ctrl-Alt-]",run:Tp}],_i={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Gt=P.define({combine(t){return Nn(t,_i)}});function sl(t){let r=[Ce,Fi];if(t)r.push(Gt.of(t));return r}function qr(t,r){let{state:s}=t,l=s.facet(Gt),f=(c)=>{let d=t.lineBlockAt(t.posAtDOM(c.target)),m=ht(t.state,d.from,d.to);if(m)t.dispatch({effects:He.of(m)});c.preventDefault()};if(l.placeholderDOM)return l.placeholderDOM(t,f,r);let h=document.createElement("span");return h.textContent=l.placeholderText,h.setAttribute("aria-label",s.phrase("folded code")),h.title=s.phrase("unfold"),h.className="cm-foldPlaceholder",h.onclick=f,h}var Ir=N.replace({widget:new class extends Ot{toDOM(t){return qr(t,null)}}});class Jr extends Ot{constructor(t){super();this.value=t}eq(t){return this.value==t.value}toDOM(t){return qr(t,this.value)}}var Ni={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class at extends Qn{constructor(t,r){super();this.config=t,this.open=r}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=t.state.phrase(this.open?"Fold line":"Unfold line"),r}}function id(t={}){let r={...Ni,...t},s=new at(r,!0),l=new at(r,!1),f=ye.fromClass(class{constructor(c){this.from=c.viewport.from,this.markers=this.buildMarkers(c)}update(c){if(c.docChanged||c.viewportChanged||c.startState.facet(ko)!=c.state.facet(ko)||c.startState.field(Ce,!1)!=c.state.field(Ce,!1)||zn(c.startState)!=zn(c.state)||r.foldingChanged(c))this.markers=this.buildMarkers(c.view)}buildMarkers(c){let d=new dt;for(let m of c.viewportLineBlocks){let p=ht(c.state,m.from,m.to)?l:ft(c.state,m.from,m.to)?s:null;if(p)d.add(m.from,m.from,p)}return d.finish()}}),{domEventHandlers:h}=r;return[f,Hi({class:"cm-foldGutter",markers(c){var d;return((d=c.plugin(f))===null||d===void 0?void 0:d.markers)||ge.empty},initialSpacer(){return new at(r,!1)},domEventHandlers:{...h,click:(c,d,m)=>{if(h.click&&h.click(c,d,m))return!0;let p=ht(c.state,d.from,d.to);if(p)return c.dispatch({effects:He.of(p)}),!0;let g=ft(c.state,d.from,d.to);if(g)return c.dispatch({effects:ct.of(g)}),!0;return!1}}}),sl()]}var Fi=_.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ut{constructor(t,r){this.specs=t;let s;function l(c){let d=Kr.newName();return(s||(s=Object.create(null)))["."+d]=c,d}let f=typeof r.all=="string"?r.all:r.all?l(r.all):void 0,h=r.scope;this.scope=h instanceof te?(c)=>c.prop(Oe)==h.data:h?(c)=>c==h:void 0,this.style=Pt(t.map((c)=>({tag:c.tag,class:c.class||l(Object.assign({},c,{tag:null}))})),{all:f}).style,this.module=s?new Kr(s):null,this.themeType=r.themeType}static define(t,r){return new Ut(t,r||{})}}var Vi=P.define(),zi=P.define({combine(t){return t.length?[t[0]]:null}});function Wi(t){let r=t.facet(Vi);return r.length?r:t.facet(zi)}function XA(t,r,s){let l=Wi(t),f=null;if(l){for(let h of l)if(!h.scope||s&&h.scope(s)){let c=h.style(r);if(c)f=f?f+" "+c:c}}return f}var bo=Ut.define([{tag:A.meta,color:"#404740"},{tag:A.link,textDecoration:"underline"},{tag:A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:A.emphasis,fontStyle:"italic"},{tag:A.strong,fontWeight:"bold"},{tag:A.strikethrough,textDecoration:"line-through"},{tag:A.keyword,color:"#708"},{tag:[A.atom,A.bool,A.url,A.contentSeparator,A.labelName],color:"#219"},{tag:[A.literal,A.inserted],color:"#164"},{tag:[A.string,A.deleted],color:"#a11"},{tag:[A.regexp,A.escape,A.special(A.string)],color:"#e40"},{tag:A.definition(A.variableName),color:"#00f"},{tag:A.local(A.variableName),color:"#30a"},{tag:[A.typeName,A.namespace],color:"#085"},{tag:A.className,color:"#167"},{tag:[A.special(A.variableName),A.macroName],color:"#256"},{tag:A.definition(A.propertyName),color:"#00c"},{tag:A.comment,color:"#940"},{tag:A.invalid,color:"#f00"}]),Gi=_.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Xr=1e4,Yr="()[]{}",Qr=P.define({combine(t){return Nn(t,{afterCursor:!0,brackets:Yr,maxScanDistance:Xr,renderMatch:qi})}}),Ui=N.mark({class:"cm-matchingBracket"}),$i=N.mark({class:"cm-nonmatchingBracket"});function qi(t){let r=[],s=t.matched?Ui:$i;if(r.push(s.range(t.start.from,t.start.to)),t.end)r.push(s.range(t.end.from,t.end.to));return r}function Pr(t){let r=[],s=t.facet(Qr);for(let l of t.selection.ranges){if(!l.empty)continue;let f=_r(t,l.head,-1,s)||l.head>0&&_r(t,l.head-1,1,s)||s.afterCursor&&(_r(t,l.head,1,s)||l.head<t.doc.length&&_r(t,l.head+1,-1,s));if(f)r=r.concat(s.renderMatch(f,t))}return N.set(r,!0)}var Ji=ye.fromClass(class{constructor(t){this.paused=!1,this.decorations=Pr(t.state)}update(t){if(t.docChanged||t.selectionSet||this.paused)if(t.view.composing)this.decorations=this.decorations.map(t.changes),this.paused=!0;else this.decorations=Pr(t.state),this.paused=!1}},{decorations:(t)=>t.decorations}),Ki=[Ji,Gi];function sd(t={}){return[Qr.of(t),Ki]}var Xi=new Ee;function zt(t,r,s){let l=t.prop(r<0?Ee.openedBy:Ee.closedBy);if(l)return l;if(t.name.length==1){let f=s.indexOf(t.name);if(f>-1&&f%2==(r<0?1:0))return[s[f+r]]}return null}function Ht(t){let r=t.type.prop(Xi);return r?r(t.node):t}function _r(t,r,s,l={}){let f=l.maxScanDistance||Xr,h=l.brackets||Yr,c=zn(t),d=c.resolveInner(r,s);for(let m=d;m;m=m.parent){let p=zt(m.type,s,h);if(p&&m.from<m.to){let g=Ht(m);if(g&&(s>0?r>=g.from&&r<g.to:r>g.from&&r<=g.to))return Yi(t,r,s,m,g,p,h)}}return Qi(t,r,s,c,d.type,f,h)}function Yi(t,r,s,l,f,h,c){let d=l.parent,m={from:f.from,to:f.to},p=0,g=d===null||d===void 0?void 0:d.cursor();if(g&&(s<0?g.childBefore(l.from):g.childAfter(l.to)))do if(s<0?g.to<=l.from:g.from>=l.to){if(p==0&&h.indexOf(g.type.name)>-1&&g.from<g.to){let b=Ht(g);return{start:m,end:b?{from:b.from,to:b.to}:void 0,matched:!0}}else if(zt(g.type,s,c))p++;else if(zt(g.type,-s,c)){if(p==0){let b=Ht(g);return{start:m,end:b&&b.from<b.to?{from:b.from,to:b.to}:void 0,matched:!1}}p--}}while(s<0?g.prevSibling():g.nextSibling());return{start:m,matched:!1}}function Qi(t,r,s,l,f,h,c){if(s<0?!r:r==t.doc.length)return null;let d=s<0?t.sliceDoc(r-1,r):t.sliceDoc(r,r+1),m=c.indexOf(d);if(m<0||m%2==0!=s>0)return null;let p={from:s<0?r-1:r,to:s>0?r+1:r},g=t.doc.iterRange(r,s>0?t.doc.length:0),b=0;for(let k=0;!g.next().done&&k<=h;){let v=g.value;if(s<0)k+=v.length;let w=r+k*s;for(let D=s>0?0:v.length-1,M=s>0?v.length:-1;D!=M;D+=s){let L=c.indexOf(v[D]);if(L<0||l.resolveInner(w+D,1).type!=f)continue;if(L%2==0==s>0)b++;else if(b==1)return{start:p,end:{from:w+D,to:w+D+1},matched:L>>1==m>>1};else b--}if(s>0)k+=v.length}return g.done?{start:p,matched:!1}:null}function Zi(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||es,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||$t,mergeTokens:t.mergeTokens!==!1}}function es(t){if(typeof t!="object")return t;let r={};for(let s in t){let l=t[s];r[s]=l instanceof Array?l.slice():l}return r}var Rr=new WeakMap;class eh extends te{constructor(t){let r=wi(t.languageData),s=Zi(t),l,f=new class extends tt{createParse(h,c,d){return new en(l,h,c,d)}};super(r,f,[],t.name);this.topNode=is(r,this),l=this,this.streamParser=s,this.stateAfter=new Ee({perNode:!0}),this.tokenTable=t.tokenTable?new qt(s.tokenTable):ns}static define(t){return new eh(t)}getIndent(t){let r=void 0,{overrideIndentation:s}=t.options;if(s){if(r=Rr.get(t.state),r!=null&&r<t.pos-1e4)r=void 0}let l=jt(this,t.node.tree,t.node.from,t.node.from,r!==null&&r!==void 0?r:t.pos),f,h;if(l)h=l.state,f=l.pos+1;else h=this.streamParser.startState(t.unit),f=t.node.from;if(t.pos-f>1e4)return null;while(f<t.pos){let d=t.state.doc.lineAt(f),m=Math.min(t.pos,d.to);if(d.length){let p=s?s(d.from):-1,g=new lt(d.text,t.state.tabSize,t.unit,p<0?void 0:p);while(g.pos<m-d.from)tn(this.streamParser.token,g,h)}else this.streamParser.blankLine(h,t.unit);if(m==t.pos)break;f=d.to+1}let c=t.lineAt(t.pos);if(s&&r==null)Rr.set(t.state,c.from);return this.streamParser.indent(h,/^\s*(.*)/.exec(c.text)[1],t)}get allowsNesting(){return!1}}function jt(t,r,s,l,f){let h=s>=l&&s+r.length<=f&&r.prop(t.stateAfter);if(h)return{state:t.streamParser.copyState(h),pos:s+r.length};for(let c=r.children.length-1;c>=0;c--){let d=r.children[c],m=s+r.positions[c],p=d instanceof W&&m<f&&jt(t,d,m,l,f);if(p)return p}return null}function Zr(t,r,s,l,f){if(f&&s<=0&&l>=r.length)return r;if(!f&&s==0&&r.type==t.topNode)f=!0;for(let h=r.children.length-1;h>=0;h--){let c=r.positions[h],d=r.children[h],m;if(c<l&&d instanceof W){if(!(m=Zr(t,d,s-c,l-c,f)))break;return!f?m:new W(r.type,r.children.slice(0,h).concat(m),r.positions.slice(0,h+1),c+m.length)}}return null}function ts(t,r,s,l,f){for(let h of r){let c=h.from+(h.openStart?25:0),d=h.to-(h.openEnd?25:0),m=c<=s&&d>s&&jt(t,h.tree,0-h.offset,s,d),p;if(m&&m.pos<=l&&(p=Zr(t,h.tree,s+h.offset,m.pos+h.offset,!1)))return{state:m.state,tree:p}}return{state:t.streamParser.startState(f?ci(f):4),tree:W.empty}}class en{constructor(t,r,s,l){this.lang=t,this.input=r,this.fragments=s,this.ranges=l,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=l[l.length-1].to;let f=Te.get(),h=l[0].from,{state:c,tree:d}=ts(t,s,h,this.to,f===null||f===void 0?void 0:f.state);this.state=c,this.parsedPos=this.chunkStart=h+d.length;for(let m=0;m<d.children.length;m++)this.chunks.push(d.children[m]),this.chunkPos.push(d.positions[m]);if(f&&this.parsedPos<f.viewport.from-1e5&&l.some((m)=>m.from<=f.viewport.from&&m.to>=f.viewport.from))this.state=this.lang.streamParser.startState(ci(f.state)),f.skipUntilInView(this.parsedPos,f.viewport.from),this.parsedPos=f.viewport.from;this.moveRangeIndex()}advance(){let t=Te.get(),r=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),s=Math.min(r,this.chunkStart+512);if(t)s=Math.min(s,t.viewport.to);while(this.parsedPos<s)this.parseLine(t);if(this.chunkStart<this.parsedPos)this.finishChunk();if(this.parsedPos>=r)return this.finish();if(t&&this.parsedPos>=t.viewport.to)return t.skipUntilInView(this.parsedPos,r),this.finish();return null}stopAt(t){this.stoppedAt=t}lineAfter(t){let r=this.input.chunk(t);if(!this.input.lineChunks){let s=r.indexOf(`
1
+ import{n,o,K,i,u,a,nt,e,Il,fe,At,Hm,ys,qm,Wm,po,Es,np,xb,wb}from"./index-1mkn5fbf.js";import{ke,_t,x,P,Ge,Tr,hn,ie,pe,Nn,ge,dt,Aa,Kr,Ot,N,We,wn,ye,_,xo,Qn,Hi,ld}from"./index-q3k8r0ms.js";import{ph,cd}from"./index-3kedv94b.js";var ai=600,fi=150,Ct=1,St=new Map;function Ep(t){if(!t)return;St.get(t)?.()}function al({tabKey:t,surface:r,ready:s=!0,slot:l=np,element:f}){let h=nt(Il),c=h?.sessionId??null,d=h?.ready??!1,m=i(null),p=i(null),g=i(0),b=i(!1),k=i(0),v=i(!1),w=i(null),D=i(),M=a(()=>{let E=p.current,S=m.current;if(!E||!S)return;if(performance.now()>E.until){p.current=null;return}if(Math.abs(S.scrollTop-E.top)<Ct){k.current=S.scrollTop;return}b.current=!0,S.scrollTop=E.top,b.current=!1,g.current=S.scrollTop,k.current=S.scrollTop},[]),L=a((E)=>{if(m.current=E,E)M()},[M]),F=a((E)=>{if(!t)return;let S=fe(c,l);if((S?.[t]?.[r]??0)===E)return;At(c,l,wb(S,t,r,E))},[c,l,t,r]),R=a(()=>{let E=m.current;if(!E||!t)return;let S=E.scrollTop;if(p.current){if(b.current)return;let B=Math.abs(S-k.current)>=Ct;if(k.current=S,B&&!v.current){M();return}if(Math.abs(S-g.current)<Ct*2)return;p.current=null}k.current=S,v.current=!1,w.current=S,clearTimeout(D.current),D.current=setTimeout(()=>{D.current=void 0;let B=w.current;if(B!==null)F(B)},fi)},[M,F,t]);return o(()=>{if(!f)return;let E=()=>R();return f.addEventListener("scroll",E,{passive:!0}),()=>f.removeEventListener("scroll",E)},[f,R]),o(()=>{let E=f??m.current;if(!E)return;let S=()=>{v.current=!0},B=["wheel","keydown","pointerdown","touchstart"];for(let y of B)E.addEventListener(y,S,{passive:!0});return window.addEventListener("keydown",S,{passive:!0}),()=>{for(let y of B)E.removeEventListener(y,S);window.removeEventListener("keydown",S)}},[f]),K(()=>{p.current=null,w.current=null,v.current=!1;let E=null;if(f!==void 0)m.current=f;let S=m.current;if(s&&d&&t&&S){let B=xb(fe(c,l),t,r);p.current={top:B,until:performance.now()+ai},St.set(S,()=>{p.current=null}),M();let y=S.firstElementChild;if(y&&typeof ResizeObserver<"u")E=new ResizeObserver(()=>M()),E.observe(y)}return()=>{if(S)St.delete(S);E?.disconnect(),clearTimeout(D.current),D.current=void 0;let B=w.current;if(w.current=null,B!==null)F(B)}},[s,d,t,r,c,l,M,F,f]),{ref:L,onScroll:R}}var hi=0;class Ye{constructor(t,r){this.from=t,this.to=r}}class Ee{constructor(t={}){this.id=hi++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw RangeError("Can't add per-node props to node types");if(typeof t!="function")t=Y.match(t);return(r)=>{let s=t(r);return s===void 0?null:[this,s]}}}Ee.closedBy=new Ee({deserialize:(t)=>t.split(" ")});Ee.openedBy=new Ee({deserialize:(t)=>t.split(" ")});Ee.group=new Ee({deserialize:(t)=>t.split(" ")});Ee.isolate=new Ee({deserialize:(t)=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ee.contextHash=new Ee({perNode:!0});Ee.lookAhead=new Ee({perNode:!0});Ee.mounted=new Ee({perNode:!0});class Be{constructor(t,r,s,l=!1){this.tree=t,this.overlay=r,this.parser=s,this.bracketed=l}static get(t){return t&&t.props&&t.props[Ee.mounted.id]}}var ui=Object.create(null);class Y{constructor(t,r,s,l=0){this.name=t,this.props=r,this.id=s,this.flags=l}static define(t){let r=t.props&&t.props.length?Object.create(null):ui,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),l=new Y(t.name||"",r,t.id,s);if(t.props)for(let f of t.props){if(!Array.isArray(f))f=f(l);if(f){if(f[0].perNode)throw RangeError("Can't store a per-node prop on a node type");r[f[0].id]=f[1]}}return l}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Ee.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let s in t)for(let l of s.split(" "))r[l]=t[s];return(s)=>{for(let l=s.prop(Ee.group),f=-1;f<(l?l.length:0);f++){let h=r[f<0?s.name:l[f]];if(h)return h}}}}Y.none=new Y("",Object.create(null),0,8);class et{constructor(t){this.types=t;for(let r=0;r<t.length;r++)if(t[r].id!=r)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let r=[];for(let s of this.types){let l=null;for(let f of t){let h=f(s);if(h){if(!l)l=Object.assign({},s.props);let c=h[1],d=h[0];if(d.combine&&d.id in l)c=d.combine(l[d.id],c);l[d.id]=c}}r.push(l?new Y(s.name,l,s.id,s.flags):s)}return new et(r)}}var Xe=new WeakMap,pr=new WeakMap,U;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(U||(U={}));class W{constructor(t,r,s,l,f){if(this.type=t,this.children=r,this.positions=s,this.length=l,this.props=null,f&&f.length){this.props=Object.create(null);for(let[h,c]of f)this.props[typeof h=="number"?h:h.id]=c}}toString(){let t=Be.get(this);if(t&&!t.overlay)return t.tree.toString();let r="";for(let s of this.children){let l=s.toString();if(l){if(r)r+=",";r+=l}}return!this.type.name?r:(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":"")}cursor(t=0){return new Ze(this.topNode,t)}cursorAt(t,r=0,s=0){let l=Xe.get(this)||this.topNode,f=new Ze(l);return f.moveTo(t,r),Xe.set(this,f._tree),f}get topNode(){return new Z(this,0,0,null)}resolve(t,r=0){let s=Ne(Xe.get(this)||this.topNode,t,r,!1);return Xe.set(this,s),s}resolveInner(t,r=0){let s=Ne(pr.get(this)||this.topNode,t,r,!0);return pr.set(this,s),s}resolveStack(t,r=0){return di(this,t,r)}iterate(t){let{enter:r,leave:s,from:l=0,to:f=this.length}=t,h=t.mode||0,c=(h&U.IncludeAnonymous)>0;for(let d=this.cursor(h|U.IncludeAnonymous);;){let m=!1;if(d.from<=f&&d.to>=l&&(!c&&d.type.isAnonymous||r(d)!==!1)){if(d.firstChild())continue;m=!0}for(;;){if(m&&s&&(c||!d.type.isAnonymous))s(d);if(d.nextSibling())break;if(!d.parent())return;m=!0}}}prop(t){return!t.perNode?this.type.prop(t):this.props?this.props[t.id]:void 0}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:Lt(Y.none,this.children,this.positions,0,this.children.length,0,this.length,(r,s,l)=>new W(this.type,r,s,l,this.propValues),t.makeTree||((r,s,l)=>new W(Y.none,r,s,l)))}static build(t){return mi(t)}}W.empty=new W(Y.none,[],[],0);class Dt{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Dt(this.buffer,this.index)}}class ue{constructor(t,r,s){this.buffer=t,this.length=r,this.set=s}get type(){return Y.none}toString(){let t=[];for(let r=0;r<this.buffer.length;)t.push(this.childString(r)),r=this.buffer[r+3];return t.join(",")}childString(t){let r=this.buffer[t],s=this.buffer[t+3],l=this.set.types[r],f=l.name;if(/\W/.test(f)&&!l.isError)f=JSON.stringify(f);if(t+=4,s==t)return f;let h=[];while(t<s)h.push(this.childString(t)),t=this.buffer[t+3];return f+"("+h.join(",")+")"}findChild(t,r,s,l,f){let{buffer:h}=this,c=-1;for(let d=t;d!=r;d=h[d+3])if(kr(f,l,h[d+1],h[d+2])){if(c=d,s>0)break}return c}slice(t,r,s){let l=this.buffer,f=new Uint16Array(r-t),h=0;for(let c=t,d=0;c<r;){f[d++]=l[c++],f[d++]=l[c++]-s;let m=f[d++]=l[c++]-s;f[d++]=l[c++]-t,h=Math.max(h,m)}return new ue(f,h,this.set)}}function kr(t,r,s,l){switch(t){case-2:return s<r;case-1:return l>=r&&s<r;case 0:return s<r&&l>r;case 1:return s<=r&&l>r;case 2:return l>r;case 4:return!0}}function Ne(t,r,s,l){var f;while(t.from==t.to||(s<1?t.from>=r:t.from>r)||(s>-1?t.to<=r:t.to<r)){let c=!l&&t instanceof Z&&t.index<0?null:t.parent;if(!c)return t;t=c}let h=l?0:U.IgnoreOverlays;if(l){for(let c=t,d=c.parent;d;c=d,d=c.parent)if(c instanceof Z&&c.index<0&&((f=d.enter(r,s,h))===null||f===void 0?void 0:f.from)!=c.from)t=d}for(;;){let c=t.enter(r,s,h);if(!c)return t;t=c}}class Bt{cursor(t=0){return new Ze(this,t)}getChild(t,r=null,s=null){let l=gr(this,t,r,s);return l.length?l[0]:null}getChildren(t,r=null,s=null){return gr(this,t,r,s)}resolve(t,r=0){return Ne(this,t,r,!1)}resolveInner(t,r=0){return Ne(this,t,r,!0)}matchContext(t){return Mt(this.parent,t)}enterUnfinishedNodesBefore(t){let r=this.childBefore(t),s=this;while(r){let l=r.lastChild;if(!l||l.to!=r.to)break;if(l.type.isError&&l.from==l.to)s=r,r=l.prevSibling;else r=l}return s}get node(){return this}get next(){return this.parent}}class Z extends Bt{constructor(t,r,s,l){super();this._tree=t,this.from=r,this.index=s,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,r,s,l,f=0){for(let h=this;;){for(let{children:c,positions:d}=h._tree,m=r>0?c.length:-1;t!=m;t+=r){let p=c[t],g=d[t]+h.from,b;if(!(f&U.EnterBracketed&&p instanceof W&&(b=Be.get(p))&&!b.overlay&&b.bracketed&&s>=g&&s<=g+p.length)&&!kr(l,s,g,g+p.length))continue;if(p instanceof ue){if(f&U.ExcludeBuffers)continue;let k=p.findChild(0,p.buffer.length,r,s-g,l);if(k>-1)return new ce(new xr(h,p,t,g),null,k)}else if(f&U.IncludeAnonymous||(!p.type.isAnonymous||Et(p))){let k;if(!(f&U.IgnoreMounts)&&(k=Be.get(p))&&!k.overlay)return new Z(k.tree,g,t,h);let v=new Z(p,g,t,h);return f&U.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(r<0?p.children.length-1:0,r,s,l,f)}}if(f&U.IncludeAnonymous||!h.type.isAnonymous)return null;if(h.index>=0)t=h.index+r;else t=r<0?-1:h._parent._tree.children.length;if(h=h._parent,!h)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,r,s=0){let l;if(!(s&U.IgnoreOverlays)&&(l=Be.get(this._tree))&&l.overlay){let f=t-this.from,h=s&U.EnterBracketed&&l.bracketed;for(let{from:c,to:d}of l.overlay)if((r>0||h?c<=f:c<f)&&(r<0||h?d>=f:d>f))return new Z(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,s)}nextSignificantParent(){let t=this;while(t.type.isAnonymous&&t._parent)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function gr(t,r,s,l){let f=t.cursor(),h=[];if(!f.firstChild())return h;if(s!=null){for(let c=!1;!c;)if(c=f.type.is(s),!f.nextSibling())return h}for(;;){if(l!=null&&f.type.is(l))return h;if(f.type.is(r))h.push(f.node);if(!f.nextSibling())return l==null?h:[]}}function Mt(t,r,s=r.length-1){for(let l=t;s>=0;l=l.parent){if(!l)return!1;if(!l.type.isAnonymous){if(r[s]&&r[s]!=l.name)return!1;s--}}return!0}class xr{constructor(t,r,s,l){this.parent=t,this.buffer=r,this.index=s,this.start=l}}class ce extends Bt{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,r,s){super();this.context=t,this._parent=r,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,r,s){let{buffer:l}=this.context,f=l.findChild(this.index+4,l.buffer[this.index+3],t,r-this.context.start,s);return f<0?null:new ce(this.context,this,f)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,r,s=0){if(s&U.ExcludeBuffers)return null;let{buffer:l}=this.context,f=l.findChild(this.index+4,l.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return f<0?null:new ce(this.context,this,f)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];if(r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length))return new ce(this.context,this._parent,r);return this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;if(this.index==r)return this.externalSibling(-1);return new ce(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],r=[],{buffer:s}=this.context,l=this.index+4,f=s.buffer[this.index+3];if(f>l){let h=s.buffer[this.index+1];t.push(s.slice(l,f,h)),r.push(0)}return new W(this.type,t,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function vr(t){if(!t.length)return null;let r=0,s=t[0];for(let h=1;h<t.length;h++){let c=t[h];if(c.from>s.from||c.to<s.to)s=c,r=h}let l=s instanceof Z&&s.index<0?null:s.parent,f=t.slice();if(l)f[r]=l;else f.splice(r,1);return new wr(f,s)}class wr{constructor(t,r){this.heads=t,this.node=r}get next(){return vr(this.heads)}}function di(t,r,s){let l=t.resolveInner(r,s),f=null;for(let h=l instanceof Z?l:l.context.parent;h;h=h.parent)if(h.index<0){let c=h.parent;(f||(f=[l])).push(c.resolve(r,s)),h=c}else{let c=Be.get(h.tree);if(c&&c.overlay&&c.overlay[0].from<=r&&c.overlay[c.overlay.length-1].to>=r){let d=new Z(c.tree,c.overlay[0].from+h.from,-1,h);(f||(f=[l])).push(Ne(d,r,s,!1))}}return f?vr(f):l}class Ze{get name(){return this.type.name}constructor(t,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~U.EnterBracketed,t instanceof Z)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){if(!t)return!1;return this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0}yieldBuf(t,r){this.index=t;let{start:s,buffer:l}=this.buffer;return this.type=r||l.set.types[l.buffer[t]],this.from=s+l.buffer[t+1],this.to=s+l.buffer[t+2],!0}yield(t){if(!t)return!1;if(t instanceof Z)return this.buffer=null,this.yieldNode(t);return this.buffer=t.context,this.yieldBuf(t.index,t.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,s,this.mode));let{buffer:l}=this.buffer,f=l.findChild(this.index+4,l.buffer[this.index+3],t,r-this.buffer.start,s);if(f<0)return!1;return this.stack.push(this.index),this.yieldBuf(f)}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,s=this.mode){if(!this.buffer)return this.yield(this._tree.enter(t,r,s));return s&U.ExcludeBuffers?!1:this.enterChild(1,t,r)}parent(){if(!this.buffer)return this.yieldNode(this.mode&U.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&U.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!this._tree._parent?!1:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:r}=this.buffer,s=this.stack.length-1;if(t<0){let l=s<0?0:this.stack[s]+4;if(this.index!=l)return this.yieldBuf(r.findChild(l,this.index,-1,0,4))}else{let l=r.buffer[this.index+3];if(l<(s<0?r.buffer.length:r.buffer[this.stack[s]+3]))return this.yieldBuf(l)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,s,{buffer:l}=this;if(l){if(t>0){if(this.index<l.buffer.buffer.length)return!1}else for(let f=0;f<this.index;f++)if(l.buffer.buffer[f+3]<this.index)return!1;({index:r,parent:s}=l)}else({index:r,_parent:s}=this._tree);for(;s;{index:r,_parent:s}=s)if(r>-1)for(let f=r+t,h=t<0?-1:s._tree.children.length;f!=h;f+=t){let c=s._tree.children[f];if(this.mode&U.IncludeAnonymous||c instanceof ue||!c.type.isAnonymous||Et(c))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){while(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to<t))if(!this.parent())break;while(this.enterChild(1,t,r));return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,r=null,s=0;if(t&&t.context==this.buffer)e:for(let l=this.index,f=this.stack.length;f>=0;){for(let h=t;h;h=h._parent)if(h.index==l){if(l==this.index)return h;r=h,s=f+1;break e}l=this.stack[--f]}for(let l=s;l<this.stack.length;l++)r=new ce(this.buffer,r,this.stack[l]);return this.bufferNode=new ce(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,r){for(let s=0;;){let l=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){s++;continue}if(!this.type.isAnonymous)l=!0}for(;;){if(l&&r)r(this);if(l=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,l=!0}}}matchContext(t){if(!this.buffer)return Mt(this.node.parent,t);let{buffer:r}=this.buffer,{types:s}=r.set;for(let l=t.length-1,f=this.stack.length-1;l>=0;f--){if(f<0)return Mt(this._tree,t,l);let h=s[r.buffer[this.stack[f]]];if(!h.isAnonymous){if(t[l]&&t[l]!=h.name)return!1;l--}}return!0}}function Et(t){return t.children.some((r)=>r instanceof ue||!r.type.isAnonymous||Et(r))}function mi(t){var r;let{buffer:s,nodeSet:l,maxBufferLength:f=1024,reused:h=[],minRepeatType:c=l.types.length}=t,d=Array.isArray(s)?new Dt(s,s.length):s,m=l.types,p=0,g=0;function b(S,B,y,T,V,H){let{id:I,start:O,end:z,size:G}=d,J=g,he=p;if(G<0)if(d.next(),G==-1){let le=h[I];y.push(le),T.push(O-S);return}else if(G==-3){p=I;return}else if(G==-4){g=I;return}else throw RangeError(`Unrecognized record size: ${G}`);let _e=m[I],Je,xe,dr=O-S;if(z-O<=f&&(xe=M(d.pos-B,V))){let le=new Uint16Array(xe.size-xe.skip),Q=d.pos-xe.size,re=le.length;while(d.pos>Q)re=L(xe.start,le,re);Je=new ue(le,z-xe.start,l),dr=xe.start-S}else{let le=d.pos-G;d.next();let Q=[],re=[],ve=I>=c?I:-1,De=0,Ke=z,yt=J;while(d.pos>le)if(ve>=0&&d.id==ve&&d.size>=0){if(d.end<=Ke-f)w(Q,re,O,De,d.end,Ke,ve,yt,he),De=Q.length,Ke=d.end,yt=g;d.next()}else if(H>2500)k(O,le,Q,re);else b(O,le,Q,re,ve,H+1);if(ve>=0&&De>0&&De<Q.length)w(Q,re,O,De,O,Ke,ve,yt,he);if(Q.reverse(),re.reverse(),ve>-1&&De>0){let mr=v(_e,he);Je=Lt(_e,Q,re,0,Q.length,0,z-O,mr,mr)}else Je=D(_e,Q,re,z-O,J-z,he)}y.push(Je),T.push(dr)}function k(S,B,y,T){let V=[],H=0,I=-1;while(d.pos>B){let{id:O,start:z,end:G,size:J}=d;if(J>4)d.next();else if(I>-1&&z<I)break;else{if(I<0)I=G-f;V.push(O,z,G),H++,d.next()}}if(H){let O=new Uint16Array(H*4),z=V[V.length-2];for(let G=V.length-3,J=0;G>=0;G-=3)O[J++]=V[G],O[J++]=V[G+1]-z,O[J++]=V[G+2]-z,O[J++]=J;y.push(new ue(O,V[2]-z,l)),T.push(z-S)}}function v(S,B){return(y,T,V)=>{let H=0,I=y.length-1,O,z;if(I>=0&&(O=y[I])instanceof W){if(!I&&O.type==S&&O.length==V)return O;if(z=O.prop(Ee.lookAhead))H=T[I]+O.length+z-V}return D(S,y,T,V,H,B)}}function w(S,B,y,T,V,H,I,O,z){let G=[],J=[];while(S.length>T)G.push(S.pop()),J.push(B.pop()+y-V);S.push(D(l.types[I],G,J,H-V,O-H,z)),B.push(V-y)}function D(S,B,y,T,V,H,I){if(H){let O=[Ee.contextHash,H];I=I?[O].concat(I):[O]}if(V>25){let O=[Ee.lookAhead,V];I=I?[O].concat(I):[O]}return new W(S,B,y,T,I)}function M(S,B){let y=d.fork(),T=0,V=0,H=0,I=y.end-f,O={size:0,start:0,skip:0};e:for(let z=y.pos-S;y.pos>z;){let G=y.size;if(y.id==B&&G>=0){O.size=T,O.start=V,O.skip=H,H+=4,T+=4,y.next();continue}let J=y.pos-G;if(G<0||J<z||y.start<I)break;let he=y.id>=c?4:0,_e=y.start;y.next();while(y.pos>J){if(y.size<0)if(y.size==-3||y.size==-4)he+=4;else break e;else if(y.id>=c)he+=4;y.next()}V=_e,T+=G,H+=he}if(B<0||T==S)O.size=T,O.start=V,O.skip=H;return O.size>4?O:void 0}function L(S,B,y){let{id:T,start:V,end:H,size:I}=d;if(d.next(),I>=0&&T<c){let O=y;if(I>4){let z=d.pos-(I-4);while(d.pos>z)y=L(S,B,y)}B[--y]=O,B[--y]=H-S,B[--y]=V-S,B[--y]=T}else if(I==-3)p=T;else if(I==-4)g=T;return y}let F=[],R=[];while(d.pos>0)b(t.start||0,t.bufferStart||0,F,R,-1,0);let E=(r=t.length)!==null&&r!==void 0?r:F.length?R[0]+F[0].length:0;return new W(m[t.topID],F.reverse(),R.reverse(),E)}var br=new WeakMap;function Qe(t,r){if(!t.isAnonymous||r instanceof ue||r.type!=t)return 1;let s=br.get(r);if(s==null){s=1;for(let l of r.children){if(l.type!=t||!(l instanceof W)){s=1;break}s+=Qe(t,l)}br.set(r,s)}return s}function Lt(t,r,s,l,f,h,c,d,m){let p=0;for(let w=l;w<f;w++)p+=Qe(t,r[w]);let g=Math.ceil(p*1.5/8),b=[],k=[];function v(w,D,M,L,F){for(let R=M;R<L;){let E=R,S=D[R],B=Qe(t,w[R]);R++;for(;R<L;R++){let y=Qe(t,w[R]);if(B+y>=g)break;B+=y}if(R==E+1){if(B>g){let y=w[E];v(y.children,y.positions,0,y.children.length,D[E]+F);continue}b.push(w[E])}else{let y=D[R-1]+w[R-1].length-S;b.push(Lt(t,w,D,E,R,S,y,null,m))}k.push(S+F-h)}}return v(r,s,l,f,0),(d||m)(b,k,c)}class de{constructor(t,r,s,l,f=!1,h=!1){this.from=t,this.to=r,this.tree=s,this.offset=l,this.open=(f?1:0)|(h?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],s=!1){let l=[new de(0,t.length,t,0,!1,s)];for(let f of r)if(f.to>t.length)l.push(f);return l}static applyChanges(t,r,s=128){if(!r.length)return t;let l=[],f=1,h=t.length?t[0]:null;for(let c=0,d=0,m=0;;c++){let p=c<r.length?r[c]:null,g=p?p.fromA:1e9;if(g-d>=s)while(h&&h.from<g){let b=h;if(d>=b.from||g<=b.to||m){let k=Math.max(b.from,d)-m,v=Math.min(b.to,g)-m;b=k>=v?null:new de(k,v,b.tree,b.offset+m,c>0,!!p)}if(b)l.push(b);if(h.to>g)break;h=f<t.length?t[f++]:null}if(!p)break;d=p.toA,m=p.toA-p.toB}return l}}class tt{startParse(t,r,s){if(typeof t=="string")t=new yr(t);return s=!s?[new Ye(0,t.length)]:s.length?s.map((l)=>new Ye(l.from,l.to)):[new Ye(0,0)],this.createParse(t,r||[],s)}parse(t,r,s){let l=this.startParse(t,r,s);for(;;){let f=l.advance();if(f)return f}}}class yr{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}}var no=new Ee({perNode:!0});var pi=0;class ee{constructor(t,r,s,l){this.name=t,this.set=r,this.base=s,this.modified=l,this.id=pi++}toString(){let{name:t}=this;for(let r of this.modified)if(r.name)t=`${r.name}(${t})`;return t}static define(t,r){let s=typeof t=="string"?t:"?";if(t instanceof ee)r=t;if(r===null||r===void 0?void 0:r.base)throw Error("Can not derive from a modified tag");let l=new ee(s,[],null,[]);if(l.set.push(l),r)for(let f of r.set)l.set.push(f);return l}static defineModifier(t){let r=new ot(t);return(s)=>{if(s.modified.indexOf(r)>-1)return s;return ot.get(s.base||s,s.modified.concat(r).sort((l,f)=>l.id-f.id))}}}var gi=0;class ot{constructor(t){this.name=t,this.instances=[],this.id=gi++}static get(t,r){if(!r.length)return t;let s=r[0].instances.find((c)=>c.base==t&&bi(r,c.modified));if(s)return s;let l=[],f=new ee(t.name,l,t,r);for(let c of r)c.instances.push(f);let h=ki(r);for(let c of t.set)if(!c.modified.length)for(let d of h)l.push(ot.get(c,d));return f}}function bi(t,r){return t.length==r.length&&t.every((s,l)=>s==r[l])}function ki(t){let r=[[]];for(let s=0;s<t.length;s++)for(let l=0,f=r.length;l<f;l++)r.push(r[l].concat(t[s]));return r.sort((s,l)=>l.length-s.length)}function Sr(t){let r=Object.create(null);for(let s in t){let l=t[s];if(!Array.isArray(l))l=[l];for(let f of s.split(" "))if(f){let h=[],c=2,d=f;for(let b=0;;){if(d=="..."&&b>0&&b+3==f.length){c=1;break}let k=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(d);if(!k)throw RangeError("Invalid path: "+f);if(h.push(k[0]=="*"?"":k[0][0]=='"'?JSON.parse(k[0]):k[0]),b+=k[0].length,b==f.length)break;let v=f[b++];if(b==f.length&&v=="!"){c=0;break}if(v!="/")throw RangeError("Invalid path: "+f);d=f.slice(b)}let m=h.length-1,p=h[m];if(!p)throw RangeError("Invalid path: "+f);let g=new Le(l,c,m>0?h.slice(0,m):null);r[p]=g.sort(r[p])}}return Mr.add(r)}var Mr=new Ee({combine(t,r){let s,l,f;while(t||r){if(!t||r&&t.depth<=r.depth)f=r,r=r.next;else f=t,t=t.next;if(s&&s.mode==f.mode&&!f.context&&!s.context)continue;let h=new Le(f.tags,f.mode,f.context);if(s)s.next=h;else l=h;s=h}return l}});class Le{constructor(t,r,s,l){this.tags=t,this.mode=r,this.context=s,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){if(!t||t.depth<this.depth)return this.next=t,this;return t.next=this.sort(t.next),t}get depth(){return this.context?this.context.length:0}}Le.empty=new Le([],2,null);function Pt(t,r){let s=Object.create(null);for(let h of t)if(!Array.isArray(h.tag))s[h.tag.id]=h.class;else for(let c of h.tag)s[c.id]=h.class;let{scope:l,all:f=null}=r||{};return{style:(h)=>{let c=f;for(let d of h)for(let m of d.set){let p=s[m.id];if(p){c=c?c+" "+p:p;break}}return c},scope:l}}function xi(t,r){let s=null;for(let l of t){let f=l.style(r);if(f)s=s?s+" "+f:f}return s}function Rt(t,r,s,l=0,f=t.length){let h=new Dr(l,Array.isArray(r)?r:[r],s);h.highlightRange(t.cursor(),l,f,"",h.highlighters),h.flush(f)}class Dr{constructor(t,r,s){this.at=t,this.highlighters=r,this.span=s,this.class=""}startSpan(t,r){if(r!=this.class){if(this.flush(t),t>this.at)this.at=t;this.class=r}}flush(t){if(t>this.at&&this.class)this.span(this.at,t,this.class)}highlightRange(t,r,s,l,f){let{type:h,from:c,to:d}=t;if(c>=s||d<=r)return;if(h.isTop)f=this.highlighters.filter((k)=>!k.scope||k.scope(h));let m=l,p=vi(t)||Le.empty,g=xi(f,p.tags);if(g){if(m)m+=" ";if(m+=g,p.mode==1)l+=(l?" ":"")+g}if(this.startSpan(Math.max(r,c),m),p.opaque)return;let b=t.tree&&t.tree.prop(Ee.mounted);if(b&&b.overlay){let k=t.node.enter(b.overlay[0].from+c,1),v=this.highlighters.filter((D)=>!D.scope||D.scope(b.tree.type)),w=t.firstChild();for(let D=0,M=c;;D++){let L=D<b.overlay.length?b.overlay[D]:null,F=L?L.from+c:d,R=Math.max(r,M),E=Math.min(s,F);if(R<E&&w){while(t.from<E)if(this.highlightRange(t,R,E,l,f),this.startSpan(Math.min(E,t.to),m),t.to>=F||!t.nextSibling())break}if(!L||F>s)break;if(M=L.to+c,M>r)this.highlightRange(k.cursor(),Math.max(r,L.from+c),Math.min(s,M),"",v),this.startSpan(Math.min(s,M),m)}if(w)t.parent()}else if(t.firstChild()){if(b)l="";do{if(t.to<=r)continue;if(t.from>=s)break;this.highlightRange(t,r,s,l,f),this.startSpan(Math.min(s,t.to),m)}while(t.nextSibling());t.parent()}}}function vi(t){let r=t.type.prop(Mr);while(r&&r.context&&!t.matchContext(r.context))r=r.next;return r||null}var C=ee.define,rt=C(),me=C(),Cr=C(me),Ar=C(me),be=C(),it=C(be),Tt=C(be),oe=C(),we=C(oe),ne=C(),se=C(),It=C(),Fe=C(It),st=C(),A={comment:rt,lineComment:C(rt),blockComment:C(rt),docComment:C(rt),name:me,variableName:C(me),typeName:Cr,tagName:C(Cr),propertyName:Ar,attributeName:C(Ar),className:C(me),labelName:C(me),namespace:C(me),macroName:C(me),literal:be,string:it,docString:C(it),character:C(it),attributeValue:C(it),number:Tt,integer:C(Tt),float:C(Tt),bool:C(be),regexp:C(be),escape:C(be),color:C(be),url:C(be),keyword:ne,self:C(ne),null:C(ne),atom:C(ne),unit:C(ne),modifier:C(ne),operatorKeyword:C(ne),controlKeyword:C(ne),definitionKeyword:C(ne),moduleKeyword:C(ne),operator:se,derefOperator:C(se),arithmeticOperator:C(se),logicOperator:C(se),bitwiseOperator:C(se),compareOperator:C(se),updateOperator:C(se),definitionOperator:C(se),typeOperator:C(se),controlOperator:C(se),punctuation:It,separator:C(It),bracket:Fe,angleBracket:C(Fe),squareBracket:C(Fe),paren:C(Fe),brace:C(Fe),content:oe,heading:we,heading1:C(we),heading2:C(we),heading3:C(we),heading4:C(we),heading5:C(we),heading6:C(we),contentSeparator:C(oe),list:C(oe),quote:C(oe),emphasis:C(oe),strong:C(oe),link:C(oe),monospace:C(oe),strikethrough:C(oe),inserted:C(),deleted:C(),changed:C(),invalid:C(),meta:st,documentMeta:C(st),annotation:C(st),processingInstruction:C(st),definition:ee.defineModifier("definition"),constant:ee.defineModifier("constant"),function:ee.defineModifier("function"),standard:ee.defineModifier("standard"),local:ee.defineModifier("local"),special:ee.defineModifier("special")};for(let t in A){let r=A[t];if(r instanceof ee)r.name=t}var oo=Pt([{tag:A.link,class:"tok-link"},{tag:A.heading,class:"tok-heading"},{tag:A.emphasis,class:"tok-emphasis"},{tag:A.strong,class:"tok-strong"},{tag:A.keyword,class:"tok-keyword"},{tag:A.atom,class:"tok-atom"},{tag:A.bool,class:"tok-bool"},{tag:A.url,class:"tok-url"},{tag:A.labelName,class:"tok-labelName"},{tag:A.inserted,class:"tok-inserted"},{tag:A.deleted,class:"tok-deleted"},{tag:A.literal,class:"tok-literal"},{tag:A.string,class:"tok-string"},{tag:A.number,class:"tok-number"},{tag:[A.regexp,A.escape,A.special(A.string)],class:"tok-string2"},{tag:A.variableName,class:"tok-variableName"},{tag:A.local(A.variableName),class:"tok-variableName tok-local"},{tag:A.definition(A.variableName),class:"tok-variableName tok-definition"},{tag:A.special(A.variableName),class:"tok-variableName2"},{tag:A.definition(A.propertyName),class:"tok-propertyName tok-definition"},{tag:A.typeName,class:"tok-typeName"},{tag:A.namespace,class:"tok-namespace"},{tag:A.className,class:"tok-className"},{tag:A.macroName,class:"tok-macroName"},{tag:A.propertyName,class:"tok-propertyName"},{tag:A.operator,class:"tok-operator"},{tag:A.comment,class:"tok-comment"},{tag:A.meta,class:"tok-meta"},{tag:A.invalid,class:"tok-invalid"},{tag:A.punctuation,class:"tok-punctuation"}]);function Br(t,r,s,l=0,f=0){if(r==null){if(r=t.search(/[^\s\u00a0]/),r==-1)r=t.length}let h=f;for(let c=l;c<r;c++)if(t.charCodeAt(c)==9)h+=s-h%s;else h++;return h}class lt{constructor(t,r,s,l){this.string=t,this.tabSize=r,this.indentUnit=s,this.overrideIndent=l,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(t){let r=this.string.charAt(this.pos),s;if(typeof t=="string")s=r==t;else s=r&&(t instanceof RegExp?t.test(r):t(r));if(s)return++this.pos,r}eatWhile(t){let r=this.pos;while(this.eat(t));return this.pos>r}eatSpace(){let t=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let r=this.string.indexOf(t,this.pos);if(r>-1)return this.pos=r,!0}backUp(t){this.pos-=t}column(){if(this.lastColumnPos<this.start)this.lastColumnValue=Br(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start;return this.lastColumnValue}indentation(){var t;return(t=this.overrideIndent)!==null&&t!==void 0?t:Br(this.string,null,this.tabSize)}match(t,r,s){if(typeof t=="string"){let l=(h)=>s?h.toLowerCase():h,f=this.string.substr(this.pos,t.length);if(l(f)==l(t)){if(r!==!1)this.pos+=t.length;return!0}else return null}else{let l=this.string.slice(this.pos).match(t);if(l&&l.index>0)return null;if(l&&r!==!1)this.pos+=l[0].length;return l}}current(){return this.string.slice(this.start,this.pos)}}var Nt,Oe=new Ee;function wi(t){return P.define({combine:t?(r)=>r.concat(t):void 0})}var yi=new Ee;class te{constructor(t,r,s=[],l=""){if(this.data=t,this.name=l,!pe.prototype.hasOwnProperty("tree"))Object.defineProperty(pe.prototype,"tree",{get(){return zn(this)}});this.parser=r,this.extension=[ko.of(this),pe.languageData.of((f,h,c)=>{let d=Er(f,h,c),m=d.type.prop(Oe);if(!m)return[];let p=f.facet(m),g=d.type.prop(yi);if(g){let b=d.resolve(h-d.from,c);for(let k of g)if(k.test(b,f)){let v=f.facet(k.facet);return k.type=="replace"?v:v.concat(p)}}return p})].concat(s)}isActiveAt(t,r,s=-1){return Er(t,r,s).type.prop(Oe)==this.data}findRegions(t){let r=t.facet(ko);if((r===null||r===void 0?void 0:r.data)==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let s=[],l=(f,h)=>{if(f.prop(Oe)==this.data){s.push({from:h,to:h+f.length});return}let c=f.prop(Ee.mounted);if(c){if(c.tree.prop(Oe)==this.data){if(c.overlay)for(let d of c.overlay)s.push({from:d.from+h,to:d.to+h});else s.push({from:h,to:h+f.length});return}else if(c.overlay){let d=s.length;if(l(c.tree,c.overlay[0].from+h),s.length>d)return}}for(let d=0;d<f.children.length;d++){let m=f.children[d];if(m instanceof W)l(m,f.positions[d]+h)}};return l(zn(t),0),s}get allowsNesting(){return!0}}te.setState=ie.define();function Er(t,r,s){let l=t.facet(ko),f=zn(t).topNode;if(!l||l.allowsNesting){for(let h=f;h;h=h.enter(r,s,U.ExcludeBuffers|U.EnterBracketed))if(h.type.isTop)f=h}return f}function zn(t){let r=t.field(te.state,!1);return r?r.tree:W.empty}class Vr{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,r){let s=this.cursorPos-this.string.length;if(t<s||r>=this.cursorPos)return this.doc.sliceString(t,r);else return this.string.slice(t-s,r-s)}}var Ve=null;class Te{constructor(t,r,s=[],l,f,h,c,d){this.parser=t,this.state=r,this.fragments=s,this.tree=l,this.treeLen=f,this.viewport=h,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(t,r,s){return new Te(t,r,[],W.empty,0,s,[],null)}startParse(){return this.parser.startParse(new Vr(this.state.doc),this.fragments)}work(t,r){if(r!=null&&r>=this.state.doc.length)r=void 0;if(this.tree!=W.empty&&this.isDone(r!==null&&r!==void 0?r:this.state.doc.length))return this.takeTree(),!0;return this.withContext(()=>{var s;if(typeof t=="number"){let l=Date.now()+t;t=()=>Date.now()>l}if(!this.parse)this.parse=this.startParse();if(r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length)this.parse.stopAt(r);for(;;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(de.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(s=this.parse.stoppedAt)!==null&&s!==void 0?s:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(r!==null&&r!==void 0?r:this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,r;if(this.parse&&(t=this.parse.parsedPos)>=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>t)this.parse.stopAt(t);this.withContext(()=>{while(!(r=this.parse.advance()));}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(de.addTree(this.tree,this.fragments,!0)),this.parse=null}}withContext(t){let r=Ve;Ve=this;try{return t()}finally{Ve=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=Lr(t,r.from,r.to);return t}changes(t,r){let{fragments:s,tree:l,treeLen:f,viewport:h,skipped:c}=this;if(this.takeTree(),!t.empty){let d=[];if(t.iterChangedRanges((m,p,g,b)=>d.push({fromA:m,toA:p,fromB:g,toB:b})),s=de.applyChanges(s,d),l=W.empty,f=0,h={from:t.mapPos(h.from,-1),to:t.mapPos(h.to,1)},this.skipped.length){c=[];for(let m of this.skipped){let p=t.mapPos(m.from,1),g=t.mapPos(m.to,-1);if(p<g)c.push({from:p,to:g})}}}return new Te(this.parser,r,s,l,f,h,c,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let r=this.skipped.length;for(let s=0;s<this.skipped.length;s++){let{from:l,to:f}=this.skipped[s];if(l<t.to&&f>t.from)this.fragments=Lr(this.fragments,l,f),this.skipped.splice(s--,1)}if(this.skipped.length>=r)return!1;return this.reset(),!0}reset(){if(this.parse)this.takeTree(),this.parse=null}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends tt{createParse(r,s,l){let f=l[0].from,h=l[l.length-1].to;return{parsedPos:f,advance(){let d=Ve;if(d){for(let m of l)d.tempSkipped.push(m);if(t)d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,t]):t}return this.parsedPos=h,new W(Y.none,[],[],h-f)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return Ve}}function Lr(t,r,s){return de.applyChanges(t,[{fromA:r,toA:s,fromB:r,toB:s}])}class Ie{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),s=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);if(!r.work(20,s))r.takeTree();return new Ie(r)}static init(t){let r=Math.min(3000,t.doc.length),s=Te.create(t.facet(ko).parser,t,{from:0,to:r});if(!s.work(20,r))s.takeTree();return new Ie(s)}}te.state=Ge.define({create:Ie.init,update(t,r){for(let s of r.effects)if(s.is(te.setState))return s.value;if(r.startState.facet(ko)!=r.state.facet(ko))return Ie.init(r.state);return t.apply(r)}});var zr=(t)=>{let r=setTimeout(()=>t(),500);return()=>clearTimeout(r)};if(typeof requestIdleCallback<"u")zr=(t)=>{let r=-1,s=setTimeout(()=>{r=requestIdleCallback(t,{timeout:400})},100);return()=>r<0?clearTimeout(s):cancelIdleCallback(r)};var Ft=typeof navigator<"u"&&((Nt=navigator.scheduling)===null||Nt===void 0?void 0:Nt.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ci=ye.fromClass(class{constructor(r){this.view=r,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(r){let s=this.view.state.field(te.state).context;if(s.updateViewport(r.view.viewport)||this.view.viewport.to>s.treeLen)this.scheduleWork();if(r.docChanged||r.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(s)}scheduleWork(){if(this.working)return;let{state:r}=this.view,s=r.field(te.state);if(s.tree!=s.context.tree||!s.context.isDone(r.doc.length))this.working=zr(this.work)}work(r){this.working=null;let s=Date.now();if(this.chunkEnd<s&&(this.chunkEnd<0||this.view.hasFocus))this.chunkEnd=s+30000,this.chunkBudget=3000;if(this.chunkBudget<=0)return;let{state:l,viewport:{to:f}}=this.view,h=l.field(te.state);if(h.tree==h.context.tree&&h.context.isDone(f+1e5))return;let c=Date.now()+Math.min(this.chunkBudget,100,r&&!Ft?Math.max(25,r.timeRemaining()-5):1e9),d=h.context.treeLen<f&&l.doc.length>f+1000,m=h.context.work(()=>Ft&&Ft()||Date.now()>c,f+(d?0:1e5));if(this.chunkBudget-=Date.now()-s,m||this.chunkBudget<=0)h.context.takeTree(),this.view.dispatch({effects:te.setState.of(new Ie(h.context))});if(this.chunkBudget>0&&!(m&&!d))this.scheduleWork();this.checkAsyncSchedule(h.context)}checkAsyncSchedule(r){if(r.scheduleOn)this.workScheduled++,r.scheduleOn.then(()=>this.scheduleWork()).catch((s)=>wn(this.view.state,s)).then(()=>this.workScheduled--),r.scheduleOn=null}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ko=P.define({combine(t){return t.length?t[0]:null},enables:(t)=>[te.state,Ci,_.contentAttributes.compute([t],(r)=>{let s=r.facet(t);return s&&s.name?{"data-language":s.name}:{}})]});var Bp=P.define(),ji=P.define({combine:(t)=>{if(!t.length)return" ";let r=t[0];if(!r||/\S/.test(r)||Array.from(r).some((s)=>s!=r[0]))throw Error("Invalid indent unit: "+JSON.stringify(t[0]));return r}});function ci(t){let r=t.facet(ji);return r.charCodeAt(0)==9?t.tabSize*r.length:r.length}function ol(t,r){let s="",l=t.tabSize,f=t.facet(ji)[0];if(f=="\t"){while(r>=l)s+="\t",r-=l;f=" "}for(let h=0;h<r;h++)s+=f;return s}function ad(t,r){if(t instanceof pe)t=new il(t);for(let l of t.state.facet(Bp)){let f=l(t,r);if(f!==void 0)return f}let s=zn(t.state);return s.length>=r?Ai(t,s,r):null}class il{constructor(t,r={}){this.state=t,this.options=r,this.unit=ci(t)}lineAt(t,r=1){let s=this.state.doc.lineAt(t),{simulateBreak:l,simulateDoubleBreak:f}=this.options;if(l!=null&&l>=s.from&&l<=s.to)if(f&&l==t)return{text:"",from:t};else if(r<0?l<t:l<=t)return{text:s.text.slice(l-s.from),from:l};else return{text:s.text.slice(0,l-s.from),from:s.from};return s}textAfterPos(t,r=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:s,from:l}=this.lineAt(t,r);return s.slice(t-l,Math.min(s.length,t+100-l))}column(t,r=1){let{text:s,from:l}=this.lineAt(t,r),f=this.countColumn(s,t-l),h=this.options.overrideIndentation?this.options.overrideIndentation(l):-1;if(h>-1)f+=h-this.countColumn(s,s.search(/\S|$/));return f}countColumn(t,r=t.length){return Aa(t,this.state.tabSize,r)}lineIndent(t,r=1){let{text:s,from:l}=this.lineAt(t,r),f=this.options.overrideIndentation;if(f){let h=f(l);if(h>-1)return h}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}var Hr=new Ee;function Ai(t,r,s){let l=r.resolveStack(s),f=r.resolveInner(s,-1).resolve(s,0).enterUnfinishedNodesBefore(s);if(f!=l.node){let h=[];for(let c=f;c&&!(c.from<l.node.from||c.to>l.node.to||c.from==l.node.from&&c.type==l.node.type);c=c.parent)h.push(c);for(let c=h.length-1;c>=0;c--)l={node:h[c],next:l}}return Wr(l,t,s)}function Wr(t,r,s){for(let l=t;l;l=l.next){let f=Mi(l.node);if(f)return f(Wt.create(r,s,l))}return 0}function Si(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Mi(t){let r=t.type.prop(Hr);if(r)return r;let s=t.firstChild,l;if(s&&(l=s.type.prop(Ee.closedBy))){let f=t.lastChild,h=f&&l.indexOf(f.name)>-1;return(c)=>Li(c,!0,1,void 0,h&&!Si(c)?f.from:void 0)}return t.parent==null?Di:null}function Di(){return 0}class Wt extends il{constructor(t,r,s){super(t.state,t.options);this.base=t,this.pos=r,this.context=s}get node(){return this.context.node}static create(t,r,s){return new Wt(t,r,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let r=this.state.doc.lineAt(t.from);for(;;){let s=t.resolve(r.from);while(s.parent&&s.parent.from==s.from)s=s.parent;if(Bi(s,t))break;r=this.state.doc.lineAt(s.from)}return this.lineIndent(r.from)}continue(){return Wr(this.context.next,this.base,this.pos)}}function Bi(t,r){for(let s=r;s;s=s.parent)if(t==s)return!0;return!1}function Ei(t){let r=t.node,s=r.childAfter(r.from),l=r.lastChild;if(!s)return null;let f=t.options.simulateBreak,h=t.state.doc.lineAt(s.from),c=f==null||f<=h.from?h.to:Math.min(h.to,f);for(let d=s.to;;){let m=r.childAfter(d);if(!m||m==l)return null;if(!m.type.isSkipped){if(m.from>=c)return null;let p=/^ */.exec(h.text.slice(s.to-h.from))[0].length;return{from:s.from,to:s.to+p}}d=m.to}}function Li(t,r,s,l,f){let h=t.textAfter,c=h.match(/^\s*/)[0].length,d=l&&h.slice(c,c+l.length)==l||f==t.pos+c,m=r?Ei(t):null;if(m)return d?t.column(m.from):t.column(m.to);return t.baseIndent+(d?0:t.unit*s)}var Oi=200;function _g(){return pe.transactionFilter.of((t)=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let r=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!r.length)return t;let s=t.newDoc,{head:l}=t.newSelection.main,f=s.lineAt(l);if(l>f.from+Oi)return t;let h=s.sliceString(f.from,l);if(!r.some((p)=>p.test(h)))return t;let{state:c}=t,d=-1,m=[];for(let{head:p}of c.selection.ranges){let g=c.doc.lineAt(p);if(g.from==d)continue;d=g.from;let b=ad(c,g.from);if(b==null)continue;let k=/^\s*/.exec(g.text)[0],v=ol(c,b);if(k!=v)m.push({from:g.from,to:g.from+k.length,insert:v})}return m.length?[t,{changes:m,sequential:!0}]:t})}var od=P.define(),Ti=new Ee;function Ii(t,r,s){let l=zn(t);if(l.length<s)return null;let f=l.resolveStack(s,1),h=null;for(let c=f;c;c=c.next){let d=c.node;if(d.to<=s||d.from>s)continue;if(h&&d.from<r)break;let m=d.type.prop(Ti);if(m&&(d.to<l.length-50||l.length==t.doc.length||!Pi(d))){let p=m(d,t);if(p&&p.from<=s&&p.from>=r&&p.to>s)h=p}}return h}function Pi(t){let r=t.lastChild;return r&&r.to==t.to&&r.type.isError}function ft(t,r,s){for(let l of t.facet(od)){let f=l(t,r,s);if(f)return f}return Ii(t,r,s)}function Gr(t,r){let s=r.mapPos(t.from,1),l=r.mapPos(t.to,-1);return s>=l?void 0:{from:s,to:l}}var ct=ie.define({map:Gr}),He=ie.define({map:Gr});function Ur(t){let r=[];for(let{head:s}of t.state.selection.ranges){if(r.some((l)=>l.from<=s&&l.to>=s))continue;r.push(t.lineBlockAt(s))}return r}var Ce=Ge.define({create(){return N.none},update(t,r){if(r.isUserEvent("delete"))r.changes.iterChangedRanges((l,f)=>t=Or(t,l,f));t=t.map(r.changes);let s=[];for(let l of r.effects)if(l.is(ct)&&!Ri(t,l.value.from,l.value.to))s.push(l.value);else if(l.is(He))t=t.update({filter:(f,h)=>l.value.from!=f||l.value.to!=h,filterFrom:l.value.from,filterTo:l.value.to});if(s.length){let{preparePlaceholder:l}=r.state.facet(Gt),f=s.map((h)=>(!l?Ir:N.replace({widget:new Jr(l(r.state,h))})).range(h.from,h.to));t=t.update({add:f})}if(r.selection)t=Or(t,r.selection.main.head);return t},provide:(t)=>_.decorations.from(t),toJSON(t,r){let s=[];return t.between(0,r.doc.length,(l,f)=>{s.push(l,f)}),s},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw RangeError("Invalid JSON for fold state");let r=[];for(let s=0;s<t.length;){let l=t[s++],f=t[s++];if(typeof l!="number"||typeof f!="number")throw RangeError("Invalid JSON for fold state");r.push(Ir.range(l,f))}return N.set(r,!0)}});function Or(t,r,s=r){let l=!1;return t.between(r,s,(f,h)=>{if(f<s&&h>r)l=!0}),!l?t:t.update({filterFrom:r,filterTo:s,filter:(f,h)=>f>=s||h<=r})}function ht(t,r,s){var l;let f=null;return(l=t.field(Ce,!1))===null||l===void 0||l.between(r,s,(h,c)=>{if(!f||f.from>h)f={from:h,to:c}}),f}function Ri(t,r,s){let l=!1;return t.between(r,r,(f,h)=>{if(f==r&&h==s)l=!0}),l}function jr(t,r){return t.field(Ce,!1)?r:r.concat(ie.appendConfig.of(sl()))}var Ip=(t)=>{for(let r of Ur(t)){let s=ft(t.state,r.from,r.to);if(s)return t.dispatch({effects:jr(t.state,[ct.of(s),$r(t,s)])}),!0}return!1},_p=(t)=>{if(!t.state.field(Ce,!1))return!1;let r=[];for(let s of Ur(t)){let l=ht(t.state,s.from,s.to);if(l)r.push(He.of(l),$r(t,l,!1))}if(r.length)t.dispatch({effects:r});return r.length>0};function $r(t,r,s=!0){let l=t.state.doc.lineAt(r.from).number,f=t.state.doc.lineAt(r.to).number;return _.announce.of(`${t.state.phrase(s?"Folded lines":"Unfolded lines")} ${l} ${t.state.phrase("to")} ${f}.`)}var Sp=(t)=>{let{state:r}=t,s=[];for(let l=0;l<r.doc.length;){let f=t.lineBlockAt(l),h=ft(r,f.from,f.to);if(h)s.push(ct.of(h));l=(h?t.lineBlockAt(h.to):f).to+1}if(s.length)t.dispatch({effects:jr(t.state,s)});return!!s.length},Tp=(t)=>{let r=t.state.field(Ce,!1);if(!r||!r.size)return!1;let s=[];return r.between(0,t.state.doc.length,(l,f)=>{s.push(He.of({from:l,to:f}))}),t.dispatch({effects:s}),!0};var ZA=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Ip},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:_p},{key:"Ctrl-Alt-[",run:Sp},{key:"Ctrl-Alt-]",run:Tp}],_i={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Gt=P.define({combine(t){return Nn(t,_i)}});function sl(t){let r=[Ce,Fi];if(t)r.push(Gt.of(t));return r}function qr(t,r){let{state:s}=t,l=s.facet(Gt),f=(c)=>{let d=t.lineBlockAt(t.posAtDOM(c.target)),m=ht(t.state,d.from,d.to);if(m)t.dispatch({effects:He.of(m)});c.preventDefault()};if(l.placeholderDOM)return l.placeholderDOM(t,f,r);let h=document.createElement("span");return h.textContent=l.placeholderText,h.setAttribute("aria-label",s.phrase("folded code")),h.title=s.phrase("unfold"),h.className="cm-foldPlaceholder",h.onclick=f,h}var Ir=N.replace({widget:new class extends Ot{toDOM(t){return qr(t,null)}}});class Jr extends Ot{constructor(t){super();this.value=t}eq(t){return this.value==t.value}toDOM(t){return qr(t,this.value)}}var Ni={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class at extends Qn{constructor(t,r){super();this.config=t,this.open=r}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=t.state.phrase(this.open?"Fold line":"Unfold line"),r}}function id(t={}){let r={...Ni,...t},s=new at(r,!0),l=new at(r,!1),f=ye.fromClass(class{constructor(c){this.from=c.viewport.from,this.markers=this.buildMarkers(c)}update(c){if(c.docChanged||c.viewportChanged||c.startState.facet(ko)!=c.state.facet(ko)||c.startState.field(Ce,!1)!=c.state.field(Ce,!1)||zn(c.startState)!=zn(c.state)||r.foldingChanged(c))this.markers=this.buildMarkers(c.view)}buildMarkers(c){let d=new dt;for(let m of c.viewportLineBlocks){let p=ht(c.state,m.from,m.to)?l:ft(c.state,m.from,m.to)?s:null;if(p)d.add(m.from,m.from,p)}return d.finish()}}),{domEventHandlers:h}=r;return[f,Hi({class:"cm-foldGutter",markers(c){var d;return((d=c.plugin(f))===null||d===void 0?void 0:d.markers)||ge.empty},initialSpacer(){return new at(r,!1)},domEventHandlers:{...h,click:(c,d,m)=>{if(h.click&&h.click(c,d,m))return!0;let p=ht(c.state,d.from,d.to);if(p)return c.dispatch({effects:He.of(p)}),!0;let g=ft(c.state,d.from,d.to);if(g)return c.dispatch({effects:ct.of(g)}),!0;return!1}}}),sl()]}var Fi=_.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ut{constructor(t,r){this.specs=t;let s;function l(c){let d=Kr.newName();return(s||(s=Object.create(null)))["."+d]=c,d}let f=typeof r.all=="string"?r.all:r.all?l(r.all):void 0,h=r.scope;this.scope=h instanceof te?(c)=>c.prop(Oe)==h.data:h?(c)=>c==h:void 0,this.style=Pt(t.map((c)=>({tag:c.tag,class:c.class||l(Object.assign({},c,{tag:null}))})),{all:f}).style,this.module=s?new Kr(s):null,this.themeType=r.themeType}static define(t,r){return new Ut(t,r||{})}}var Vi=P.define(),zi=P.define({combine(t){return t.length?[t[0]]:null}});function Wi(t){let r=t.facet(Vi);return r.length?r:t.facet(zi)}function XA(t,r,s){let l=Wi(t),f=null;if(l){for(let h of l)if(!h.scope||s&&h.scope(s)){let c=h.style(r);if(c)f=f?f+" "+c:c}}return f}var bo=Ut.define([{tag:A.meta,color:"#404740"},{tag:A.link,textDecoration:"underline"},{tag:A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:A.emphasis,fontStyle:"italic"},{tag:A.strong,fontWeight:"bold"},{tag:A.strikethrough,textDecoration:"line-through"},{tag:A.keyword,color:"#708"},{tag:[A.atom,A.bool,A.url,A.contentSeparator,A.labelName],color:"#219"},{tag:[A.literal,A.inserted],color:"#164"},{tag:[A.string,A.deleted],color:"#a11"},{tag:[A.regexp,A.escape,A.special(A.string)],color:"#e40"},{tag:A.definition(A.variableName),color:"#00f"},{tag:A.local(A.variableName),color:"#30a"},{tag:[A.typeName,A.namespace],color:"#085"},{tag:A.className,color:"#167"},{tag:[A.special(A.variableName),A.macroName],color:"#256"},{tag:A.definition(A.propertyName),color:"#00c"},{tag:A.comment,color:"#940"},{tag:A.invalid,color:"#f00"}]),Gi=_.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Xr=1e4,Yr="()[]{}",Qr=P.define({combine(t){return Nn(t,{afterCursor:!0,brackets:Yr,maxScanDistance:Xr,renderMatch:qi})}}),Ui=N.mark({class:"cm-matchingBracket"}),$i=N.mark({class:"cm-nonmatchingBracket"});function qi(t){let r=[],s=t.matched?Ui:$i;if(r.push(s.range(t.start.from,t.start.to)),t.end)r.push(s.range(t.end.from,t.end.to));return r}function Pr(t){let r=[],s=t.facet(Qr);for(let l of t.selection.ranges){if(!l.empty)continue;let f=_r(t,l.head,-1,s)||l.head>0&&_r(t,l.head-1,1,s)||s.afterCursor&&(_r(t,l.head,1,s)||l.head<t.doc.length&&_r(t,l.head+1,-1,s));if(f)r=r.concat(s.renderMatch(f,t))}return N.set(r,!0)}var Ji=ye.fromClass(class{constructor(t){this.paused=!1,this.decorations=Pr(t.state)}update(t){if(t.docChanged||t.selectionSet||this.paused)if(t.view.composing)this.decorations=this.decorations.map(t.changes),this.paused=!0;else this.decorations=Pr(t.state),this.paused=!1}},{decorations:(t)=>t.decorations}),Ki=[Ji,Gi];function sd(t={}){return[Qr.of(t),Ki]}var Xi=new Ee;function zt(t,r,s){let l=t.prop(r<0?Ee.openedBy:Ee.closedBy);if(l)return l;if(t.name.length==1){let f=s.indexOf(t.name);if(f>-1&&f%2==(r<0?1:0))return[s[f+r]]}return null}function Ht(t){let r=t.type.prop(Xi);return r?r(t.node):t}function _r(t,r,s,l={}){let f=l.maxScanDistance||Xr,h=l.brackets||Yr,c=zn(t),d=c.resolveInner(r,s);for(let m=d;m;m=m.parent){let p=zt(m.type,s,h);if(p&&m.from<m.to){let g=Ht(m);if(g&&(s>0?r>=g.from&&r<g.to:r>g.from&&r<=g.to))return Yi(t,r,s,m,g,p,h)}}return Qi(t,r,s,c,d.type,f,h)}function Yi(t,r,s,l,f,h,c){let d=l.parent,m={from:f.from,to:f.to},p=0,g=d===null||d===void 0?void 0:d.cursor();if(g&&(s<0?g.childBefore(l.from):g.childAfter(l.to)))do if(s<0?g.to<=l.from:g.from>=l.to){if(p==0&&h.indexOf(g.type.name)>-1&&g.from<g.to){let b=Ht(g);return{start:m,end:b?{from:b.from,to:b.to}:void 0,matched:!0}}else if(zt(g.type,s,c))p++;else if(zt(g.type,-s,c)){if(p==0){let b=Ht(g);return{start:m,end:b&&b.from<b.to?{from:b.from,to:b.to}:void 0,matched:!1}}p--}}while(s<0?g.prevSibling():g.nextSibling());return{start:m,matched:!1}}function Qi(t,r,s,l,f,h,c){if(s<0?!r:r==t.doc.length)return null;let d=s<0?t.sliceDoc(r-1,r):t.sliceDoc(r,r+1),m=c.indexOf(d);if(m<0||m%2==0!=s>0)return null;let p={from:s<0?r-1:r,to:s>0?r+1:r},g=t.doc.iterRange(r,s>0?t.doc.length:0),b=0;for(let k=0;!g.next().done&&k<=h;){let v=g.value;if(s<0)k+=v.length;let w=r+k*s;for(let D=s>0?0:v.length-1,M=s>0?v.length:-1;D!=M;D+=s){let L=c.indexOf(v[D]);if(L<0||l.resolveInner(w+D,1).type!=f)continue;if(L%2==0==s>0)b++;else if(b==1)return{start:p,end:{from:w+D,to:w+D+1},matched:L>>1==m>>1};else b--}if(s>0)k+=v.length}return g.done?{start:p,matched:!1}:null}function Zi(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||es,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||$t,mergeTokens:t.mergeTokens!==!1}}function es(t){if(typeof t!="object")return t;let r={};for(let s in t){let l=t[s];r[s]=l instanceof Array?l.slice():l}return r}var Rr=new WeakMap;class eh extends te{constructor(t){let r=wi(t.languageData),s=Zi(t),l,f=new class extends tt{createParse(h,c,d){return new en(l,h,c,d)}};super(r,f,[],t.name);this.topNode=is(r,this),l=this,this.streamParser=s,this.stateAfter=new Ee({perNode:!0}),this.tokenTable=t.tokenTable?new qt(s.tokenTable):ns}static define(t){return new eh(t)}getIndent(t){let r=void 0,{overrideIndentation:s}=t.options;if(s){if(r=Rr.get(t.state),r!=null&&r<t.pos-1e4)r=void 0}let l=jt(this,t.node.tree,t.node.from,t.node.from,r!==null&&r!==void 0?r:t.pos),f,h;if(l)h=l.state,f=l.pos+1;else h=this.streamParser.startState(t.unit),f=t.node.from;if(t.pos-f>1e4)return null;while(f<t.pos){let d=t.state.doc.lineAt(f),m=Math.min(t.pos,d.to);if(d.length){let p=s?s(d.from):-1,g=new lt(d.text,t.state.tabSize,t.unit,p<0?void 0:p);while(g.pos<m-d.from)tn(this.streamParser.token,g,h)}else this.streamParser.blankLine(h,t.unit);if(m==t.pos)break;f=d.to+1}let c=t.lineAt(t.pos);if(s&&r==null)Rr.set(t.state,c.from);return this.streamParser.indent(h,/^\s*(.*)/.exec(c.text)[1],t)}get allowsNesting(){return!1}}function jt(t,r,s,l,f){let h=s>=l&&s+r.length<=f&&r.prop(t.stateAfter);if(h)return{state:t.streamParser.copyState(h),pos:s+r.length};for(let c=r.children.length-1;c>=0;c--){let d=r.children[c],m=s+r.positions[c],p=d instanceof W&&m<f&&jt(t,d,m,l,f);if(p)return p}return null}function Zr(t,r,s,l,f){if(f&&s<=0&&l>=r.length)return r;if(!f&&s==0&&r.type==t.topNode)f=!0;for(let h=r.children.length-1;h>=0;h--){let c=r.positions[h],d=r.children[h],m;if(c<l&&d instanceof W){if(!(m=Zr(t,d,s-c,l-c,f)))break;return!f?m:new W(r.type,r.children.slice(0,h).concat(m),r.positions.slice(0,h+1),c+m.length)}}return null}function ts(t,r,s,l,f){for(let h of r){let c=h.from+(h.openStart?25:0),d=h.to-(h.openEnd?25:0),m=c<=s&&d>s&&jt(t,h.tree,0-h.offset,s,d),p;if(m&&m.pos<=l&&(p=Zr(t,h.tree,s+h.offset,m.pos+h.offset,!1)))return{state:m.state,tree:p}}return{state:t.streamParser.startState(f?ci(f):4),tree:W.empty}}class en{constructor(t,r,s,l){this.lang=t,this.input=r,this.fragments=s,this.ranges=l,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=l[l.length-1].to;let f=Te.get(),h=l[0].from,{state:c,tree:d}=ts(t,s,h,this.to,f===null||f===void 0?void 0:f.state);this.state=c,this.parsedPos=this.chunkStart=h+d.length;for(let m=0;m<d.children.length;m++)this.chunks.push(d.children[m]),this.chunkPos.push(d.positions[m]);if(f&&this.parsedPos<f.viewport.from-1e5&&l.some((m)=>m.from<=f.viewport.from&&m.to>=f.viewport.from))this.state=this.lang.streamParser.startState(ci(f.state)),f.skipUntilInView(this.parsedPos,f.viewport.from),this.parsedPos=f.viewport.from;this.moveRangeIndex()}advance(){let t=Te.get(),r=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),s=Math.min(r,this.chunkStart+512);if(t)s=Math.min(s,t.viewport.to);while(this.parsedPos<s)this.parseLine(t);if(this.chunkStart<this.parsedPos)this.finishChunk();if(this.parsedPos>=r)return this.finish();if(t&&this.parsedPos>=t.viewport.to)return t.skipUntilInView(this.parsedPos,r),this.finish();return null}stopAt(t){this.stoppedAt=t}lineAfter(t){let r=this.input.chunk(t);if(!this.input.lineChunks){let s=r.indexOf(`
2
2
  `);if(s>-1)r=r.slice(0,s)}else if(r==`
3
3
  `)r="";return t+r.length<=this.to?r:r.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,r=this.lineAfter(t),s=t+r.length;for(let l=this.rangeIndex;;){let f=this.ranges[l].to;if(f>=s)break;if(r=r.slice(0,f-(s-r.length)),l++,l==this.ranges.length)break;let h=this.ranges[l].from,c=this.lineAfter(h);r+=c,s=h+c.length}return{line:r,end:s}}skipGapsTo(t,r,s){for(;;){let l=this.ranges[this.rangeIndex].to,f=t+r;if(s>0?l>f:l>=f)break;let h=this.ranges[++this.rangeIndex].from;r+=h-l}return r}moveRangeIndex(){while(this.ranges[this.rangeIndex].to<this.parsedPos)this.rangeIndex++}emitToken(t,r,s,l){let f=4;if(this.ranges.length>1){l=this.skipGapsTo(r,l,1),r+=l;let c=this.chunk.length;l=this.skipGapsTo(s,l,-1),s+=l,f+=this.chunk.length-c}let h=this.chunk.length-4;if(this.lang.streamParser.mergeTokens&&f==4&&h>=0&&this.chunk[h]==t&&this.chunk[h+2]==r)this.chunk[h+2]=s;else this.chunk.push(t,r,s,f);return l}parseLine(t){let{line:r,end:s}=this.nextLine(),l=0,{streamParser:f}=this.lang,h=new lt(r,t?t.state.tabSize:4,t?ci(t.state):2);if(h.eol())f.blankLine(this.state,h.indentUnit);else while(!h.eol()){let c=tn(f.token,h,this.state);if(c)l=this.emitToken(this.lang.tokenTable.resolve(c),this.parsedPos+h.start,this.parsedPos+h.pos,l);if(h.start>1e4)break}if(this.parsedPos=s,this.moveRangeIndex(),this.parsedPos<this.to)this.parsedPos++}finishChunk(){let t=W.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:rs,topID:0,maxBufferLength:512,reused:this.chunkReused});t=new W(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new W(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function tn(t,r,s){r.start=r.pos;for(let l=0;l<10;l++){let f=t(r,s);if(r.pos>r.start)return f}throw Error("Stream parser failed to advance stream.")}var $t=Object.create(null),ze=[Y.none],rs=new et(ze),Nr=[],Fr=Object.create(null),rn=Object.create(null);for(let[t,r]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])rn[t]=nn($t,r);class qt{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),rn)}resolve(t){return!t?0:this.table[t]||(this.table[t]=nn(this.extra,t))}}var ns=new qt($t);function Vt(t,r){if(Nr.indexOf(t)>-1)return;Nr.push(t),console.warn(r)}function nn(t,r){let s=[];for(let d of r.split(" ")){let m=[];for(let p of d.split(".")){let g=t[p]||A[p];if(!g)Vt(p,`Unknown highlighting tag ${p}`);else if(typeof g=="function")if(!m.length)Vt(p,`Modifier ${p} used at start of tag`);else m=m.map(g);else if(m.length)Vt(p,`Tag ${p} used as modifier`);else m=Array.isArray(g)?g:[g]}for(let p of m)s.push(p)}if(!s.length)return 0;let l=r.replace(/ /g,"_"),f=l+" "+s.map((d)=>d.id),h=Fr[f];if(h)return h.id;let c=Fr[f]=Y.define({id:ze.length,name:l,props:[Sr({[l]:s})]});return ze.push(c),c.id}function is(t,r){let s=Y.define({id:ze.length,name:"Document",props:[Oe.add(()=>t),Hr.add(()=>(l)=>r.getIndent(l))],top:!0});return ze.push(s),s}var vo={rtl:N.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:We.RTL}),ltr:N.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:We.LTR}),auto:N.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};class j{constructor(t,r,s,l){this.fromA=t,this.toA=r,this.fromB=s,this.toB=l}offset(t,r=t){return new j(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function Se(t,r,s,l,f,h){if(t==l)return[];let c=rr(t,r,s,l,f,h),d=nr(t,r+c,s,l,f+c,h);r+=c,s-=d,f+=c,h-=d;let m=s-r,p=h-f;if(!m||!p)return[new j(r,s,f,h)];if(m>p){let b=t.slice(r,s).indexOf(l.slice(f,h));if(b>-1)return[new j(r,r+b,f,f),new j(r+b+p,s,h,h)]}else if(p>m){let b=l.slice(f,h).indexOf(t.slice(r,s));if(b>-1)return[new j(r,r,f,f+b),new j(s,s,f+b+m,h)]}if(m==1||p==1)return[new j(r,s,f,h)];let g=Dn(t,r,s,l,f,h);if(g){let[b,k,v]=g;return Se(t,r,b,l,f,k).concat(Se(t,b+v,s,l,k+v,h))}return ss(t,r,s,l,f,h)}var Ue=1e9,je=0,er=!1;function ss(t,r,s,l,f,h){let c=s-r,d=h-f;if(Ue<1e9&&Math.min(c,d)>Ue*16||je>0&&Date.now()>je){if(Math.min(c,d)>Ue*64)return[new j(r,s,f,h)];return sn(t,r,s,l,f,h)}let m=Math.ceil((c+d)/2);Jt.reset(m),Kt.reset(m);let p=(v,w)=>t.charCodeAt(r+v)==l.charCodeAt(f+w),g=(v,w)=>t.charCodeAt(s-v-1)==l.charCodeAt(h-w-1),b=(c-d)%2!=0?Kt:null,k=b?null:Jt;for(let v=0;v<m;v++){if(v>Ue||je>0&&!(v&63)&&Date.now()>je)return sn(t,r,s,l,f,h);let w=Jt.advance(v,c,d,m,b,!1,p)||Kt.advance(v,c,d,m,k,!0,g);if(w)return os(t,r,s,r+w[0],l,f,h,f+w[1])}return[new j(r,s,f,h)]}class tr{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,s,l,f,h,c){for(let d=-t+this.start;d<=t-this.end;d+=2){let m=l+d,p=d==-t||d!=t&&this.vec[m-1]<this.vec[m+1]?this.vec[m+1]:this.vec[m-1]+1,g=p-d;while(p<r&&g<s&&c(p,g))p++,g++;if(this.vec[m]=p,p>r)this.end+=2;else if(g>s)this.start+=2;else if(f){let b=l+(r-s)-d;if(b>=0&&b<this.len&&f.vec[b]!=-1)if(!h){let k=r-f.vec[b];if(p>=k)return[p,g]}else{let k=f.vec[b];if(k>=r-p)return[k,l+k-b]}}}return null}}var Jt=new tr,Kt=new tr;function os(t,r,s,l,f,h,c,d){let m=!1;if(!Pe(t,l)&&++l==s)m=!0;if(!Pe(f,d)&&++d==c)m=!0;if(m)return[new j(r,s,h,c)];return Se(t,r,l,f,h,d).concat(Se(t,l,s,f,d,c))}function Mn(t,r){let s=1,l=Math.min(t,r);while(s<l)s=s<<1;return s}function rr(t,r,s,l,f,h){if(r==s||r==h||t.charCodeAt(r)!=l.charCodeAt(f))return 0;let c=Mn(s-r,h-f);for(let d=r,m=f;;){let p=d+c,g=m+c;if(p>s||g>h||t.slice(d,p)!=l.slice(m,g)){if(c==1)return d-r-(Pe(t,d)?0:1);c=c>>1}else if(p==s||g==h)return p-r;else d=p,m=g}}function nr(t,r,s,l,f,h){if(r==s||f==h||t.charCodeAt(s-1)!=l.charCodeAt(h-1))return 0;let c=Mn(s-r,h-f);for(let d=s,m=h;;){let p=d-c,g=m-c;if(p<r||g<f||t.slice(p,d)!=l.slice(g,m)){if(c==1)return s-d-(Pe(t,d)?0:1);c=c>>1}else if(p==r||g==f)return s-p;else d=p,m=g}}function Xt(t,r,s,l,f,h,c,d){let m=l.slice(f,h),p=null;for(;;){if(p||c<d)return p;for(let g=r+c;;){if(!Pe(t,g))g++;let b=g+c;if(!Pe(t,b))b+=b==g+1?1:-1;if(b>=s)break;let k=t.slice(g,b),v=-1;while((v=m.indexOf(k,v+1))!=-1){let w=rr(t,b,s,l,f+v+k.length,h),D=nr(t,r,g,l,f,f+v),M=k.length+w+D;if(!p||p[2]<M)p=[g-D,f+v-D,M]}g=b}if(d<0)return p;c=c>>1}}function Dn(t,r,s,l,f,h){let c=s-r,d=h-f;if(c<d){let m=Dn(l,f,h,t,r,s);return m&&[m[1],m[0],m[2]]}if(c<4||d*2<c)return null;return Xt(t,r,s,l,f,h,Math.floor(c/4),-1)}function sn(t,r,s,l,f,h){er=!0;let c=s-r,d=h-f,m;if(c<d){let k=Xt(l,f,h,t,r,s,Math.floor(c/6),50);m=k&&[k[1],k[0],k[2]]}else m=Xt(t,r,s,l,f,h,Math.floor(d/6),50);if(!m)return[new j(r,s,f,h)];let[p,g,b]=m;return Se(t,r,p,l,f,g).concat(Se(t,p+b,s,l,g+b,h))}function Bn(t,r){for(let s=1;s<t.length;s++){let l=t[s-1],f=t[s];if(l.toA>f.fromA-r&&l.toB>f.fromB-r)t[s-1]=new j(l.fromA,f.toA,l.fromB,f.toB),t.splice(s--,1)}}function ls(t,r,s){for(;;){Bn(s,1);let l=!1;for(let f=0;f<s.length;f++){let h=s[f],c,d;if(c=rr(t,h.fromA,h.toA,r,h.fromB,h.toB))h=s[f]=new j(h.fromA+c,h.toA,h.fromB+c,h.toB);if(d=nr(t,h.fromA,h.toA,r,h.fromB,h.toB))h=s[f]=new j(h.fromA,h.toA-d,h.fromB,h.toB-d);let m=h.toA-h.fromA,p=h.toB-h.fromB;if(m&&p)continue;let g=h.fromA-(f?s[f-1].toA:0),b=(f<s.length-1?s[f+1].fromA:t.length)-h.toA;if(!g||!b)continue;let k=m?t.slice(h.fromA,h.toA):r.slice(h.fromB,h.toB);if(g<=k.length&&t.slice(h.fromA-g,h.fromA)==k.slice(k.length-g))s[f]=new j(h.fromA-g,h.toA-g,h.fromB-g,h.toB-g),l=!0;else if(b<=k.length&&t.slice(h.toA,h.toA+b)==k.slice(0,b))s[f]=new j(h.fromA+b,h.toA+b,h.fromB+b,h.toB+b),l=!0}if(!l)break}return s}function as(t,r,s){for(let l=0,f=0;f<t.length;f++){let h=t[f],c=h.toA-h.fromA,d=h.toB-h.fromB;if(c&&d||c>3||d>3){let m=f==t.length-1?r.length:t[f+1].fromA,p=h.fromA-l,g=m-h.toA,b=ln(r,h.fromA,p),k=on(r,h.toA,g),v=h.fromA-b,w=k-h.toA;if((!c||!d)&&v&&w){let D=Math.max(c,d),[M,L,F]=c?[r,h.fromA,h.toA]:[s,h.fromB,h.toB];if(D>v&&r.slice(b,h.fromA)==M.slice(F-v,F))h=t[f]=new j(b,b+c,h.fromB-v,h.toB-v),b=h.fromA,k=on(r,h.toA,m-h.toA);else if(D>w&&r.slice(h.toA,k)==M.slice(L,L+w))h=t[f]=new j(k-c,k,h.fromB+w,h.toB+w),k=h.toA,b=ln(r,h.fromA,h.fromA-l);v=h.fromA-b,w=k-h.toA}if(v||w)h=t[f]=new j(h.fromA-v,h.toA+w,h.fromB-v,h.toB+w);else if(!c){let D=fn(s,h.fromB,h.toB),M,L=D<0?-1:an(s,h.toB,h.fromB);if(D>-1&&(M=D-h.fromB)<=g&&s.slice(h.fromB,D)==s.slice(h.toB,h.toB+M))h=t[f]=h.offset(M);else if(L>-1&&(M=h.toB-L)<=p&&s.slice(h.fromB-M,h.fromB)==s.slice(L,h.toB))h=t[f]=h.offset(-M)}else if(!d){let D=fn(r,h.fromA,h.toA),M,L=D<0?-1:an(r,h.toA,h.fromA);if(D>-1&&(M=D-h.fromA)<=g&&r.slice(h.fromA,D)==r.slice(h.toA,h.toA+M))h=t[f]=h.offset(M);else if(L>-1&&(M=h.toA-L)<=p&&r.slice(h.fromA-M,h.fromA)==r.slice(L,h.toA))h=t[f]=h.offset(-M)}}l=h.toA}return Bn(t,3),t}var Ae;try{Ae=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(t){}function En(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function Ln(t,r){if(r==t.length)return 0;let s=t.charCodeAt(r);if(s<192)return En(s)?1:0;if(!Ae)return 0;if(!In(s)||r==t.length-1)return Ae.test(String.fromCharCode(s))?1:0;return Ae.test(t.slice(r,r+2))?2:0}function On(t,r){if(!r)return 0;let s=t.charCodeAt(r-1);if(s<192)return En(s)?1:0;if(!Ae)return 0;if(!Pn(s)||r==1)return Ae.test(String.fromCharCode(s))?1:0;return Ae.test(t.slice(r-2,r))?2:0}var Tn=8;function on(t,r,s){if(r==t.length||!On(t,r))return r;for(let l=r,f=r+s,h=0;h<Tn;h++){let c=Ln(t,l);if(!c||l+c>f)return l;l+=c}return r}function ln(t,r,s){if(!r||!Ln(t,r))return r;for(let l=r,f=r-s,h=0;h<Tn;h++){let c=On(t,l);if(!c||l-c<f)return l;l-=c}return r}function an(t,r,s){for(;r!=s;r--)if(t.charCodeAt(r-1)==10)return r;return-1}function fn(t,r,s){for(;r!=s;r++)if(t.charCodeAt(r)==10)return r;return-1}var In=(t)=>t>=55296&&t<=56319,Pn=(t)=>t>=56320&&t<=57343;function Pe(t,r){return!r||r==t.length||!In(t.charCodeAt(r-1))||!Pn(t.charCodeAt(r))}function ir(t,r,s){var l;let f=s===null||s===void 0?void 0:s.override;if(f)return f(t,r);return Ue=((l=s===null||s===void 0?void 0:s.scanLimit)!==null&&l!==void 0?l:1e9)>>1,je=(s===null||s===void 0?void 0:s.timeout)?Date.now()+s.timeout:0,er=!1,ls(t,r,Se(t,0,t.length,r,0,r.length))}function Rn(){return!er}function _n(t,r,s){return as(ir(t,r,s),t,r)}var X=P.define({combine:(t)=>t[0]}),Yt=ie.define(),Fn=P.define(),q=Ge.define({create(t){return null},update(t,r){for(let s of r.effects)if(s.is(Yt))t=s.value;for(let s of r.state.facet(Fn))t=s(t,r);return t}});function kt(t){let r=t.field(q,!1);if(!r)return null;let s=t.facet(X);return{chunks:r,side:s?s.side:null}}var Vn=(t)=>({state:r,dispatch:s})=>{let l=r.field(q,!1),f=r.facet(X);if(!l||!l.length||!f)return!1;let{head:h}=r.selection.main,c=0;for(let g=l.length-1;g>=0;g--){let b=l[g],[k,v]=f.side=="b"?[b.fromB,b.toB]:[b.fromA,b.toA];if(v<h){c=g+1;break}if(k<=h){if(l.length==1)return!1;c=g+(t<0?0:1);break}}let d=l[(c+(t<0?l.length-1:0))%l.length],[m,p]=f.side=="b"?[d.fromB,d.toB]:[d.fromA,d.toA];return s(r.update({selection:{anchor:m},userEvent:"select.byChunk",effects:_.scrollIntoView(x.range(p,m))})),!0},Hn=Vn(1),Wn=Vn(-1);class ae{constructor(t,r,s,l,f,h=!0){this.changes=t,this.fromA=r,this.toA=s,this.fromB=l,this.toB=f,this.precise=h}offset(t,r){return t||r?new ae(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,r,s){let l=_n(t.toString(),r.toString(),s);return Gn(l,t,r,0,0,Rn())}static updateA(t,r,s,l,f){return pn(mn(t,l,!0,s.length),t,r,s,f)}static updateB(t,r,s,l,f){return pn(mn(t,l,!1,r.length),t,r,s,f)}}function cn(t,r,s,l){let f=s.lineAt(t),h=l.lineAt(r);return f.to==t&&h.to==r&&t<s.length&&r<l.length?[t+1,r+1]:[f.from,h.from]}function un(t,r,s,l){let f=s.lineAt(t),h=l.lineAt(r);return f.from==t&&h.from==r?[t,r]:[f.to+1,h.to+1]}function Gn(t,r,s,l,f,h){let c=[];for(let d=0;d<t.length;d++){let m=t[d],[p,g]=cn(m.fromA+l,m.fromB+f,r,s),[b,k]=un(m.toA+l,m.toB+f,r,s),v=[m.offset(-p+l,-g+f)];while(d<t.length-1){let w=t[d+1],[D,M]=cn(w.fromA+l,w.fromB+f,r,s);if(D>b+1&&M>k+1)break;v.push(w.offset(-p+l,-g+f)),[b,k]=un(w.toA+l,w.toB+f,r,s),d++}c.push(new ae(v,p,Math.max(p,b),g,Math.max(g,k),h))}return c}var ut=1000;function dn(t,r,s,l){let f=0,h=t.length;for(;;){if(f==h){let g=0,b=0;if(f)({toA:g,toB:b}=t[f-1]);let k=r-(s?g:b);return[g+k,b+k]}let c=f+h>>1,d=t[c],[m,p]=s?[d.fromA,d.toA]:[d.fromB,d.toB];if(m>r)h=c;else if(p<=r)f=c+1;else return l?[d.fromA,d.fromB]:[d.toA,d.toB]}}function mn(t,r,s,l){let f=[];return r.iterChangedRanges((h,c,d,m)=>{let p=0,g=s?r.length:l,b=0,k=s?l:r.length;if(h>ut)[p,b]=dn(t,h-ut,s,!0);if(c<r.length-ut)[g,k]=dn(t,c+ut,s,!1);let v=m-d-(c-h),w,[D,M]=s?[v,0]:[0,v];if(f.length&&(w=f[f.length-1]).toA>=p)f[f.length-1]={fromA:w.fromA,fromB:w.fromB,toA:g,toB:k,diffA:w.diffA+D,diffB:w.diffB+M};else f.push({fromA:p,toA:g,fromB:b,toB:k,diffA:D,diffB:M})}),f}function pn(t,r,s,l,f){if(!t.length)return r;let h=[];for(let c=0,d=0,m=0,p=0;;c++){let g=c==t.length?null:t[c],b=g?g.fromA+d:s.length,k=g?g.fromB+m:l.length;while(p<r.length){let M=r[p];if(g&&(M.toA+d>b||M.toB+m>k))break;h.push(M.offset(d,m)),p++}if(!g)break;let v=g.toA+d+g.diffA,w=g.toB+m+g.diffB,D=_n(s.sliceString(b,v),l.sliceString(k,w),f);for(let M of Gn(D,s,l,b,k,Rn()))h.push(M);d+=g.diffA,m+=g.diffB;while(p<r.length){let M=r[p];if(M.fromA+d>v&&M.fromB+m>w)break;p++}}return h}var Un={scanLimit:500},xt=ye.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=kn(t))}update(t){if(t.docChanged||t.viewportChanged||fs(t.startState,t.state)||hs(t.startState,t.state))({deco:this.deco,gutter:this.gutter}=kn(t.view))}},{decorations:(t)=>t.deco}),mt=Tr.low(Hi({class:"cm-changeGutter",markers:(t)=>{var r;return((r=t.plugin(xt))===null||r===void 0?void 0:r.gutter)||ge.empty}}));function fs(t,r){return t.field(q,!1)!=r.field(q,!1)}function hs(t,r){return t.facet(X)!=r.facet(X)}var gn=N.line({class:"cm-changedLine"}),jn=N.mark({class:"cm-changedText"}),cs=N.mark({tagName:"ins",class:"cm-insertedLine"}),us=N.mark({tagName:"del",class:"cm-deletedLine"}),bn=new class extends Qn{constructor(){super(...arguments);this.elementClass="cm-changedLineGutter"}};function ds(t,r,s,l,f,h){let c=s?t.fromA:t.fromB,d=s?t.toA:t.toB,m=0;if(c!=d){if(f.add(c,c,gn),f.add(c,d,s?us:cs),h)h.add(c,c,bn);for(let p=r.iterRange(c,d-1),g=c;!p.next().done;){if(p.lineBreak){if(g++,f.add(g,g,gn),h)h.add(g,g,bn);continue}let b=g+p.value.length;if(l)while(m<t.changes.length){let k=t.changes[m],v=c+(s?k.fromA:k.fromB),w=c+(s?k.toA:k.toB),D=Math.max(g,v),M=Math.min(b,w);if(D<M)f.add(D,M,jn);if(w<b)m++;else break}g=b}}}function kn(t){let r=t.state.field(q),{side:s,highlightChanges:l,markGutter:f,overrideChunk:h}=t.state.facet(X),c=s=="a",d=new dt,m=f?new dt:null,{from:p,to:g}=t.viewport;for(let b of r){if((c?b.fromA:b.fromB)>=g)break;if((c?b.toA:b.toB)>p){if(!h||!h(t.state,b,d,m))ds(b,t.state.doc,c,l,d,m)}}return{deco:d.finish(),gutter:m&&m.finish()}}class $e extends Ot{constructor(t){super();this.height=t}eq(t){return this.height==t.height}toDOM(){let t=document.createElement("div");return t.className="cm-mergeSpacer",t.style.height=this.height+"px",t}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}var bt=ie.define({map:(t,r)=>t.map(r)}),qe=Ge.define({create:()=>N.none,update:(t,r)=>{for(let s of r.effects)if(s.is(bt))return s.value;return t.map(r.changes)},provide:(t)=>_.decorations.from(t)}),pt=0.01;function xn(t,r){if(t.size!=r.size)return!1;let s=t.iter(),l=r.iter();while(s.value){if(s.from!=l.from||Math.abs(s.value.spec.widget.height-l.value.spec.widget.height)>1)return!1;s.next(),l.next()}return!0}function ms(t,r,s){let l=new dt,f=new dt,h=t.state.field(qe).iter(),c=r.state.field(qe).iter(),d=0,m=0,p=0,g=0,b=t.viewport,k=r.viewport;for(let M=0;;M++){let L=M<s.length?s[M]:null,F=L?L.fromA:t.state.doc.length,R=L?L.fromB:r.state.doc.length;if(d<F){let E=t.lineBlockAt(d).top+p,S=r.lineBlockAt(m).top+g,B=E-S;if(B<-pt)p-=B,l.add(d,d,N.widget({widget:new $e(-B),block:!0,side:-1}));else if(B>pt)g+=B,f.add(m,m,N.widget({widget:new $e(B),block:!0,side:-1}))}if(F>d+1000&&d<b.from&&F>b.from&&m<k.from&&R>k.from){let E=Math.max(b.from-d,k.from-m);d+=E,m+=E,M--}else if(!L)break;else d=L.toA,m=L.toB;while(h.value&&h.from<d)p-=h.value.spec.widget.height,h.next();while(c.value&&c.from<m)g-=c.value.spec.widget.height,c.next()}while(h.value)p-=h.value.spec.widget.height,h.next();while(c.value)g-=c.value.spec.widget.height,c.next();let v=t.contentHeight+p-(r.contentHeight+g);if(v<pt)l.add(t.state.doc.length,t.state.doc.length,N.widget({widget:new $e(-v),block:!0,side:1}));else if(v>pt)f.add(r.state.doc.length,r.state.doc.length,N.widget({widget:new $e(v),block:!0,side:1}));let w=l.finish(),D=f.finish();if(!xn(w,t.state.field(qe)))t.dispatch({effects:bt.of(w)});if(!xn(D,r.state.field(qe)))r.dispatch({effects:bt.of(D)})}var Qt=ie.define({map:(t,r)=>r.mapPos(t)});class $n extends Ot{constructor(t){super();this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",(s)=>{let l=t.posAtDOM(s.target);t.dispatch({effects:Qt.of(l)});let{side:f,sibling:h}=t.state.facet(X);if(h)h().dispatch({effects:Qt.of(ps(l,t.state.field(q),f=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function ps(t,r,s){let l=0,f=0;for(let h=0;;h++){let c=h<r.length?r[h]:null;if(!c||(s?c.fromA:c.fromB)>=t)return f+(t-l);[l,f]=s?[c.toA,c.toB]:[c.toB,c.toA]}}var gs=Ge.define({create(t){return N.none},update(t,r){t=t.map(r.changes);for(let s of r.effects)if(s.is(Qt))t=t.update({filter:(l)=>l!=s.value});if(t.size&&r.state.field(q)!=r.startState.field(q,!1)){let s=r.state.facet(X).side=="a",l=[];for(let f of r.state.field(q))t.between(s?f.fromA:f.fromB,s?f.toA:f.toB,(h)=>{l.push(h)});if(l.length)t=t.update({filter:(f)=>l.indexOf(f)<0})}return t},provide:(t)=>_.decorations.from(t)});function Zt({margin:t=3,minSize:r=4}){return gs.init((s)=>bs(s,t,r))}function bs(t,r,s){let l=new dt,f=t.facet(X).side=="a",h=t.field(q),c=1;for(let d=0;;d++){let m=d<h.length?h[d]:null,p=d?c+r:1,g=m?t.doc.lineAt(f?m.fromA:m.fromB).number-1-r:t.doc.lines,b=g-p+1;if(b>=s)l.add(t.doc.line(p).from,t.doc.line(g).to,N.replace({widget:new $n(b),block:!0}));if(!m)break;c=t.doc.lineAt(Math.min(t.doc.length,f?m.toA:m.toB)).number}return l.finish()}var ks=_.styleModule.of(new Kr({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),qn=_.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),vn=new hn,gt=new hn;class sr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||Un;let r=[Tr.low(xt),qn,ks,qe,_.updateListener.of((g)=>{if(this.measuring<0&&(g.heightChanged||g.viewportChanged)&&!g.transactions.some((b)=>b.effects.some((k)=>k.is(bt))))this.measure()})],s=[X.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];if(t.gutter!==!1)s.push(mt);let l=pe.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],_.editorAttributes.of({class:"cm-merge-a"}),gt.of(s),r]}),f=[X.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];if(t.gutter!==!1)f.push(mt);let h=pe.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],_.editorAttributes.of({class:"cm-merge-b"}),gt.of(f),r]});this.chunks=ae.build(l.doc,h.doc,this.diffConf);let c=[q.init(()=>this.chunks),vn.of(t.collapseUnchanged?Zt(t.collapseUnchanged):[])];l=l.update({effects:ie.appendConfig.of(c)}).state,h=h.update({effects:ie.appendConfig.of(c)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let d=t.orientation||"a-b",m=document.createElement("div");m.className="cm-mergeViewEditor";let p=document.createElement("div");if(p.className="cm-mergeViewEditor",this.editorDOM.appendChild(d=="a-b"?m:p),this.editorDOM.appendChild(d=="a-b"?p:m),this.a=new _({state:l,parent:m,root:t.root,dispatchTransactions:(g)=>this.dispatch(g,this.a)}),this.b=new _({state:h,parent:p,root:t.root,dispatchTransactions:(g)=>this.dispatch(g,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent)t.parent.appendChild(this.dom);this.scheduleMeasure()}dispatch(t,r){if(t.some((s)=>s.docChanged)){let s=t[t.length-1],l=t.reduce((h,c)=>h.compose(c.changes),_t.empty(t[0].startState.doc.length));this.chunks=r==this.a?ae.updateA(this.chunks,s.newDoc,this.b.state.doc,l,this.diffConf):ae.updateB(this.chunks,this.a.state.doc,s.newDoc,l,this.diffConf),r.update([...t,s.state.update({effects:Yt.of(this.chunks)})]);let f=r==this.a?this.b:this.a;f.update([f.state.update({effects:Yt.of(this.chunks)})]),this.scheduleMeasure()}else r.update(t)}reconfigure(t){if("diffConfig"in t)this.diffConf=t.diffConfig;if("orientation"in t){let f=t.orientation!="b-a";if(f!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let h=this.a.dom.parentNode,c=this.b.dom.parentNode;if(h.remove(),c.remove(),this.editorDOM.insertBefore(f?h:c,this.editorDOM.firstChild),this.editorDOM.appendChild(f?c:h),this.revertToLeft=!this.revertToLeft,this.revertDOM)this.revertDOM.textContent=""}}if("revertControls"in t||"renderRevertControl"in t){let f=!!this.revertDOM,h=this.revertToA,c=this.renderRevert;if("revertControls"in t)f=!!t.revertControls,h=t.revertControls=="b-to-a";if("renderRevertControl"in t)c=t.renderRevertControl;this.setupRevertControls(f,h,c)}let r="highlightChanges"in t,s="gutter"in t,l="collapseUnchanged"in t;if(r||s||l){let f=[],h=[];if(r||s){let c=this.a.state.facet(X),d=s?t.gutter!==!1:c.markGutter,m=r?t.highlightChanges!==!1:c.highlightChanges;f.push(gt.reconfigure([X.of({side:"a",sibling:()=>this.b,highlightChanges:m,markGutter:d}),d?mt:[]])),h.push(gt.reconfigure([X.of({side:"b",sibling:()=>this.a,highlightChanges:m,markGutter:d}),d?mt:[]]))}if(l){let c=vn.reconfigure(t.collapseUnchanged?Zt(t.collapseUnchanged):[]);f.push(c),h.push(c)}this.a.dispatch({effects:f}),this.b.dispatch({effects:h})}this.scheduleMeasure()}setupRevertControls(t,r,s){if(this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=s,!t&&this.revertDOM)this.revertDOM.remove(),this.revertDOM=null;else if(t&&!this.revertDOM)this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",(l)=>this.revertClicked(l)),this.revertDOM.className="cm-merge-revert";else if(this.revertDOM)this.revertDOM.textContent=""}scheduleMeasure(){if(this.measuring<0){let t=this.dom.ownerDocument.defaultView||window;this.measuring=t.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){if(ms(this.a,this.b,this.chunks),this.revertDOM)this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,r=t.firstChild,s=this.a.viewport,l=this.b.viewport;for(let f=0;f<this.chunks.length;f++){let h=this.chunks[f];if(h.fromA>s.to||h.fromB>l.to)break;if(h.fromA<s.from||h.fromB<l.from)continue;let c=this.a.lineBlockAt(h.fromA).top+"px";while(r&&+r.dataset.chunk<f)r=yn(r);if(r&&r.dataset.chunk==String(f)){if(r.style.top!=c)r.style.top=c;r=r.nextSibling}else t.insertBefore(this.renderRevertButton(c,f),r)}while(r)r=yn(r)}renderRevertButton(t,r){let s;if(this.renderRevert)s=this.renderRevert();else{s=document.createElement("button");let l=this.a.state.phrase("Revert this chunk");s.setAttribute("aria-label",l),s.setAttribute("title",l),s.textContent=this.revertToLeft?"⇜":"⇝"}return s.style.top=t,s.setAttribute("data-chunk",String(r)),s}revertClicked(t){let r=t.target,s;while(r&&r.parentNode!=this.revertDOM)r=r.parentNode;if(r&&(s=this.chunks[r.dataset.chunk])){let[l,f,h,c,d,m]=this.revertToA?[this.b,this.a,s.fromB,s.toB,s.fromA,s.toA]:[this.a,this.b,s.fromA,s.toA,s.fromB,s.toB],p=l.state.sliceDoc(h,Math.max(h,c-1));if(h!=c&&m<=f.state.doc.length)p+=l.state.lineBreak;f.dispatch({changes:{from:d,to:Math.min(f.state.doc.length,m),insert:p},userEvent:"revert"}),t.preventDefault()}}destroy(){if(this.a.destroy(),this.b.destroy(),this.measuring>-1)(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring);this.dom.remove()}}function yn(t){let r=t.nextSibling;return t.remove(),r}var xs=new class extends Qn{constructor(){super(...arguments);this.elementClass="cm-deletedLineGutter"}},vs=Tr.low(Hi({class:"cm-changeGutter",markers:(t)=>{var r;return((r=t.plugin(xt))===null||r===void 0?void 0:r.gutter)||ge.empty},widgetMarker:(t,r)=>r instanceof lr?xs:null}));function Jn(t){var r;let s=typeof t.original=="string"?ke.of(t.original.split(/\r?\n/)):t.original,l=t.diffConfig||Un;return[Tr.low(xt),Ss,qn,_.editorAttributes.of({class:"cm-merge-b"}),Fn.of((f,h)=>{let c=h.effects.find((d)=>d.is(or));if(c)f=ae.updateA(f,c.value.doc,h.startState.doc,c.value.changes,l);if(h.docChanged)f=ae.updateB(f,h.state.field(Me),h.newDoc,h.changes,l);return f}),X.of({highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1,syntaxHighlightDeletions:t.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3000,mergeControls:(r=t.mergeControls)!==null&&r!==void 0?r:!0,overrideChunk:t.allowInlineDiffs?Bs:void 0,side:"b"}),Me.init(()=>s),t.gutter!==!1?vs:[],t.collapseUnchanged?Zt(t.collapseUnchanged):[],q.init((f)=>ae.build(s,f.doc,l))]}var or=ie.define();var Me=Ge.define({create:()=>ke.empty,update(t,r){for(let s of r.effects)if(s.is(or))t=s.value.doc;return t}});function Kn(t){return t.field(Me)}var Cn=new WeakMap;class lr extends Ot{constructor(t){super();this.buildDOM=t,this.dom=null}eq(t){return this.dom==t.dom}toDOM(t){return this.dom||(this.dom=this.buildDOM(t))}}function ws(t,r,s){let l=Cn.get(r.changes);if(l)return l;let f=(c)=>{let{highlightChanges:d,syntaxHighlightDeletions:m,syntaxHighlightDeletionsMaxLength:p,mergeControls:g}=t.facet(X),b=document.createElement("div");if(b.className="cm-deletedChunk",g){let E=b.appendChild(document.createElement("div"));E.className="cm-chunkButtons";let S=(y)=>{y.preventDefault(),Cs(c,c.posAtDOM(b))},B=(y)=>{y.preventDefault(),As(c,c.posAtDOM(b))};if(typeof g=="function")E.appendChild(g("accept",S)),E.appendChild(g("reject",B));else{let y=E.appendChild(document.createElement("button"));y.name="accept",y.textContent=t.phrase("Accept"),y.onmousedown=S;let T=E.appendChild(document.createElement("button"));T.name="reject",T.textContent=t.phrase("Reject"),T.onmousedown=B}}if(s||r.fromA>=r.toA)return b;let k=c.state.field(Me).sliceString(r.fromA,r.endA),v=m&&t.facet(ko),w=F(),D=r.changes,M=0,L=!1;function F(){let E=b.appendChild(document.createElement("div"));return E.className="cm-deletedLine",E.appendChild(document.createElement("del"))}function R(E,S,B){for(let y=E;y<S;){if(k.charAt(y)==`
4
4
  `){if(!w.firstChild)w.appendChild(document.createElement("br"));w=F(),y++;continue}let T=S,V=B+(L?" cm-deletedText":""),H=!1,I=k.indexOf(`
@@ -1,2 +1,2 @@
1
- import{d,n,K,i,e,s,f,C,ae,Be,Ra,La,Et,Pa,xr,Me,ze}from"./index-eggbcdwx.js";import{Ya,Ja,ui}from"./index-trq7bdvk.js";var Q={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]},w=s(Q);var Y={name:"laptop",size:24,node:[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]]},P=s(Y);var j={name:"ratio",size:24,node:[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]},N=s(j);var ee={name:"tablet",size:24,node:[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]},T=s(ee);var g=[{id:"responsive",label:"Responsive (100% Fluid)",category:"responsive",icon:La},{id:"desktop-16-9",label:"Desktop 16:9 (Auto H:W)",category:"responsive",icon:N},{id:"laptop",label:"Laptop (1024 × 768)",category:"responsive",icon:P},{id:"tablet",label:"Tablet (768 × 1024)",category:"mobile",icon:T},{id:"mobile",label:"Mobile Phone (375 × 667)",category:"mobile",icon:xr},{id:"mobile-lg",label:"Mobile Large (414 × 896)",category:"mobile",icon:xr}];function te(o){switch(o){case"desktop-16-9":return"Desktop 16:9";case"laptop":return"Laptop 1024p";case"tablet":return"Tablet 768p";case"mobile":return"Mobile 375p";case"mobile-lg":return"Mobile Lg 414p";case"responsive":default:return"Responsive"}}function A({viewportMode:o,onChangeViewport:a,zoomLevel:r=100,onSetZoom:l}){let[b,c]=n(null);return e("div",{className:"flex items-center space-x-1.5 flex-shrink-0",children:[e("div",{className:"hidden sm:flex items-center bg-canvas border border-ink/10 rounded-md p-0.5",children:[e("button",{type:"button",onClick:()=>a("responsive"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="responsive"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Responsive (100% Fluid)",children:e(La,{size:12})}),e("button",{type:"button",onClick:()=>a("desktop-16-9"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="desktop-16-9"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Desktop 16:9 (Auto Height following Width)",children:e(N,{size:12})}),e("button",{type:"button",onClick:()=>a("tablet"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="tablet"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Tablet (768px)",children:e(T,{size:12})}),e("button",{type:"button",onClick:()=>a("mobile"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="mobile"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Mobile (375px)",children:e(xr,{size:12})})]}),e("button",{type:"button","aria-haspopup":"menu","aria-expanded":b!==null,onClick:(t)=>c(b?null:Me(t.currentTarget)),className:"flex items-center space-x-1 px-2 py-1 rounded bg-canvas border border-ink/15 hover:border-ink/30 text-ink text-[11px] font-mono transition-colors cursor-pointer",title:"Device & Responsive Testing Menu",children:[e("span",{className:"hidden md:inline text-[10px] font-medium",children:te(o)}),e(C,{size:11,className:"text-ink/60"})]}),e(ze,{anchor:b,ariaLabel:"Device & Responsive Testing Menu",className:"w-56 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs font-mono",onClose:()=>c(null),children:[e("div",{className:"px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold",children:"Responsive Testing"}),g.filter((t)=>t.category==="responsive").map((t)=>{let m=t.icon,p=o===t.id;return e("button",{type:"button",role:"menuitemradio","aria-checked":p,onClick:()=>{a(t.id),c(null)},className:`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${p?"bg-ink/10 font-semibold text-ink":"text-ink/75"}`,children:[e("div",{className:"flex items-center space-x-2",children:[e(m,{size:13,className:"text-ink/60"}),e("span",{children:t.label})]}),p&&e(f,{size:12,className:"text-success-text"})]},t.id)}),e("div",{className:"mt-1 pt-1 border-t border-ink/10 px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold",children:"Mobile Testing"}),g.filter((t)=>t.category==="mobile").map((t)=>{let m=t.icon,p=o===t.id;return e("button",{type:"button",role:"menuitemradio","aria-checked":p,onClick:()=>{a(t.id),c(null)},className:`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${p?"bg-ink/10 font-semibold text-ink":"text-ink/75"}`,children:[e("div",{className:"flex items-center space-x-2",children:[e(m,{size:13,className:"text-ink/60"}),e("span",{children:t.label})]}),p&&e(f,{size:12,className:"text-success-text"})]},t.id)}),l&&e(d,{children:[e("div",{className:"mt-1 pt-1 border-t border-ink/10 px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold",children:["Zoom Scale (",r,"%)"]}),e("div",{className:"grid grid-cols-3 gap-1 px-2 py-1",children:[50,75,100,125,150,200].map((t)=>e("button",{type:"button",onClick:()=>{l(t),c(null)},className:`px-1.5 py-1 text-center rounded text-[11px] font-mono cursor-pointer transition-colors ${r===t?"bg-ink text-canvas font-semibold":"bg-canvas border border-ink/10 text-ink/75 hover:bg-ink/5"}`,children:[t,"%"]},t))})]})]})]})}function B({zoomLevel:o,onZoomIn:a,onZoomOut:r,onResetZoom:l}){return e("div",{className:"flex items-center bg-canvas border border-ink/10 rounded-md p-0.5 space-x-0.5 text-xs font-mono",children:[e("button",{type:"button",onClick:r,disabled:o<=50,"aria-label":"Perkecil tampilan",title:"Zoom Out (-10%)",className:"p-1 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink cursor-pointer disabled:cursor-not-allowed transition-colors",children:e(Ja,{size:12})}),e("button",{type:"button",onClick:l,className:"px-1 text-[10px] font-medium text-ink/75 hover:text-ink hover:underline cursor-pointer select-none",title:"Reset Zoom (100%)",children:[o,"%"]}),e("button",{type:"button",onClick:a,disabled:o>=200,"aria-label":"Perbesar tampilan",title:"Zoom In (+10%)",className:"p-1 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink cursor-pointer disabled:cursor-not-allowed transition-colors",children:e(Ya,{size:12})})]})}var h="p-1.5 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:cursor-not-allowed";function V(o){let a=[],{url:r,zoomLevel:l,copied:b,included:c}=o;if(o.viewportMode&&o.onChangeViewport){let{viewportMode:t,onChangeViewport:m,onSetZoom:p}=o;a.push({id:"viewport",actions:g.map((x)=>({label:x.label,icon:x.icon,onSelect:()=>m(x.id),active:t===x.id})),children:e(A,{viewportMode:t,onChangeViewport:m,zoomLevel:l,onSetZoom:p})})}if(a.push({id:"zoom",actions:[{label:"Zoom in (+10%)",icon:Ya,onSelect:o.onZoomIn,disabled:l>=200},{label:"Zoom out (-10%)",icon:Ja,onSelect:o.onZoomOut,disabled:l<=50},{label:"Reset zoom (100%)",icon:Et,onSelect:o.onResetZoom,active:l===100}],children:e(B,{zoomLevel:l,onZoomIn:o.onZoomIn,onZoomOut:o.onZoomOut,onResetZoom:o.onResetZoom})}),a.push({id:"include",actions:[{label:c?"Page context added to the draft":"Include this page in the chat draft",icon:Ra,onSelect:o.onIncludeInChat,disabled:!r}],children:e("button",{type:"button",onClick:o.onIncludeInChat,disabled:!r,"aria-label":"Include this page in the chat draft",title:c?"Page context added to the draft":"Include this page in the chat draft",className:h,children:c?e(f,{size:14,className:"text-success-text"}):e(Ra,{size:14})})}),o.annotate){let t=o.annotate;a.push({id:"annotate",actions:[{label:t.count>0?`${t.active?"Tutup mode anotasi":"Buka mode anotasi"} (${t.count})`:"Mark a part of the page, then send it to the chat",icon:w,onSelect:t.onToggle,active:t.active,disabled:!r}],children:e("button",{type:"button",onClick:t.onToggle,disabled:!r,"aria-label":"Page annotation mode","aria-pressed":t.active,title:t.active?"Tutup mode anotasi":t.count>0?`Anotasi (${t.count}) — buka lagi`:"Mark a part of the page, then send it to the chat",className:`${h} relative ${t.active?"bg-ink/10 text-ink":""}`,children:[e(w,{size:14}),t.count>0&&e("span",{className:"absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-0.5 rounded-full bg-error text-paper text-[10px] leading-[13px] font-mono text-center",children:t.count})]})})}if(a.push({id:"copy",actions:[{label:b?"Copied URL!":"Copy URL",icon:ae,onSelect:o.onCopy,disabled:!r}],children:e("button",{type:"button",onClick:o.onCopy,disabled:!r,"aria-label":"Salin URL",title:b?"Copied URL!":"Copy URL",className:h,children:b?e(f,{size:14,className:"text-success-text"}):e(ae,{size:14})})}),o.onReconnect){let t=o.onReconnect;a.push({id:"reconnect",actions:[{label:"Sambungkan ulang live view",icon:Pa,onSelect:t}],children:e("button",{type:"button",onClick:t,"aria-label":"Sambungkan ulang live view",title:"Reconnect live view",className:h,children:e(Pa,{size:14})})})}return a.push({id:"open-external",actions:[{label:o.openExternalLabel,icon:Be,onSelect:o.onOpenExternal,disabled:!r}],children:e("button",{type:"button",onClick:o.onOpenExternal,disabled:!r,"aria-label":o.openExternalLabel,title:o.openExternalTitle,className:h,children:e(Be,{size:14})})}),a}var E=108,oe=280,ne=18,ie=140,re=36;function md({url:o,statusDotClass:a,statusLabel:r,viewportMode:l,zoomLevel:b,onChangeViewport:c,onZoomIn:t,onZoomOut:m,onResetZoom:p,onSetZoom:x,annotate:D,onIncludeInChat:_,onOpenExternal:U,onReconnect:W,openExternalLabel:H,openExternalTitle:X,twoRows:k=!1,children:q}){let[F,R]=n(!1),[G,I]=n(!1),y=i(null),[u,S]=n(0),M=V({url:o,zoomLevel:b,copied:F,included:G,viewportMode:l,onChangeViewport:c,annotate:D,onReconnect:W,onIncludeInChat:()=>{_(),I(!0),setTimeout(()=>I(!1),2500)},onCopy:()=>{if(!o)return;navigator.clipboard.writeText(o).then(()=>{R(!0),setTimeout(()=>R(!1),2000)}).catch(()=>{})},onOpenExternal:U,onZoomIn:t,onZoomOut:m,onResetZoom:p,onSetZoom:x,openExternalLabel:H,openExternalTitle:X});K(()=>{let v=y.current;if(!v)return;S(v.clientWidth)}),K(()=>{let v=y.current;if(!v||typeof ResizeObserver>"u")return;let O=new ResizeObserver(()=>S(v.clientWidth));return O.observe(v),()=>O.disconnect()},[]);let Z=u===0||u>=oe,z=Z?u>0?Math.min(E,u*0.25):E:ne,L=k?u>0?u:void 0:u>0?Math.max(0,u-z-ie-re):void 0,J=e("div",{className:"flex items-center space-x-1.5 flex-shrink-0 min-w-0",style:{maxWidth:`${z}px`},title:r,children:[e("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${a}`}),Z&&e("span",{className:"text-[10px] font-mono uppercase tracking-wide text-ink/60 truncate",children:r})]});return e("div",{ref:y,"data-browser-toolbar":"",className:`px-2.5 border-b border-ink/10 bg-paper flex flex-col gap-y-1 flex-shrink-0 select-none ${k?"py-1":"h-10 justify-center"}`,children:[e("div",{"data-toolbar-band":"address",className:"flex items-center gap-x-2 min-w-0",children:[J,e("div",{className:"flex flex-1 min-w-0 items-center",children:q}),!k&&e(ui,{clusters:M,available:L})]}),k&&e("div",{"data-toolbar-band":"controls",className:"flex items-center min-w-0",children:e(ui,{clusters:M,available:L})})]})}
1
+ import{d,n,K,i,e,s,f,C,ae,Be,Ra,La,Et,Pa,xr,Me,ze}from"./index-1mkn5fbf.js";import{Ya,Ja,ui}from"./index-y5pkqrga.js";var Q={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]},w=s(Q);var Y={name:"laptop",size:24,node:[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]]},P=s(Y);var j={name:"ratio",size:24,node:[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]},N=s(j);var ee={name:"tablet",size:24,node:[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]},T=s(ee);var g=[{id:"responsive",label:"Responsive (100% Fluid)",category:"responsive",icon:La},{id:"desktop-16-9",label:"Desktop 16:9 (Auto H:W)",category:"responsive",icon:N},{id:"laptop",label:"Laptop (1024 × 768)",category:"responsive",icon:P},{id:"tablet",label:"Tablet (768 × 1024)",category:"mobile",icon:T},{id:"mobile",label:"Mobile Phone (375 × 667)",category:"mobile",icon:xr},{id:"mobile-lg",label:"Mobile Large (414 × 896)",category:"mobile",icon:xr}];function te(o){switch(o){case"desktop-16-9":return"Desktop 16:9";case"laptop":return"Laptop 1024p";case"tablet":return"Tablet 768p";case"mobile":return"Mobile 375p";case"mobile-lg":return"Mobile Lg 414p";case"responsive":default:return"Responsive"}}function A({viewportMode:o,onChangeViewport:a,zoomLevel:r=100,onSetZoom:l}){let[b,c]=n(null);return e("div",{className:"flex items-center space-x-1.5 flex-shrink-0",children:[e("div",{className:"hidden sm:flex items-center bg-canvas border border-ink/10 rounded-md p-0.5",children:[e("button",{type:"button",onClick:()=>a("responsive"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="responsive"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Responsive (100% Fluid)",children:e(La,{size:12})}),e("button",{type:"button",onClick:()=>a("desktop-16-9"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="desktop-16-9"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Desktop 16:9 (Auto Height following Width)",children:e(N,{size:12})}),e("button",{type:"button",onClick:()=>a("tablet"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="tablet"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Tablet (768px)",children:e(T,{size:12})}),e("button",{type:"button",onClick:()=>a("mobile"),className:`p-1 rounded text-xs transition-colors cursor-pointer ${o==="mobile"?"bg-ink text-canvas font-medium":"text-ink/50 hover:text-ink"}`,title:"Mobile (375px)",children:e(xr,{size:12})})]}),e("button",{type:"button","aria-haspopup":"menu","aria-expanded":b!==null,onClick:(t)=>c(b?null:Me(t.currentTarget)),className:"flex items-center space-x-1 px-2 py-1 rounded bg-canvas border border-ink/15 hover:border-ink/30 text-ink text-[11px] font-mono transition-colors cursor-pointer",title:"Device & Responsive Testing Menu",children:[e("span",{className:"hidden md:inline text-[10px] font-medium",children:te(o)}),e(C,{size:11,className:"text-ink/60"})]}),e(ze,{anchor:b,ariaLabel:"Device & Responsive Testing Menu",className:"w-56 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs font-mono",onClose:()=>c(null),children:[e("div",{className:"px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold",children:"Responsive Testing"}),g.filter((t)=>t.category==="responsive").map((t)=>{let m=t.icon,p=o===t.id;return e("button",{type:"button",role:"menuitemradio","aria-checked":p,onClick:()=>{a(t.id),c(null)},className:`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${p?"bg-ink/10 font-semibold text-ink":"text-ink/75"}`,children:[e("div",{className:"flex items-center space-x-2",children:[e(m,{size:13,className:"text-ink/60"}),e("span",{children:t.label})]}),p&&e(f,{size:12,className:"text-success-text"})]},t.id)}),e("div",{className:"mt-1 pt-1 border-t border-ink/10 px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold",children:"Mobile Testing"}),g.filter((t)=>t.category==="mobile").map((t)=>{let m=t.icon,p=o===t.id;return e("button",{type:"button",role:"menuitemradio","aria-checked":p,onClick:()=>{a(t.id),c(null)},className:`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${p?"bg-ink/10 font-semibold text-ink":"text-ink/75"}`,children:[e("div",{className:"flex items-center space-x-2",children:[e(m,{size:13,className:"text-ink/60"}),e("span",{children:t.label})]}),p&&e(f,{size:12,className:"text-success-text"})]},t.id)}),l&&e(d,{children:[e("div",{className:"mt-1 pt-1 border-t border-ink/10 px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold",children:["Zoom Scale (",r,"%)"]}),e("div",{className:"grid grid-cols-3 gap-1 px-2 py-1",children:[50,75,100,125,150,200].map((t)=>e("button",{type:"button",onClick:()=>{l(t),c(null)},className:`px-1.5 py-1 text-center rounded text-[11px] font-mono cursor-pointer transition-colors ${r===t?"bg-ink text-canvas font-semibold":"bg-canvas border border-ink/10 text-ink/75 hover:bg-ink/5"}`,children:[t,"%"]},t))})]})]})]})}function B({zoomLevel:o,onZoomIn:a,onZoomOut:r,onResetZoom:l}){return e("div",{className:"flex items-center bg-canvas border border-ink/10 rounded-md p-0.5 space-x-0.5 text-xs font-mono",children:[e("button",{type:"button",onClick:r,disabled:o<=50,"aria-label":"Perkecil tampilan",title:"Zoom Out (-10%)",className:"p-1 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink cursor-pointer disabled:cursor-not-allowed transition-colors",children:e(Ja,{size:12})}),e("button",{type:"button",onClick:l,className:"px-1 text-[10px] font-medium text-ink/75 hover:text-ink hover:underline cursor-pointer select-none",title:"Reset Zoom (100%)",children:[o,"%"]}),e("button",{type:"button",onClick:a,disabled:o>=200,"aria-label":"Perbesar tampilan",title:"Zoom In (+10%)",className:"p-1 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink cursor-pointer disabled:cursor-not-allowed transition-colors",children:e(Ya,{size:12})})]})}var h="p-1.5 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:cursor-not-allowed";function V(o){let a=[],{url:r,zoomLevel:l,copied:b,included:c}=o;if(o.viewportMode&&o.onChangeViewport){let{viewportMode:t,onChangeViewport:m,onSetZoom:p}=o;a.push({id:"viewport",actions:g.map((x)=>({label:x.label,icon:x.icon,onSelect:()=>m(x.id),active:t===x.id})),children:e(A,{viewportMode:t,onChangeViewport:m,zoomLevel:l,onSetZoom:p})})}if(a.push({id:"zoom",actions:[{label:"Zoom in (+10%)",icon:Ya,onSelect:o.onZoomIn,disabled:l>=200},{label:"Zoom out (-10%)",icon:Ja,onSelect:o.onZoomOut,disabled:l<=50},{label:"Reset zoom (100%)",icon:Et,onSelect:o.onResetZoom,active:l===100}],children:e(B,{zoomLevel:l,onZoomIn:o.onZoomIn,onZoomOut:o.onZoomOut,onResetZoom:o.onResetZoom})}),a.push({id:"include",actions:[{label:c?"Page context added to the draft":"Include this page in the chat draft",icon:Ra,onSelect:o.onIncludeInChat,disabled:!r}],children:e("button",{type:"button",onClick:o.onIncludeInChat,disabled:!r,"aria-label":"Include this page in the chat draft",title:c?"Page context added to the draft":"Include this page in the chat draft",className:h,children:c?e(f,{size:14,className:"text-success-text"}):e(Ra,{size:14})})}),o.annotate){let t=o.annotate;a.push({id:"annotate",actions:[{label:t.count>0?`${t.active?"Tutup mode anotasi":"Buka mode anotasi"} (${t.count})`:"Mark a part of the page, then send it to the chat",icon:w,onSelect:t.onToggle,active:t.active,disabled:!r}],children:e("button",{type:"button",onClick:t.onToggle,disabled:!r,"aria-label":"Page annotation mode","aria-pressed":t.active,title:t.active?"Tutup mode anotasi":t.count>0?`Anotasi (${t.count}) — buka lagi`:"Mark a part of the page, then send it to the chat",className:`${h} relative ${t.active?"bg-ink/10 text-ink":""}`,children:[e(w,{size:14}),t.count>0&&e("span",{className:"absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-0.5 rounded-full bg-error text-paper text-[10px] leading-[13px] font-mono text-center",children:t.count})]})})}if(a.push({id:"copy",actions:[{label:b?"Copied URL!":"Copy URL",icon:ae,onSelect:o.onCopy,disabled:!r}],children:e("button",{type:"button",onClick:o.onCopy,disabled:!r,"aria-label":"Salin URL",title:b?"Copied URL!":"Copy URL",className:h,children:b?e(f,{size:14,className:"text-success-text"}):e(ae,{size:14})})}),o.onReconnect){let t=o.onReconnect;a.push({id:"reconnect",actions:[{label:"Sambungkan ulang live view",icon:Pa,onSelect:t}],children:e("button",{type:"button",onClick:t,"aria-label":"Sambungkan ulang live view",title:"Reconnect live view",className:h,children:e(Pa,{size:14})})})}return a.push({id:"open-external",actions:[{label:o.openExternalLabel,icon:Be,onSelect:o.onOpenExternal,disabled:!r}],children:e("button",{type:"button",onClick:o.onOpenExternal,disabled:!r,"aria-label":o.openExternalLabel,title:o.openExternalTitle,className:h,children:e(Be,{size:14})})}),a}var E=108,oe=280,ne=18,ie=140,re=36;function md({url:o,statusDotClass:a,statusLabel:r,viewportMode:l,zoomLevel:b,onChangeViewport:c,onZoomIn:t,onZoomOut:m,onResetZoom:p,onSetZoom:x,annotate:D,onIncludeInChat:_,onOpenExternal:U,onReconnect:W,openExternalLabel:H,openExternalTitle:X,twoRows:k=!1,children:q}){let[F,R]=n(!1),[G,I]=n(!1),y=i(null),[u,S]=n(0),M=V({url:o,zoomLevel:b,copied:F,included:G,viewportMode:l,onChangeViewport:c,annotate:D,onReconnect:W,onIncludeInChat:()=>{_(),I(!0),setTimeout(()=>I(!1),2500)},onCopy:()=>{if(!o)return;navigator.clipboard.writeText(o).then(()=>{R(!0),setTimeout(()=>R(!1),2000)}).catch(()=>{})},onOpenExternal:U,onZoomIn:t,onZoomOut:m,onResetZoom:p,onSetZoom:x,openExternalLabel:H,openExternalTitle:X});K(()=>{let v=y.current;if(!v)return;S(v.clientWidth)}),K(()=>{let v=y.current;if(!v||typeof ResizeObserver>"u")return;let O=new ResizeObserver(()=>S(v.clientWidth));return O.observe(v),()=>O.disconnect()},[]);let Z=u===0||u>=oe,z=Z?u>0?Math.min(E,u*0.25):E:ne,L=k?u>0?u:void 0:u>0?Math.max(0,u-z-ie-re):void 0,J=e("div",{className:"flex items-center space-x-1.5 flex-shrink-0 min-w-0",style:{maxWidth:`${z}px`},title:r,children:[e("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${a}`}),Z&&e("span",{className:"text-[10px] font-mono uppercase tracking-wide text-ink/60 truncate",children:r})]});return e("div",{ref:y,"data-browser-toolbar":"",className:`px-2.5 border-b border-ink/10 bg-paper flex flex-col gap-y-1 flex-shrink-0 select-none ${k?"py-1":"h-10 justify-center"}`,children:[e("div",{"data-toolbar-band":"address",className:"flex items-center gap-x-2 min-w-0",children:[J,e("div",{className:"flex flex-1 min-w-0 items-center",children:q}),!k&&e(ui,{clusters:M,available:L})]}),k&&e("div",{"data-toolbar-band":"controls",className:"flex items-center min-w-0",children:e(ui,{clusters:M,available:L})})]})}
2
2
  export{md};
@@ -1 +1 @@
1
- import{n,o,K,i,a,He,Fe,_e,se,e,s,p,B,C,rt,Ei,ir,h,lr,Oe,fe,T,ot,Si,$e,X,ht,Ho,Ko,ab,vb,ng,ri,Pi,hg,FA}from"./index-eggbcdwx.js";import"./index-2f6afhze.js";import{zi}from"./index-wwyjzhgs.js";import"./index-q3k8r0ms.js";import{GA,Nu,Us,Qu,Ru,Lu,Mu,Fu,Pu,Ou,$u,zu}from"./index-c253x7vt.js";var gt={name:"panel-right-close",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]},ge=s(gt);var z=new Set,ae=new Set,ve=new Set;function he(){ve=new Set(z);for(let t of[...ae])t()}function xe(t){let r=new Set(t);if(r.size===z.size){let l=!0;for(let d of r)if(!z.has(d)){l=!1;break}if(l)return}z.clear();for(let l of r)z.add(l);he()}function ye(t){let r=new Set(t),l=!1;for(let d of[...z])if(!r.has(d))z.delete(d),l=!0;if(l)he()}function Ce(t){return z.has(t)}function ke(){return z.size>0}function vt(t){return ae.add(t),()=>{ae.delete(t)}}var xt=vt;function Se(){return He(xt,()=>ve)}function we({x:t,y:r,rows:l,onAction:d,onClose:u}){let x=i(null),[m,c]=n({left:t,top:r});return K(()=>{let b=x.current;if(!b)return;let{width:S,height:g}=b.getBoundingClientRect();c({left:Math.min(t,Math.max(0,window.innerWidth-S-8)),top:Math.min(r,Math.max(0,window.innerHeight-g-8))})},[t,r,l.length]),se(e("div",{className:"fixed inset-0 z-[70]",onClick:u,onContextMenu:(b)=>{b.preventDefault(),u()},children:e("div",{ref:x,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${m.left}px`,top:`${m.top}px`},onClick:(b)=>b.stopPropagation(),children:l.map((b)=>e("button",{type:"button",role:"menuitem",onClick:()=>{d(b.action),u()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:b.label},b.action))})}),document.body)}var ee={rightFileId:null,fraction:0.5};function ne(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Ee(t,r){for(let l=r.length-1;l>=0;l-=1){let d=r[l];if(d!==t)return d}return null}function Te(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function Y(t){if(!Number.isFinite(t))return ee.fraction;return Math.max(0.2,Math.min(0.8,t))}function Ne(t,r){if(typeof t!=="object"||t===null)return ee;let l=t,d=typeof l.fraction==="number"?Y(l.fraction):ee.fraction,u=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(u===null||!r.includes(u))return{rightFileId:null,fraction:d};return{rightFileId:u,fraction:d}}function Me({tab:t,openedFiles:r,dirtyIds:l,reopenable:d,activeFileId:u,splitRightFileId:x}){let m=r.filter((g)=>g.id!==t.id),c=r.filter((g)=>!l.has(g.id)),b=r.map((g)=>g.id);return[{action:"split-right",label:"Split right",enabled:ne(t.id,u,b)},{action:"unsplit",label:"Unsplit",enabled:x!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:m.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:c.some((g)=>g.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:d>0}].filter((g)=>g.enabled)}function Z({onHide:t}){let r=ri("toggleEditorPanel","Hide Editor Panel");return e("button",{type:"button",onClick:t,className:"p-1.5 mx-1 rounded transition-colors cursor-pointer text-ink/60 hover:bg-ink/10 hover:text-ink flex-shrink-0",title:r,"aria-label":r,children:e(ge,{size:14})})}function De({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,missingIds:u,onCopyPath:x,onRevealInFiles:m,onReopenClosed:c,reopenableCount:b,onSplitTo:S,onUnsplit:g,splitRightFileId:y=null,onHide:R}){let M=Se(),P=i(null),F=i(null),[D,O]=n(5),[I,A]=n(!1),[f,Q]=n(null);$e(F,()=>A(!1)),o(()=>{let v=new ResizeObserver((E)=>{for(let w of E){let q=w.contentRect.width,H=Math.max(1,Math.floor((q-60)/150));O(H)}});if(P.current)v.observe(P.current);return()=>v.disconnect()},[]);let U=Ee(r,t.map((v)=>v.id)),j=[],G=[];if(t.length<=D)j=t;else{let v=t.findIndex((w)=>w.id===r),E=new Set;if(v!==-1&&r!==null)E.add(r);for(let w=t.length-1;w>=0;w--){if(E.size>=D)break;E.add(t[w].id)}j=t.filter((w)=>E.has(w.id)),G=t.filter((w)=>!E.has(w.id))}return e("div",{className:`${Si.desktop} flex bg-ink/10 w-full relative border-b border-ink/10`,ref:P,children:[e("div",{className:"flex overflow-hidden",children:j.map((v)=>{let E=v.id===r,w=Boolean(v.isDiff),q=w?lr(v.diffStatus||"M",v.diffStaged):null,H=Boolean(u?.has(v.id));return e("div",{onClick:()=>l(v.id),onContextMenu:(_)=>{_.preventDefault(),Q({tab:v,x:_.clientX,y:_.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${E?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:H?`${v.path} — file no longer exists`:v.path,children:[w?e(Ei,{size:14,className:E?"text-info-text flex-shrink-0":"text-info-text flex-shrink-0"}):e(ht,{name:v.name,size:14,className:`flex-shrink-0${E||H?"":" opacity-60"}${H?" text-error-text":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${H?" text-error-text line-through":""}`,children:v.name}),q&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${q.badgeBgClass}`,children:q.charStatus}),e(Pe,{dirty:M.has(v.id),active:E,label:`Close ${v.name}`,onClose:()=>d(v.id)})]},v.id)})}),f?e(we,{x:f.x,y:f.y,rows:Me({tab:f.tab,openedFiles:t,dirtyIds:M,reopenable:b?.()??0,activeFileId:r,splitRightFileId:y}),onAction:(v)=>{let E=f.tab;switch(v){case"close":d(E.id);return;case"close-others":for(let w of[...t].reverse())if(w.id!==E.id)d(w.id);l(E.id);return;case"close-all":for(let w of[...t].reverse())d(w.id);return;case"close-saved":for(let w of[...t].reverse())if(!M.has(w.id))d(w.id);return;case"copy-path":x?.(E);return;case"reveal-in-files":m?.(E);return;case"reopen-closed":c?.();return;case"split-right":S?.(E.id);return;case"unsplit":g?.();return}},onClose:()=>Q(null)}):null,e("div",{className:"ml-auto flex items-center",children:[e("button",{type:"button",onClick:()=>y!==null?g?.():S?.(U),disabled:y===null&&U===null,"aria-pressed":y!==null,"aria-label":"Split editor",title:y!==null?"Close the split pane (the tab stays open)":U===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${y!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(ir,{size:14})}),R&&e(Z,{onHide:R})]}),G.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:F,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${I?"bg-ink/10 text-ink":""}`,onClick:()=>A(!I),title:"More open files",children:e(C,{size:14})}),I&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),G.map((v)=>{let E=Boolean(u?.has(v.id));return e("div",{onClick:()=>{l(v.id),A(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[v.isDiff?e(Ei,{size:14,className:"text-info-text"}):e(ht,{name:v.name,size:14,className:E?"text-error-text":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${E?"text-error-text line-through":"text-ink/80"}`,children:v.name}),e(Pe,{dirty:M.has(v.id),active:!1,label:`Close ${v.name}`,onClose:()=>{if(d(v.id),G.length===1)A(!1)}})]},v.id)})]})]})]})}function Pe({dirty:t,active:r,label:l,onClose:d}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(u)=>{u.stopPropagation(),d()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(h,{size:12})})}function Re({pluginId:t,Component:r,sessionId:l,className:d="",onHide:u}){return e("div",{className:`flex flex-col h-full bg-canvas ${d}`,children:[u&&e("div",{className:"flex justify-end flex-shrink-0 border-b border-ink/10",children:e(Z,{onHide:u})}),e(ot,{pluginId:t,children:e(r,{sessionId:l,workspacePath:null})})]})}function Ie({className:t="",onHide:r}){return e("div",{className:`relative flex flex-col h-full bg-canvas items-center justify-center text-muted ${t}`,children:[r&&e("div",{className:"absolute top-0 right-0 flex items-center",children:e(Z,{onHide:r})}),e(ht,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),e("p",{className:"font-mono text-sm",children:"Select a file to open"})]})}function Ae({searchReveal:t,revealMatch:r}){let l=i(r);l.current=r;let d=i(null);o(()=>{if(!t||d.current===t.request)return;d.current=t.request,l.current({query:t.request.query,options:t.request.options,line:t.request.line})},[t])}function Le({openedFiles:t,dirtyKeys:r,activeFile:l,previewReady:d,setPreviewMode:u,sessionId:x}){o(()=>{let m=new Set(t.filter((c)=>!c.isDiff&&c.content===void 0).map((c)=>c.id));xe([...r].filter((c)=>m.has(c)))},[r,t]),o(()=>{if(!d)return;let m=l?.id;if(!l||m===void 0||m===null)return;if(!Nu(Us(l.name)))return;let c=fe(x,"editor.previewMode");if(c&&c[m]!==void 0)return;u((b)=>b[m]===void 0?{...b,[m]:!0}:b)},[d,l])}function Be({activeFile:t,externalChange:r,conflict:l,onReload:d,onKeepMine:u}){if(!t)return null;if(l)return e(Ou,{diskMtimeMs:l.diskMtimeMs,fileName:t.name,onReload:d,onKeepMine:u});if(r)return e(Pu,{fileName:t.name,onReload:d,onKeepMine:u});return null}async function Ke(t){let r=t.name.trim();if(!r)return{status:"failed",reason:"Enter a file name."};let l=new FormData;if(l.append("actionType","saveAs"),l.append("path",t.parent),l.append("name",r),l.append("content",t.content),l.append("eol",t.eol),t.root)l.append("root",t.root);if(t.repo&&t.repo!==".")l.append("repo",t.repo);try{let d=await fetch("/api/fs/action",{method:"POST",body:l}),u=await d.json().catch(()=>null),x=typeof u?.error==="string"?u.error:null;if(d.status===409)return{status:"exists",reason:x??`${r} already exists.`};if(d.ok&&u?.success&&typeof u.path==="string")return{status:"written",path:u.path};return{status:"failed",reason:x??"The file could not be written."}}catch{return{status:"failed",reason:"The file could not be written."}}}function ze(t){let r=t.lastIndexOf(".");if(r<=0)return`${t} copy`;return`${t.slice(0,r)} copy${t.slice(r)}`}function Ue(t){let r=t.trim();if(!r)return!1;if(r==="."||r==="..")return!1;return!r.includes("/")&&!r.includes("\\")}function yt(t){let r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function Ge({fileName:t,filePath:r,content:l,eol:d,root:u,repo:x,onSaved:m,onClose:c}){let[b,S]=n(()=>yt(r)),[g,y]=n(()=>ze(t)),[R,M]=n(!1),[P,F]=n(null),D=i(null);o(()=>{D.current?.focus(),D.current?.select()},[]);let O=Ue(g),I=async()=>{if(!O||R)return;M(!0),F(null);let f=await Ke({parent:b,name:g,content:l,eol:d,root:u,repo:x});if(M(!1),f.status==="written"){m({path:f.path});return}F(f.reason)},A=(f)=>{if(f.key==="Enter"){f.preventDefault(),I();return}if(f.key==="Escape")f.preventDefault(),c()};return e(X,{onClose:c,maxWidthClass:"max-w-md",header:e("span",{className:"text-sm font-semibold text-ink",children:"Save as"}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>void I(),disabled:!O||R,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-ink text-paper disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[R?e(p,{size:12,className:"animate-spin"}):e(rt,{size:12}),"Save"]})]}),children:e("div",{className:"px-4 py-3 space-y-2 text-xs",children:[e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Folder"}),e("input",{value:b,onInput:(f)=>S(f.target.value),onKeyDown:A,placeholder:"(workspace root)","aria-label":"Destination folder",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1 font-mono text-ink outline-none focus:border-ink/40"})]}),e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Name"}),e("input",{ref:D,value:g,onInput:(f)=>y(f.target.value),onKeyDown:A,"aria-label":"File name","aria-invalid":!O,className:`w-full bg-paper border rounded px-2 py-1 font-mono text-ink outline-none ${O?"border-ink/20 focus:border-ink/40":"border-error text-error-text"}`})]}),!O?e("div",{className:"text-[10px] text-error-text font-mono",children:"Enter a file name without a path separator"}):null,P?e("div",{className:"text-[10px] text-error-text font-mono",children:P}):null,e("div",{className:"text-[10px] text-ink/40",children:"The original file stays where it is, and its tab stays open."})]})})}function qe(){o(()=>{let t=(r)=>{if(!ke())return;r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[])}function We({fileName:t,onAnswer:r}){return e(X,{onClose:()=>r("cancel"),header:e("div",{className:"flex items-center gap-2",children:[e(B,{size:15,className:"text-warning-text"}),e("span",{className:"text-sm font-semibold text-ink",children:"Unsaved changes"})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:()=>r("cancel"),className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>r("discard"),className:"px-3 py-1.5 rounded border border-error/40 text-error-text hover:bg-error/10 transition-colors cursor-pointer",children:"Discard"}),e("button",{type:"button",onClick:()=>r("save"),className:"px-3 py-1.5 rounded bg-ink text-paper hover:bg-ink/90 transition-colors cursor-pointer",children:"Save & close"})]}),children:e("div",{className:"px-4 py-3 text-xs text-ink/80",children:[e("span",{className:"font-mono text-ink",children:t})," has changes that are not on disk.",e("div",{className:"mt-1 text-ink/50",children:"Discarding them cannot be undone."})]})})}function Ve({closeGuard:t,activeFile:r,saveMissingConfirm:l,onCancelSaveMissing:d,onConfirmSaveMissing:u}){if(t.pending)return e(We,{fileName:t.pending.name,onAnswer:t.answer});if(l&&r)return e($u,{fileName:r.name,filePath:r.path,onClose:d,onConfirm:u});return null}function Xe({className:t="",isMaximized:r,onKeyDownCapture:l,onFocusCapture:d,asSplitPane:u,tabs:x,activeFile:m,editor:c,externalChange:b,conflict:S,onReload:g,onKeepMine:y,body:R,saveAsOpen:M,onSaveAsClose:P,onSavedAs:F,closeGuard:D}){let O=r?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return e("div",{className:O,onKeyDownCapture:l,onFocusCapture:d,children:[u?null:x,e(Be,{activeFile:m,externalChange:b,conflict:S,onReload:g,onKeepMine:y}),R,M&&m?e(Ge,{fileName:m.name,filePath:m.path,content:c.content,eol:c.eol,root:m.root,repo:m.repo,onSaved:({path:I})=>F(I),onClose:P}):null,e(Ve,{closeGuard:D,activeFile:m,saveMissingConfirm:c.saveMissingConfirm,onCancelSaveMissing:c.cancelSaveMissing,onConfirmSaveMissing:c.confirmSaveMissing})]})}function Je({fileName:t,onClose:r,children:l}){return e("div",{className:"flex flex-col h-full min-w-0","data-split-pane":"",children:[e("div",{className:"flex items-center justify-between gap-2 px-3 py-1 border-b border-ink/10 bg-canvas flex-shrink-0",children:[e("span",{className:"text-[11px] font-mono text-ink/60 truncate",title:t,children:t}),e("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-ink/10 text-ink/50 hover:text-ink transition-colors cursor-pointer flex-shrink-0",title:"Close this pane (the tab stays open)","aria-label":"Close split pane",children:e(h,{size:12})})]}),e("div",{className:"flex-1 min-h-0",children:l})]})}function Ye({fraction:t,onFraction:r,rightPaneName:l,onClosePane:d,rightPane:u,children:x}){let m=i(null),c=i(null),b=ng(c),S=(g)=>{let y=g.currentTarget,R=m.current;if(!y||!R)return;y.setPointerCapture(g.pointerId);let M=(F)=>{let D=R.getBoundingClientRect();if(D.width===0)return;r(Y((F.clientX-D.left)/D.width))},P=()=>{y.releasePointerCapture(g.pointerId),y.removeEventListener("pointermove",M),y.removeEventListener("pointerup",P)};y.addEventListener("pointermove",M),y.addEventListener("pointerup",P)};return e("div",{ref:m,className:"flex w-full h-full","data-split-column":"",children:[e("div",{className:"flex flex-col min-w-0 h-full",style:{width:`${Math.round(Y(t)*100)}%`},children:x}),e("div",{ref:c,className:`w-[3px] flex-shrink-0 cursor-col-resize transition-colors active:bg-ink/40 ${b?"bg-ink/40":"bg-ink/10"}`,role:"separator","aria-orientation":"vertical","aria-label":"Resize split panes",onPointerDown:S}),e("div",{className:"flex-1 min-w-0 h-full",children:e(Je,{fileName:l,onClose:d,children:u})})]})}function Ze({openedFiles:t,activeFileId:r,enabled:l}){let[d,u]=T("editor.split",ee),x=t.map((y)=>y.id),m=Te(Ne(d,x),r),c=l&&m.rightFileId!==null?t.find((y)=>y.id===m.rightFileId)??null:null,b=a((y)=>{if(y!==null&&!ne(y,r,x))return;u({...m,rightFileId:y})},[m,u,r,x]),S=a(()=>u({...m,rightFileId:null}),[m,u]),g=a((y)=>u({...m,fraction:Y(y)}),[m,u]);return{rightFile:c,fraction:m.fraction,splitTo:b,close:S,setFraction:g}}function Qe({find:t,runCommand:r,reopenClosed:l}){let d=i(t);d.current=t;let u=i(r);u.current=r;let x=i(l);return x.current=l,{onKeyDownCapture:a((c)=>{let b=d.current;if(c.key==="Escape"){if(!b.open)return;c.preventDefault(),c.stopPropagation(),b.close();return}if((c.metaKey||c.ctrlKey)&&c.shiftKey&&c.code==="KeyT"){if(x.current?.())c.preventDefault(),c.stopPropagation();return}let S=ab(Pi,c);if(!S||!hg(S))return;c.preventDefault(),c.stopPropagation(),u.current(S)},[])}}function je(t){let r=i(t);r.current=t;let l=i(null);if(!l.current)l.current={saveNow:()=>r.current.saveNow(),runCommand:(u)=>r.current.runCommand(u)};return o(()=>{let u=l.current;if(!u)return;return FA(u)},[]),{onFocusCapture:a(()=>{if(l.current)FA(l.current)},[])}}function et({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,saveNow:u}){let[x,m]=n(null);qe();let c=a((S)=>{let g=t.find((y)=>y.id===S);if(g&&Ce(S)){m(g);return}d(S)},[t,d]),b=a((S)=>{let g=x;if(!g)return;if(S==="cancel"){m(null);return}if(S==="save"){if(g.id!==r)l(g.id);u()}m(null),d(g.id)},[x,r,l,u,d]);return{requestClose:c,pending:x,answer:b}}function tt(){let[t,r]=n(0),[l,d]=n(!1),u=a(()=>r((x)=>x+1),[]);return{goToLineRequest:t,openGoToLine:u,saveAsOpen:l,setSaveAsOpen:d}}var Ct=_e(()=>import("./Body-jqq4654r.js").then((t)=>({default:t.EditorBody})));function nt(t){return e(Fe,{fallback:e("div",{className:"h-full w-full"}),children:e(Ct,{...t})})}function kt({className:t="",openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m=0,onFileSaved:c,onOpenPath:b,onReopenClosed:S,reopenableCount:g,onCopyPath:y,onRevealInFiles:R,rootPath:M=null,repoPath:P=null,activeEditorPanelKey:F=null,forcedActiveFileId:D=null,asSplitPane:O=!1,onHidePanel:I}){let A=O?D:l,f=r.find((k)=>k.id===A),[Q,U,j]=T("editor.previewMode",{}),G=zu(String(A??"")),[v,E]=T("editor.zoomLevel",Ho),[w,q]=n(!1),[H,_]=T("editor.wordWrap",!0),J=tt(),{sessionId:le}=Oe(),L=Ze({openedFiles:r,activeFileId:A,enabled:!O}),W=i(null),it=Ko(),st=zi(),de=Qu(r,m),ue=Boolean(f&&de.has(f.id)),N=Ru(f??null,{reportSaveError:!0,onFileSaved:c,missing:ue}),at=GA({path:f?.path??"",content:N.content,language:N.language}),lt=N.diskChange,pe=et({openedFiles:r,activeFileId:A,onSelectFile:d,onCloseFile:u,saveNow:N.saveNow}),te=Lu({text:N.content,documentKey:`${f?.id??""}\x00${N.language}`,readSelection:()=>W.current?.getSelection()??null,select:(k,V,ie=!0)=>W.current?.select(k,V,ie),reveal:(k)=>W.current?.revealOffset(k),applyDocument:(k,V,ie)=>W.current?.applyDocument(k,V,ie),toggleWordWrap:()=>_((k)=>!k)}),ce=Mu(f?.path??null,N.content,N.loaded&&!N.loadError);Ae({searchReveal:ce,revealMatch:te.revealMatch}),Fu({file:f,editor:N,surfaceRef:W,isPreview:f?Q[f.id]===!0:!1,exitPreview:()=>{let k=f?.id;if(k===void 0||k===null)return;U((V)=>({...V,[k]:!1}))}}),o(()=>{if(m>0)N.reset()},[m]),o(()=>{N.retain(r.map((k)=>k.id)),ye(r.map((k)=>k.id))},[r]),Le({openedFiles:r,dirtyKeys:N.dirtyKeys,activeFile:f,previewReady:j,setPreviewMode:U,sessionId:le});let dt=()=>{if(!f)return;U((k)=>({...k,[f.id]:!k[f.id]}))},oe=(k)=>{if(hg(k)){te.runCommand(k);return}if(k==="toggleWordWrap"){_((V)=>!V);return}if(k==="goToLine"){J.openGoToLine();return}W.current?.runCommand(k)},ut=Qe({find:te,runCommand:oe,reopenClosed:S}),pt=je({saveNow:N.saveNow,runCommand:oe}),re=vb(F);if(re)return e(Re,{pluginId:re.pluginId,Component:re.Component,sessionId:le,className:t,onHide:I});if(r.length===0)return e(Ie,{className:t,onHide:I});let ct=N.viewerKind,me=f?Q[f.id]:!1,mt={activeFile:f,editor:N,find:te,surfaceRef:W,pluginFileView:at,wordWrap:H,setWordWrap:_,viewerKind:ct,isPreview:Boolean(me),isReviewing:Boolean(me)&&G.active,onToggleReview:G.toggle,isMaximized:w,setIsMaximized:q,zoomLevel:v,setZoomLevel:E,goToLineRequest:J.goToLineRequest,onSaveAs:()=>J.setSaveAsOpen(!0),onOpenPath:b,rootPath:M,repoPath:P,runCommand:oe,editorFontFamily:it,editorTheme:st,togglePreview:dt,revealActive:Boolean(ce),missing:ue,onConvertDiffToEditor:x,onFileSaved:c},ft=(k)=>({openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m,onFileSaved:c,onOpenPath:b,rootPath:M,repoPath:P,forcedActiveFileId:k,asSplitPane:!0}),bt=e(De,{openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:pe.requestClose,missingIds:de,onCopyPath:y,onRevealInFiles:R,onReopenClosed:S,reopenableCount:g,onSplitTo:L.splitTo,onUnsplit:L.close,splitRightFileId:L.rightFile?.id??null,onHide:I}),be=e(Xe,{className:t,isMaximized:w,onKeyDownCapture:ut.onKeyDownCapture,onFocusCapture:pt.onFocusCapture,asSplitPane:O,tabs:bt,activeFile:f,editor:N,externalChange:lt,conflict:N.conflict,onReload:N.resolveConflictByReload,onKeepMine:N.keepMineAgainstDisk,body:e(nt,{...mt}),saveAsOpen:J.saveAsOpen,onSaveAsClose:()=>J.setSaveAsOpen(!1),onSavedAs:(k)=>{J.setSaveAsOpen(!1),b?.(k)},closeGuard:pe});if(!L.rightFile)return be;return e(Ye,{fraction:L.fraction,onFraction:L.setFraction,rightPaneName:L.rightFile.name,onClosePane:L.close,rightPane:e(kt,{...ft(L.rightFile.id)}),children:be})}export{kt as Editor};
1
+ import{n,o,K,i,a,He,Fe,_e,se,e,s,p,B,C,rt,Ei,ir,h,lr,Oe,fe,T,ot,Si,$e,X,ht,Ho,Ko,ab,vb,ng,ri,Pi,hg,FA}from"./index-1mkn5fbf.js";import"./index-3kedv94b.js";import{zi}from"./index-dbsy29gn.js";import"./index-q3k8r0ms.js";import{GA,Nu,Us,Qu,Ru,Lu,Mu,Fu,Pu,Ou,$u,zu}from"./index-hrez92pw.js";var gt={name:"panel-right-close",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]},ge=s(gt);var z=new Set,ae=new Set,ve=new Set;function he(){ve=new Set(z);for(let t of[...ae])t()}function xe(t){let r=new Set(t);if(r.size===z.size){let l=!0;for(let d of r)if(!z.has(d)){l=!1;break}if(l)return}z.clear();for(let l of r)z.add(l);he()}function ye(t){let r=new Set(t),l=!1;for(let d of[...z])if(!r.has(d))z.delete(d),l=!0;if(l)he()}function Ce(t){return z.has(t)}function ke(){return z.size>0}function vt(t){return ae.add(t),()=>{ae.delete(t)}}var xt=vt;function Se(){return He(xt,()=>ve)}function we({x:t,y:r,rows:l,onAction:d,onClose:u}){let x=i(null),[m,c]=n({left:t,top:r});return K(()=>{let b=x.current;if(!b)return;let{width:S,height:g}=b.getBoundingClientRect();c({left:Math.min(t,Math.max(0,window.innerWidth-S-8)),top:Math.min(r,Math.max(0,window.innerHeight-g-8))})},[t,r,l.length]),se(e("div",{className:"fixed inset-0 z-[70]",onClick:u,onContextMenu:(b)=>{b.preventDefault(),u()},children:e("div",{ref:x,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${m.left}px`,top:`${m.top}px`},onClick:(b)=>b.stopPropagation(),children:l.map((b)=>e("button",{type:"button",role:"menuitem",onClick:()=>{d(b.action),u()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:b.label},b.action))})}),document.body)}var ee={rightFileId:null,fraction:0.5};function ne(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Ee(t,r){for(let l=r.length-1;l>=0;l-=1){let d=r[l];if(d!==t)return d}return null}function Te(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function Y(t){if(!Number.isFinite(t))return ee.fraction;return Math.max(0.2,Math.min(0.8,t))}function Ne(t,r){if(typeof t!=="object"||t===null)return ee;let l=t,d=typeof l.fraction==="number"?Y(l.fraction):ee.fraction,u=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(u===null||!r.includes(u))return{rightFileId:null,fraction:d};return{rightFileId:u,fraction:d}}function Me({tab:t,openedFiles:r,dirtyIds:l,reopenable:d,activeFileId:u,splitRightFileId:x}){let m=r.filter((g)=>g.id!==t.id),c=r.filter((g)=>!l.has(g.id)),b=r.map((g)=>g.id);return[{action:"split-right",label:"Split right",enabled:ne(t.id,u,b)},{action:"unsplit",label:"Unsplit",enabled:x!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:m.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:c.some((g)=>g.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:d>0}].filter((g)=>g.enabled)}function Z({onHide:t}){let r=ri("toggleEditorPanel","Hide Editor Panel");return e("button",{type:"button",onClick:t,className:"p-1.5 mx-1 rounded transition-colors cursor-pointer text-ink/60 hover:bg-ink/10 hover:text-ink flex-shrink-0",title:r,"aria-label":r,children:e(ge,{size:14})})}function De({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,missingIds:u,onCopyPath:x,onRevealInFiles:m,onReopenClosed:c,reopenableCount:b,onSplitTo:S,onUnsplit:g,splitRightFileId:y=null,onHide:R}){let M=Se(),P=i(null),F=i(null),[D,O]=n(5),[I,A]=n(!1),[f,Q]=n(null);$e(F,()=>A(!1)),o(()=>{let v=new ResizeObserver((E)=>{for(let w of E){let q=w.contentRect.width,H=Math.max(1,Math.floor((q-60)/150));O(H)}});if(P.current)v.observe(P.current);return()=>v.disconnect()},[]);let U=Ee(r,t.map((v)=>v.id)),j=[],G=[];if(t.length<=D)j=t;else{let v=t.findIndex((w)=>w.id===r),E=new Set;if(v!==-1&&r!==null)E.add(r);for(let w=t.length-1;w>=0;w--){if(E.size>=D)break;E.add(t[w].id)}j=t.filter((w)=>E.has(w.id)),G=t.filter((w)=>!E.has(w.id))}return e("div",{className:`${Si.desktop} flex bg-ink/10 w-full relative border-b border-ink/10`,ref:P,children:[e("div",{className:"flex overflow-hidden",children:j.map((v)=>{let E=v.id===r,w=Boolean(v.isDiff),q=w?lr(v.diffStatus||"M",v.diffStaged):null,H=Boolean(u?.has(v.id));return e("div",{onClick:()=>l(v.id),onContextMenu:(_)=>{_.preventDefault(),Q({tab:v,x:_.clientX,y:_.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${E?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:H?`${v.path} — file no longer exists`:v.path,children:[w?e(Ei,{size:14,className:E?"text-info-text flex-shrink-0":"text-info-text flex-shrink-0"}):e(ht,{name:v.name,size:14,className:`flex-shrink-0${E||H?"":" opacity-60"}${H?" text-error-text":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${H?" text-error-text line-through":""}`,children:v.name}),q&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${q.badgeBgClass}`,children:q.charStatus}),e(Pe,{dirty:M.has(v.id),active:E,label:`Close ${v.name}`,onClose:()=>d(v.id)})]},v.id)})}),f?e(we,{x:f.x,y:f.y,rows:Me({tab:f.tab,openedFiles:t,dirtyIds:M,reopenable:b?.()??0,activeFileId:r,splitRightFileId:y}),onAction:(v)=>{let E=f.tab;switch(v){case"close":d(E.id);return;case"close-others":for(let w of[...t].reverse())if(w.id!==E.id)d(w.id);l(E.id);return;case"close-all":for(let w of[...t].reverse())d(w.id);return;case"close-saved":for(let w of[...t].reverse())if(!M.has(w.id))d(w.id);return;case"copy-path":x?.(E);return;case"reveal-in-files":m?.(E);return;case"reopen-closed":c?.();return;case"split-right":S?.(E.id);return;case"unsplit":g?.();return}},onClose:()=>Q(null)}):null,e("div",{className:"ml-auto flex items-center",children:[e("button",{type:"button",onClick:()=>y!==null?g?.():S?.(U),disabled:y===null&&U===null,"aria-pressed":y!==null,"aria-label":"Split editor",title:y!==null?"Close the split pane (the tab stays open)":U===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${y!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(ir,{size:14})}),R&&e(Z,{onHide:R})]}),G.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:F,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${I?"bg-ink/10 text-ink":""}`,onClick:()=>A(!I),title:"More open files",children:e(C,{size:14})}),I&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),G.map((v)=>{let E=Boolean(u?.has(v.id));return e("div",{onClick:()=>{l(v.id),A(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[v.isDiff?e(Ei,{size:14,className:"text-info-text"}):e(ht,{name:v.name,size:14,className:E?"text-error-text":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${E?"text-error-text line-through":"text-ink/80"}`,children:v.name}),e(Pe,{dirty:M.has(v.id),active:!1,label:`Close ${v.name}`,onClose:()=>{if(d(v.id),G.length===1)A(!1)}})]},v.id)})]})]})]})}function Pe({dirty:t,active:r,label:l,onClose:d}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(u)=>{u.stopPropagation(),d()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(h,{size:12})})}function Re({pluginId:t,Component:r,sessionId:l,className:d="",onHide:u}){return e("div",{className:`flex flex-col h-full bg-canvas ${d}`,children:[u&&e("div",{className:"flex justify-end flex-shrink-0 border-b border-ink/10",children:e(Z,{onHide:u})}),e(ot,{pluginId:t,children:e(r,{sessionId:l,workspacePath:null})})]})}function Ie({className:t="",onHide:r}){return e("div",{className:`relative flex flex-col h-full bg-canvas items-center justify-center text-muted ${t}`,children:[r&&e("div",{className:"absolute top-0 right-0 flex items-center",children:e(Z,{onHide:r})}),e(ht,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),e("p",{className:"font-mono text-sm",children:"Select a file to open"})]})}function Ae({searchReveal:t,revealMatch:r}){let l=i(r);l.current=r;let d=i(null);o(()=>{if(!t||d.current===t.request)return;d.current=t.request,l.current({query:t.request.query,options:t.request.options,line:t.request.line})},[t])}function Le({openedFiles:t,dirtyKeys:r,activeFile:l,previewReady:d,setPreviewMode:u,sessionId:x}){o(()=>{let m=new Set(t.filter((c)=>!c.isDiff&&c.content===void 0).map((c)=>c.id));xe([...r].filter((c)=>m.has(c)))},[r,t]),o(()=>{if(!d)return;let m=l?.id;if(!l||m===void 0||m===null)return;if(!Nu(Us(l.name)))return;let c=fe(x,"editor.previewMode");if(c&&c[m]!==void 0)return;u((b)=>b[m]===void 0?{...b,[m]:!0}:b)},[d,l])}function Be({activeFile:t,externalChange:r,conflict:l,onReload:d,onKeepMine:u}){if(!t)return null;if(l)return e(Ou,{diskMtimeMs:l.diskMtimeMs,fileName:t.name,onReload:d,onKeepMine:u});if(r)return e(Pu,{fileName:t.name,onReload:d,onKeepMine:u});return null}async function Ke(t){let r=t.name.trim();if(!r)return{status:"failed",reason:"Enter a file name."};let l=new FormData;if(l.append("actionType","saveAs"),l.append("path",t.parent),l.append("name",r),l.append("content",t.content),l.append("eol",t.eol),t.root)l.append("root",t.root);if(t.repo&&t.repo!==".")l.append("repo",t.repo);try{let d=await fetch("/api/fs/action",{method:"POST",body:l}),u=await d.json().catch(()=>null),x=typeof u?.error==="string"?u.error:null;if(d.status===409)return{status:"exists",reason:x??`${r} already exists.`};if(d.ok&&u?.success&&typeof u.path==="string")return{status:"written",path:u.path};return{status:"failed",reason:x??"The file could not be written."}}catch{return{status:"failed",reason:"The file could not be written."}}}function ze(t){let r=t.lastIndexOf(".");if(r<=0)return`${t} copy`;return`${t.slice(0,r)} copy${t.slice(r)}`}function Ue(t){let r=t.trim();if(!r)return!1;if(r==="."||r==="..")return!1;return!r.includes("/")&&!r.includes("\\")}function yt(t){let r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function Ge({fileName:t,filePath:r,content:l,eol:d,root:u,repo:x,onSaved:m,onClose:c}){let[b,S]=n(()=>yt(r)),[g,y]=n(()=>ze(t)),[R,M]=n(!1),[P,F]=n(null),D=i(null);o(()=>{D.current?.focus(),D.current?.select()},[]);let O=Ue(g),I=async()=>{if(!O||R)return;M(!0),F(null);let f=await Ke({parent:b,name:g,content:l,eol:d,root:u,repo:x});if(M(!1),f.status==="written"){m({path:f.path});return}F(f.reason)},A=(f)=>{if(f.key==="Enter"){f.preventDefault(),I();return}if(f.key==="Escape")f.preventDefault(),c()};return e(X,{onClose:c,maxWidthClass:"max-w-md",header:e("span",{className:"text-sm font-semibold text-ink",children:"Save as"}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>void I(),disabled:!O||R,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-ink text-paper disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[R?e(p,{size:12,className:"animate-spin"}):e(rt,{size:12}),"Save"]})]}),children:e("div",{className:"px-4 py-3 space-y-2 text-xs",children:[e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Folder"}),e("input",{value:b,onInput:(f)=>S(f.target.value),onKeyDown:A,placeholder:"(workspace root)","aria-label":"Destination folder",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1 font-mono text-ink outline-none focus:border-ink/40"})]}),e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Name"}),e("input",{ref:D,value:g,onInput:(f)=>y(f.target.value),onKeyDown:A,"aria-label":"File name","aria-invalid":!O,className:`w-full bg-paper border rounded px-2 py-1 font-mono text-ink outline-none ${O?"border-ink/20 focus:border-ink/40":"border-error text-error-text"}`})]}),!O?e("div",{className:"text-[10px] text-error-text font-mono",children:"Enter a file name without a path separator"}):null,P?e("div",{className:"text-[10px] text-error-text font-mono",children:P}):null,e("div",{className:"text-[10px] text-ink/40",children:"The original file stays where it is, and its tab stays open."})]})})}function qe(){o(()=>{let t=(r)=>{if(!ke())return;r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[])}function We({fileName:t,onAnswer:r}){return e(X,{onClose:()=>r("cancel"),header:e("div",{className:"flex items-center gap-2",children:[e(B,{size:15,className:"text-warning-text"}),e("span",{className:"text-sm font-semibold text-ink",children:"Unsaved changes"})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:()=>r("cancel"),className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>r("discard"),className:"px-3 py-1.5 rounded border border-error/40 text-error-text hover:bg-error/10 transition-colors cursor-pointer",children:"Discard"}),e("button",{type:"button",onClick:()=>r("save"),className:"px-3 py-1.5 rounded bg-ink text-paper hover:bg-ink/90 transition-colors cursor-pointer",children:"Save & close"})]}),children:e("div",{className:"px-4 py-3 text-xs text-ink/80",children:[e("span",{className:"font-mono text-ink",children:t})," has changes that are not on disk.",e("div",{className:"mt-1 text-ink/50",children:"Discarding them cannot be undone."})]})})}function Ve({closeGuard:t,activeFile:r,saveMissingConfirm:l,onCancelSaveMissing:d,onConfirmSaveMissing:u}){if(t.pending)return e(We,{fileName:t.pending.name,onAnswer:t.answer});if(l&&r)return e($u,{fileName:r.name,filePath:r.path,onClose:d,onConfirm:u});return null}function Xe({className:t="",isMaximized:r,onKeyDownCapture:l,onFocusCapture:d,asSplitPane:u,tabs:x,activeFile:m,editor:c,externalChange:b,conflict:S,onReload:g,onKeepMine:y,body:R,saveAsOpen:M,onSaveAsClose:P,onSavedAs:F,closeGuard:D}){let O=r?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return e("div",{className:O,onKeyDownCapture:l,onFocusCapture:d,children:[u?null:x,e(Be,{activeFile:m,externalChange:b,conflict:S,onReload:g,onKeepMine:y}),R,M&&m?e(Ge,{fileName:m.name,filePath:m.path,content:c.content,eol:c.eol,root:m.root,repo:m.repo,onSaved:({path:I})=>F(I),onClose:P}):null,e(Ve,{closeGuard:D,activeFile:m,saveMissingConfirm:c.saveMissingConfirm,onCancelSaveMissing:c.cancelSaveMissing,onConfirmSaveMissing:c.confirmSaveMissing})]})}function Je({fileName:t,onClose:r,children:l}){return e("div",{className:"flex flex-col h-full min-w-0","data-split-pane":"",children:[e("div",{className:"flex items-center justify-between gap-2 px-3 py-1 border-b border-ink/10 bg-canvas flex-shrink-0",children:[e("span",{className:"text-[11px] font-mono text-ink/60 truncate",title:t,children:t}),e("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-ink/10 text-ink/50 hover:text-ink transition-colors cursor-pointer flex-shrink-0",title:"Close this pane (the tab stays open)","aria-label":"Close split pane",children:e(h,{size:12})})]}),e("div",{className:"flex-1 min-h-0",children:l})]})}function Ye({fraction:t,onFraction:r,rightPaneName:l,onClosePane:d,rightPane:u,children:x}){let m=i(null),c=i(null),b=ng(c),S=(g)=>{let y=g.currentTarget,R=m.current;if(!y||!R)return;y.setPointerCapture(g.pointerId);let M=(F)=>{let D=R.getBoundingClientRect();if(D.width===0)return;r(Y((F.clientX-D.left)/D.width))},P=()=>{y.releasePointerCapture(g.pointerId),y.removeEventListener("pointermove",M),y.removeEventListener("pointerup",P)};y.addEventListener("pointermove",M),y.addEventListener("pointerup",P)};return e("div",{ref:m,className:"flex w-full h-full","data-split-column":"",children:[e("div",{className:"flex flex-col min-w-0 h-full",style:{width:`${Math.round(Y(t)*100)}%`},children:x}),e("div",{ref:c,className:`w-[3px] flex-shrink-0 cursor-col-resize transition-colors active:bg-ink/40 ${b?"bg-ink/40":"bg-ink/10"}`,role:"separator","aria-orientation":"vertical","aria-label":"Resize split panes",onPointerDown:S}),e("div",{className:"flex-1 min-w-0 h-full",children:e(Je,{fileName:l,onClose:d,children:u})})]})}function Ze({openedFiles:t,activeFileId:r,enabled:l}){let[d,u]=T("editor.split",ee),x=t.map((y)=>y.id),m=Te(Ne(d,x),r),c=l&&m.rightFileId!==null?t.find((y)=>y.id===m.rightFileId)??null:null,b=a((y)=>{if(y!==null&&!ne(y,r,x))return;u({...m,rightFileId:y})},[m,u,r,x]),S=a(()=>u({...m,rightFileId:null}),[m,u]),g=a((y)=>u({...m,fraction:Y(y)}),[m,u]);return{rightFile:c,fraction:m.fraction,splitTo:b,close:S,setFraction:g}}function Qe({find:t,runCommand:r,reopenClosed:l}){let d=i(t);d.current=t;let u=i(r);u.current=r;let x=i(l);return x.current=l,{onKeyDownCapture:a((c)=>{let b=d.current;if(c.key==="Escape"){if(!b.open)return;c.preventDefault(),c.stopPropagation(),b.close();return}if((c.metaKey||c.ctrlKey)&&c.shiftKey&&c.code==="KeyT"){if(x.current?.())c.preventDefault(),c.stopPropagation();return}let S=ab(Pi,c);if(!S||!hg(S))return;c.preventDefault(),c.stopPropagation(),u.current(S)},[])}}function je(t){let r=i(t);r.current=t;let l=i(null);if(!l.current)l.current={saveNow:()=>r.current.saveNow(),runCommand:(u)=>r.current.runCommand(u)};return o(()=>{let u=l.current;if(!u)return;return FA(u)},[]),{onFocusCapture:a(()=>{if(l.current)FA(l.current)},[])}}function et({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:d,saveNow:u}){let[x,m]=n(null);qe();let c=a((S)=>{let g=t.find((y)=>y.id===S);if(g&&Ce(S)){m(g);return}d(S)},[t,d]),b=a((S)=>{let g=x;if(!g)return;if(S==="cancel"){m(null);return}if(S==="save"){if(g.id!==r)l(g.id);u()}m(null),d(g.id)},[x,r,l,u,d]);return{requestClose:c,pending:x,answer:b}}function tt(){let[t,r]=n(0),[l,d]=n(!1),u=a(()=>r((x)=>x+1),[]);return{goToLineRequest:t,openGoToLine:u,saveAsOpen:l,setSaveAsOpen:d}}var Ct=_e(()=>import("./Body-5yedtmnk.js").then((t)=>({default:t.EditorBody})));function nt(t){return e(Fe,{fallback:e("div",{className:"h-full w-full"}),children:e(Ct,{...t})})}function kt({className:t="",openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m=0,onFileSaved:c,onOpenPath:b,onReopenClosed:S,reopenableCount:g,onCopyPath:y,onRevealInFiles:R,rootPath:M=null,repoPath:P=null,activeEditorPanelKey:F=null,forcedActiveFileId:D=null,asSplitPane:O=!1,onHidePanel:I}){let A=O?D:l,f=r.find((k)=>k.id===A),[Q,U,j]=T("editor.previewMode",{}),G=zu(String(A??"")),[v,E]=T("editor.zoomLevel",Ho),[w,q]=n(!1),[H,_]=T("editor.wordWrap",!0),J=tt(),{sessionId:le}=Oe(),L=Ze({openedFiles:r,activeFileId:A,enabled:!O}),W=i(null),it=Ko(),st=zi(),de=Qu(r,m),ue=Boolean(f&&de.has(f.id)),N=Ru(f??null,{reportSaveError:!0,onFileSaved:c,missing:ue}),at=GA({path:f?.path??"",content:N.content,language:N.language}),lt=N.diskChange,pe=et({openedFiles:r,activeFileId:A,onSelectFile:d,onCloseFile:u,saveNow:N.saveNow}),te=Lu({text:N.content,documentKey:`${f?.id??""}\x00${N.language}`,readSelection:()=>W.current?.getSelection()??null,select:(k,V,ie=!0)=>W.current?.select(k,V,ie),reveal:(k)=>W.current?.revealOffset(k),applyDocument:(k,V,ie)=>W.current?.applyDocument(k,V,ie),toggleWordWrap:()=>_((k)=>!k)}),ce=Mu(f?.path??null,N.content,N.loaded&&!N.loadError);Ae({searchReveal:ce,revealMatch:te.revealMatch}),Fu({file:f,editor:N,surfaceRef:W,isPreview:f?Q[f.id]===!0:!1,exitPreview:()=>{let k=f?.id;if(k===void 0||k===null)return;U((V)=>({...V,[k]:!1}))}}),o(()=>{if(m>0)N.reset()},[m]),o(()=>{N.retain(r.map((k)=>k.id)),ye(r.map((k)=>k.id))},[r]),Le({openedFiles:r,dirtyKeys:N.dirtyKeys,activeFile:f,previewReady:j,setPreviewMode:U,sessionId:le});let dt=()=>{if(!f)return;U((k)=>({...k,[f.id]:!k[f.id]}))},oe=(k)=>{if(hg(k)){te.runCommand(k);return}if(k==="toggleWordWrap"){_((V)=>!V);return}if(k==="goToLine"){J.openGoToLine();return}W.current?.runCommand(k)},ut=Qe({find:te,runCommand:oe,reopenClosed:S}),pt=je({saveNow:N.saveNow,runCommand:oe}),re=vb(F);if(re)return e(Re,{pluginId:re.pluginId,Component:re.Component,sessionId:le,className:t,onHide:I});if(r.length===0)return e(Ie,{className:t,onHide:I});let ct=N.viewerKind,me=f?Q[f.id]:!1,mt={activeFile:f,editor:N,find:te,surfaceRef:W,pluginFileView:at,wordWrap:H,setWordWrap:_,viewerKind:ct,isPreview:Boolean(me),isReviewing:Boolean(me)&&G.active,onToggleReview:G.toggle,isMaximized:w,setIsMaximized:q,zoomLevel:v,setZoomLevel:E,goToLineRequest:J.goToLineRequest,onSaveAs:()=>J.setSaveAsOpen(!0),onOpenPath:b,rootPath:M,repoPath:P,runCommand:oe,editorFontFamily:it,editorTheme:st,togglePreview:dt,revealActive:Boolean(ce),missing:ue,onConvertDiffToEditor:x,onFileSaved:c},ft=(k)=>({openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:u,onConvertDiffToEditor:x,refreshKey:m,onFileSaved:c,onOpenPath:b,rootPath:M,repoPath:P,forcedActiveFileId:k,asSplitPane:!0}),bt=e(De,{openedFiles:r,activeFileId:l,onSelectFile:d,onCloseFile:pe.requestClose,missingIds:de,onCopyPath:y,onRevealInFiles:R,onReopenClosed:S,reopenableCount:g,onSplitTo:L.splitTo,onUnsplit:L.close,splitRightFileId:L.rightFile?.id??null,onHide:I}),be=e(Xe,{className:t,isMaximized:w,onKeyDownCapture:ut.onKeyDownCapture,onFocusCapture:pt.onFocusCapture,asSplitPane:O,tabs:bt,activeFile:f,editor:N,externalChange:lt,conflict:N.conflict,onReload:N.resolveConflictByReload,onKeepMine:N.keepMineAgainstDisk,body:e(nt,{...mt}),saveAsOpen:J.saveAsOpen,onSaveAsClose:()=>J.setSaveAsOpen(!1),onSavedAs:(k)=>{J.setSaveAsOpen(!1),b?.(k)},closeGuard:pe});if(!L.rightFile)return be;return e(Ye,{fraction:L.fraction,onFraction:L.setFraction,rightPaneName:L.rightFile.name,onClosePane:L.close,rightPane:e(kt,{...ft(L.rightFile.id)}),children:be})}export{kt as Editor};