spec-cat 0.1.58 → 0.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{DwcvN5GM.js → 7eph1R-v.js} +1 -1
- package/.output/public/_nuxt/{CYdWOFi9.js → BaExZSVL.js} +1 -1
- package/.output/public/_nuxt/{w20OYULH.js → CP6qThLL.js} +1 -1
- package/.output/public/_nuxt/Cv6DvX4n.js +85 -0
- package/.output/public/_nuxt/{BuWYk-fr.js → DDghssmX.js} +1 -1
- package/.output/public/_nuxt/DHIxLBiw.js +4 -0
- package/.output/public/_nuxt/DWre0_Af.js +1 -0
- package/.output/public/_nuxt/{CoOXiJfR.js → DY4QYo3x.js} +1 -1
- package/.output/public/_nuxt/{C9i5JA80.js → DfNdsoMe.js} +1 -1
- package/.output/public/_nuxt/{ST6bRT0I.js → DpOhLQ1p.js} +1 -1
- package/.output/public/_nuxt/{Be9k1viH.js → TEerWOiL.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/c93a118f-1e99-4828-8f3a-96a75df838f7.json +1 -0
- package/.output/public/_nuxt/entry.BUDfUMkE.css +1 -0
- package/.output/public/_nuxt/{B6ZjNZ4D.js → t18G9qkt.js} +1 -1
- package/.output/public/_nuxt/{U3f2srqp.js → x26pmbJN.js} +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +579 -579
- package/.output/server/package.json +1 -1
- package/package.json +1 -1
- package/.output/public/_nuxt/B0RraLLt.js +0 -4
- package/.output/public/_nuxt/BadhMNaa.js +0 -1
- package/.output/public/_nuxt/builds/meta/8cd41d21-421c-4f9a-acaa-ab86b2ee6310.json +0 -1
- package/.output/public/_nuxt/entry.DJNhqbsn.css +0 -1
- package/.output/public/_nuxt/gSXqmL92.js +0 -85
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DDghssmX.js","./DHIxLBiw.js","./entry.BUDfUMkE.css","./x26pmbJN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{y as v,z as y,A as d,d as Ve,C as ee,G as m,R as je,S as Je,U as Rt,I as we,E as Ie,B as A,K as F,g as P,J as Ne,V as hs,k as J,W as tr,L as _e,H as pe,o as gt,X as wt,Y as Gm,O as ze,Z as It,T as Pr,_ as ps,M as Mu,$ as Ae,a0 as ds,P as On,D as ut,Q as kr,a1 as Hm,a2 as Or,a3 as ks,a4 as Sc,a5 as z1,c as N1,a6 as zh,a7 as Km,a8 as W1,q as q1,a9 as j1,x as Y1,aa as Eo}from"./DHIxLBiw.js";import{r as St,c as vn,b as dl,a as gs}from"./DfNdsoMe.js";import{g as Oo,m as F1,p as U1,h as Nh,i as G1,j as Wh,k as H1,l as K1,n as J1,w as ev,o as tv,q as Jm,s as qh,C as rv,_ as nv,t as Au,u as sv,r as jh,a as Yh}from"./TEerWOiL.js";import{_ as ws}from"./DlAUqK2U.js";import{S as Ma,i as iv,b as ov,P as av,W as Fh,M as Uh,c as Gh,d as Hh,g as Kh,e as lv,D as ep,f as tp,h as cv,a as vo,j as Ht,u as bo,k as Zs,l as Do}from"./DDghssmX.js";import{u as $c,_ as uv}from"./DpOhLQ1p.js";function hv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"})])}function dv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m8.25 3v6.75m0 0-3-3m3 3 3-3M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function fv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15M9 12l3 3m0 0 3-3m-3 3V2.25"})])}function mv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"})])}function pv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function rp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3"})])}function np(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})])}function sp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function ip(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"})])}function op(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})])}function ap(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})])}function gv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"})])}function lp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}function Ov(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"})])}function vv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function cp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"})])}function bv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 0 1 1.037-.443 48.282 48.282 0 0 0 5.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"})])}function _u(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function xv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Ru(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"})])}function yv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function Bu(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"})])}function Ys(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5A3.375 3.375 0 0 0 6.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0 0 15 2.25h-1.5a2.251 2.251 0 0 0-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 0 0-9-9Z"})])}function up(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"})])}function kv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 9.75 16.5 12l-2.25 2.25m-4.5 0L7.5 12l2.25-2.25M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function Cc(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function wv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})])}function Sv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"})])}function $v(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})])}function Cv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"})])}function Os(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})])}function En(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})])}function Qv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"})])}function Pv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function Tv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"})])}function Mv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})])}function Av(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"})])}function _v(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})])}function Rv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})])}function hp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})])}function fs(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])}function Bv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function Zv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13"})])}function dp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"})])}function Ev(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})])}function Jh(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})])}function Zu(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z"})])}function fp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})])}function mp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})])}function Eu(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m0-10.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.75c0 5.592 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.57-.598-3.75h-.152c-3.196 0-6.1-1.25-8.25-3.286Zm0 13.036h.008v.008H12v-.008Z"})])}function ji(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})])}function pp(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})])}function Du(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function Dv(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"})])}async function ed(r){return $fetch("/api/chat/worktree",{method:"POST",body:r})}async function Lv(r){await $fetch("/api/chat/worktree",{method:"DELETE",body:r})}async function Xv(r){const e=await $fetch("/api/chat/preview-sync",{method:"POST",body:r});if(!e.success)throw new Error(e.error||"Unknown preview sync failure")}const Iv={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},Vv={class:"relative flex-1 min-w-0"},zv={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},Nv=["disabled"],Wv=["disabled"],qv=Ve({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(r,{expose:e,emit:t}){const n=t,s=P(""),i=P(null);let o=null;function a(){o&&clearTimeout(o),o=setTimeout(()=>{n("search",s.value)},200)}function l(u){u.key==="Escape"?(u.preventDefault(),n("close")):u.key==="Enter"&&(u.preventDefault(),u.shiftKey?n("prev"):n("next"))}function c(){i.value?.focus(),i.value?.select()}return e({focus:c}),(u,h)=>(v(),y("div",Iv,[ee(m(fs),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("div",Vv,[je(d("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":h[0]||(h[0]=f=>Je(s)?s.value=f:null),type:"text",placeholder:"Find in commits...","aria-label":"Search commits",class:"w-full px-2 py-1 text-sm bg-retro-dark border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onInput:a,onKeydown:l},null,544),[[Rt,m(s)]])]),m(s)?(v(),y("span",zv,[r.resultCount>0?(v(),y(we,{key:0},[Ie(A(r.currentIndex+1)+" of "+A(r.resultCount),1)],64)):(v(),y(we,{key:1},[Ie(" No results ")],64))])):F("",!0),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:r.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:h[1]||(h[1]=f=>n("prev"))},[ee(m(yv),{class:"w-4 h-4"})],8,Nv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:r.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:h[2]||(h[2]=f=>n("next"))},[ee(m(xv),{class:"w-4 h-4"})],8,Wv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:h[3]||(h[3]=f=>n("close"))},[ee(m(St),{class:"w-4 h-4"})])]))}}),jv={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},Yv={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},Fv={class:"flex-1 overflow-auto max-h-[300px]"},Uv={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},Gv=["onKeyup"],Hv=["onClick"],Kv={class:"text-retro-muted truncate flex-1 font-mono"},Jv=["onClick"],eb=["onClick"],tb={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},rb={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},nb={class:"flex gap-2 justify-end"},sb=["disabled"],ib={key:1,class:"px-3 py-2 border-t border-retro-border"},ob=Ve({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(r,{emit:e}){const t=e,n=P(!1),s=P(""),i=P(""),o=P(null),a=P("");function l(){n.value=!0,s.value="",i.value=""}function c(){!s.value.trim()||!i.value.trim()||(t("add",{name:s.value.trim(),url:i.value.trim()}),n.value=!1)}function u(p){o.value=p.name,a.value=p.fetchUrl}function h(p){a.value.trim()&&(t("edit",{name:p,newUrl:a.value.trim()}),o.value=null)}function f(){o.value=null}return(p,g)=>(v(),y("div",jv,[d("div",Yv,[g[5]||(g[5]=d("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:g[0]||(g[0]=O=>t("close"))},[ee(m(St),{class:"w-4 h-4"})])]),d("div",Fv,[(v(!0),y(we,null,Ne(r.remotes,O=>(v(),y("div",{key:O.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[d("span",Uv,A(O.name),1),m(o)===O.name?(v(),y(we,{key:0},[je(d("input",{"onUpdate:modelValue":g[1]||(g[1]=b=>Je(a)?a.value=b:null),type:"text",class:"flex-1 px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan",onKeyup:[hs(b=>h(O.name),["enter"]),hs(f,["escape"])]},null,40,Gv),[[Rt,m(a)]]),d("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:b=>h(O.name)},[ee(m(_u),{class:"w-3.5 h-3.5"})],8,Hv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:f},[ee(m(St),{class:"w-3.5 h-3.5"})])],64)):(v(),y(we,{key:1},[d("span",Kv,A(O.fetchUrl),1),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:b=>u(O)},[ee(m(dp),{class:"w-3.5 h-3.5"})],8,Jv),d("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:b=>t("delete",O.name)},[ee(m(vn),{class:"w-3.5 h-3.5"})],8,eb)],64))]))),128)),r.remotes.length===0?(v(),y("div",tb," No remotes configured ")):F("",!0)]),m(n)?(v(),y("div",rb,[je(d("input",{"onUpdate:modelValue":g[2]||(g[2]=O=>Je(s)?s.value=O:null),type:"text",placeholder:"Remote name (e.g., origin)",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Rt,m(s)]]),je(d("input",{"onUpdate:modelValue":g[3]||(g[3]=O=>Je(i)?i.value=O:null),type:"text",placeholder:"Remote URL",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onKeyup:hs(c,["enter"])},null,544),[[Rt,m(i)]]),d("div",nb,[d("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:g[4]||(g[4]=O=>n.value=!1)}," Cancel "),d("button",{class:"px-2 py-1 text-xs bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40 rounded hover:bg-retro-cyan/30 transition-colors",disabled:!m(s).trim()||!m(i).trim(),onClick:c}," Add Remote ",8,sb)])])):F("",!0),m(n)?F("",!0):(v(),y("div",ib,[d("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:l},[ee(m(dl),{class:"w-3.5 h-3.5"}),g[6]||(g[6]=Ie(" Add Remote ",-1))])]))]))}}),fl={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},Lo=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Fs={A:{label:"Added",colorClass:"text-retro-green"},M:{label:"Modified",colorClass:"text-retro-yellow"},D:{label:"Deleted",colorClass:"text-retro-red"},R:{label:"Renamed",colorClass:"text-retro-blue"},C:{label:"Copied",colorClass:"text-retro-purple"},U:{label:"Unmerged",colorClass:"text-retro-cyan"}},ab=["width","height"],lb=["d","stroke","stroke-dasharray"],cb={key:0},ub=["cx","r"],hb=["cx","r","fill"],db=["cx","r","stroke"],fb=["cx","r","fill"],mb=["cx","r","stroke"],pb=["cx","r","fill"],gb=["cx","r"],Ob=["cx","r","fill"],gp=Ve({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(r){const e=r,{COLUMN_WIDTH:t,ROW_HEIGHT:n,NODE_RADIUS:s,PADDING:i}=fl,o=J(()=>i*2+(e.maxLane+1)*t),a=n,l=n/2;function c(f){return i+f*t}function u(f){const p=c(f.fromLane),g=c(f.toLane);if(f.type==="vertical")return`M ${p} 0 L ${g} ${a}`;if(f.type==="vertical-top")return`M ${p} 0 L ${p} ${l}`;if(f.type==="vertical-bottom")return`M ${p} ${l} L ${p} ${a}`;if(f.style==="rounded")return`M ${p} ${l} C ${p} ${a}, ${g} ${a}, ${g} ${a}`;{const O=a*.75;return`M ${p} ${l} L ${p} ${O} L ${g} ${a}`}}const h=J(()=>e.rowData?c(e.rowData.lane):i);return(f,p)=>(v(),y("svg",{width:m(o),height:m(a),class:"block flex-shrink-0","aria-hidden":"true"},[r.rowData?(v(),y(we,{key:0},[(v(!0),y(we,null,Ne(r.rowData.connections,(g,O)=>(v(),y("path",{key:O,d:u(g),stroke:g.color,"stroke-width":"2",fill:"none","stroke-dasharray":g.type.startsWith("merge")?"4 3":"none"},null,8,lb))),128)),d("g",null,[r.tooltipText?(v(),y("title",cb,A(r.tooltipText),1)):F("",!0),r.rowData.nodeType==="head"?(v(),y(we,{key:1},[d("circle",{cx:m(h),cy:l,r:m(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,ub),d("circle",{cx:m(h),cy:l,r:m(s),fill:r.rowData.color},null,8,hb)],64)):r.rowData.nodeType==="merge"?(v(),y(we,{key:2},[d("circle",{cx:m(h),cy:l,r:m(s)+1,fill:"none",stroke:r.rowData.color,"stroke-width":"1.5"},null,8,db),d("circle",{cx:m(h),cy:l,r:m(s)-1,fill:r.rowData.color},null,8,fb)],64)):r.rowData.nodeType==="stash"?(v(),y(we,{key:3},[d("circle",{cx:m(h),cy:l,r:m(s),fill:"none",stroke:r.rowData.color,"stroke-width":"2"},null,8,mb),d("circle",{cx:m(h),cy:l,r:m(s)-2,fill:r.rowData.color},null,8,pb)],64)):r.rowData.nodeType==="uncommitted"?(v(),y("circle",{key:4,cx:m(h),cy:l,r:m(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,gb)):(v(),y("circle",{key:5,cx:m(h),cy:l,r:m(s),fill:r.rowData.color},null,8,Ob))])],64)):F("",!0)],8,ab))}}),vb=["aria-selected","aria-label"],bb={key:1,class:"flex gap-1 flex-shrink-0"},xb=["title","onContextmenu"],yb={key:2,class:"flex gap-1 flex-shrink-0"},kb=["onContextmenu"],wb={class:"text-retro-text text-xs truncate flex-1"},Sb={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},$b={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},td=72,Cb=Ve({__name:"GitCommitRow",props:{commit:{},index:{},isSelected:{type:Boolean},isHighlighted:{type:Boolean},isBranchHighlighted:{type:Boolean},isFeatureHighlighted:{type:Boolean},isPreviewHighlighted:{type:Boolean},isMuted:{type:Boolean},currentBranchName:{},localBranchNames:{},graphRowData:{},maxLane:{},columnVisibility:{}},emits:["click","keydown","branchContextMenu","commitContextMenu","tagContextMenu"],setup(r,{emit:e}){const t=r,n=e,s=J(()=>{const f=t.commit.branches;if(f.length===0)return[];const p=t.localBranchNames,g=[],O=[];for(const S of f)p.has(S)?g.push(S):O.push(S);const b=new Set(g),x=new Map,k=[];for(const S of O){const Q=S.indexOf("/");if(Q>0){const L=S.substring(Q+1),E=S.substring(0,Q);b.has(L)?(x.has(L)||x.set(L,[]),x.get(L).push(E)):k.push(S)}else k.push(S)}const w=[];for(const S of g){const Q=x.get(S)||[];Q.length>0?w.push({displayName:`${S}/${Q.join(",")}`,originalBranches:[S,...Q.map(L=>`${L}/${S}`)],isLocal:!0}):w.push({displayName:S,originalBranches:[S],isLocal:!0})}for(const S of k)w.push({displayName:S,originalBranches:[S],isLocal:!1});return w});function i(f,p){f.preventDefault(),f.stopPropagation();const g=p.originalBranches[0];n("branchContextMenu",{branch:g,x:f.clientX,y:f.clientY,isCurrentBranch:p.isLocal&&p.originalBranches.includes(t.currentBranchName??""),isLocal:p.isLocal})}function o(f,p){f.preventDefault(),f.stopPropagation(),n("tagContextMenu",{tag:p,x:f.clientX,y:f.clientY})}function a(f){f.preventDefault(),f.stopPropagation(),n("commitContextMenu",{x:f.clientX,y:f.clientY})}const{ROW_HEIGHT:l}=fl,c=J(()=>{const f=[t.commit.shortHash];return t.commit.branches.length>0&&f.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&f.push(t.commit.tags.map(p=>`tag: ${p}`).join(", ")),f.join(" — ")});function u(f){const g=Date.now()/1e3-f;return g<60?"just now":g<3600?`${Math.floor(g/60)}m ago`:g<86400?`${Math.floor(g/3600)}h ago`:g<604800?`${Math.floor(g/86400)}d ago`:g<2592e3?`${Math.floor(g/604800)}w ago`:new Date(f*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function h(f){const p=f.split(`
|
|
3
|
+
`)[0];return p.length>td?p.substring(0,td-3)+"...":p}return(f,p)=>{const g=gp;return v(),y("div",{class:_e(["flex items-center cursor-pointer group focus:outline-none focus:ring-1 focus:ring-retro-cyan/50 focus:ring-inset",{"opacity-40":r.isMuted,"bg-retro-magenta/10":r.isPreviewHighlighted,"bg-retro-yellow/20":r.isFeatureHighlighted&&!r.isPreviewHighlighted}]),style:tr({height:`${m(l)}px`}),role:"row",tabindex:"0","aria-selected":r.isSelected,"aria-label":`Commit ${r.commit.shortHash} by ${r.commit.author}: ${r.commit.message.split(`
|
|
4
|
+
`)[0]}`,onClick:p[0]||(p[0]=O=>n("click",O)),onKeydown:p[1]||(p[1]=O=>n("keydown",O)),onContextmenu:a},[ee(g,{rowData:r.graphRowData,maxLane:r.maxLane,tooltipText:m(c)},null,8,["rowData","maxLane","tooltipText"]),d("div",{class:_e(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-magenta/10 border-l-2 border-retro-magenta/40":r.isPreviewHighlighted,"bg-retro-yellow/30 border-l-2 border-retro-yellow":r.isFeatureHighlighted&&!r.isPreviewHighlighted,"bg-retro-cyan/15":r.isSelected&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted,"bg-retro-yellow/10":r.isHighlighted&&!r.isSelected&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted,"bg-retro-cyan/5":r.isBranchHighlighted&&!r.isSelected&&!r.isHighlighted&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted,"group-hover:bg-retro-panel/50":!r.isSelected&&!r.isHighlighted&&!r.isFeatureHighlighted&&!r.isPreviewHighlighted&&!r.isBranchHighlighted}]),style:tr({height:`${m(l)-4}px`})},[!r.columnVisibility||r.columnVisibility.commit!==!1?(v(),y("span",{key:0,class:_e(["flex-shrink-0 font-mono text-[11px]",r.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},A(r.commit.shortHash),3)):F("",!0),m(s).length>0?(v(),y("div",bb,[(v(!0),y(we,null,Ne(m(s),O=>(v(),y("span",{key:O.displayName,class:_e(["px-1.5 py-0.5 text-[10px] rounded font-semibold leading-none cursor-context-menu hover:ring-1 hover:ring-retro-cyan/50",r.commit.isHead&&O.isLocal?"bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40":r.isPreviewHighlighted?"bg-retro-magenta/10 text-retro-magenta border border-retro-magenta/40":r.isFeatureHighlighted?"bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/30":r.isBranchHighlighted?"bg-retro-cyan/15 text-retro-cyan/80 border border-retro-cyan/30":O.isLocal?"bg-retro-green/15 text-retro-green border border-retro-green/30":"bg-retro-orange/15 text-retro-orange border border-retro-orange/30"]),title:O.originalBranches.join(", "),onContextmenu:b=>i(b,O)},A(O.displayName),43,xb))),128))])):F("",!0),r.commit.tags.length>0?(v(),y("div",yb,[(v(!0),y(we,null,Ne(r.commit.tags,O=>(v(),y("span",{key:O,class:"px-1 py-0.5 text-[10px] rounded-sm bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/25 flex items-center gap-0.5 leading-none cursor-context-menu hover:ring-1 hover:ring-retro-yellow/50",onContextmenu:b=>o(b,O)},[ee(m(Du),{class:"w-2.5 h-2.5"}),Ie(" "+A(O),1)],40,kb))),128))])):F("",!0),d("span",wb,A(h(r.commit.message)),1),r.commit.signatureStatus==="good"?(v(),pe(m(mp),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):r.commit.signatureStatus==="bad"?(v(),pe(m(Eu),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):F("",!0),!r.columnVisibility||r.columnVisibility.author!==!1?(v(),y("span",Sb,A(r.commit.author),1)):F("",!0),!r.columnVisibility||r.columnVisibility.date!==!1?(v(),y("span",$b,A(u(r.commit.timestamp)),1)):F("",!0)],6)],46,vb)}}});function Qb(){const{COLUMN_WIDTH:r,ROW_HEIGHT:e,NODE_RADIUS:t,PADDING:n}=fl;function s(l){let c=0;for(let u=0;u<l.length;u++){const h=l.charCodeAt(u);c=(c<<5)-c+h,c=c&c}return Math.abs(c)}function i(l){const c=s(l)%Lo.length;return Lo[c]}function o(l,c="rounded"){const u=new Map;if(l.length===0)return u;const h=new Set,f=new Map;for(const w of l)f.set(w.hash,w);const p=l[0];if(p){let w=p;for(;w;){h.add(w.hash);const S=w.parents?.[0];w=S?f.get(S):void 0}}const g=new Map,O=new Map,b=new Map,x=new Map,k=new Map;for(let w=0;w<l.length;w++){const S=l[w];k.set(S.hash,w);const Q=h.has(S.hash);let L,E;if(x.has(S.hash)){const V=x.get(S.hash);L=V.lane,E=V.color,x.delete(S.hash)}else if(Q)L=0,E=Lo[0];else{for(L=1;b.has(L);)L++;E=i(S.hash.substring(0,7))}g.set(S.hash,L),O.set(S.hash,E),b.set(L,S.hash);const G=S.isMerge||S.parents&&S.parents.length>1;let oe="regular";S.isHead?oe="head":G&&(oe="merge"),u.set(S.hash,{commitHash:S.hash,lane:L,color:E,nodeType:oe,isMainline:h.has(S.hash),connections:[]});const ie=S.parents||[];for(let V=0;V<ie.length;V++){const Z=ie[V];if(g.has(Z)||x.has(Z))continue;const U=h.has(Z);let W,N;if(V===0)W=L,N=E;else if(U)W=0,N=Lo[0];else{for(W=1;b.has(W)||W===L;)W++;N=i(Z.substring(0,7))}x.set(Z,{lane:W,color:N,childHash:S.hash})}const j=ie[0];if(!j)b.delete(L);else{const V=g.get(j),Z=x.get(j),U=V??Z?.lane;U!==void 0&&U!==L&&b.delete(L)}}for(let w=0;w<l.length;w++){const S=l[w],Q=u.get(S.hash);if(!Q)continue;const L=S.parents||[];for(let E=0;E<L.length;E++){const G=L[E],oe=g.get(G),ie=k.get(G);if(oe===void 0)continue;const j=Q.lane,V=oe,Z=E===0?Q.color:O.get(G)||i(G.substring(0,7));if(j===V?Q.connections.push({type:"vertical-bottom",fromLane:j,toLane:V,color:Z,style:c}):E>0?Q.connections.push({type:j<V?"merge-out":"merge-in",fromLane:j,toLane:V,color:Z,style:c}):Q.connections.push({type:j<V?"branch-out":"branch-in",fromLane:j,toLane:V,color:Z,style:c}),ie!==void 0&&ie>w+1)for(let U=w+1;U<ie;U++){const W=l[U],N=u.get(W.hash);N&&N.connections.push({type:"vertical",fromLane:V,toLane:V,color:Z,style:c})}if(ie!==void 0){const U=u.get(G);U&&U.connections.push({type:"vertical-top",fromLane:V,toLane:V,color:Z,style:c})}}}return u}function a(l){let c=0;for(const u of l.values()){u.lane>c&&(c=u.lane);for(const h of u.connections)h.fromLane>c&&(c=h.fromLane),h.toLane>c&&(c=h.toLane)}return c}return{computeGraphRows:o,computeMaxLane:a,getBranchColor:i,COLUMN_WIDTH:r,ROW_HEIGHT:e,NODE_RADIUS:t,PADDING:n}}const Pb=["aria-selected"],Tb={class:"text-retro-yellow text-xs font-medium"},Mb={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},Ab={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},_b=Ve({__name:"GitCommitList",props:{commits:{},stashes:{},selectedCommit:{},hasMore:{type:Boolean},loading:{type:Boolean},loadingMore:{type:Boolean},searchQuery:{},uncommittedChangesCount:{},isUncommittedChangesSelected:{type:Boolean},highlightBranches:{},featureHighlightBranches:{},featureMergeBases:{},previewHighlightBranches:{},previewMergeBases:{},currentBranchName:{},localBranchNames:{},graphStyle:{default:"rounded"},muteNonAncestral:{type:Boolean},columnVisibility:{}},emits:["select","compareSelect","loadMore","branchContextMenu","commitContextMenu","tagContextMenu","stashContextMenu","selectUncommittedChanges","scrollStart","scrollEnd"],setup(r,{expose:e,emit:t}){const n=r,s=t;function i(){s("selectUncommittedChanges")}function o(re){(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),s("selectUncommittedChanges"))}const a=J(()=>n.searchQuery?.toLowerCase()??""),l=J(()=>new Set(n.highlightBranches??[])),c=J(()=>l.value.size>0),u=J(()=>{const re=a.value;if(!re)return new Set;const Oe=new Set;for(const ge of n.commits)(ge.message.toLowerCase().includes(re)||ge.author.toLowerCase().includes(re)||ge.shortHash.toLowerCase().includes(re)||ge.hash.toLowerCase().includes(re)||ge.branches.some($e=>$e.toLowerCase().includes(re))||ge.tags.some($e=>$e.toLowerCase().includes(re)))&&Oe.add(ge.hash);return Oe}),h=J(()=>{if(!c.value)return new Set;const re=new Set;for(const Oe of n.commits)Oe.branches.some(ge=>l.value.has(ge))&&re.add(Oe.hash);return re}),f=J(()=>{if(!n.featureHighlightBranches||n.featureHighlightBranches.length===0)return new Set;const re=n.featureMergeBases??{},Oe=new Map;for(const $e of n.commits)Oe.set($e.hash,$e);const ge=new Set;for(const $e of n.featureHighlightBranches){const Pe=n.commits.find(M=>M.branches.includes($e));if(!Pe)continue;const Fe=re[$e]??null;if(!Fe)continue;let T=Pe;for(;T&&T.hash!==Fe;)ge.add(T.hash),T=T.parents?.[0]?Oe.get(T.parents[0]):void 0}return ge}),p=J(()=>{if(!n.previewHighlightBranches||n.previewHighlightBranches.length===0)return new Set;const re=n.previewMergeBases??{},Oe=new Map;for(const $e of n.commits)Oe.set($e.hash,$e);const ge=new Set;for(const $e of n.previewHighlightBranches){const Pe=n.commits.find(M=>M.branches.includes($e));if(!Pe)continue;const Fe=re[$e]??null;if(!Fe)continue;let T=Pe;for(;T&&T.hash!==Fe;)ge.add(T.hash),T=T.parents?.[0]?Oe.get(T.parents[0]):void 0}return ge});function g(re,Oe){s("branchContextMenu",{...Oe,commitHash:re.hash})}function O(re,Oe){s("commitContextMenu",{commit:re,...Oe})}function b(re,Oe){s("tagContextMenu",{...Oe,commitHash:re.hash})}const{ROW_HEIGHT:x,VISIBLE_BUFFER:k}=fl,{computeGraphRows:w,computeMaxLane:S}=Qb(),Q=J(()=>w([...n.commits],n.graphStyle)),L=J(()=>S(Q.value)),E=J(()=>{const re=n.stashes||[];if(re.length===0)return n.commits.map((Pe,Fe)=>({type:"commit",commit:Pe,commitIndex:Fe}));const Oe=[],ge=[...re].sort((Pe,Fe)=>new Date(Fe.date).getTime()-new Date(Pe.date).getTime());let $e=0;for(let Pe=0;Pe<n.commits.length;Pe++){const Fe=n.commits[Pe],T=Fe.timestamp*1e3;for(;$e<ge.length&&new Date(ge[$e].date).getTime()>=T;)Oe.push({type:"stash",stash:ge[$e]}),$e++;Oe.push({type:"commit",commit:Fe,commitIndex:Pe})}for(;$e<ge.length;)Oe.push({type:"stash",stash:ge[$e]}),$e++;return Oe}),G=P(null),oe=P(0),ie=P(400);let j=null;const V=J(()=>{const re=k,Oe=E.value.length,ge=Math.max(0,Math.floor(oe.value/x)-re),$e=Math.min(Oe,Math.ceil((oe.value+ie.value)/x)+re);return{startIndex:ge,endIndex:$e}}),Z=J(()=>{const{startIndex:re,endIndex:Oe}=V.value;return E.value.slice(re,Oe).map((ge,$e)=>({row:ge,index:re+$e,graphRow:ge.type==="commit"&&Q.value.get(ge.commit.hash)||null,isHighlighted:ge.type==="commit"?u.value.has(ge.commit.hash):!1,isBranchHighlighted:ge.type==="commit"?h.value.has(ge.commit.hash):!1,isFeatureHighlighted:ge.type==="commit"?f.value.has(ge.commit.hash):!1,isPreviewHighlighted:ge.type==="commit"?p.value.has(ge.commit.hash):!1,isMuted:ge.type==="commit"&&n.muteNonAncestral?!(Q.value.get(ge.commit.hash)?.isMainline??!1):!1}))}),U=J(()=>E.value.length*x),W=J(()=>V.value.startIndex*x);function N(re){const Oe=re.target;oe.value=Oe.scrollTop,j||s("scrollStart"),j&&clearTimeout(j),j=setTimeout(()=>{j=null,s("scrollEnd")},150),n.hasMore&&!n.loading&&!n.loadingMore&&Oe.scrollTop+Oe.clientHeight>=Oe.scrollHeight-200&&s("loadMore")}function I(re,Oe){Oe.ctrlKey||Oe.metaKey?s("compareSelect",re):s("select",re)}function z(re,Oe,ge){if(re.key==="Enter"||re.key===" ")re.preventDefault(),s("select",Oe);else if(re.key==="ArrowDown"){re.preventDefault();for(let $e=ge+1;$e<E.value.length;$e++){const Pe=E.value[$e];if(Pe.type==="commit"){s("select",Pe.commit),be($e);break}}}else if(re.key==="ArrowUp"){re.preventDefault();for(let $e=ge-1;$e>=0;$e--){const Pe=E.value[$e];if(Pe.type==="commit"){s("select",Pe.commit),be($e);break}}}}function be(re){if(!G.value)return;const Oe=re*x,ge=G.value.scrollTop,$e=ge+G.value.clientHeight;Oe<ge?G.value.scrollTop=Oe:Oe+x>$e&&(G.value.scrollTop=Oe+x-G.value.clientHeight)}gt(()=>{if(G.value){ie.value=G.value.clientHeight;const re=new ResizeObserver(Oe=>{for(const ge of Oe)ie.value=ge.contentRect.height});re.observe(G.value),wt(()=>re.disconnect())}});function K(){return G.value?.scrollTop??0}function H(re){G.value&&(G.value.scrollTop=re)}return e({getScrollPosition:K,setScrollPosition:H,scrollToIndex:be}),(re,Oe)=>{const ge=gp,$e=Cb;return v(),y("div",{ref_key:"containerRef",ref:G,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:N},[r.uncommittedChangesCount&&r.uncommittedChangesCount>0?(v(),y("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:tr({height:`${m(x)}px`}),role:"button",tabindex:"0","aria-selected":r.isUncommittedChangesSelected,onClick:i,onKeydown:o},[ee(ge,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:m(L)},null,8,["maxLane"]),d("div",{class:_e(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-yellow/15":r.isUncommittedChangesSelected,"group-hover:bg-retro-panel/50":!r.isUncommittedChangesSelected}]),style:tr({height:`${m(x)-4}px`})},[ee(m(Oo),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),d("span",Tb," Uncommitted Changes ("+A(r.uncommittedChangesCount)+") ",1),Oe[1]||(Oe[1]=d("span",{class:"flex-1"},null,-1)),Oe[2]||(Oe[2]=d("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,Pb)):F("",!0),d("div",{class:"relative",style:tr({height:`${m(U)}px`})},[d("div",{class:"absolute left-0 right-0",style:tr({transform:`translateY(${m(W)}px)`})},[(v(!0),y(we,null,Ne(m(Z),({row:Pe,index:Fe,graphRow:T,isHighlighted:M,isBranchHighlighted:D,isFeatureHighlighted:B,isPreviewHighlighted:xe,isMuted:Re})=>(v(),y(we,{key:Pe.type==="commit"?Pe.commit.hash:`stash-${Pe.stash.index}`},[Pe.type==="commit"?Gm([Pe.commit.hash,Pe.commit.message,Pe.commit.timestamp,Pe.commit.branches.join("|"),Pe.commit.tags.join("|"),r.selectedCommit?.hash===Pe.commit.hash,M,D,B,xe,Re,n.currentBranchName||"",n.columnVisibility?.date!==!1,n.columnVisibility?.author!==!1,n.columnVisibility?.commit!==!1],()=>(v(),pe($e,{key:0,commit:Pe.commit,index:Pe.commitIndex,isSelected:r.selectedCommit?.hash===Pe.commit.hash,isHighlighted:M,isBranchHighlighted:D,isFeatureHighlighted:B,isPreviewHighlighted:xe,isMuted:Re,currentBranchName:n.currentBranchName,localBranchNames:n.localBranchNames,graphRowData:T,maxLane:m(L),columnVisibility:n.columnVisibility,onClick:Me=>I(Pe.commit,Me),onKeydown:Me=>z(Me,Pe.commit,Fe),onBranchContextMenu:Me=>g(Pe.commit,Me),onCommitContextMenu:Me=>O(Pe.commit,Me),onTagContextMenu:Me=>b(Pe.commit,Me)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),Oe,0):F("",!0)],64))),128))],4)],4),(r.loading||r.loadingMore)&&r.commits.length>0?(v(),y("div",Mb,[...Oe[3]||(Oe[3]=[d("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ie(" Loading more commits... ",-1)])])):F("",!0),!r.hasMore&&r.commits.length>0&&!r.loading?(v(),y("div",Ab,A(r.commits.length)+" commits loaded ",1)):F("",!0)],544)}}});function Rb(r){const e=r.charAt(0).toUpperCase();return e in Fs?e:"M"}function Xo(r,e){if(r&&typeof r=="object"){const t=r;if(typeof t.data?.message=="string"&&t.data.message.trim())return t.data.message;if(typeof t.statusMessage=="string"&&t.statusMessage.trim())return t.statusMessage;if(typeof t.message=="string"&&t.message.trim())return t.message}return r instanceof Error&&r.message?r.message:e}function Op(r,e){const t=e.trim().toLowerCase();return t?r.filter(n=>n.message.toLowerCase().includes(t)||n.author.toLowerCase().includes(t)||n.shortHash.includes(t)||n.hash.includes(t)||n.branches.some(s=>s.toLowerCase().includes(t))||n.tags.some(s=>s.toLowerCase().includes(t))):[...r]}function Bb(r,e){return e.size===0?[...r]:r.filter(t=>t.branches.some(n=>e.has(n)))}function Zb(r=10){const e=new Map;function t(s,i){const o=i.toLowerCase(),a=`${o}:${s.length}`,l=e.get(a);if(l)return l;const c=Op(s,o);if(e.size>=r){const u=e.keys().next().value;u!==void 0&&e.delete(u)}return e.set(a,c),c}function n(){e.clear()}return{filter:t,clear:n}}const Eb={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},Db={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},Lb={class:"flex items-center gap-2 text-xs min-w-0"},Xb={class:"font-mono text-retro-cyan"},Ib={class:"font-mono text-retro-cyan"},Vb={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},zb={class:"text-retro-green"},Nb={class:"text-retro-red"},Wb={key:1,class:"flex-1 flex items-center justify-center"},qb={key:2,class:"flex-1 overflow-auto"},jb={class:"text-retro-text truncate flex-1"},Yb={class:"text-retro-muted"},Fb={key:0,class:"flex-shrink-0 text-[10px] font-mono"},Ub={key:0,class:"text-retro-green"},Gb={key:1,class:"text-retro-red ml-1"},Hb={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},Kb={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},Jb=Ve({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(r,{emit:e}){const t=e;function n(s){const i=Rb(s);return Fs[i]||Fs.M}return(s,i)=>(v(),y("div",Eb,[d("div",Db,[d("div",Lb,[i[1]||(i[1]=d("span",{class:"text-retro-muted"},"Comparing",-1)),d("span",Xb,A(r.fromCommit.shortHash),1),i[2]||(i[2]=d("span",{class:"text-retro-muted"},"→",-1)),d("span",Ib,A(r.toCommit.shortHash),1)]),d("button",{class:"p-1 text-retro-muted hover:text-retro-text transition-colors flex-shrink-0","aria-label":"Close comparison",onClick:i[0]||(i[0]=o=>t("close"))},[ee(m(St),{class:"w-4 h-4"})])]),r.stats?(v(),y("div",Vb,[Ie(A(r.stats.filesChanged)+" file"+A(r.stats.filesChanged!==1?"s":"")+" changed, ",1),d("span",zb,"+"+A(r.stats.additions),1),d("span",Nb," -"+A(r.stats.deletions),1)])):F("",!0),r.loading?(v(),y("div",Wb,[...i[3]||(i[3]=[d("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[d("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"}),Ie(" Loading comparison... ")],-1)])])):r.files&&r.files.length>0?(v(),y("div",qb,[(v(!0),y(we,null,Ne(r.files,o=>(v(),y("div",{key:o.path,class:"flex items-center gap-2 px-3 py-1.5 hover:bg-retro-panel/50 text-xs border-b border-retro-border/50"},[d("span",{class:_e(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",n(o.status).colorClass])},A(o.status.charAt(0)),3),d("span",jb,[o.oldPath&&o.status.startsWith("R")?(v(),y(we,{key:0},[d("span",Yb,A(o.oldPath),1),i[4]||(i[4]=d("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):F("",!0),Ie(" "+A(o.path),1)]),o.binary?(v(),y("span",Hb,"binary")):(v(),y("span",Fb,[o.additions>0?(v(),y("span",Ub,"+"+A(o.additions),1)):F("",!0),o.deletions>0?(v(),y("span",Gb,"-"+A(o.deletions),1)):F("",!0)]))]))),128))])):r.files&&r.files.length===0?(v(),y("div",Kb," No differences between these commits ")):F("",!0)]))}}),ex={":art:":"🎨",":zap:":"⚡",":fire:":"🔥",":bug:":"🐛",":ambulance:":"🚑",":sparkles:":"✨",":memo:":"📝",":rocket:":"🚀",":lipstick:":"💄",":tada:":"🎉",":white_check_mark:":"✅",":lock:":"🔒",":closed_lock_with_key:":"🔐",":bookmark:":"🔖",":rotating_light:":"🚨",":construction:":"🚧",":green_heart:":"💚",":arrow_down:":"⬇️",":arrow_up:":"⬆️",":pushpin:":"📌",":construction_worker:":"👷",":chart_with_upwards_trend:":"📈",":recycle:":"♻️",":heavy_plus_sign:":"➕",":heavy_minus_sign:":"➖",":wrench:":"🔧",":hammer:":"🔨",":globe_with_meridians:":"🌐",":pencil2:":"✏️",":poop:":"💩",":rewind:":"⏪",":twisted_rightwards_arrows:":"🔀",":package:":"📦",":alien:":"👽",":truck:":"🚚",":page_facing_up:":"📄",":boom:":"💥",":bento:":"🍱",":wheelchair:":"♿",":bulb:":"💡",":beers:":"🍻",":speech_balloon:":"💬",":card_file_box:":"🗃️",":loud_sound:":"🔊",":mute:":"🔇",":busts_in_silhouette:":"👥",":children_crossing:":"🚸",":building_construction:":"🏗️",":iphone:":"📱",":clown_face:":"🤡",":egg:":"🥚",":see_no_evil:":"🙈",":camera_flash:":"📸",":alembic:":"⚗️",":mag:":"🔍",":label:":"🏷️",":seedling:":"🌱",":triangular_flag_on_post:":"🚩",":goal_net:":"🥅",":dizzy:":"💫",":wastebasket:":"🗑️",":passport_control:":"🛂",":adhesive_bandage:":"🩹",":monocle_face:":"🧐",":coffin:":"⚰️",":test_tube:":"🧪",":necktie:":"👔",":stethoscope:":"🩺",":bricks:":"🧱",":technologist:":"🧑💻",":money_with_wings:":"💸",":thread:":"🧵",":safety_vest:":"🦺"},tx=/https?:\/\/[^\s<>)"']+/g;function rx(r){return r.replace(tx,e=>`<a href="${e}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${e}</a>`)}function nx(r){return r.replace(/:[a-z0-9_]+:/g,e=>ex[e]||e)}function sx(r){if(!r)return"";let e=nx(r);return e=F1.parse(e),e=rx(e),e=U1.sanitize(e,{ALLOWED_TAGS:["a","strong","em","code","b","i","br","p","ul","ol","li","pre","blockquote","h1","h2","h3"],ALLOWED_ATTR:["href","target","rel","class"]}),e}const ix={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},ox={class:"flex items-center gap-2 min-w-0"},ax={class:"text-retro-cyan font-mono text-sm"},lx={class:"text-retro-muted text-sm truncate"},cx={class:"flex items-center gap-1 flex-shrink-0"},ux=["aria-label","title"],hx={class:"flex-1 overflow-auto p-4 space-y-4"},dx={class:"space-y-2"},fx={class:"flex items-center gap-2 text-sm"},mx={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},px={class:"flex items-center gap-2 text-sm"},gx={class:"text-retro-text"},Ox={class:"text-retro-muted"},vx={key:0,class:"flex items-center gap-2 text-sm"},bx={class:"text-retro-text"},xx={class:"text-retro-muted"},yx={class:"flex items-center gap-2 text-sm"},kx={class:"text-retro-text"},wx={key:1,class:"flex items-start gap-2 text-sm"},Sx={class:"flex flex-wrap gap-1"},$x=["onClick","title"],Cx={key:2,class:"flex items-start gap-2 text-sm"},Qx={class:"flex flex-wrap gap-1"},Px={key:3,class:"flex items-start gap-2 text-sm"},Tx={class:"flex flex-wrap gap-1"},Mx={class:"space-y-1"},Ax={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},_x={key:0,class:"space-y-1"},Rx=["innerHTML"],Bx={key:1,class:"space-y-2"},Zx={class:"flex items-center gap-2 text-sm"},Ex={class:"text-retro-muted"},Dx={key:0,class:"flex items-center gap-2"},Lx={class:"text-retro-green text-xs font-mono"},Xx={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},Ix={class:"text-retro-red text-xs font-mono"},Vx={key:2,class:"space-y-2"},zx={class:"flex items-center justify-between"},Nx={class:"text-retro-muted text-xs uppercase tracking-wide"},Wx={class:"flex items-center gap-1"},qx={key:0,class:"text-retro-muted text-sm py-2"},jx={key:1,class:"space-y-0.5"},Yx=["onClick"],Fx=["title"],Ux={class:"text-retro-text font-mono text-xs truncate flex-1"},Gx={class:"text-retro-muted"},Hx={class:"text-retro-text"},Kx={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Jx={key:0,class:"text-retro-green"},ey={key:1,class:"text-retro-red"},ty={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},ry={key:2,class:"space-y-0"},ny=["onClick"],sy={class:"text-retro-text font-mono text-xs"},iy=["title"],oy={class:"text-retro-text font-mono text-xs truncate flex-1"},ay={class:"text-retro-muted"},ly={class:"text-retro-text"},cy={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},uy={key:0,class:"text-retro-green"},hy={key:1,class:"text-retro-red"},dy={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},fy={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},my={key:4,class:"text-retro-muted text-sm py-2"},py=Ve({__name:"GitCommitDetail",props:{commit:{},files:{},stats:{},loading:{type:Boolean,default:!1},committer:{},committerEmail:{},detailPosition:{default:"inline"}},emits:["close","navigateToCommit","togglePosition","navigatePrev","navigateNext","openFileDiff"],setup(r,{emit:e}){const t=r,n=e,s=P(null),i=P("flat"),o=P(new Set),a=J(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),l=J(()=>{const j=t.commit.body;return j?sx(j):""}),c=J(()=>{if(!t.stats)return"";const{filesChanged:j,additions:V,deletions:Z}=t.stats,W=[`${j} ${j===1?"file":"files"} changed`];return V>0&&W.push(`+${V} insertion${V===1?"":"s"}`),Z>0&&W.push(`-${Z} deletion${Z===1?"":"s"}`),W.join(", ")});function u(j){const V=[];for(const Z of j){const U=Z.path.split("/");let W=V;for(let N=0;N<U.length;N++){const I=U[N],z=N===U.length-1,be=U.slice(0,N+1).join("/");let K=W.find(H=>H.name===I&&H.isDirectory===!z);K||(K={name:I,fullPath:be,isDirectory:!z,children:[],file:z?Z:void 0},W.push(K)),z||(W=K.children)}}return h(V),V}function h(j){for(const V of j)if(V.isDirectory)for(h(V.children);V.children.length===1&&V.children[0].isDirectory;){const Z=V.children[0];V.name=`${V.name}/${Z.name}`,V.fullPath=Z.fullPath,V.children=Z.children}}function f(j){return[...j].sort((V,Z)=>V.isDirectory&&!Z.isDirectory?-1:!V.isDirectory&&Z.isDirectory?1:V.name.localeCompare(Z.name))}function p(j,V,Z){const U=[];for(const W of f(j)){const N=Z.size===0?!0:Z.has(W.fullPath);U.push({key:W.fullPath,depth:V,isDirectory:W.isDirectory,name:W.name,fullPath:W.fullPath,expanded:W.isDirectory?N:!1,file:W.file}),W.isDirectory&&N&&U.push(...p(W.children,V+1,Z))}return U}const g=J(()=>!t.files||t.files.length===0?[]:u(t.files)),O=J(()=>p(g.value,0,o.value));function b(j){o.value.has(j)?o.value.delete(j):o.value.add(j),o.value=new Set(o.value)}function x(){const j=V=>{const Z=[];for(const U of V)U.isDirectory&&(Z.push(U.fullPath),Z.push(...j(U.children)));return Z};o.value=new Set(j(g.value))}function k(){o.value=new Set}ze(i,j=>{j==="tree"&&x()});function w(j){return new Date(j*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function S(j){return Fs[j]||{label:j,colorClass:"text-retro-muted"}}const Q=J(()=>{if(!t.stats)return{addPct:0,delPct:0};const j=t.stats.additions+t.stats.deletions;return j===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/j*100),delPct:Math.round(t.stats.deletions/j*100)}});function L(j){j.key==="ArrowUp"?(j.preventDefault(),n("navigatePrev")):j.key==="ArrowDown"?(j.preventDefault(),n("navigateNext")):j.key==="Escape"&&(j.preventDefault(),n("close"))}gt(()=>{It(()=>{s.value?.focus()})}),ze(()=>t.commit.hash,()=>{It(()=>{s.value?.focus()})});function E(){n("close")}function G(j){n("navigateToCommit",j)}function oe(){n("togglePosition")}function ie(j){n("openFileDiff",j)}return(j,V)=>(v(),y("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:L,class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark focus:outline-none","aria-label":"Commit details",role:"region"},[d("div",ix,[d("div",ox,[d("span",ax,A(r.commit.shortHash),1),d("span",lx,A(r.commit.message.split(`
|
|
5
|
+
`)[0]),1)]),d("div",cx,[d("button",{onClick:oe,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":r.detailPosition==="inline"?"Dock detail to bottom":"Show detail inline",title:r.detailPosition==="inline"?"Dock to bottom":"Show inline"},[r.detailPosition==="inline"?(v(),pe(m(op),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(v(),pe(m(ip),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,ux),d("button",{onClick:E,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close commit details"},[ee(m(St),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),d("div",hx,[d("div",dx,[d("div",fx,[V[2]||(V[2]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),d("code",mx,A(r.commit.hash),1)]),d("div",px,[ee(m(Nh),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",gx,A(r.commit.author),1),d("span",Ox,"<"+A(r.commit.email)+">",1)]),a.value?(v(),y("div",vx,[ee(m(Nh),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),V[3]||(V[3]=d("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),d("span",bx,A(r.committer),1),d("span",xx,"<"+A(r.committerEmail)+">",1)])):F("",!0),d("div",yx,[ee(m(G1),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",kx,A(w(r.commit.timestamp)),1)]),r.commit.parents?.length>0?(v(),y("div",wx,[V[4]||(V[4]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),d("div",Sx,[(v(!0),y(we,null,Ne(r.commit.parents,Z=>(v(),y("button",{key:Z,onClick:U=>G(Z),class:"text-retro-cyan font-mono text-xs bg-retro-panel px-2 py-0.5 rounded hover:bg-retro-dark hover:text-retro-text transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-retro-cyan",title:`Navigate to parent ${Z.substring(0,7)}`},A(Z.substring(0,7)),9,$x))),128))])])):F("",!0),r.commit.branches?.length>0?(v(),y("div",Cx,[V[5]||(V[5]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),d("div",Qx,[(v(!0),y(we,null,Ne(r.commit.branches,Z=>(v(),y("span",{key:Z,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},A(Z),1))),128))])])):F("",!0),r.commit.tags?.length>0?(v(),y("div",Px,[V[6]||(V[6]=d("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),d("div",Tx,[(v(!0),y(we,null,Ne(r.commit.tags,Z=>(v(),y("span",{key:Z,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},A(Z),1))),128))])])):F("",!0)]),d("div",Mx,[V[7]||(V[7]=d("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),d("div",Ax,A(r.commit.message.split(`
|
|
6
|
+
`)[0]),1)]),r.commit.body?(v(),y("div",_x,[V[8]||(V[8]=d("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),d("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:l.value},null,8,Rx)])):F("",!0),r.stats?(v(),y("div",Bx,[d("div",Zx,[d("span",Ex,A(c.value),1)]),r.stats.additions>0||r.stats.deletions>0?(v(),y("div",Dx,[d("span",Lx,"+"+A(r.stats.additions),1),d("div",Xx,[d("div",{class:"bg-retro-green h-full transition-all",style:tr({width:Q.value.addPct+"%"})},null,4),d("div",{class:"bg-retro-red h-full transition-all",style:tr({width:Q.value.delPct+"%"})},null,4)]),d("span",Ix,"-"+A(r.stats.deletions),1)])):F("",!0)])):F("",!0),r.files?(v(),y("div",Vx,[d("div",zx,[d("h4",Nx," Files Changed ("+A(r.files.length)+") ",1),d("div",Wx,[d("button",{onClick:V[0]||(V[0]=Z=>i.value="flat"),class:_e(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",i.value==="flat"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Flat file list",title:"Flat file list"},[ee(m(hp),{class:"w-4 h-4"})],2),d("button",{onClick:V[1]||(V[1]=Z=>i.value="tree"),class:_e(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",i.value==="tree"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Tree file view",title:"Tree file view"},[ee(m(Wh),{class:"w-4 h-4"})],2)])]),r.files.length===0?(v(),y("div",qx," No files changed in this commit. ")):i.value==="flat"?(v(),y("ul",jx,[(v(!0),y(we,null,Ne(r.files,Z=>(v(),y("li",{key:Z.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:U=>ie(Z)},[d("span",{class:_e(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",S(Z.status).colorClass]),title:S(Z.status).label},A(Z.status),11,Fx),ee(m(Os),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",Ux,[Z.status==="R"&&Z.oldPath?(v(),y(we,{key:0},[d("span",Gx,A(Z.oldPath),1),V[9]||(V[9]=d("span",{class:"text-retro-yellow mx-1"},"→",-1)),d("span",Hx,A(Z.path),1)],64)):(v(),y(we,{key:1},[Ie(A(Z.path),1)],64))]),!Z.binary&&(Z.additions>0||Z.deletions>0)?(v(),y("span",Kx,[Z.additions>0?(v(),y("span",Jx,"+"+A(Z.additions),1)):F("",!0),Z.deletions>0?(v(),y("span",ey,"-"+A(Z.deletions),1)):F("",!0)])):Z.binary?(v(),y("span",ty,"binary")):F("",!0)],8,Yx))),128))])):(v(),y("div",ry,[d("div",{class:"flex items-center gap-2 mb-1"},[d("button",{onClick:x,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),V[10]||(V[10]=d("span",{class:"text-retro-muted text-xs"},"|",-1)),d("button",{onClick:k,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(v(!0),y(we,null,Ne(O.value,Z=>(v(),y("div",{key:Z.key,class:_e(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":Z.isDirectory}]),style:tr({paddingLeft:Z.depth*16+4+"px"}),onClick:U=>Z.isDirectory?b(Z.fullPath):Z.file?ie(Z.file):void 0},[Z.isDirectory?(v(),y(we,{key:0},[ee(m(H1),{class:_e(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":Z.expanded}])},null,8,["class"]),ee(m(Wh),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),d("span",sy,A(Z.name),1)],64)):Z.file?(v(),y(we,{key:1},[d("span",{class:_e(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",S(Z.file.status).colorClass]),title:S(Z.file.status).label},A(Z.file.status),11,iy),ee(m(Os),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),d("span",oy,[Z.file.status==="R"&&Z.file.oldPath?(v(),y(we,{key:0},[d("span",ay,A(Z.file.oldPath.split("/").pop()),1),V[11]||(V[11]=d("span",{class:"text-retro-yellow mx-1"},"→",-1)),d("span",ly,A(Z.name),1)],64)):(v(),y(we,{key:1},[Ie(A(Z.name),1)],64))]),!Z.file.binary&&(Z.file.additions>0||Z.file.deletions>0)?(v(),y("span",cy,[Z.file.additions>0?(v(),y("span",uy,"+"+A(Z.file.additions),1)):F("",!0),Z.file.deletions>0?(v(),y("span",hy,"-"+A(Z.file.deletions),1)):F("",!0)])):Z.file.binary?(v(),y("span",dy,"binary")):F("",!0)],64)):F("",!0)],14,ny))),128))]))])):r.loading?(v(),y("div",fy,[...V[12]||(V[12]=[d("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ie(" Loading file changes... ",-1)])])):(v(),y("div",my," Failed to load file changes. "))])],544))}}),gy=ws(py,[["__scopeId","data-v-29f450ea"]]),Oy={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},vy={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},by={class:"flex items-center gap-2 min-w-0"},xy={class:"text-retro-muted text-sm"},yy={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},ky={class:"flex-1 overflow-auto p-4 space-y-3"},wy={class:"space-y-2"},Sy=["disabled"],$y={class:"space-y-1"},Cy={class:"flex items-center justify-between"},Qy={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},Py={key:0,class:"text-retro-muted text-xs py-1"},Ty={key:1,class:"space-y-0.5"},My=["aria-label","onClick"],Ay={class:"text-retro-text font-mono text-xs truncate"},_y={class:"space-y-1"},Ry={class:"flex items-center justify-between"},By={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},Zy={key:0,class:"text-retro-muted text-xs py-1"},Ey={key:1,class:"space-y-0.5"},Dy=["aria-label","onClick"],Ly={class:"text-retro-text font-mono text-xs truncate"},Xy=Ve({__name:"GitUncommittedDetail",props:{stagedFiles:{default:()=>[]},unstagedFiles:{default:()=>[]},isStaging:{type:Boolean,default:!1},isCommitting:{type:Boolean,default:!1}},emits:["close","stageFiles","unstageFiles","stageAll","unstageAll","commit"],setup(r,{emit:e}){const t=r,n=e,s=P(""),i=P(!1),o=J(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!i.value&&!t.isCommitting);function a(O){return Fs[O]||{label:O,colorClass:"text-retro-muted"}}function l(){n("close")}function c(O){n("stageFiles",[O.path])}function u(O){n("unstageFiles",[O.path])}function h(){n("stageAll")}function f(){n("unstageAll")}async function p(){o.value&&(i.value=!0,n("commit",s.value.trim()),s.value="",i.value=!1)}function g(O){(O.metaKey||O.ctrlKey)&&O.key==="Enter"&&(O.preventDefault(),p())}return(O,b)=>(v(),y("section",Oy,[d("div",vy,[d("div",by,[ee(m(Oo),{class:"w-4 h-4 text-retro-yellow"}),b[1]||(b[1]=d("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),d("span",xy,"("+A(r.stagedFiles.length+r.unstagedFiles.length)+" files)",1),t.isStaging?(v(),y("div",yy)):F("",!0)]),d("button",{onClick:l,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close uncommitted changes details"},[ee(m(St),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),d("div",ky,[d("div",wy,[je(d("textarea",{"onUpdate:modelValue":b[0]||(b[0]=x=>Je(s)?s.value=x:null),placeholder:"Commit message...",rows:"3",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none font-mono",onKeydown:g},null,544),[[Rt,m(s)]]),d("button",{disabled:!m(o),class:_e(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",m(o)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:p},A(m(i)||t.isCommitting?"Committing...":`Commit (${r.stagedFiles.length} staged)`),11,Sy)]),d("div",$y,[d("div",Cy,[d("h4",Qy," Staged Changes ("+A(r.stagedFiles.length)+") ",1),r.stagedFiles.length>0?(v(),y("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:f}," Unstage All ")):F("",!0)]),r.stagedFiles.length===0?(v(),y("div",Py," No staged files. Stage files below to commit. ")):(v(),y("ul",Ty,[(v(!0),y(we,null,Ne(r.stagedFiles,x=>(v(),y("li",{key:"staged-"+x.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[d("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-red/20 transition-colors opacity-60 group-hover:opacity-100",title:"Unstage file","aria-label":`Unstage ${x.path}`,onClick:k=>u(x)},[ee(m(Bv),{class:"w-3.5 h-3.5 text-retro-red"})],8,My),d("span",{class:_e(["flex-shrink-0 w-4 text-center text-xs font-bold",a(x.status).colorClass])},A(x.status),3),ee(m(Os),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),d("span",Ay,A(x.oldPath?`${x.oldPath} → ${x.path}`:x.path),1)]))),128))]))]),d("div",_y,[d("div",Ry,[d("h4",By," Unstaged Changes ("+A(r.unstagedFiles.length)+") ",1),r.unstagedFiles.length>0?(v(),y("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:h}," Stage All ")):F("",!0)]),r.unstagedFiles.length===0?(v(),y("div",Zy," No unstaged changes. ")):(v(),y("ul",Ey,[(v(!0),y(we,null,Ne(r.unstagedFiles,x=>(v(),y("li",{key:"unstaged-"+x.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[d("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-green/20 transition-colors opacity-60 group-hover:opacity-100",title:"Stage file","aria-label":`Stage ${x.path}`,onClick:k=>c(x)},[ee(m(dl),{class:"w-3.5 h-3.5 text-retro-green"})],8,Dy),d("span",{class:_e(["flex-shrink-0 w-4 text-center text-xs font-bold",a(x.status).colorClass])},A(x.status),3),ee(m(Os),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),d("span",Ly,A(x.oldPath?`${x.oldPath} → ${x.path}`:x.path),1)]))),128))]))])])]))}}),Iy=["aria-label"],Vy={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},zy={key:0,class:"my-1 border-t border-retro-border",role:"separator"},Ny=["aria-disabled","onClick","onMouseenter"],Wy={key:1,class:"w-4 h-4 flex-shrink-0"},rd=220,qy=36,jy=9,Yy=29,hn=8,xo=Ve({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(r,{emit:e}){const t=r,n=e,s=P(null),i=P(-1),o=J(()=>t.items.map((p,g)=>({item:p,i:g})).filter(({item:p})=>!p.disabled).map(({i:p})=>p));let a=!1;function l(p){a&&s.value&&!s.value.contains(p.target)&&n("close")}gt(()=>{requestAnimationFrame(()=>{a=!0}),document.addEventListener("mousedown",l),document.addEventListener("contextmenu",l),It(()=>{s.value?.focus()})}),wt(()=>{a=!1,document.removeEventListener("mousedown",l),document.removeEventListener("contextmenu",l)});function c(p){const g=o.value;if(g.length===0)return;if(i.value===-1){i.value=p===1?g[0]:g[g.length-1];return}const O=g.indexOf(i.value);if(O===-1){i.value=p===1?g[0]:g[g.length-1];return}const b=O+p;b>=0&&b<g.length&&(i.value=g[b])}function u(p){switch(p.key){case"Escape":p.preventDefault(),n("close");break;case"ArrowDown":p.preventDefault(),c(1);break;case"ArrowUp":p.preventDefault(),c(-1);break;case"Enter":{p.preventDefault();const g=t.items[i.value];g&&!g.disabled&&(n("action",g.key),n("close"));break}}}function h(p){p.disabled||(n("action",p.key),n("close"))}const f=J(()=>{const p=t.title?Yy:0,g=t.items.filter(w=>w.separator).length,O=t.items.length*qy+g*jy+hn,b=p+O;let x=t.x,k=t.y;return typeof window<"u"&&(x+rd>window.innerWidth-hn&&(x=window.innerWidth-rd-hn),x<hn&&(x=hn),k+b>window.innerHeight-hn&&(k=window.innerHeight-b-hn),k<hn&&(k=hn)),{left:`${x}px`,top:`${k}px`}});return(p,g)=>(v(),pe(Pr,{to:"body"},[d("div",{ref_key:"menuRef",ref:s,class:"fixed z-50 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px]",style:tr(m(f)),role:"menu","aria-label":r.title??"Context menu",tabindex:"-1",onKeydown:u},[r.title?(v(),y("div",Vy,A(r.title),1)):F("",!0),(v(!0),y(we,null,Ne(r.items,(O,b)=>(v(),y(we,{key:O.key},[O.separator?(v(),y("div",zy)):F("",!0),d("button",{class:_e(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[O.disabled?"text-retro-muted/50 cursor-not-allowed":O.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",m(i)===b?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",m(i)===b?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":O.disabled||void 0,tabindex:-1,onClick:x=>h(O),onMouseenter:x=>i.value=O.disabled?m(i):b,onMouseleave:g[0]||(g[0]=x=>i.value=-1)},[O.icon?(v(),pe(ps(O.icon),{key:0,class:_e(["w-4 h-4 flex-shrink-0",O.disabled?"opacity-50":O.danger?"":"text-retro-muted"])},null,8,["class"])):(v(),y("span",Wy)),Ie(" "+A(O.label),1)],42,Ny)],64))),128))],44,Iy)]))}}),Fy=Ve({__name:"GitBranchMenu",props:{branchName:{},isCurrentBranch:{type:Boolean},isLocal:{type:Boolean},x:{},y:{}},emits:["close","checkout","createBranch","deleteBranch","rename","merge","rebase","push","pull","fetch","copyName"],setup(r,{emit:e}){const t=r,n=e,s=J(()=>[{key:"checkout",label:"Checkout",icon:gs,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:K1,separator:!0},{key:"deleteBranch",label:"Delete",icon:vn,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:ap,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:rp,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:np,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Ys,separator:!0}]),i=J(()=>[{key:"checkout",label:"Checkout",icon:gs},{key:"deleteBranch",label:"Delete Remote Branch",icon:vn,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:up,separator:!0},{key:"pull",label:"Pull into Current",icon:mv},{key:"copyName",label:"Copy Branch Name",icon:Ys,separator:!0}]),o=J(()=>t.isLocal?s.value:i.value),a={checkout:()=>n("checkout"),createBranch:()=>n("createBranch"),deleteBranch:()=>n("deleteBranch"),rename:()=>n("rename"),merge:()=>n("merge"),rebase:()=>n("rebase"),push:()=>n("push"),pull:()=>n("pull"),fetch:()=>n("fetch"),copyName:()=>n("copyName")};function l(c){a[c]?.(),n("close")}return(c,u)=>{const h=xo;return v(),pe(h,{items:m(o),x:r.x,y:r.y,title:r.branchName,onAction:l,onClose:u[0]||(u[0]=f=>n("close"))},null,8,["items","x","y","title"])}}}),Uy=Ve({__name:"GitCommitMenu",props:{commit:{},x:{},y:{}},emits:["close","addTag","createBranch","checkout","cherryPick","revert","mergeInto","reset","copyHash","copySubject"],setup(r,{emit:e}){const t=e,n=J(()=>[{key:"addTag",label:"Add Tag",icon:Du},{key:"createBranch",label:"Create Branch",icon:dl},{key:"checkout",label:"Checkout (detached HEAD)",icon:gs,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:$v},{key:"revert",label:"Revert",icon:sp},{key:"mergeInto",label:"Merge into Current",icon:ap,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:rp,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:Ys,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Ys}]),s={addTag:()=>t("addTag"),createBranch:()=>t("createBranch"),checkout:()=>t("checkout"),cherryPick:()=>t("cherryPick"),revert:()=>t("revert"),mergeInto:()=>t("mergeInto"),reset:()=>t("reset"),copyHash:()=>t("copyHash"),copySubject:()=>t("copySubject")};function i(o){s[o]?.(),t("close")}return(o,a)=>{const l=xo;return v(),pe(l,{items:m(n),x:r.x,y:r.y,title:r.commit.shortHash,onAction:i,onClose:a[0]||(a[0]=c=>t("close"))},null,8,["items","x","y","title"])}}}),Gy=Ve({__name:"GitTagMenu",props:{tagName:{},x:{},y:{}},emits:["close","viewDetails","deleteTag","pushTag","copyName"],setup(r,{emit:e}){const t=e,n=[{key:"viewDetails",label:"View Details",icon:Du},{key:"deleteTag",label:"Delete Tag",icon:vn,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:np},{key:"copyName",label:"Copy Tag Name",icon:Ys,separator:!0}],s={viewDetails:()=>t("viewDetails"),deleteTag:()=>t("deleteTag"),pushTag:()=>t("pushTag"),copyName:()=>t("copyName")};function i(o){s[o]?.()}return(o,a)=>{const l=xo;return v(),pe(l,{items:n,x:r.x,y:r.y,title:r.tagName,onClose:a[0]||(a[0]=c=>t("close")),onAction:i},null,8,["x","y","title"])}}}),Hy=Ve({__name:"GitStashMenu",props:{stashIndex:{},stashMessage:{},x:{},y:{}},emits:["close","apply","pop","drop","createBranch","copyName","copyHash"],setup(r,{emit:e}){const t=e,n=[{key:"apply",label:"Apply Stash",icon:fv},{key:"pop",label:"Pop Stash",icon:sp},{key:"createBranch",label:"Create Branch from Stash",icon:J1,separator:!0},{key:"drop",label:"Drop Stash",icon:vn,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Ys,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:Av}],s={apply:()=>t("apply"),pop:()=>t("pop"),drop:()=>t("drop"),createBranch:()=>t("createBranch"),copyName:()=>t("copyName"),copyHash:()=>t("copyHash")};function i(o){s[o]?.()}return(o,a)=>{const l=xo;return v(),pe(l,{items:n,x:r.x,y:r.y,title:r.stashMessage,onClose:a[0]||(a[0]=c=>t("close")),onAction:i},null,8,["x","y","title"])}}}),Ky=Ve({__name:"GitUncommittedMenu",props:{x:{},y:{}},emits:["close","stash","reset","clean"],setup(r,{emit:e}){const t=e,n=[{key:"stash",label:"Stash Uncommitted Changes",icon:dv},{key:"reset",label:"Reset Working Directory",icon:gs,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:vn,danger:!0}],s={stash:()=>t("stash"),reset:()=>t("reset"),clean:()=>t("clean")};function i(o){s[o]?.()}return(o,a)=>{const l=xo;return v(),pe(l,{items:n,x:r.x,y:r.y,title:"Uncommitted Changes",onClose:a[0]||(a[0]=c=>t("close")),onAction:i},null,8,["x","y"])}}});async function Jy(r,e,t){try{return(await $fetch("/api/git/merge-base",{params:{workingDirectory:r,branch:e,baseBranch:t??void 0}})).mergeBase}catch{return null}}function nd(r){const e={};for(const{branch:t,mergeBase:n}of r)t&&n&&(e[t]=n);return e}async function ek(r){return $fetch("/api/git/file-diff",{query:r})}async function tk(r){return $fetch("/api/git/diff",{query:r})}const ml=Mu("gitGraph",()=>{const r=P([]),e=P([]),t=P([]),n=P(new Set),s=P([]),i=P([]),o=P(0),a=P(!1),l=P(null),c=P(null),u=P(null),h=P(!1),f=P(null),p=P(!1),g=P(0),O=P(""),b=P([]),x=P(null),k=P(!1),w=P(!1),S=P(!1),Q=P(!1),L=8e3,E=P(null);let G=null;function oe(Y){E.value=Y,G&&clearTimeout(G),G=setTimeout(()=>{E.value=null},L)}function ie(){E.value=null,G&&(clearTimeout(G),G=null)}async function j(Y,se,Xe,Ut){if(!x.value)return{success:!1,error:"No working directory set"};try{const zr=await $fetch(Y,{method:Ut?.method??"POST",body:{workingDirectory:x.value,...se}});return(Ut?.reloadGraph??!0)&&await sr(x.value),{success:!0,data:zr}}catch(zr){const Nr=Xo(zr,Xe);return oe(Nr),{success:!1,error:Nr}}}const V=P(null),Z=P(!1),U=P(!1),W=P(null),N=P([]),I=P([]),z=P(null),be=P(null),K=P(null),H=P("inline"),re=P("list"),Oe=P("rounded"),ge=P(!1),$e=P({date:!0,author:!0,commit:!0}),Pe=P(0),Fe=P(0),T=P(null),M=P(null),D=P(null),B=P(null),xe=P(null),Re=P(null),Me=P(null),ue=P(null),ne=P(null),Ce=P(null),q=P(null),ve=P(!1),Ze=Zb(),it=J(()=>{if(!O.value&&b.value.length===0)return r.value;let Y=r.value;if(O.value&&(Y=Ze.filter(Y,O.value)),b.value.length>0){const se=new Set(b.value);Y=Bb(Y,se)}return Y}),Nt=J(()=>e.value.find(Y=>Y.isHead)||null);async function sr(Y){x.value=Y,h.value=!0,f.value=null;try{const[se,Xe,Ut,zr,Nr]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:Y}}),$fetch("/api/git/status",{query:{workingDirectory:Y}}),$fetch("/api/git/stash",{query:{workingDirectory:Y}}).then(Pn=>Pn.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:Y}}).then(Pn=>Pn.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:Y}}).then(Pn=>Pn.state).catch(()=>null)]);r.value=se.commits,e.value=se.branches,t.value=se.tags,n.value=new Set(se.localBranches??[]),p.value=se.hasMore,g.value=se.totalCount,s.value=Xe.stagedFiles??[],i.value=Xe.unstagedFiles??[],o.value=(Xe.stagedCount??0)+(Xe.unstagedCount??0),N.value=Ut,I.value=zr,W.value=Nr,V.value=Date.now(),await Ts()}catch(se){const Xe=se instanceof Error?se.message:"Failed to load git graph";f.value=Xe,r.value=[],e.value=[],t.value=[],s.value=[],i.value=[],o.value=0,N.value=[],I.value=[]}finally{h.value=!1}}async function on(){if(x.value)try{const Y=await $fetch("/api/git/status",{query:{workingDirectory:x.value}});s.value=Y.stagedFiles??[],i.value=Y.unstagedFiles??[],o.value=(Y.stagedCount??0)+(Y.unstagedCount??0)}catch(Y){console.error("Failed to refresh uncommitted changes:",Y)}}const xr=P(!1);async function qn(){if(!(!x.value||!p.value||h.value||xr.value)){xr.value=!0;try{const Y=await $fetch("/api/git/log",{query:{workingDirectory:x.value,offset:r.value.length}});r.value=[...r.value,...Y.commits],p.value=Y.hasMore}catch(Y){console.error("Failed to load more commits:",Y)}finally{xr.value=!1}}}async function an(Y){if(l.value=Y,c.value=null,u.value=null,a.value=!1,k.value=!0,!x.value){k.value=!1;return}try{const se=await $fetch("/api/git/show",{query:{workingDirectory:x.value,hash:Y.hash}});c.value=se.files,u.value=se.stats}catch(se){console.error("Failed to load commit details:",se),c.value=[],u.value={additions:0,deletions:0,filesChanged:0},oe("Failed to load commit details")}finally{k.value=!1}}function jn(){l.value=null,c.value=null,u.value=null,a.value=!1}function ln(){l.value=null,u.value=null,c.value=null,a.value=!0}function Sn(Y){O.value=Y,Pe.value=0,Wt()}const Et=J(()=>O.value?Op(r.value,O.value).map(Y=>Y.hash):[]);function Wt(){Fe.value=Et.value.length}function he(){Et.value.length!==0&&(Pe.value=(Pe.value+1)%Et.value.length,Wt(),Be())}function ye(){Et.value.length!==0&&(Pe.value=Pe.value<=0?Et.value.length-1:Pe.value-1,Wt(),Be())}function Be(){const Y=Et.value[Pe.value];if(Y){const se=r.value.find(Xe=>Xe.hash===Y);se&&an(se)}}function Ye(Y){const se=b.value.indexOf(Y);se===-1?b.value.push(Y):b.value.splice(se,1)}function Ue(){O.value="",b.value=[]}async function Ct(Y){if(!x.value)return{success:!1,error:"No working directory set"};Q.value=!0;try{const se=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:x.value,branchName:Y}});return se.success&&await sr(x.value),{success:se.success,error:se.error}}catch(se){const Xe=se instanceof Error?se.message:"Failed to checkout branch";return oe(Xe),{success:!1,error:Xe}}finally{Q.value=!1}}async function ot(Y,se){if(!x.value)return{success:!1,error:"No working directory set"};try{const Xe=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:x.value,branchName:Y,createBranch:!0,fromCommit:se}});return Xe.success&&await sr(x.value),{success:Xe.success,error:Xe.error}}catch(Xe){return{success:!1,error:Xe instanceof Error?Xe.message:"Failed to create branch"}}}async function Ft(Y,se=!1){return j("/api/git/branch",{branchName:Y,force:se},"Failed to delete branch",{method:"DELETE"})}async function ir(Y){return j("/api/git/branch",{branchName:Y,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function yr(Y){if(!x.value)return{success:!1,error:"No working directory set"};w.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:x.value,files:Y}}),await on(),{success:!0}}catch(se){const Xe=se instanceof Error?se.message:"Failed to stage files";return oe(Xe),{success:!1,error:Xe}}finally{w.value=!1}}async function Yn(Y){if(!x.value)return{success:!1,error:"No working directory set"};w.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:x.value,files:Y}}),await on(),{success:!0}}catch(se){const Xe=se instanceof Error?se.message:"Failed to unstage files";return oe(Xe),{success:!1,error:Xe}}finally{w.value=!1}}async function Xr(Y){if(!x.value)return{success:!1,error:"No working directory set"};S.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:x.value,message:Y}}),await sr(x.value),{success:!0}}catch(se){const Xe=se instanceof Error?se.message:"Failed to commit changes";return oe(Xe),{success:!1,error:Xe}}finally{S.value=!1}}async function hi(Y,se){return j("/api/git/branch-rename",{oldName:Y,newName:se},"Failed to rename branch")}async function di(Y,se){return j("/api/git/merge",{branch:Y,...se},"Failed to merge branch")}async function fi(Y){return j("/api/git/rebase",{onto:Y},"Failed to rebase branch")}async function mi(Y,se,Xe,Ut){return j("/api/git/push",{branch:Y,remote:se,force:Xe,forceWithLease:Ut},"Failed to push branch")}async function pi(Y,se,Xe,Ut){return j("/api/git/pull",{branch:Y,remote:se,noFastForward:Xe,squash:Ut},"Failed to pull branch")}async function gi(Y,se,Xe){return j("/api/git/fetch",{branch:Y,remote:se,...Xe},"Failed to fetch")}async function Oi(Y,se,Xe){return j("/api/git/cherry-pick",{hash:Y,recordOrigin:se,noCommit:Xe},"Failed to cherry-pick commit")}async function vi(Y){return j("/api/git/revert",{hash:Y},"Failed to revert commit")}async function bi(Y,se){return j("/api/git/reset",{hash:Y,mode:se},"Failed to reset to commit")}async function xi(Y){if(!x.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:x.value,branchName:Y}}),await sr(x.value),{success:!0}}catch(se){const Xe=se?.data?.message||se?.statusMessage||se?.message||"Failed to checkout commit";return oe(Xe),{success:!1,error:Xe}}}async function Dt(Y){const se=Y.message.split(`
|
|
7
|
+
`)[0];return lr(se)}async function or(Y,se,Xe,Ut,zr){return j("/api/git/tag",{name:Y,hash:se,annotated:Xe,message:Ut,pushToRemote:zr},"Failed to create tag")}async function Ss(Y,se){return j("/api/git/tag",{name:Y,deleteFromRemote:se},"Failed to delete tag",{method:"DELETE"})}async function cn(Y,se){return j("/api/git/tag-push",{name:Y,remote:se},"Failed to push tag")}async function $n(Y){if(!x.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(Y)}`,{query:{workingDirectory:x.value}})}}catch(se){const Xe=Xo(se,"Failed to get tag detail");return oe(Xe),{success:!1,error:Xe}}}async function $s(Y){return lr(Y)}async function Cn(){if(!x.value)return{success:!1,error:"No working directory set"};try{const Y=await $fetch("/api/git/stash",{query:{workingDirectory:x.value}});return N.value=Y.stashes,{success:!0}}catch(Y){const se=Xo(Y,"Failed to load stashes");return oe(se),{success:!1,error:se}}}async function un(Y,se){return j("/api/git/stash-apply",{index:Y,reinstateIndex:se},"Failed to apply stash")}async function yi(Y,se){return j("/api/git/stash-pop",{index:Y,reinstateIndex:se},"Failed to pop stash")}async function Cs(Y){return j("/api/git/stash-drop",{index:Y},"Failed to drop stash")}async function Qn(Y,se){return j("/api/git/stash-branch",{index:Y,branchName:se},"Failed to create branch from stash")}async function Ot(Y,se){return j("/api/git/stash",{message:Y,includeUntracked:se},"Failed to stash changes")}async function _r(){if(!x.value)return{success:!1,error:"No working directory set"};try{const Y=await $fetch("/api/git/remotes",{query:{workingDirectory:x.value}});return I.value=Y.remotes,{success:!0}}catch(Y){const se=Xo(Y,"Failed to load remotes");return oe(se),{success:!1,error:se}}}async function Fn(Y,se){return j("/api/git/remote",{name:Y,url:se},"Failed to add remote")}async function ki(Y,se){return j("/api/git/remote",{name:Y,newUrl:se},"Failed to edit remote",{method:"PUT"})}async function Un(Y){return j("/api/git/remote",{name:Y},"Failed to delete remote",{method:"DELETE"})}async function Qs(Y,se){return j("/api/git/fetch",{all:!0,prune:Y,pruneTags:se},"Failed to fetch all")}function Ps(){H.value=H.value==="inline"?"bottom":"inline"}function Ir(){re.value=re.value==="list"?"tree":"list"}function ar(Y){Oe.value=Y}function Gn(){ge.value=!ge.value}function wi(Y){$e.value={...$e.value,[Y]:!$e.value[Y]}}async function Vr(Y,se,Xe){if(!se||!x.value){Y.value=null;return}Y.value=await Jy(x.value,se,Xe)}async function Si(Y){T.value=Y,await Vr(M,Y)}async function Hn(Y,se){D.value=Y,xe.value=se??null,await Vr(B,Y,se)}async function Kn(Y,se){Re.value=Y,ue.value=se??null,await Vr(Me,Y,se)}async function Ts(){x.value&&await Promise.all([Vr(M,T.value),Vr(B,D.value,xe.value),Vr(Me,Re.value,ue.value)])}function Ee(Y){const se=r.value.find(Xe=>Xe.hash===Y||Xe.shortHash===Y);se&&an(se)}async function le(Y){return j("/api/git/reset",{hash:"HEAD",mode:Y},"Failed to reset working directory")}async function C(){return j("/api/git/clean",{},"Failed to clean untracked files")}function R(Y){be.value=Y}function _(){be.value=null}function X(Y){K.value=Y}function ce(){K.value=null}const de=P(null),ae=P(null),fe=P(!1),rt=J(()=>!!z.value&&!!l.value);function at(Y){z.value=Y,Y&&l.value&&et()}function qt(){z.value=null,de.value=null,ae.value=null,fe.value=!1}async function et(){if(!(!x.value||!l.value||!z.value)){fe.value=!0;try{const Y=await tk({workingDirectory:x.value,from:z.value.hash,to:l.value.hash});de.value=Y.files,ae.value=Y.stats}catch(Y){console.error("Failed to load comparison:",Y),oe("Failed to load commit comparison"),de.value=null,ae.value=null}finally{fe.value=!1}}}async function lr(Y){try{return await ev(Y),{success:!0}}catch(se){const Xe=se?.message||"Failed to copy to clipboard";return oe(Xe),{success:!1,error:Xe}}}async function Ms(Y,se){ne.value=se,Ce.value=Y,q.value=null,ve.value=!0,await Z1()}function Vh(){ne.value=null,Ce.value=null,q.value=null,ve.value=!1}async function Z1(){if(!x.value||!Ce.value||!ne.value){ve.value=!1;return}ve.value=!0;try{q.value=await ek({workingDirectory:x.value,commitHash:Ce.value,filePath:ne.value.path})}catch(Y){console.error("Failed to load file diff:",Y),oe("Failed to load file diff"),q.value=null}finally{ve.value=!1}}function E1(){r.value=[],e.value=[],t.value=[],n.value=new Set,s.value=[],i.value=[],o.value=0,a.value=!1,l.value=null,c.value=null,u.value=null,h.value=!1,f.value=null,p.value=!1,g.value=0,O.value="",b.value=[],x.value=null,V.value=null,Z.value=!1,U.value=!1,W.value=null,xr.value=!1,k.value=!1,w.value=!1,S.value=!1,Q.value=!1,N.value=[],I.value=[],z.value=null,de.value=null,ae.value=null,fe.value=!1,be.value=null,K.value=null,H.value="inline",re.value="list",Oe.value="rounded",ge.value=!1,$e.value={date:!0,author:!0,commit:!0},Pe.value=0,Fe.value=0,T.value=null,D.value=null,B.value=null,xe.value=null,Re.value=null,Me.value=null,ue.value=null,ne.value=null,Ce.value=null,q.value=null,ve.value=!1,ie(),Ze.clear()}async function D1(){if(!x.value||U.value||h.value)return!1;U.value=!0;try{const Y=(await $fetch("/api/git/state",{query:{workingDirectory:x.value}})).state,se=W.value;if(W.value=Y,V.value=Date.now(),!se)return!1;const Xe=se.headCommit!==Y.headCommit||se.branchListHash!==Y.branchListHash,Ut=se.workingTreeHash!==Y.workingTreeHash,zr=se.stashListHash!==Y.stashListHash;if(Xe){const[Tn,Zo,I1]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:x.value}}),$fetch("/api/git/status",{query:{workingDirectory:x.value}}),$fetch("/api/git/stash",{query:{workingDirectory:x.value}}).then(V1=>V1.stashes).catch(()=>[])]);return r.value=Tn.commits,e.value=Tn.branches,t.value=Tn.tags,n.value=new Set(Tn.localBranches??[]),p.value=Tn.hasMore,g.value=Tn.totalCount,s.value=Zo.stagedFiles??[],i.value=Zo.unstagedFiles??[],o.value=(Zo.stagedCount??0)+(Zo.unstagedCount??0),N.value=I1,await Ts(),!0}if(!Ut&&!zr)return!1;const[Nr,Pn]=await Promise.all([Ut?$fetch("/api/git/status",{query:{workingDirectory:x.value}}):Promise.resolve(null),zr?$fetch("/api/git/stash",{query:{workingDirectory:x.value}}).then(Tn=>Tn.stashes).catch(()=>[]):Promise.resolve(null)]);return Nr&&(s.value=Nr.stagedFiles??[],i.value=Nr.unstagedFiles??[],o.value=(Nr.stagedCount??0)+(Nr.unstagedCount??0)),Pn&&(N.value=Pn),!0}catch(Y){return console.error("Failed to refresh git graph:",Y),!1}finally{U.value=!1}}function L1(){Z.value=!0}function X1(){Z.value=!1}return{commits:Ae(r),branches:Ae(e),tags:Ae(t),localBranchNames:Ae(n),stagedFiles:Ae(s),unstagedFiles:Ae(i),uncommittedChangesCount:Ae(o),isUncommittedChangesSelected:Ae(a),selectedCommit:Ae(l),selectedCommitFiles:Ae(c),selectedCommitStats:Ae(u),loading:Ae(h),loadingMore:Ae(xr),error:Ae(f),hasMore:Ae(p),totalCount:Ae(g),searchQuery:Ae(O),filteredBranches:Ae(b),workingDirectory:Ae(x),stashes:Ae(N),remotes:Ae(I),comparisonCommit:Ae(z),comparisonFiles:Ae(de),comparisonStats:Ae(ae),comparisonLoading:Ae(fe),isComparing:rt,activeDialog:Ae(be),activeContextMenu:Ae(K),detailViewPosition:Ae(H),fileViewMode:Ae(re),graphStyle:Ae(Oe),muteNonAncestral:Ae(ge),columnVisibility:Ae($e),searchResultIndex:Ae(Pe),searchResultCount:Ae(Fe),selectedFeatureId:Ae(T),featureMergeBase:Ae(M),conversationBranch:Ae(D),conversationMergeBase:Ae(B),conversationBaseBranch:Ae(xe),previewBranch:Ae(Re),previewMergeBase:Ae(Me),previewBaseBranch:Ae(ue),diffViewerFile:Ae(ne),diffViewerCommitHash:Ae(Ce),diffViewerContent:Ae(q),diffViewerLoading:Ae(ve),lastRefreshTime:Ae(V),isPollingActive:Ae(Z),isRefreshing:Ae(U),isLoadingDetails:Ae(k),isStaging:Ae(w),isCommitting:Ae(S),isCheckingOut:Ae(Q),operationError:Ae(E),filteredCommits:it,currentBranch:Nt,searchResultHashes:Et,loadGitGraph:sr,loadMoreCommits:qn,refreshUncommittedChanges:on,selectCommit:an,selectUncommittedChanges:ln,clearSelection:jn,setSearchQuery:Sn,toggleBranchFilter:Ye,clearFilters:Ue,nextSearchResult:he,prevSearchResult:ye,checkoutBranch:Ct,createBranch:ot,deleteLocalBranch:Ft,deleteRemoteBranch:ir,stageFiles:yr,unstageFiles:Yn,commitChanges:Xr,reset:E1,clearOperationError:ie,renameBranch:hi,mergeBranch:di,rebaseBranch:fi,pushBranch:mi,pullBranch:pi,fetchBranch:gi,cherryPickCommit:Oi,revertCommit:vi,resetToCommit:bi,checkoutCommit:xi,copyCommitSubject:Dt,createTag:or,deleteTag:Ss,pushTag:cn,getTagDetail:$n,copyTagName:$s,loadStashes:Cn,applyStash:un,popStash:yi,dropStash:Cs,stashBranch:Qn,stashChanges:Ot,loadRemotes:_r,addRemote:Fn,editRemote:ki,deleteRemote:Un,fetchAll:Qs,setActiveDialog:R,clearActiveDialog:_,setActiveContextMenu:X,clearActiveContextMenu:ce,selectComparisonCommit:at,clearComparison:qt,loadComparisonData:et,copyToClipboard:lr,toggleDetailViewPosition:Ps,toggleFileViewMode:Ir,setGraphStyle:ar,toggleMuteNonAncestral:Gn,toggleColumnVisibility:wi,navigateToCommit:Ee,resetWorking:le,cleanUntracked:C,setSelectedFeatureId:Si,setConversationBranch:Hn,setPreviewBranch:Kn,openFileDiff:Ms,closeFileDiff:Vh,checkAndRefresh:D1,startPolling:L1,stopPolling:X1}});async function sd(){if(typeof window>"u")return{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};try{const r=await $fetch("/api/conversations");if(!r||!Array.isArray(r.conversations))return console.warn("[conversationStorage] Invalid data structure from server"),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};r.version!==Ma&&console.warn(`[conversationStorage] Storage version mismatch: ${r.version} vs ${Ma}`);const e=r.conversations.map(l=>{if(!l||typeof l!="object")return l;const c=l;return"claudeSessionId"in c&&!("providerSessionId"in c)?{...c,providerSessionId:c.claudeSessionId}:l}),n=(Array.isArray(r.archivedConversations)?r.archivedConversations:[]).map(l=>{if(!l||typeof l!="object")return l;const c=l;return"claudeSessionId"in c&&!("providerSessionId"in c)?{...c,providerSessionId:c.claudeSessionId}:l}),s=e.filter(iv),i=n.filter(ov),o=e.length-s.length,a=n.length-i.length;return o>0&&console.warn(`[conversationStorage] Discarded ${o} corrupted active conversation(s)`),a>0&&console.warn(`[conversationStorage] Discarded ${a} corrupted archive conversation(s)`),{conversations:s,archivedConversations:i,discardedConversations:o,discardedArchives:a}}catch(r){return console.error("[conversationStorage] Failed to load conversations:",r),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function rk(r,e=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:Ma,conversations:r,archivedConversations:e}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}async function nk(r){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations/update",{method:"POST",body:{version:Ma,conversation:r}}),!0}catch(e){return console.error("Failed to save conversation:",e),!1}}function sk(r){return r?r.map(e=>{switch(e.type){case"text":return e.text;case"tool_use":return`[${e.name}] ${e.inputSummary}`;case"tool_result":return e.isError?`Error: ${e.content.slice(0,100)}`:"";case"thinking":case"result_summary":case"session_init":return"";default:return""}}).filter(Boolean).join(`
|
|
8
|
+
`):""}function Io(r){r.contentBlocks&&(r.content=sk(r.contentBlocks))}function ik(r,e){if(r.type!==e.type)return!0;switch(e.type){case"text":return r.text!==e.text;case"tool_use":{const t=r;return t.name!==e.name||t.inputSummary!==e.inputSummary}case"tool_result":{const t=r;return t.content!==e.content||t.isError!==e.isError}default:return!1}}function ok(r,e,t="info",n,s=Date.now,i=Math.random){return{id:`conflict-msg-${s()}-${i().toString(36).slice(2,7)}`,role:r,content:e,timestamp:s(),type:t,fileRef:n}}function ak(r,e){return e===0?{message:`All ${r} file${r===1?"":"s"} resolved successfully. Click "Continue Rebase" to proceed.`,succeeded:!0}:{message:`Resolution complete: ${r} succeeded, ${e} failed. You can retry or abort.`,succeeded:!1}}function lk(r,e){const t=[];for(let n=0;n<r.length;n+=e)t.push(r.slice(n,n+e));return t}function ck(r,e){return r.filter(t=>!e.has(t.path))}function uk(r){return`Detected ${r} conflicted file${r===1?"":"s"}. Enter optional guidance below and click "Resolve Conflicts Automatically" to start.`}function hk(r){return`Starting AI resolution for ${r} file${r===1?"":"s"} (parallel)...`}async function dk(r){return $fetch("/api/chat/preview",{method:"POST",body:r})}async function fk(r){return $fetch("/api/chat/preview",{method:"DELETE",body:r})}function mk(r,e){return r===e?{kind:"end-current",id:e}:r?{kind:"swap",endId:r,startId:e}:{kind:"start",id:e}}function pk(r){const e=new Map,t=r.setTimer??setTimeout,n=r.clearTimer??clearTimeout;function s(l){if(e.has(l))return;const c=t(()=>{e.delete(l),r.onFlush(l)},r.delayMs);e.set(l,c)}function i(l){const c=e.get(l);c&&(n(c),e.delete(l)),r.onFlush(l)}function o(l){const c=e.get(l);c&&(n(c),e.delete(l))}function a(){for(const l of e.values())n(l);e.clear()}return{schedule:s,flush:i,cancel:o,cancelAll:a,hasPending:l=>e.has(l),pendingCount:()=>e.size}}async function gk(r){return $fetch("/api/chat/finalize",{method:"POST",body:r})}async function Ok(r){return $fetch("/api/chat/rebase",{method:"POST",body:r})}async function vk(r){return $fetch("/api/rebase/conflicts",{params:{worktreePath:r}})}async function bk(r){return $fetch("/api/rebase/resolve",{method:"PUT",body:r})}async function xk(r){const e=r.mode==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue",{mode:t,...n}=r;return $fetch(e,{method:"POST",body:n})}async function id(r){return $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:r}})}async function yk(r){return $fetch("/api/rebase/ai-resolve",{method:"POST",body:r})}const vr=Mu("chat",()=>{const r=P(!1),e=P(av),t=P("ask"),n=P(""),s=P([]),i=P([]),o=P(null),a=P("active"),l=P(new Set),c=new Map,u=P(!1),h=P(0),p=pk({delayMs:1200,onFlush:C=>{const R=s.value.find(_=>_.id===C);R&&(R.updatedAt=new Date().toISOString(),nk(R))}}),g=P(null),O=P(null);let b=null;function x(C){return C?c.get(C)??null:null}function k(C){let R=c.get(C);return R||(R={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},c.set(C,R)),R}const w=J(()=>s.value.find(C=>C.id===o.value)||null),S=J(()=>w.value?.messages??[]),Q=J(()=>(h.value,x(o.value)?.session??null)),L=J(()=>(h.value,x(o.value)?.pendingPermission??null)),E=J(()=>(h.value,x(o.value)?.pendingPlanApproval??null)),G=J(()=>(h.value,x(o.value)?.lastError??null)),oe=J(()=>(h.value,x(o.value)?.debugEvents??[])),ie=J(()=>Q.value?.status==="streaming"),j=J(()=>w.value?.providerSessionId??""),V=J(()=>S.value.length>0),Z=J(()=>S.value[S.value.length-1]||null);function U(C){return l.value.has(C)}const W=J(()=>o.value?l.value.has(o.value):!1),N=J(()=>s.value.length>0),I=J(()=>i.value.length>0),z=J(()=>s.value.length),be=J(()=>z.value>=Fh),K=J(()=>s.value),H=J(()=>i.value),re=J(()=>g.value&&s.value.find(C=>C.id===g.value)||null);function Oe(C){return g.value===C}function ge(C){a.value=C}async function $e(C){if(!(!C?.previewBranch||!C.worktreePath))try{await Xv({previewBranch:C.previewBranch,worktreePath:C.worktreePath})}catch(R){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:C.id,previewBranch:C.previewBranch,worktreePath:C.worktreePath,error:R instanceof Error?R.message:String(R)})}}async function Pe(C){if(U(C))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(_=>_.id===C)===-1)return{success:!1,error:"Conversation not found"};try{const _=await $fetch(`/api/conversations/${C}/archive`,{method:"POST"});return _.success&&_.archived?(p.cancel(C),c.delete(C),s.value=Array.isArray(_.conversations)?_.conversations:s.value.filter(X=>X.id!==C),i.value=Array.isArray(_.archivedConversations)?_.archivedConversations:[_.archived,...i.value],cn(),$n(),g.value===C&&(g.value=null),o.value===C&&(o.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value}}).catch(X=>{console.error("Failed to save active conversation:",X)}),{success:!0}):{success:!1,error:"Failed to archive conversation"}}catch(_){return{success:!1,error:_ instanceof Error?_.message:"Failed to archive conversation"}}}async function Fe(C,R){if(Kn().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${Uh}.`};if(!i.value.some(X=>X.id===C))return{success:!1,error:"Archived conversation not found"};try{const X=await $fetch(`/api/conversations/archives/${C}/restore`,{method:"POST",body:{baseBranch:R}});return X.success&&X.conversation?(s.value=Array.isArray(X.conversations)?X.conversations:[X.conversation,...s.value],Array.isArray(X.archivedConversations)?i.value=X.archivedConversations:i.value=i.value.filter(ce=>ce.id!==C),a.value="active",Cn(X.conversation.id),cn(),Dt(),{success:!0,conversationId:X.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(X){return{success:!1,error:X instanceof Error?X.message:"Failed to restore archived conversation"}}}async function T(C){const R=i.value.findIndex(_=>_.id===C);if(R===-1)return{success:!1,error:"Archived conversation not found"};try{return await $fetch(`/api/conversations/archives/${C}`,{method:"DELETE"}),i.value.splice(R,1),$n(),{success:!0}}catch{return i.value.splice(R,1),Dt(),{success:!0}}}async function M(){if(!(typeof window>"u"))try{const C=await $fetch("/api/settings");if(C){if(typeof C.panelWidth=="number"){const X=C.panelWidth;X>=Gh&&X<=Hh&&(e.value=X)}typeof C.isPanelOpen=="boolean"&&(r.value=C.isPanelOpen),typeof C.activeConversationId=="string"&&(o.value=C.activeConversationId);const{useSettingsStore:R}=await ds(async()=>{const{useSettingsStore:X}=await import("./DDghssmX.js").then(ce=>ce.s);return{useSettingsStore:X}},__vite__mapDeps([0,1,2]),import.meta.url),_=R();await _.hydrate(),t.value=_.permissionMode}}catch(C){console.error("Failed to load chat settings:",C)}}function D(C){t.value=C,typeof window<"u"&&ds(async()=>{const{useSettingsStore:R}=await import("./DDghssmX.js").then(_=>_.s);return{useSettingsStore:R}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:R})=>{R().setPermissionMode(C)})}function B(C,R){const _=R??o.value;if(!_)return;const X=k(_);X.pendingPermission=C,h.value++}function xe(C){const R=C??o.value;if(!R)return;const _=c.get(R);_&&(_.pendingPermission=null,h.value++)}function Re(C,R){const _=R??o.value;if(!_)return;const X=k(_);X.pendingPlanApproval=C,h.value++}function Me(C){const R=C??o.value;if(!R)return;const _=c.get(R);_&&(_.pendingPlanApproval=null,h.value++)}function ue(){r.value=!r.value,q()}function ne(){r.value=!0,q()}function Ce(){r.value=!1,q()}function q(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:r.value}}).catch(C=>{console.error("Failed to save panel state:",C)})}function ve(C){const R=Math.max(Gh,Math.min(Hh,C));e.value=R,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:R}}).catch(_=>{console.error("Failed to save panel width:",_)})}function Ze(C){n.value=C}function it(C,R){const _=R??o.value;if(!_)return;const X=s.value.find(ce=>ce.id===_);X&&(X.providerSessionId=C)}function Nt(C,R){const _=s.value.find(X=>X.id===C);_&&(_.worktreeBranch=R,_.lastCommitTime=new Date().toISOString())}async function sr(C){const R=s.value.find(X=>X.id===C);if(!R?.worktreeBranch)return null;const _=R.worktreeBranch.trim();if(!_)return null;try{const ce=(await $fetch("/api/specs/features")).features.find(de=>de.id===_);return ce?(R.featureId!==ce.id&&(R.featureId=ce.id,R.updatedAt=new Date().toISOString(),Dt()),ce.id):null}catch(X){return console.warn("[chat] Failed to map branch to feature",{conversationId:C,branchName:_,error:X instanceof Error?X.message:String(X)}),null}}function on(C,R,_){const X=s.value.find(ce=>ce.id===C);X&&(X.providerId=R,X.providerModelKey=_)}function xr(C){const R=C??o.value;if(!R)return;const _=s.value.find(X=>X.id===R);_&&(_.providerSessionId="")}function qn(C){return s.value.find(_=>_.id===C)?.providerSessionId??""}function an(C){l.value.add(C)}function jn(C){l.value.delete(C)}function ln(C,R){const _=R??o.value;if(!_)return;const X=s.value.find(ce=>ce.id===_);X&&X.messages.push(C)}function Sn(C,R,_){const X={id:Kh(),role:"user",content:C,attachments:_&&_.length>0?_:void 0,timestamp:new Date().toISOString()};return ln(X,R),X}function Et(C){const R={id:Kh(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return ln(R,C),R}function Wt(C,R,_){const X=_??o.value;if(!X)return;const ce=s.value.find(ae=>ae.id===X);if(!ce)return;const de=ce.messages.findIndex(ae=>ae.id===C);de!==-1&&(ce.messages[de]={...ce.messages[de],...R})}function he(C,R){const _=s.value.find(ce=>ce.id===R);if(!_)return;const X=_.messages.findIndex(ce=>ce.id===C);X!==-1&&(_.messages[X]={..._.messages[X],content:"",status:"streaming",contentBlocks:[]})}function ye(C,R,_){const X=_??o.value;if(!X)return;const ce=s.value.find(ae=>ae.id===X);if(!ce)return;const de=ce.messages.findIndex(ae=>ae.id===C);de!==-1&&(ce.messages[de].content+=R)}function Be(C,R,_){const X=_??o.value;if(!X)return;const ce=s.value.find(ae=>ae.id===X);if(!ce)return;const de=ce.messages.findIndex(ae=>ae.id===C);if(de!==-1){const ae=ce.messages[de],fe=ae.tools?[...ae.tools,R]:[R];ce.messages[de]={...ae,tools:fe}}}function Ye(C,R,_,X){const ce=X??o.value;if(!ce)return;const de=s.value.find(fe=>fe.id===ce);if(!de)return;const ae=de.messages.findIndex(fe=>fe.id===C);if(ae!==-1){const fe=de.messages[ae];if(fe.tools){const rt=fe.tools.findIndex(at=>at.id===R);if(rt!==-1){const at=[...fe.tools];at[rt]={...at[rt],..._},de.messages[ae]={...fe,tools:at}}}}or(ce,!1)}function Ue(C,R){const _=R??o.value;if(!_)return;const X=s.value.find(de=>de.id===_);if(!X)return;const ce=X.messages.find(de=>de.id===C);ce&&!ce.contentBlocks&&(ce.contentBlocks=[])}function Ct(C,R,_){const X=_??o.value;if(!X)return;const ce=s.value.find(ae=>ae.id===X);if(!ce)return;const de=ce.messages.find(ae=>ae.id===C);de&&(de.contentBlocks||(de.contentBlocks=[]),de.contentBlocks.push(R),Io(de))}function ot(C,R,_,X){const ce=X??o.value;if(!ce)return;const de=s.value.find(qt=>qt.id===ce);if(!de)return;const ae=de.messages.find(qt=>qt.id===C);if(!ae?.contentBlocks)return;const fe=ae.contentBlocks.findIndex(qt=>qt.id===R);if(fe===-1)return;const at={...ae.contentBlocks[fe]};_(at),ae.contentBlocks[fe]=at}function Ft(C,R,_,X,ce){const de=X??o.value;if(!de)return;const ae=s.value.find(lr=>lr.id===de);if(!ae)return;const fe=ae.messages.find(lr=>lr.id===C);if(!fe?.contentBlocks)return;const rt=fe.contentBlocks.findIndex(lr=>lr.id===R);if(rt===-1)return;const at=fe.contentBlocks[rt],qt={...at};_(qt),fe.contentBlocks[rt]=qt,ce?.syncContent!==!1&&ik(at,qt)&&Io(fe),or(de,!1)}function ir(C,R,_){const X=_??o.value;if(!X)return;const ce=s.value.find(ae=>ae.id===X);if(!ce)return;const de=ce.messages.find(ae=>ae.id===C);de&&(de.contentBlocks||(de.contentBlocks=[]),de.contentBlocks.push(R),Io(de),or(X,!1))}function yr(C,R,_){const X=_??o.value;if(!X)return null;const ce=s.value.find(ae=>ae.id===X);if(!ce)return null;const de=ce.messages.find(ae=>ae.id===C);return de?.contentBlocks?de.contentBlocks.find(ae=>ae.type==="tool_use"&&ae.toolUseId===R)??null:null}function Yn(C,R,_,X,ce){const de=s.value.find(fe=>fe.id===ce);if(!de)return;const ae=de.messages.findIndex(fe=>fe.id===C);ae!==-1&&(de.messages[ae]={...de.messages[ae],content:_,contentBlocks:R,status:X},or(ce,!0))}function Xr(C,R){const _=R??o.value;if(!_)return;const X=c.get(_);X?.session&&(X.session.status=C,h.value++)}function hi(C,R){const _=R??o.value;if(!_)return;const X=k(_);X.session={sessionId:C,cwd:n.value,status:"streaming",startedAt:new Date().toISOString()},X.lastError=null,h.value++}function di(C){const R=C??o.value;if(!R)return;const _=c.get(R);_?.session&&(_.session.status="idle",h.value++)}function fi(C,R){const _=R??o.value;if(!_)return;const X=k(_);X.session&&(X.session.status="error",X.session.error=C),X.lastError=C,h.value++}function mi(C,R){if(!u.value)return;const _=R??o.value;if(!_)return;const X=k(_),ce=(()=>{if(typeof C.payload=="string")return C.payload;try{return JSON.stringify(C.payload,null,2)}catch{return String(C.payload)}})(),de=8e3,ae=300,fe=ce.length>de?`${ce.slice(0,de)}
|
|
9
|
+
... (truncated)`:ce;X.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:C.direction,channel:C.channel,eventType:C.eventType||"unknown",payload:fe}),X.debugEvents.length>ae&&X.debugEvents.splice(0,X.debugEvents.length-ae),h.value++}function pi(C){u.value=C}function gi(C){const R=C??o.value;if(!R)return;const _=c.get(R);_&&(_.debugEvents=[],h.value++)}function Oi(){if(!o.value)return;const C=s.value.find(_=>_.id===o.value);C&&(C.messages=[]);const R=o.value;c.delete(R),h.value++}function vi(C){const R=C??o.value;if(!R)return;const _=c.get(R);_&&(_.lastError=null,_.session&&(_.session.error=void 0),h.value++)}async function bi(){const C=await sd();if(s.value=C.conversations,i.value=C.archivedConversations,C.discardedArchives>0&&console.warn(`[chat] Skipped ${C.discardedArchives} corrupted archived conversation(s)`),cn(),$n(),!g.value){const R=s.value.find(_=>!!_.previewBranch&&!_.finalized);R&&(g.value=R.id)}if(o.value){const R=s.value.find(_=>_.id===o.value);R&&R.cwd?n.value=R.cwd:R||(o.value=null,r.value=!1)}}async function xi(){const C=await sd(),R=new Map(s.value.map(ae=>[ae.id,ae])),_=new Set(C.conversations.map(ae=>ae.id));let X=0,ce=0,de=0;for(const ae of C.conversations){const fe=R.get(ae.id);if(!fe)s.value.push(ae),R.set(ae.id,ae),X++,console.log(`[chat] refresh: added new conversation ${ae.id} (source=${ae.source}, msgs=${ae.messages.length})`);else if(ae.source!=="user"&&(ae.messages.length>fe.messages.length||ae.updatedAt>(fe.updatedAt||""))){const rt=s.value.findIndex(at=>at.id===ae.id);rt!==-1&&(s.value.splice(rt,1,ae),console.log(`[chat] refresh: updated conversation ${ae.id} (msgs: ${fe.messages.length} → ${ae.messages.length}, updatedAt: ${fe.updatedAt} → ${ae.updatedAt})`)),ce++}else fe&&ae.messages.length!==fe.messages.length&&console.log(`[chat] refresh: skipped update for ${ae.id} (source=${ae.source}, server msgs=${ae.messages.length}, local msgs=${fe.messages.length})`)}for(let ae=s.value.length-1;ae>=0;ae--){const fe=s.value[ae];!_.has(fe.id)&&!l.value.has(fe.id)&&(console.log(`[chat] refresh: removed conversation ${fe.id} (no longer on server)`),o.value===fe.id&&(o.value=null),s.value.splice(ae,1),de++)}return C.archivedConversations&&(i.value=C.archivedConversations),(X>0||ce>0||de>0)&&cn(),console.log(`[chat] refreshServerConversations: loaded=${C.conversations.length}, added=${X}, updated=${ce}, removed=${de}`),X+ce+de}function Dt(){rk(s.value,i.value)}function or(C,R=!1){s.value.find(X=>X.id===C)&&(R?p.flush(C):p.schedule(C))}function Ss(C=!1){o.value&&or(o.value,C)}function cn(){s.value.sort((C,R)=>new Date(R.createdAt).getTime()-new Date(C.createdAt).getTime())}function $n(){i.value.sort((C,R)=>new Date(R.archivedAt).getTime()-new Date(C.archivedAt).getTime())}async function $s(C){if(Kn().atLimit)return"";const _=lv();let X=null;if(C?.featureId){const fe=await ed({conversationId:_,featureId:C.featureId,baseBranch:C.baseBranch});if(!fe.success&&fe.error)throw new Error(fe.error);X=fe}let ce=null;if(typeof window<"u")try{const{useSettingsStore:fe}=await ds(async()=>{const{useSettingsStore:at}=await import("./DDghssmX.js").then(qt=>qt.s);return{useSettingsStore:at}},__vite__mapDeps([0,1,2]),import.meta.url),rt=fe();await rt.hydrate(),ce=rt.providerSelection}catch(fe){console.warn("[chat] Failed to load provider selection for new conversation",fe)}const de=ce||{providerId:tp,modelKey:ep},ae={id:_,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:n.value||process.cwd?.()||"",source:C?.featureId?"cascade":"user",featureId:C?.featureId,providerId:de.providerId,providerModelKey:de.modelKey};if(X?.success&&X.worktreePath&&X.branch&&(ae.worktreePath=X.worktreePath,ae.worktreeBranch=X.branch,ae.cwd=X.worktreePath,ae.hasWorktree=!0,X.baseBranch&&(ae.baseBranch=X.baseBranch)),s.value.unshift(ae),o.value=_,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:_}}).catch(fe=>{console.error("Failed to save active conversation:",fe)}),!C?.featureId)try{const fe=await ed({conversationId:_,baseBranch:C?.baseBranch});if(fe.success&&fe.worktreePath&&fe.branch){const rt=s.value.find(at=>at.id===_);rt&&(rt.worktreePath=fe.worktreePath,rt.worktreeBranch=fe.branch,rt.cwd=fe.worktreePath,rt.hasWorktree=!0,fe.baseBranch&&(rt.baseBranch=fe.baseBranch))}}catch(fe){console.warn("[chat] Failed to create worktree for conversation",_,fe)}return or(_,!0),_}function Cn(C){const R=s.value.find(_=>_.id===C);R&&(o.value=C,r.value=!0,R.cwd&&(n.value=R.cwd),!R.featureId&&R.worktreeBranch&&sr(C),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:C,isPanelOpen:!0}}).catch(_=>{console.error("Failed to save active conversation:",_)}))}async function un(C){const R=s.value.findIndex(X=>X.id===C);if(R===-1)return;const _=s.value[R];if(g.value===C&&(g.value=null),_.hasWorktree&&_.worktreePath&&_.worktreeBranch)try{await Lv({worktreePath:_.worktreePath,branch:_.worktreeBranch})}catch(X){console.warn("[chat] Failed to clean up worktree for conversation",C,X)}s.value.splice(R,1),c.delete(C),p.cancel(C),o.value===C&&(o.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(X=>{console.error("Failed to clear active conversation:",X)})),Dt()}async function yi(C,R,_){const X=s.value.find(de=>de.id===C);if(!X)return{success:!1,error:"Conversation not found"};if(!X.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const ce=_||X.baseBranch;try{const de=await gk({conversationId:C,commitMessage:R,baseBranch:ce,worktreePath:X.worktreePath,worktreeBranch:X.worktreeBranch,previewBranch:X.previewBranch});return de.success?(g.value===C&&(g.value=null),X.worktreePath=void 0,X.worktreeBranch=void 0,X.hasWorktree=!1,X.baseBranch=void 0,X.previewBranch=void 0,X.finalized=!0,X.updatedAt=new Date().toISOString(),Dt()):de.rebaseInProgress&&await Qn(C,X.worktreePath,ce||"main",R),de}catch(de){return{success:!1,error:de instanceof Error?de.message:String(de)}}}async function Cs(C,R){const _=s.value.find(ce=>ce.id===C);if(!_)return{success:!1,error:"Conversation not found"};if(!_.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const X=R||_.baseBranch;try{const ce=await Ok({conversationId:C,baseBranch:X,worktreePath:_.worktreePath});return ce.rebaseInProgress?await Qn(C,_.worktreePath,X||"main","","sync"):ce.success&&(await $e(_),_.baseBranch=X,Dt()),ce}catch(ce){return{success:!1,error:ce instanceof Error?ce.message:String(ce)}}}async function Qn(C,R,_,X,ce="finalize"){O.value={conversationId:C,worktreePath:R,baseBranch:_,commitMessage:X,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:ce,retryCount:0,strategy:"auto",chatMessages:[],userGuidance:"",lifecycleState:"detected"};try{const de=await vk(R);O.value&&(O.value.files=de.files,O.value.loading=!1,Ot("system",uk(de.files.length),"info"))}catch(de){O.value&&(O.value.error=de instanceof Error?de.message:String(de),O.value.loading=!1)}}function Ot(C,R,_="info",X){O.value&&O.value.chatMessages.push(ok(C,R,_,X))}function _r(C){O.value&&(O.value.userGuidance=C)}async function Fn(C,R){if(!O.value)return!1;try{const _=await bk({worktreePath:O.value.worktreePath,filePath:C,content:R});return _.success&&O.value&&O.value.resolvedFiles.add(C),_.success}catch{return!1}}async function ki(){if(!O.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:C,commitMessage:R,baseBranch:_,mode:X,worktreePath:ce}=O.value;try{const de=s.value.find(fe=>fe.id===C),ae=await xk({mode:X,conversationId:C,commitMessage:R,baseBranch:_,worktreePath:ce,worktreeBranch:de?.worktreeBranch,previewBranch:de?.previewBranch});if(ae.success){if(X==="finalize"){g.value===C&&(g.value=null);const fe=s.value.find(rt=>rt.id===C);fe&&(fe.worktreePath=void 0,fe.worktreeBranch=void 0,fe.hasWorktree=!1,fe.baseBranch=void 0,fe.previewBranch=void 0,fe.finalized=!0,fe.updatedAt=new Date().toISOString(),Dt())}else if(X==="sync"){const fe=s.value.find(rt=>rt.id===C);fe&&(await $e(fe),fe.baseBranch=_,fe.updatedAt=new Date().toISOString(),Dt())}O.value=null}else ae.rebaseInProgress&&await Qn(C,ce,_,R,X);return ae}catch(de){return{success:!1,error:de instanceof Error?de.message:String(de)}}}async function Un(){if(!O.value)return!1;try{const C=await id(O.value.worktreePath);return O.value=null,C.success}catch{return O.value=null,!1}}async function Qs(C){if(!O.value)return!1;const R=O.value.files.find(_=>_.path===C);if(!R)return!1;try{const _=await yk({worktreePath:O.value.worktreePath,filePath:C,conflictContent:R.content,userGuidance:O.value.userGuidance||void 0});if(_.success&&_.resolvedContent!==void 0){R.content=_.resolvedContent;const X=await Fn(C,_.resolvedContent);return X?Ot("assistant",`Resolved: ${C}`,"success",C):Ot("assistant",`Failed to write resolved content for ${C}`,"error",C),X}return Ot("assistant",`Failed to resolve ${C}: ${_.error||"Unknown error"}`,"error",C),!1}catch(_){const X=_ instanceof Error?_.message:String(_);return Ot("assistant",`Error resolving ${C}: ${X}`,"error",C),!1}}async function Ps(){if(!O.value)return;const C=ck(O.value.files,O.value.resolvedFiles);if(C.length===0){Ot("system","All files are already resolved.","info");return}b=new AbortController;const R=b.signal;O.value.lifecycleState="resolving";const _=O.value.userGuidance;_&&Ot("user",_),Ot("system",hk(C.length),"info");let X=0,ce=0;const de=lk(C,3);for(const fe of de){if(!O.value||R.aborted)break;for(const at of fe)Ot("assistant",`Resolving: ${at.path}...`,"progress",at.path);const rt=await Promise.all(fe.map(at=>Qs(at.path)));for(const at of rt)at?X++:ce++}if(b=null,!O.value||R.aborted)return;const ae=ak(X,ce);O.value.lifecycleState=ae.succeeded?"resolved":"failed",Ot("system",ae.message,"summary")}async function Ir(){if(!O.value)return;b&&(b.abort(),b=null);const{conversationId:C,worktreePath:R,baseBranch:_,commitMessage:X,mode:ce}=O.value;Ot("system","Resolution cancelled. Resetting conflict state...","info");try{await id(R)}catch{}O.value=null,Ot("system","Conflict resolution aborted and reset.","info")}async function ar(C){const R=s.value.find(_=>_.id===C);if(!R)return{success:!1,error:"Conversation not found"};if(!R.hasWorktree||!R.worktreePath||!R.baseBranch)return{success:!1,error:"No worktree to preview"};try{const _=await dk({conversationId:C,worktreePath:R.worktreePath,baseBranch:R.baseBranch});return _.success&&_.previewBranch&&(R.previewBranch=_.previewBranch,g.value=C,R.updatedAt=new Date().toISOString(),Dt()),{success:_.success,error:_.error}}catch(_){return{success:!1,error:_ instanceof Error?_.message:String(_)}}}async function Gn(C){const R=s.value.find(_=>_.id===C);if(!R)return{success:!1,error:"Conversation not found"};if(!R.previewBranch||!R.baseBranch)return g.value=null,{success:!1,error:"No active preview"};try{const _=await fk({previewBranch:R.previewBranch,baseBranch:R.baseBranch});return _.success&&(R.previewBranch=void 0,g.value=null,R.updatedAt=new Date().toISOString(),Dt()),{success:_.success,error:_.error}}catch(_){return{success:!1,error:_ instanceof Error?_.message:String(_)}}}async function wi(C){const R=mk(g.value,C);if(R.kind==="end-current")return await Gn(R.id);if(R.kind==="swap"){const _=await Gn(R.endId);return _.success?await ar(R.startId):{success:!1,error:`Failed to end previous preview: ${_.error}`}}return await ar(R.id)}function Vr(C){const R=C.trim();if(!R)return null;const _=s.value.filter(X=>X.featureId===R?!0:X.worktreeBranch?.trim()===R);return _.length===0?null:_.sort((X,ce)=>new Date(ce.updatedAt).getTime()-new Date(X.updatedAt).getTime())[0]||null}function Si(C,R){const _=s.value.find(X=>X.id===C);_&&(_.title=R.trim(),_.updatedAt=new Date().toISOString(),cn(),Dt())}function Hn(C){const R=o.value;if(!R)return;const _=s.value.find(ce=>ce.id===R);if(!_||_.title!=="New Conversation")return;const X=_.messages.find(ce=>ce.role==="user");X&&(X.content.trim().length>0?_.title=cv(X.content):X.attachments&&X.attachments.length>0&&(_.title=X.attachments.length===1?"[Image] New Conversation":`[${X.attachments.length} Images] New Conversation`))}function Kn(){const C=s.value.length;return{atLimit:C>=Uh,nearLimit:C>=Fh,count:C}}async function Ts(C,R){o.value||await $s();const _=Sn(C,void 0,R);return Hn(),Ss(!0),_}function Ee(C,R,_){const X=_??o.value;ye(C,R,X??void 0),X&&or(X,!1)}function le(C,R){const _=R??o.value;Wt(C,{status:"complete"},_??void 0),_&&or(_,!0)}return{messages:S,session:Q,isPanelOpen:r,panelWidth:Ae(e),permissionMode:Ae(t),pendingPermission:L,pendingPlanApproval:E,cwd:Ae(n),lastError:G,debugEvents:oe,debugStreamEnabled:Ae(u),providerSessionId:j,conversations:Ae(s),archivedConversations:Ae(i),activeConversationId:Ae(o),conversationViewMode:Ae(a),conflictState:Ae(O),previewingConversationId:Ae(g),isStreaming:ie,hasMessages:V,lastMessage:Z,isActiveConversationStreaming:W,hasConversations:N,hasArchivedConversations:I,activeConversation:w,conversationCount:z,isNearStorageLimit:be,sortedConversations:K,sortedArchivedConversations:H,previewingConversation:re,streamingConversations:Ae(l),initialize:M,togglePanel:ue,openPanel:ne,closePanel:Ce,setPanelWidth:ve,setPermissionMode:D,setPendingPermission:B,clearPendingPermission:xe,setPendingPlanApproval:Re,clearPendingPlanApproval:Me,setCwd:Ze,setProviderSessionId:it,clearProviderSession:xr,getProviderSessionId:qn,updateWorktreeBranch:Nt,setConversationProviderSelection:on,startConversationStreaming:an,endConversationStreaming:jn,isConversationStreaming:U,addMessage:ln,addUserMessage:Sn,addAssistantMessage:Et,updateMessage:Wt,resetMessageForReplay:he,appendToMessage:ye,addToolToMessage:Be,updateToolInMessage:Ye,initContentBlocks:Ue,appendContentBlock:Ct,appendContentBlockWithSave:ir,updateBlockById:ot,updateBlockWithSave:Ft,findToolUseBlock:yr,batchSetMessageBlocks:Yn,syncContentFromBlocks:Io,setSessionStatus:Xr,startSession:hi,endSession:di,setSessionError:fi,setDebugStreamEnabled:pi,pushDebugEvent:mi,clearDebugEvents:gi,clearMessages:Oi,clearError:vi,loadConversations:bi,refreshServerConversations:xi,saveAllConversations:Dt,saveCurrentConversation:Ss,saveConversation:or,createConversation:$s,selectConversation:Cn,deleteConversation:un,archiveConversation:Pe,restoreArchivedConversation:Fe,deleteArchivedConversation:T,setConversationViewMode:ge,findConversationByFeature:Vr,syncConversationFeatureFromBranch:sr,renameConversation:Si,checkStorageLimits:Kn,finalizeConversation:yi,rebaseConversation:Cs,resolveConflictFile:Fn,continueRebase:ki,abortRebase:Un,aiResolveConflictFile:Qs,aiResolveAllConflicts:Ps,addConflictChatMessage:Ot,setConflictUserGuidance:_r,cancelConflictResolution:Ir,previewConversation:ar,unpreviewConversation:Gn,togglePreview:wi,isConversationPreviewing:Oe,addUserMessageWithConversation:Ts,appendToMessageWithSave:Ee,completeMessageWithSave:le}});function kk(r={}){const e=ml(),t=300,n=5e3,s=250;let i=null,o=null,a=null,l=null,c=null,u=!1,h=!1;const f=P(!1),p=P(!1);let g=r;function O(V){g=V}async function b(){const V=g.getScrollPosition?.()??0,Z=await e.checkAndRefresh();return Z&&g.setScrollPosition&&(await It(),g.setScrollPosition(V)),Z}function x(){return f.value||!!e.activeContextMenu||!!e.activeDialog}async function k(){if(x()){p.value=!0;return}S()}async function w(){if(u){h=!0;return}u=!0;try{await b()}finally{u=!1,h&&(h=!1,S())}}function S(){o&&clearTimeout(o),o=setTimeout(()=>{o=null,w()},s)}function Q(V){if(typeof window>"u")return;if(a&&a.readyState===WebSocket.OPEN){a.send(JSON.stringify({type:"watch",workingDirectory:V}));return}l&&(clearTimeout(l),l=null);const U=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;a=new WebSocket(U),a.onopen=()=>{a.send(JSON.stringify({type:"watch",workingDirectory:V}))},a.onmessage=W=>{try{JSON.parse(W.data).type==="git_changed"&&k()}catch{}},a.onclose=()=>{a=null,e.isPollingActive&&c&&(l=setTimeout(()=>{c&&Q(c)},n))},a.onerror=()=>{}}function L(){l&&(clearTimeout(l),l=null),a&&(a.close(),a=null)}function E(V){V&&(c=V),!e.isPollingActive&&(e.startPolling(),c&&Q(c))}function G(){L(),e.stopPolling()}function oe(){f.value=!0,i&&(clearTimeout(i),i=null)}function ie(){i&&clearTimeout(i),i=setTimeout(async()=>{f.value=!1,p.value&&(p.value=!1,S())},t)}function j(){G(),i&&(clearTimeout(i),i=null),o&&(clearTimeout(o),o=null),u=!1,h=!1,c=null}return ze(()=>[e.activeContextMenu,e.activeDialog],()=>{!e.activeContextMenu&&!e.activeDialog&&p.value&&!f.value&&(p.value=!1,S())}),{isUserInteracting:Ae(f),isDeferredRefresh:Ae(p),startPolling:E,stopPolling:G,startInteraction:oe,endInteraction:ie,cleanup:j,setScrollCallbacks:O}}function wk(r){function e(s){if((s.ctrlKey||s.metaKey)&&s.key==="h"){s.preventDefault(),r.onScrollToHead();return}if(s.key==="Escape"){s.preventDefault(),r.onEscape();return}}function t(){document.addEventListener("keydown",e)}function n(){document.removeEventListener("keydown",e)}return{start:t,stop:n}}function Sk(r){const e=P({visible:!1,branchName:"",loading:!1,error:null});async function t(){e.value.loading=!0,e.value.error=null;const K=await r.checkoutBranch(e.value.branchName);e.value.loading=!1,K.success?e.value.visible=!1:e.value.error=K.error||"Unknown error"}const n=P({visible:!1,fromCommit:"",loading:!1,error:null});async function s(K){n.value.loading=!0,n.value.error=null;const H=await r.createBranch(K.name,n.value.fromCommit);n.value.loading=!1,H.success?(K.checkout&&await r.checkoutBranch(K.name),n.value.visible=!1):n.value.error=H.error||"Unknown error"}const i=P({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function o(K){i.value.loading=!0,i.value.error=null;const{branchName:H,isLocal:re}=i.value,Oe=K?.force??i.value.force,ge=re?await r.deleteLocalBranch(H,Oe):await r.deleteRemoteBranch(H);i.value.loading=!1,ge.success?i.value.visible=!1:i.value.error=ge.error||"Unknown error"}const a=P({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function l(){if(!a.value.newName.trim()){a.value.error="Branch name is required";return}a.value.loading=!0,a.value.error=null;const K=await r.renameBranch(a.value.branchName,a.value.newName.trim());a.value.loading=!1,K.success?a.value.visible=!1:a.value.error=K.error||"Unknown error"}const c=P({visible:!1,branchName:"",loading:!1,error:null});async function u(K){c.value.loading=!0,c.value.error=null;const H=await r.mergeBranch(c.value.branchName,K);c.value.loading=!1,H.success?c.value.visible=!1:c.value.error=H.error||"Unknown error"}const h=P({visible:!1,branchName:"",loading:!1,error:null});async function f(){h.value.loading=!0,h.value.error=null;const K=await r.rebaseBranch(h.value.branchName);h.value.loading=!1,K.success?h.value.visible=!1:h.value.error=K.error||"Unknown error"}const p=P({visible:!1,branchName:"",loading:!1,error:null});async function g(K){p.value.loading=!0,p.value.error=null;const H=await r.pushBranch(p.value.branchName,K.remote,K.force,K.forceWithLease);p.value.loading=!1,H.success?p.value.visible=!1:p.value.error=H.error||"Unknown error"}const O=P({visible:!1,branchName:"",loading:!1,error:null});async function b(K){O.value.loading=!0,O.value.error=null;const H=await r.pullBranch(O.value.branchName,K.remote,K.noFastForward,K.squash);O.value.loading=!1,H.success?O.value.visible=!1:O.value.error=H.error||"Unknown error"}const x=P({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function k(K){x.value.loading=!0,x.value.error=null;const H=await r.cherryPickCommit(x.value.commitHash,K.recordOrigin,K.noCommit);x.value.loading=!1,H.success?x.value.visible=!1:x.value.error=H.error||"Unknown error"}const w=P({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function S(K){w.value.loading=!0,w.value.error=null;const H=await r.resetToCommit(w.value.commitHash,K.mode);w.value.loading=!1,H.success?w.value.visible=!1:w.value.error=H.error||"Unknown error"}const Q=P({visible:!1,commitHash:"",loading:!1,error:null});async function L(K){Q.value.loading=!0,Q.value.error=null;const H=await r.createTag(K.name,Q.value.commitHash,K.annotated,K.message,K.pushToRemote);Q.value.loading=!1,H.success?Q.value.visible=!1:Q.value.error=H.error||"Unknown error"}const E=P({visible:!1,tagName:"",loading:!1,error:null});async function G(K){E.value.loading=!0,E.value.error=null;const H=await r.deleteTag(E.value.tagName,K.deleteFromRemote?K.remote||"origin":void 0);E.value.loading=!1,H.success?E.value.visible=!1:E.value.error=H.error||"Unknown error"}const oe=P({visible:!1,tagName:"",loading:!1,tagDetail:null}),ie=P({visible:!1,loading:!1,error:null});async function j(K){ie.value.loading=!0,ie.value.error=null;const H=await r.stashChanges(K.message,K.includeUntracked);ie.value.loading=!1,H.success?ie.value.visible=!1:ie.value.error=H.error||"Unknown error"}const V=P({visible:!1,stashIndex:0,loading:!1,error:null}),Z=P("");async function U(K){V.value.loading=!0,V.value.error=null;const H=await r.stashBranch(V.value.stashIndex,K);V.value.loading=!1,H.success?V.value.visible=!1:V.value.error=H.error||"Unknown error"}const W=P({visible:!1,loading:!1,error:null});async function N(K){W.value.loading=!0,W.value.error=null;const H=await r.resetWorking(K.mode);W.value.loading=!1,H.success?W.value.visible=!1:W.value.error=H.error||"Unknown error"}const I=P({visible:!1,loading:!1,error:null});async function z(){I.value.loading=!0,I.value.error=null;const K=await r.cleanUntracked();I.value.loading=!1,K.success?I.value.visible=!1:I.value.error=K.error||"Unknown error"}const be=J(()=>e.value.visible||n.value.visible||i.value.visible||a.value.visible||c.value.visible||h.value.visible||p.value.visible||O.value.visible||x.value.visible||w.value.visible||Q.value.visible||E.value.visible||oe.value.visible||ie.value.visible||V.value.visible||W.value.visible||I.value.visible);return{checkoutDialog:e,confirmCheckout:t,createBranchDialog:n,confirmCreateBranch:s,deleteBranchDialog:i,confirmDeleteBranch:o,renameDialog:a,confirmRenameBranch:l,mergeDialog:c,confirmMerge:u,rebaseDialog:h,confirmRebase:f,pushDialog:p,confirmPush:g,pullDialog:O,confirmPull:b,cherryPickDialog:x,confirmCherryPick:k,resetDialog:w,confirmReset:S,tagCreateDialog:Q,confirmTagCreate:L,tagDeleteDialog:E,confirmTagDelete:G,tagDetailDialog:oe,stashDialog:ie,confirmStash:j,stashBranchDialog:V,stashBranchInput:Z,confirmStashBranch:U,resetWorkingDialog:W,confirmResetWorking:N,cleanUntrackedDialog:I,confirmCleanUntracked:z,isAnyDialogOpen:be}}function $k(r,e){const t=P({visible:!1,x:0,y:0});function n(q,ve){t.value={visible:!0,x:q,y:ve},setTimeout(()=>{t.value.visible=!1},1500)}const s=P({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function i(q){s.value={visible:!0,...q},r.setActiveContextMenu({type:"branch",props:q,position:{x:q.x,y:q.y}})}function o(){s.value.visible=!1,r.clearActiveContextMenu()}function a(){o(),e.checkoutDialog.value={visible:!0,branchName:s.value.branch,loading:!1,error:null}}function l(){const q=s.value.branch;o(),e.renameDialog.value={visible:!0,branchName:q,newName:q,loading:!1,error:null}}function c(){const{branch:q,isLocal:ve}=s.value;o(),e.deleteBranchDialog.value={visible:!0,branchName:q,isLocal:ve,force:!1,loading:!1,error:null}}function u(){const q=s.value.branch;o(),e.mergeDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function h(){const q=s.value.branch;o(),e.rebaseDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function f(){const q=s.value.branch;o(),e.pushDialog.value={visible:!0,branchName:q,loading:!1,error:null}}function p(){const q=s.value.branch;o(),e.pullDialog.value={visible:!0,branchName:q,loading:!1,error:null}}async function g(){const q=s.value.branch;o(),await r.fetchBranch(q)}async function O(){const{branch:q,x:ve,y:Ze}=s.value;o(),(await r.copyToClipboard(q)).success&&n(ve,Ze)}function b(){o(),e.createBranchDialog.value={visible:!0,fromCommit:s.value.commitHash,loading:!1,error:null}}const x=P({visible:!1,commit:null,x:0,y:0});function k(q){x.value={visible:!0,commit:q.commit,x:q.x,y:q.y},r.setActiveContextMenu({type:"commit",props:q,position:{x:q.x,y:q.y}})}function w(){x.value.visible=!1,r.clearActiveContextMenu()}function S(q){return q===!1?!1:typeof q=="object"&&q!==null&&"success"in q?!!q.success:!0}function Q(q){const ve=x.value.commit;if(!ve)return!1;w();const Ze=q(ve);return Ze&&typeof Ze.then=="function"?Ze.then(S).catch(()=>!1):S(Ze)}function L(){Q(q=>{e.tagCreateDialog.value={visible:!0,commitHash:q.hash,loading:!1,error:null}})}function E(){Q(q=>{e.createBranchDialog.value={visible:!0,fromCommit:q.hash,loading:!1,error:null}})}function G(){Q(q=>{e.checkoutDialog.value={visible:!0,branchName:q.hash,loading:!1,error:null}})}function oe(){Q(q=>{e.cherryPickDialog.value={visible:!0,commitHash:q.hash,commitMessage:q.message,loading:!1,error:null}})}async function ie(){await Q(q=>r.revertCommit(q.hash))}function j(){Q(q=>{e.mergeDialog.value={visible:!0,branchName:q.shortHash,loading:!1,error:null}})}function V(){Q(q=>{e.resetDialog.value={visible:!0,commitHash:q.hash,commitMessage:q.message,loading:!1,error:null}})}async function Z(){const{x:q,y:ve}=x.value;await Q(it=>r.copyToClipboard(it.hash))&&n(q,ve)}async function U(){const{x:q,y:ve}=x.value;await Q(it=>r.copyCommitSubject(it))&&n(q,ve)}const W=P({visible:!1,tag:"",x:0,y:0,commitHash:""});function N(q){W.value={visible:!0,...q},r.setActiveContextMenu({type:"tag",props:q,position:{x:q.x,y:q.y}})}function I(){W.value.visible=!1,r.clearActiveContextMenu()}async function z(){const q=W.value.tag;I(),e.tagDetailDialog.value={visible:!0,tagName:q,loading:!0,tagDetail:null};const ve=await r.getTagDetail(q);e.tagDetailDialog.value.loading=!1,ve.success&&ve.data&&(e.tagDetailDialog.value.tagDetail=ve.data)}function be(){const q=W.value.tag;I(),e.tagDeleteDialog.value={visible:!0,tagName:q,loading:!1,error:null}}async function K(){const q=W.value.tag;I(),await r.pushTag(q)}async function H(){const{tag:q,x:ve,y:Ze}=W.value;I(),(await r.copyToClipboard(q)).success&&n(ve,Ze)}const re=P({visible:!1,x:0,y:0});function Oe(q){re.value={visible:!0,...q},r.setActiveContextMenu({type:"uncommitted",props:q,position:{x:q.x,y:q.y}})}function ge(){re.value.visible=!1,r.clearActiveContextMenu()}function $e(){ge(),e.stashDialog.value={visible:!0,loading:!1,error:null}}function Pe(){ge(),e.resetWorkingDialog.value={visible:!0,loading:!1,error:null}}function Fe(){ge(),e.cleanUntrackedDialog.value={visible:!0,loading:!1,error:null}}const T=P({visible:!1,stash:null,x:0,y:0});function M(q){T.value={visible:!0,stash:q.stash,x:q.x,y:q.y},r.setActiveContextMenu({type:"stash",props:q,position:{x:q.x,y:q.y}})}function D(){T.value.visible=!1,r.clearActiveContextMenu()}function B(q){const ve=T.value.stash;if(!ve)return!1;D();const Ze=q(ve);return Ze&&typeof Ze.then=="function"?Ze.then(S).catch(()=>!1):S(Ze)}async function xe(){await B(q=>r.applyStash(q.index))}async function Re(){await B(q=>r.popStash(q.index))}async function Me(){await B(q=>r.dropStash(q.index))}function ue(){B(q=>{e.stashBranchDialog.value={visible:!0,stashIndex:q.index,loading:!1,error:null}})}async function ne(){const{x:q,y:ve}=T.value;await B(it=>r.copyToClipboard(`stash@{${it.index}}`))&&n(q,ve)}async function Ce(){const{x:q,y:ve}=T.value;await B(it=>r.copyToClipboard(it.hash))&&n(q,ve)}return{copyFeedback:t,showCopyFeedback:n,branchMenu:s,handleBranchContextMenu:i,closeBranchMenu:o,handleBranchCheckout:a,handleBranchRename:l,handleBranchDelete:c,handleBranchMerge:u,handleBranchRebase:h,handleBranchPush:f,handleBranchPull:p,handleBranchFetch:g,handleBranchCopyName:O,handleBranchCreateBranch:b,commitMenu:x,handleCommitContextMenu:k,closeCommitMenu:w,handleCommitAddTag:L,handleCommitCreateBranch:E,handleCommitCheckout:G,handleCommitCherryPick:oe,handleCommitRevert:ie,handleCommitMergeInto:j,handleCommitReset:V,handleCommitCopyHash:Z,handleCommitCopySubject:U,tagMenu:W,handleTagContextMenu:N,closeTagMenu:I,handleTagViewDetails:z,handleTagDelete:be,handleTagPush:K,handleTagCopyName:H,uncommittedMenu:re,handleUncommittedContextMenu:Oe,closeUncommittedMenu:ge,handleUncommittedStash:$e,handleUncommittedReset:Pe,handleUncommittedClean:Fe,stashMenu:T,handleStashContextMenu:M,closeStashMenu:D,handleStashApply:xe,handleStashPop:Re,handleStashDrop:Me,handleStashCreateBranch:ue,handleStashCopyName:ne,handleStashCopyHash:Ce}}const Ck={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Qk={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},Pk={class:"text-sm font-mono text-retro-text"},Tk={class:"p-4"},Mk={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Ak={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},_k=["disabled"],Rk=["disabled"],Bt=Ve({__name:"GitDialog",props:{title:{},visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null},confirmLabel:{default:"Confirm"},confirmDanger:{type:Boolean,default:!1},cancelLabel:{default:"Cancel"}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e;function s(i){i.key==="Escape"&&n("close"),i.key==="Enter"&&!t.loading&&(i.preventDefault(),n("confirm"))}return ze(()=>t.visible,i=>{i?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),wt(()=>{document.removeEventListener("keydown",s)}),(i,o)=>(v(),pe(Pr,{to:"body"},[ee(On,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ut(()=>[r.visible?(v(),y("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:o[3]||(o[3]=kr(a=>n("close"),["self"]))},[d("div",Ck,[d("div",Qk,[d("h3",Pk,A(r.title),1),d("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:o[0]||(o[0]=a=>n("close"))},[ee(m(St),{class:"h-4 w-4"})])]),d("div",Tk,[r.error?(v(),y("div",Mk,A(r.error),1)):F("",!0),Hm(i.$slots,"default")]),d("div",Ak,[d("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-text bg-retro-panel hover:bg-retro-border rounded transition-colors",disabled:r.loading,onClick:o[1]||(o[1]=a=>n("close"))},A(r.cancelLabel),9,_k),d("button",{type:"button",class:_e(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[r.confirmDanger?"text-retro-red bg-retro-red/10 border border-retro-red/30 hover:bg-retro-red/20":"text-retro-black bg-retro-cyan hover:bg-retro-cyan/80"]]),disabled:r.loading,onClick:o[2]||(o[2]=a=>n("confirm"))},A(r.loading?"Loading...":r.confirmLabel),11,Rk)])])])):F("",!0)]),_:3})]))}}),Bk={class:"text-retro-text text-sm font-mono mb-4"},Zk={class:"text-retro-cyan"},Ek={class:"space-y-3"},Dk={class:"flex items-center gap-2 cursor-pointer"},Lk={class:"flex items-center gap-2 cursor-pointer"},Xk={class:"flex items-center gap-2 cursor-pointer"},Ik=Ve({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=P(!1),i=P(!1),o=P(!1);function a(){n("confirm",{noCommit:s.value,noFastForward:i.value,squash:o.value})}return ze(()=>t.visible,l=>{l&&(s.value=!1,i.value=!1,o.value=!1)}),(l,c)=>(v(),pe(Bt,{title:"Merge Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Merge",onClose:c[3]||(c[3]=u=>n("close")),onConfirm:a},{default:ut(()=>[d("p",Bk,[c[4]||(c[4]=Ie(" Merge ",-1)),d("span",Zk,A(r.branchName),1),c[5]||(c[5]=Ie(" into current branch ",-1))]),d("div",Ek,[d("label",Dk,[je(d("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>Je(s)?s.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(s)]]),c[6]||(c[6]=d("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),d("label",Lk,[je(d("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>Je(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(i)]]),c[7]||(c[7]=d("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),d("label",Xk,[je(d("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>Je(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(o)]]),c[8]||(c[8]=d("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Vk={class:"text-retro-text text-sm font-mono mb-2"},zk={class:"text-retro-cyan"},Nk={class:"space-y-3 mt-4"},Wk={class:"flex items-center gap-2 cursor-pointer"},qk=Ve({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=P(!1);function i(){n("confirm",{force:s.value})}return ze(()=>t.visible,o=>{o&&(s.value=!1)}),(o,a)=>(v(),pe(Bt,{title:"Delete Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Delete","confirm-danger":!0,onClose:a[1]||(a[1]=l=>n("close")),onConfirm:i},{default:ut(()=>[a[4]||(a[4]=d("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),d("p",Vk,[Ie(" Delete "+A(r.isLocal?"local":"remote")+" branch ",1),d("span",zk,A(r.branchName),1),a[2]||(a[2]=Ie("? ",-1))]),d("div",Nk,[d("label",Wk,[je(d("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>Je(s)?s.value=l:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(s)]]),a[3]||(a[3]=d("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),jk={class:"text-retro-text text-sm font-mono mb-4"},Yk={class:"text-retro-cyan"},Fk={class:"space-y-3"},Uk=["value"],Gk={class:"flex items-center gap-2 cursor-pointer"},Hk=["checked"],Kk={class:"flex items-center gap-2 cursor-pointer"},Jk=["checked"],ew={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},tw=Ve({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=P("origin"),i=P(!1),o=P(!1);function a(u){i.value=u,u&&(o.value=!1)}function l(u){o.value=u,u&&(i.value=!1)}function c(){n("confirm",{remote:s.value,force:i.value,forceWithLease:o.value})}return ze(()=>t.visible,u=>{u&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(u,h)=>(v(),pe(Bt,{title:"Push Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Push",onClose:h[3]||(h[3]=f=>n("close")),onConfirm:c},{default:ut(()=>[d("p",jk,[h[4]||(h[4]=Ie(" Push ",-1)),d("span",Yk,A(r.branchName),1),h[5]||(h[5]=Ie(" to remote ",-1))]),d("div",Fk,[d("div",null,[h[6]||(h[6]=d("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(d("select",{"onUpdate:modelValue":h[0]||(h[0]=f=>Je(s)?s.value=f:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(v(!0),y(we,null,Ne(r.remotes,f=>(v(),y("option",{key:f,value:f},A(f),9,Uk))),128))],512),[[ks,m(s)]])]),d("label",Gk,[d("input",{checked:m(i),type:"checkbox",class:"accent-retro-cyan",onChange:h[1]||(h[1]=f=>a(f.target.checked))},null,40,Hk),h[7]||(h[7]=d("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),d("label",Kk,[d("input",{checked:m(o),type:"checkbox",class:"accent-retro-cyan",onChange:h[2]||(h[2]=f=>l(f.target.checked))},null,40,Jk),h[8]||(h[8]=d("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),m(i)||m(o)?(v(),y("div",ew,A(m(i)?"Force push will overwrite remote history. Use with caution.":"Force with lease will reject the push if the remote has been updated since your last fetch."),1)):F("",!0)])]),_:1},8,["visible","loading","error"]))}}),rw={class:"text-retro-text text-sm font-mono mb-4"},nw={class:"text-retro-cyan"},sw={class:"space-y-3"},iw=["value"],ow={class:"flex items-center gap-2 cursor-pointer"},aw={class:"flex items-center gap-2 cursor-pointer"},lw=Ve({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=P("origin"),i=P(!1),o=P(!1);function a(){n("confirm",{remote:s.value,noFastForward:i.value,squash:o.value})}return ze(()=>t.visible,l=>{l&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",i.value=!1,o.value=!1)}),(l,c)=>(v(),pe(Bt,{title:"Pull Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Pull",onClose:c[3]||(c[3]=u=>n("close")),onConfirm:a},{default:ut(()=>[d("p",rw,[c[4]||(c[4]=Ie(" Pull ",-1)),d("span",nw,A(r.branchName),1),c[5]||(c[5]=Ie(" from remote ",-1))]),d("div",sw,[d("div",null,[c[6]||(c[6]=d("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(d("select",{"onUpdate:modelValue":c[0]||(c[0]=u=>Je(s)?s.value=u:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(v(!0),y(we,null,Ne(r.remotes,u=>(v(),y("option",{key:u,value:u},A(u),9,iw))),128))],512),[[ks,m(s)]])]),d("label",ow,[je(d("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>Je(i)?i.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(i)]]),c[7]||(c[7]=d("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),d("label",aw,[je(d("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>Je(o)?o.value=u:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(o)]]),c[8]||(c[8]=d("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),cw={class:"text-retro-text text-sm font-mono mb-4"},uw={class:"text-retro-cyan"},hw={class:"text-retro-cyan"},dw={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},fw={class:"text-retro-cyan"},mw={class:"text-retro-cyan"},pw=Ve({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e;return(n,s)=>(v(),pe(Bt,{title:"Rebase Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Rebase",onClose:s[0]||(s[0]=i=>t("close")),onConfirm:s[1]||(s[1]=i=>t("confirm"))},{default:ut(()=>[d("p",cw,[s[2]||(s[2]=Ie(" Rebase ",-1)),d("span",uw,A(r.branchName),1),s[3]||(s[3]=Ie(" onto ",-1)),d("span",hw,A(r.ontoBranch),1)]),d("div",dw,[s[4]||(s[4]=Ie(" This will rewrite commit history. Commits from ",-1)),d("span",fw,A(r.branchName),1),s[5]||(s[5]=Ie(" will be replayed on top of ",-1)),d("span",mw,A(r.ontoBranch),1),s[6]||(s[6]=Ie(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),gw={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Ow={class:"text-sm font-mono text-retro-cyan"},vw={class:"text-xs font-mono text-retro-text mt-1 truncate"},bw={class:"space-y-3"},xw={class:"flex items-start gap-2 cursor-pointer group"},yw={class:"flex items-start gap-2 cursor-pointer group"},kw=Ve({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=P(!1),s=P(!1);function i(){t("confirm",{recordOrigin:n.value,noCommit:s.value})}function o(){n.value=!1,s.value=!1,t("close")}return(a,l)=>(v(),pe(Bt,{title:"Cherry-Pick Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Cherry-Pick",onClose:o,onConfirm:i},{default:ut(()=>[d("div",gw,[l[2]||(l[2]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),d("div",Ow,A(r.commitHash.slice(0,7)),1),d("div",vw,A(r.commitMessage.split(`
|
|
10
|
+
`)[0]),1)]),d("div",bw,[d("label",xw,[je(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>Je(n)?n.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Or,m(n)]]),l[3]||(l[3]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),d("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),d("label",yw,[je(d("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>Je(s)?s.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Or,m(s)]]),l[4]||(l[4]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),d("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Apply changes to the working directory without committing ")],-1))])])]),_:1},8,["visible","loading","error"]))}}),ww={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Sw={class:"text-sm font-mono text-retro-cyan"},$w={class:"text-xs font-mono text-retro-text mt-1 truncate"},Cw={class:"space-y-2"},Qw=["value"],Pw={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Tw=Ve({__name:"ResetDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=P("mixed"),s=[{value:"soft",label:"Soft",description:"Move HEAD, keep staged changes and working directory"},{value:"mixed",label:"Mixed",description:"Move HEAD, reset staging area, keep working directory"},{value:"hard",label:"Hard",description:"Move HEAD, reset staging area and working directory (DESTRUCTIVE)"}];function i(){t("confirm",{mode:n.value})}function o(){n.value="mixed",t("close")}return(a,l)=>(v(),pe(Bt,{title:"Reset to Commit",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Reset","confirm-danger":m(n)==="hard",onClose:o,onConfirm:i},{default:ut(()=>[d("div",ww,[l[1]||(l[1]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),d("div",Sw,A(r.commitHash.slice(0,7)),1),d("div",$w,A(r.commitMessage.split(`
|
|
11
|
+
`)[0]),1)]),d("div",Cw,[l[2]||(l[2]=d("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(v(),y(we,null,Ne(s,c=>d("label",{key:c.value,class:_e(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[m(n)===c.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[je(d("input",{"onUpdate:modelValue":l[0]||(l[0]=u=>Je(n)?n.value=u:null),type:"radio",name:"reset-mode",value:c.value,class:"mt-0.5 accent-retro-cyan"},null,8,Qw),[[Sc,m(n)]]),d("div",null,[d("span",{class:_e(["text-sm font-mono transition-colors",[c.value==="hard"?"text-retro-red":"text-retro-text",m(n)===c.value?"text-retro-cyan":""]])},A(c.label),3),d("p",{class:_e(["text-xs font-mono mt-0.5",c.value==="hard"?"text-retro-red/70":"text-retro-muted"])},A(c.description),3)])],2)),64))]),m(n)==="hard"?(v(),y("div",Pw," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):F("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Mw={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Aw={class:"text-sm font-mono text-retro-cyan"},_w={class:"mb-4"},Rw={class:"mb-3"},Bw={class:"flex items-start gap-2 cursor-pointer group"},Zw={key:0,class:"mb-4"},Ew={class:"space-y-2"},Dw={class:"flex items-start gap-2 cursor-pointer group"},Lw=["disabled"],Xw={key:0,class:"ml-6"},Iw=["value"],Vw=Ve({__name:"TagCreateDialog",props:{visible:{type:Boolean},commitHash:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=P(""),s=P(!1),i=P(""),o=P(!1),a=P(""),l=J(()=>n.value.trim().length>0);function c(){if(!l.value)return;const h={name:n.value.trim(),annotated:s.value};s.value&&i.value.trim()&&(h.message=i.value.trim()),o.value&&a.value&&(h.pushToRemote=a.value),t("confirm",h)}function u(){n.value="",s.value=!1,i.value="",o.value=!1,a.value="",t("close")}return ze(()=>s.value,h=>{h||(i.value="")}),(h,f)=>(v(),pe(Bt,{title:"Create Tag",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Create Tag",onClose:u,onConfirm:c},{default:ut(()=>[d("div",Mw,[f[5]||(f[5]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),d("div",Aw,A(r.commitHash.slice(0,7)),1)]),d("div",_w,[f[6]||(f[6]=d("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),je(d("input",{"onUpdate:modelValue":f[0]||(f[0]=p=>Je(n)?n.value=p:null),type:"text",placeholder:"v1.0.0",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Rt,m(n)]])]),d("div",Rw,[d("label",Bw,[je(d("input",{"onUpdate:modelValue":f[1]||(f[1]=p=>Je(s)?s.value=p:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Or,m(s)]]),f[7]||(f[7]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),d("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),m(s)?(v(),y("div",Zw,[f[8]||(f[8]=d("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),je(d("textarea",{"onUpdate:modelValue":f[2]||(f[2]=p=>Je(i)?i.value=p:null),rows:"3",placeholder:"Release description...",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none"},null,512),[[Rt,m(i)]])])):F("",!0),d("div",Ew,[d("label",Dw,[je(d("input",{"onUpdate:modelValue":f[3]||(f[3]=p=>Je(o)?o.value=p:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:r.remotes.length===0},null,8,Lw),[[Or,m(o)]]),d("div",null,[d("span",{class:_e(["text-sm font-mono transition-colors",r.remotes.length===0?"text-retro-muted":"text-retro-text group-hover:text-retro-cyan"])}," Push to remote ",2)])]),m(o)&&r.remotes.length>0?(v(),y("div",Xw,[je(d("select",{"onUpdate:modelValue":f[4]||(f[4]=p=>Je(a)?a.value=p:null),class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[f[9]||(f[9]=d("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(v(!0),y(we,null,Ne(r.remotes,p=>(v(),y("option",{key:p,value:p},A(p),9,Iw))),128))],512),[[ks,m(a)]])])):F("",!0)])]),_:1},8,["visible","loading","error"]))}}),zw={class:"text-retro-text text-sm font-mono mb-2"},Nw={class:"text-retro-cyan"},Ww={class:"space-y-3 mt-4"},qw={class:"flex items-center gap-2 cursor-pointer"},jw={key:0,class:"ml-6"},Yw=["value"],Fw=Ve({__name:"TagDeleteDialog",props:{visible:{type:Boolean},tagName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=P(!1),i=P("origin");function o(){n("confirm",{deleteFromRemote:s.value,remote:s.value?i.value:void 0})}return ze(()=>t.visible,a=>{a&&(s.value=!1,i.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(a,l)=>(v(),pe(Bt,{title:"Delete Tag",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Delete","confirm-danger":!0,onClose:l[2]||(l[2]=c=>n("close")),onConfirm:o},{default:ut(()=>[l[7]||(l[7]=d("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),d("p",zw,[l[3]||(l[3]=Ie(" Delete tag ",-1)),d("span",Nw,A(r.tagName),1),l[4]||(l[4]=Ie("? ",-1))]),d("div",Ww,[d("label",qw,[je(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>Je(s)?s.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(s)]]),l[5]||(l[5]=d("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),m(s)?(v(),y("div",jw,[l[6]||(l[6]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),je(d("select",{"onUpdate:modelValue":l[1]||(l[1]=c=>Je(i)?i.value=c:null),class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[(v(!0),y(we,null,Ne(r.remotes,c=>(v(),y("option",{key:c,value:c},A(c),9,Yw))),128))],512),[[ks,m(i)]])])):F("",!0)])]),_:1},8,["visible","loading","error"]))}}),Uw={class:"mb-4"},Gw={class:"text-retro-cyan text-sm font-mono"},Hw={class:"mb-4"},Kw={class:"text-retro-text text-sm font-mono"},Jw={class:"mb-4"},eS={class:"text-retro-text text-sm font-mono break-all select-all"},tS={class:"mb-4"},rS={class:"text-retro-text text-sm font-mono"},nS={class:"text-retro-muted"},sS={class:"mb-4"},iS={class:"text-retro-text text-sm font-mono"},oS={key:1,class:"mb-2"},aS={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},lS={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},cS=Ve({__name:"TagDetailDialog",props:{visible:{type:Boolean},tagName:{},tagDetail:{},loading:{type:Boolean,default:!1}},emits:["close"],setup(r,{emit:e}){const t=e;return(n,s)=>(v(),pe(Bt,{title:"Tag Details",visible:r.visible,loading:r.loading,"confirm-label":"Close","cancel-label":"Close",onClose:s[0]||(s[0]=i=>t("close")),onConfirm:s[1]||(s[1]=i=>t("close"))},{default:ut(()=>[d("div",Uw,[s[2]||(s[2]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),d("p",Gw,A(r.tagName),1)]),r.tagDetail?(v(),y(we,{key:0},[d("div",Hw,[s[3]||(s[3]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),d("p",Kw,A(r.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),d("div",Jw,[s[4]||(s[4]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),d("p",eS,A(r.tagDetail.hash),1)]),r.tagDetail.tagger?(v(),y(we,{key:0},[d("div",tS,[s[5]||(s[5]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),d("p",rS,[Ie(A(r.tagDetail.tagger.name)+" ",1),d("span",nS,"<"+A(r.tagDetail.tagger.email)+">",1)])]),d("div",sS,[s[6]||(s[6]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),d("p",iS,A(r.tagDetail.tagger.date),1)])],64)):F("",!0),r.tagDetail.message?(v(),y("div",oS,[s[7]||(s[7]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),d("div",aS,A(r.tagDetail.message),1)])):F("",!0)],64)):r.loading?(v(),y("div",lS," Loading tag details... ")):F("",!0)]),_:1},8,["visible","loading"]))}}),uS={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},hS={class:"text-sm font-mono text-retro-cyan"},dS={class:"mb-4"},fS={class:"flex items-start gap-2 cursor-pointer group"},mS=Ve({__name:"CreateBranchDialog",props:{visible:{type:Boolean},fromCommit:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e,n=P(""),s=P(!0),i=J(()=>n.value.trim().length>0);function o(){i.value&&t("confirm",{name:n.value.trim(),checkout:s.value})}function a(){n.value="",s.value=!0,t("close")}return(l,c)=>(v(),pe(Bt,{title:"Create Branch",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Create Branch",onClose:a,onConfirm:o},{default:ut(()=>[d("div",uS,[c[2]||(c[2]=d("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),d("div",hS,A(r.fromCommit.slice(0,7)),1)]),d("div",dS,[c[3]||(c[3]=d("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),je(d("input",{"onUpdate:modelValue":c[0]||(c[0]=u=>Je(n)?n.value=u:null),type:"text",placeholder:"feature/my-branch",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Rt,m(n)]])]),d("label",fS,[je(d("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>Je(s)?s.value=u:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Or,m(s)]]),c[4]||(c[4]=d("div",null,[d("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),d("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),pS={class:"space-y-4"},gS={class:"flex items-center gap-2 cursor-pointer"},OS=Ve({__name:"StashDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=P(""),i=P(!1);function o(){n("confirm",{message:s.value.trim()||void 0,includeUntracked:i.value})}return ze(()=>t.visible,a=>{a&&(s.value="",i.value=!1)}),(a,l)=>(v(),pe(Bt,{title:"Stash Changes",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Stash",onClose:l[2]||(l[2]=c=>n("close")),onConfirm:o},{default:ut(()=>[l[5]||(l[5]=d("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),d("div",pS,[d("div",null,[l[3]||(l[3]=d("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),je(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>Je(s)?s.value=c:null),type:"text",placeholder:"Stash description...",class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted/50 focus:outline-none focus:border-retro-cyan"},null,512),[[Rt,m(s)]])]),d("label",gS,[je(d("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>Je(i)?i.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Or,m(i)]]),l[4]||(l[4]=d("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),vS={class:"space-y-3"},bS={class:"flex items-start gap-2 cursor-pointer"},xS={class:"flex items-start gap-2 cursor-pointer"},yS={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},kS=Ve({__name:"ResetWorkingDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,s=P("mixed"),i=J(()=>s.value==="hard");function o(){n("confirm",{mode:s.value})}return ze(()=>t.visible,a=>{a&&(s.value="mixed")}),(a,l)=>(v(),pe(Bt,{title:"Reset Working Directory",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Reset","confirm-danger":m(i),onClose:l[2]||(l[2]=c=>n("close")),onConfirm:o},{default:ut(()=>[l[5]||(l[5]=d("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),d("div",vS,[d("label",bS,[je(d("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>Je(s)?s.value=c:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Sc,m(s)]]),l[3]||(l[3]=d("div",null,[d("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),d("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),d("label",xS,[je(d("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>Je(s)?s.value=c:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Sc,m(s)]]),l[4]||(l[4]=d("div",null,[d("span",{class:"text-retro-text text-sm font-mono"},"Hard"),d("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),m(i)?(v(),y("div",yS," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):F("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),wS=Ve({__name:"CleanUntrackedDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(r,{emit:e}){const t=e;return(n,s)=>(v(),pe(Bt,{title:"Clean Untracked Files",visible:r.visible,loading:r.loading,error:r.error,"confirm-label":"Clean","confirm-danger":"",onClose:s[0]||(s[0]=i=>t("close")),onConfirm:s[1]||(s[1]=i=>t("confirm"))},{default:ut(()=>[...s[2]||(s[2]=[d("div",{class:"space-y-3"},[d("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),d("p",{class:"text-retro-muted text-xs font-mono"},[Ie(" This runs "),d("code",null,"git clean -fd"),Ie(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),SS={class:"text-retro-muted text-sm"},$S={class:"text-retro-cyan font-mono"},CS={class:"space-y-3"},QS={class:"text-retro-muted text-sm"},PS={class:"text-retro-cyan font-mono"},TS={class:"space-y-3"},MS={class:"text-retro-muted text-sm"},AS={class:"text-retro-magenta font-mono"},_S={key:0,class:"fixed bottom-4 right-4 z-50 flex items-center gap-2 px-4 py-2.5 text-sm bg-retro-red/90 text-white rounded-lg shadow-lg max-w-sm",role:"alert"},RS={class:"flex-1"},BS=Ve({__name:"GitGraphDialogs",props:{dialogs:{},store:{},remoteNames:{},copyFeedback:{}},setup(r){const e=r,{checkoutDialog:t,confirmCheckout:n,createBranchDialog:s,confirmCreateBranch:i,deleteBranchDialog:o,confirmDeleteBranch:a,renameDialog:l,confirmRenameBranch:c,mergeDialog:u,confirmMerge:h,rebaseDialog:f,confirmRebase:p,pushDialog:g,confirmPush:O,pullDialog:b,confirmPull:x,cherryPickDialog:k,confirmCherryPick:w,resetDialog:S,confirmReset:Q,tagCreateDialog:L,confirmTagCreate:E,tagDeleteDialog:G,confirmTagDelete:oe,tagDetailDialog:ie,stashDialog:j,confirmStash:V,stashBranchDialog:Z,stashBranchInput:U,confirmStashBranch:W,resetWorkingDialog:N,confirmResetWorking:I,cleanUntrackedDialog:z,confirmCleanUntracked:be}=e.dialogs;return(K,H)=>(v(),y(we,null,[m(t).visible?(v(),pe(Bt,{key:0,title:"Checkout",visible:m(t).visible,loading:m(t).loading,error:m(t).error,confirmLabel:"Checkout",onClose:H[0]||(H[0]=re=>m(t).visible=!1),onConfirm:m(n)},{default:ut(()=>[d("p",SS,[H[23]||(H[23]=Ie(" Are you sure you want to checkout ",-1)),d("span",$S,A(m(t).branchName),1),H[24]||(H[24]=Ie("? ",-1))])]),_:1},8,["visible","loading","error","onConfirm"])):F("",!0),m(l).visible?(v(),pe(Bt,{key:1,title:"Rename Branch",visible:m(l).visible,loading:m(l).loading,error:m(l).error,confirmLabel:"Rename",onClose:H[3]||(H[3]=re=>m(l).visible=!1),onConfirm:m(c)},{default:ut(()=>[d("div",CS,[d("p",QS,[H[25]||(H[25]=Ie(" Rename ",-1)),d("span",PS,A(m(l).branchName),1)]),je(d("input",{"onUpdate:modelValue":H[1]||(H[1]=re=>m(l).newName=re),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"New branch name",onKeyup:H[2]||(H[2]=hs((...re)=>m(c)&&m(c)(...re),["enter"]))},null,544),[[Rt,m(l).newName]])])]),_:1},8,["visible","loading","error","onConfirm"])):F("",!0),m(u).visible?(v(),pe(Ik,{key:2,visible:m(u).visible,branchName:m(u).branchName,loading:m(u).loading,error:m(u).error,onClose:H[4]||(H[4]=re=>m(u).visible=!1),onConfirm:m(h)},null,8,["visible","branchName","loading","error","onConfirm"])):F("",!0),m(o).visible?(v(),pe(qk,{key:3,visible:m(o).visible,branchName:m(o).branchName,isLocal:m(o).isLocal,loading:m(o).loading,error:m(o).error,onClose:H[5]||(H[5]=re=>m(o).visible=!1),onConfirm:m(a)},null,8,["visible","branchName","isLocal","loading","error","onConfirm"])):F("",!0),m(g).visible?(v(),pe(tw,{key:4,visible:m(g).visible,branchName:m(g).branchName,remotes:r.remoteNames,loading:m(g).loading,error:m(g).error,onClose:H[6]||(H[6]=re=>m(g).visible=!1),onConfirm:m(O)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):F("",!0),m(b).visible?(v(),pe(lw,{key:5,visible:m(b).visible,branchName:m(b).branchName,remotes:r.remoteNames,loading:m(b).loading,error:m(b).error,onClose:H[7]||(H[7]=re=>m(b).visible=!1),onConfirm:m(x)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):F("",!0),m(f).visible?(v(),pe(pw,{key:6,visible:m(f).visible,branchName:r.store.currentBranch?.name||"HEAD",ontoBranch:m(f).branchName,loading:m(f).loading,error:m(f).error,onClose:H[8]||(H[8]=re=>m(f).visible=!1),onConfirm:m(p)},null,8,["visible","branchName","ontoBranch","loading","error","onConfirm"])):F("",!0),m(k).visible?(v(),pe(kw,{key:7,visible:m(k).visible,commitHash:m(k).commitHash,commitMessage:m(k).commitMessage,loading:m(k).loading,error:m(k).error,onClose:H[9]||(H[9]=re=>m(k).visible=!1),onConfirm:m(w)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):F("",!0),m(S).visible?(v(),pe(Tw,{key:8,visible:m(S).visible,commitHash:m(S).commitHash,commitMessage:m(S).commitMessage,loading:m(S).loading,error:m(S).error,onClose:H[10]||(H[10]=re=>m(S).visible=!1),onConfirm:m(Q)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):F("",!0),m(L).visible?(v(),pe(Vw,{key:9,visible:m(L).visible,commitHash:m(L).commitHash,remotes:r.remoteNames,loading:m(L).loading,error:m(L).error,onClose:H[11]||(H[11]=re=>m(L).visible=!1),onConfirm:m(E)},null,8,["visible","commitHash","remotes","loading","error","onConfirm"])):F("",!0),m(G).visible?(v(),pe(Fw,{key:10,visible:m(G).visible,tagName:m(G).tagName,remotes:r.remoteNames,loading:m(G).loading,error:m(G).error,onClose:H[12]||(H[12]=re=>m(G).visible=!1),onConfirm:m(oe)},null,8,["visible","tagName","remotes","loading","error","onConfirm"])):F("",!0),m(ie).visible?(v(),pe(cS,{key:11,visible:m(ie).visible,tagName:m(ie).tagName,tagDetail:m(ie).tagDetail,loading:m(ie).loading,onClose:H[13]||(H[13]=re=>m(ie).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):F("",!0),m(s).visible?(v(),pe(mS,{key:12,visible:m(s).visible,fromCommit:m(s).fromCommit,loading:m(s).loading,error:m(s).error,onClose:H[14]||(H[14]=re=>m(s).visible=!1),onConfirm:m(i)},null,8,["visible","fromCommit","loading","error","onConfirm"])):F("",!0),m(Z).visible?(v(),pe(Bt,{key:13,title:"Create Branch from Stash",visible:m(Z).visible,loading:m(Z).loading,error:m(Z).error,confirmLabel:"Create Branch",onClose:H[17]||(H[17]=re=>m(Z).visible=!1),onConfirm:H[18]||(H[18]=re=>m(W)(m(U)))},{default:ut(()=>[d("div",TS,[d("p",MS,[H[26]||(H[26]=Ie(" Create a new branch from ",-1)),d("span",AS,"stash@"+A("{")+A(m(Z).stashIndex)+A("}"),1)]),je(d("input",{"onUpdate:modelValue":H[15]||(H[15]=re=>Je(U)?U.value=re:null),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"Branch name",onKeyup:H[16]||(H[16]=hs(re=>m(W)(m(U)),["enter"]))},null,544),[[Rt,m(U)]])])]),_:1},8,["visible","loading","error"])):F("",!0),m(j).visible?(v(),pe(OS,{key:14,visible:m(j).visible,loading:m(j).loading,error:m(j).error,onClose:H[19]||(H[19]=re=>m(j).visible=!1),onConfirm:m(V)},null,8,["visible","loading","error","onConfirm"])):F("",!0),m(N).visible?(v(),pe(kS,{key:15,visible:m(N).visible,loading:m(N).loading,error:m(N).error,onClose:H[20]||(H[20]=re=>m(N).visible=!1),onConfirm:m(I)},null,8,["visible","loading","error","onConfirm"])):F("",!0),m(z).visible?(v(),pe(wS,{key:16,visible:m(z).visible,loading:m(z).loading,error:m(z).error,onClose:H[21]||(H[21]=re=>m(z).visible=!1),onConfirm:m(be)},null,8,["visible","loading","error","onConfirm"])):F("",!0),(v(),pe(Pr,{to:"body"},[ee(On,{name:"fade"},{default:ut(()=>[r.copyFeedback.visible?(v(),y("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:tr({left:`${r.copyFeedback.x}px`,top:`${r.copyFeedback.y-40}px`})}," Copied! ",4)):F("",!0)]),_:1})])),(v(),pe(Pr,{to:"body"},[ee(On,{name:"fade"},{default:ut(()=>[r.store.operationError?(v(),y("div",_S,[ee(m(En),{class:"w-4 h-4 flex-shrink-0"}),d("span",RS,A(r.store.operationError),1),d("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:H[22]||(H[22]=re=>r.store.clearOperationError()),"aria-label":"Dismiss error"},[ee(m(St),{class:"w-3.5 h-3.5"})])])):F("",!0)]),_:1})]))],64))}}),ZS=ws(BS,[["__scopeId","data-v-c47c4487"]]),Lu=globalThis.setInterval,ES={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},DS={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},LS={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},XS={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},IS={class:"text-retro-red text-sm mb-4"},VS={key:3,class:"flex-1 flex items-center justify-center p-4"},zS={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},NS={class:"relative"},WS={key:0,class:"absolute left-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-2 min-w-[200px]"},qS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},jS=["checked"],YS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},FS=["checked"],US={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},GS=["checked"],HS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},KS=["checked"],JS={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},e2=["checked"],t2={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},r2=["checked"],n2={class:"relative"},s2=["aria-expanded"],i2={key:0,class:"text-xs"},o2={key:0,class:"absolute right-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px] max-h-[400px] overflow-auto"},a2=["checked","onChange"],l2={class:"text-sm text-retro-text truncate"},c2={key:0,class:"text-[10px] text-retro-cyan"},u2={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},h2=["checked","onChange"],d2={class:"text-sm text-retro-text truncate"},f2={class:"relative"},m2={key:0,class:"absolute right-0 top-full mt-1 z-20"},p2=["title"],g2=5e3,O2=Ve({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(r){const e=r,t=ml(),n=vr(),s=kk(),i=Sk(t),o=$k(t,i),{checkoutDialog:a,confirmCheckout:l,createBranchDialog:c,confirmCreateBranch:u,deleteBranchDialog:h,confirmDeleteBranch:f,renameDialog:p,confirmRenameBranch:g,mergeDialog:O,confirmMerge:b,rebaseDialog:x,confirmRebase:k,pushDialog:w,confirmPush:S,pullDialog:Q,confirmPull:L,cherryPickDialog:E,confirmCherryPick:G,resetDialog:oe,confirmReset:ie,tagCreateDialog:j,confirmTagCreate:V,tagDeleteDialog:Z,confirmTagDelete:U,tagDetailDialog:W,stashDialog:N,confirmStash:I,stashBranchDialog:z,stashBranchInput:be,confirmStashBranch:K,resetWorkingDialog:H,confirmResetWorking:re,cleanUntrackedDialog:Oe,confirmCleanUntracked:ge,isAnyDialogOpen:$e}=i,{copyFeedback:Pe,branchMenu:Fe,handleBranchContextMenu:T,closeBranchMenu:M,handleBranchCheckout:D,handleBranchRename:B,handleBranchDelete:xe,handleBranchMerge:Re,handleBranchRebase:Me,handleBranchPush:ue,handleBranchPull:ne,handleBranchFetch:Ce,handleBranchCopyName:q,handleBranchCreateBranch:ve,commitMenu:Ze,handleCommitContextMenu:it,closeCommitMenu:Nt,handleCommitAddTag:sr,handleCommitCreateBranch:on,handleCommitCheckout:xr,handleCommitCherryPick:qn,handleCommitRevert:an,handleCommitMergeInto:jn,handleCommitReset:ln,handleCommitCopyHash:Sn,handleCommitCopySubject:Et,tagMenu:Wt,handleTagContextMenu:he,closeTagMenu:ye,handleTagViewDetails:Be,handleTagDelete:Ye,handleTagPush:Ue,handleTagCopyName:Ct,uncommittedMenu:ot,closeUncommittedMenu:Ft,handleUncommittedStash:ir,handleUncommittedReset:yr,handleUncommittedClean:Yn,stashMenu:Xr,handleStashContextMenu:hi,closeStashMenu:di,handleStashApply:fi,handleStashPop:mi,handleStashDrop:pi,handleStashCreateBranch:gi,handleStashCopyName:Oi,handleStashCopyHash:vi}=o,bi=J(()=>{const Ee=n.activeConversation?.worktreeBranch;return Ee?[Ee]:[]}),xi=J(()=>{const Ee=[],le=t.selectedFeatureId;le&&Ee.push(le);const C=t.conversationBranch;return C&&!Ee.includes(C)&&Ee.push(C),Ee});ze(()=>[n.activeConversation?.worktreeBranch,n.activeConversation?.baseBranch],([Ee,le])=>{t.setConversationBranch(Ee??null,le??null)},{immediate:!0});const Dt=J(()=>{const Ee=t.previewBranch;return Ee?[Ee]:[]});ze(()=>[n.previewingConversation?.worktreeBranch,n.previewingConversation?.baseBranch],([Ee,le])=>{t.setPreviewBranch(Ee??null,le??null)},{immediate:!0});const or=J(()=>nd([{branch:t.previewBranch,mergeBase:t.previewMergeBase}])),Ss=J(()=>nd([{branch:t.selectedFeatureId,mergeBase:t.featureMergeBase},{branch:t.conversationBranch,mergeBase:t.conversationMergeBase}])),cn=J(()=>t.remotes.map(Ee=>Ee.name)),$n=P(null);ze(()=>e.workingDirectory,async Ee=>{if(Ee){await t.loadGitGraph(Ee);const le=n.previewingConversation?.worktreeBranch;le&&await t.setPreviewBranch(le,n.previewingConversation?.baseBranch??null);const C=n.activeConversation?.worktreeBranch;C&&await t.setConversationBranch(C,n.activeConversation?.baseBranch??null)}},{immediate:!0}),ze(()=>e.isActive,Ee=>{Ee&&t.commits.length>0&&!t.error?s.startPolling(e.workingDirectory):s.stopPolling()},{immediate:!0}),ze(()=>t.commits.length,Ee=>{Ee>0&&e.isActive&&!t.error&&s.startPolling(e.workingDirectory)}),ze(()=>$n.value,Ee=>{Ee&&s.setScrollCallbacks({getScrollPosition:()=>Ee.getScrollPosition(),setScrollPosition:le=>Ee.setScrollPosition(le)})}),wt(()=>{s.cleanup(),t.reset()});const $s=J(()=>t.error?.includes("Not a Git repository")),Cn=P(Date.now());let un=null;const yi=()=>{un||(un=Lu(()=>{Cn.value=Date.now()},g2))},Cs=()=>{un&&(clearInterval(un),un=null)};gt(()=>{ze(()=>e.isActive,Ee=>{Ee?(Cn.value=Date.now(),yi()):Cs()},{immediate:!0})}),wt(()=>{Cs()});const Qn=J(()=>{const Ee=t.lastRefreshTime;if(!Ee)return null;const le=Math.floor((Cn.value-Ee)/1e3);return t.isRefreshing?"Syncing...":le<5?"Just now":le<60?`${le}s ago`:`${Math.floor(le/60)}m ago`}),Ot=P(!1),_r=P(!1),Fn=P(null);function ki(){Ot.value=!0,It(()=>Fn.value?.focus())}function Un(){Ot.value=!1,t.setSearchQuery("")}function Qs(Ee){t.setSearchQuery(Ee)}const Ps=wk({onScrollToHead:()=>{const Ee=t.commits.find(le=>le.isHead);Ee&&t.selectCommit(Ee)},onEscape:()=>{Ir.value?Ir.value=!1:_r.value?_r.value=!1:ar.value?ar.value=!1:Ot.value?Un():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});gt(()=>{Ps.start()}),wt(()=>{Ps.stop()});const Ir=P(!1),ar=P(!1);async function Gn(){await t.fetchAll(!0)}async function wi(Ee){await t.addRemote(Ee.name,Ee.url)}async function Vr(Ee){await t.editRemote(Ee.name,Ee.newUrl)}async function Si(Ee){await t.deleteRemote(Ee)}const Hn=J(()=>{const Ee=[],le={};for(const C of t.branches)if(t.localBranchNames.has(C.name))Ee.push(C);else{const R=C.name.indexOf("/");if(R>0){const _=C.name.substring(0,R);le[_]||(le[_]=[]),le[_].push(C)}else Ee.push(C)}return{local:Ee,remotes:le}});ze($e,Ee=>{Ee?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function Kn(Ee){t.selectedCommit?t.selectComparisonCommit(Ee):t.selectCommit(Ee)}function Ts(Ee){t.navigateToCommit(Ee)}return(Ee,le)=>{const C=qv,R=ob,_=_b,X=Jb,ce=gy,de=Xy,ae=Fy,fe=Uy,rt=Gy,at=Hy,qt=Ky;return v(),y("div",ES,[m(t).loading&&m(t).commits.length===0?(v(),y("div",DS,[...le[20]||(le[20]=[d("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),d("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):m($s)?(v(),y("div",LS,[ee(m(En),{class:"w-12 h-12 text-retro-yellow mb-4"}),le[21]||(le[21]=d("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),le[22]||(le[22]=d("p",{class:"text-retro-muted text-sm max-w-xs"},[Ie(" This directory is not initialized as a Git repository. Run "),d("code",{class:"text-retro-cyan"},"git init"),Ie(" to get started. ")],-1))])):m(t).error?(v(),y("div",XS,[ee(m(En),{class:"w-10 h-10 text-retro-red mb-3"}),d("p",IS,A(m(t).error),1),d("button",{class:"flex items-center gap-2 px-3 py-1.5 text-sm text-retro-text border border-retro-border rounded hover:border-retro-cyan hover:text-retro-cyan transition-colors",onClick:le[0]||(le[0]=et=>m(t).loadGitGraph(e.workingDirectory))},[ee(m(gs),{class:"w-4 h-4"}),le[23]||(le[23]=Ie(" Retry ",-1))])])):m(t).commits.length===0?(v(),y("div",VS,[...le[24]||(le[24]=[d("div",{class:"text-retro-muted text-center"},[d("p",null,"No commits found in this repository.")],-1)])])):(v(),y(we,{key:4},[m(Ot)?(v(),pe(C,{key:0,ref_key:"findWidgetRef",ref:Fn,resultCount:m(t).searchResultHashes.length,currentIndex:m(t).searchResultIndex,onSearch:Qs,onNext:m(t).nextSearchResult,onPrev:m(t).prevSearchResult,onClose:Un},null,8,["resultCount","currentIndex","onNext","onPrev"])):F("",!0),d("div",zS,[d("button",{class:_e(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(Ot)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Find",title:"Find",onClick:le[1]||(le[1]=et=>m(Ot)?Un():ki())},[ee(m(fs),{class:"w-4 h-4"})],2),d("div",NS,[d("button",{class:_e(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(Ir)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Graph settings",title:"Settings",onClick:le[2]||(le[2]=et=>Ir.value=!m(Ir))},[ee(m(hv),{class:"w-4 h-4"})],2),m(Ir)?(v(),y("div",WS,[le[31]||(le[31]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),d("label",qS,[d("input",{type:"radio",name:"graphStyle",value:"rounded",checked:m(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:le[3]||(le[3]=et=>m(t).setGraphStyle("rounded"))},null,40,jS),le[25]||(le[25]=d("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),d("label",YS,[d("input",{type:"radio",name:"graphStyle",value:"angular",checked:m(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:le[4]||(le[4]=et=>m(t).setGraphStyle("angular"))},null,40,FS),le[26]||(le[26]=d("span",{class:"text-sm text-retro-text"},"Angular",-1))]),le[32]||(le[32]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),d("label",US,[d("input",{type:"checkbox",checked:m(t).muteNonAncestral,class:"accent-retro-cyan",onChange:le[5]||(le[5]=et=>m(t).toggleMuteNonAncestral())},null,40,GS),le[27]||(le[27]=d("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),le[33]||(le[33]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),d("label",HS,[d("input",{type:"checkbox",checked:m(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:le[6]||(le[6]=et=>m(t).toggleColumnVisibility("commit"))},null,40,KS),le[28]||(le[28]=d("span",{class:"text-sm text-retro-text"},"Hash",-1))]),d("label",JS,[d("input",{type:"checkbox",checked:m(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:le[7]||(le[7]=et=>m(t).toggleColumnVisibility("author"))},null,40,e2),le[29]||(le[29]=d("span",{class:"text-sm text-retro-text"},"Author",-1))]),d("label",t2,[d("input",{type:"checkbox",checked:m(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:le[8]||(le[8]=et=>m(t).toggleColumnVisibility("date"))},null,40,r2),le[30]||(le[30]=d("span",{class:"text-sm text-retro-text"},"Date",-1))])])):F("",!0)]),le[36]||(le[36]=d("span",{class:"flex-1"},null,-1)),d("div",n2,[d("button",{class:_e(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(_r)||m(t).filteredBranches.length>0?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Filter by branch","aria-expanded":m(_r),onClick:le[9]||(le[9]=et=>_r.value=!m(_r))},[ee(m(Mv),{class:"w-4 h-4"}),m(t).filteredBranches.length>0?(v(),y("span",i2," ("+A(m(t).filteredBranches.length)+") ",1)):F("",!0)],10,s2),m(_r)?(v(),y("div",o2,[le[35]||(le[35]=d("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),m(t).filteredBranches.length>0?(v(),y("button",{key:0,class:"w-full text-left px-3 py-1.5 text-sm text-retro-cyan hover:bg-retro-cyan/10",onClick:le[10]||(le[10]=et=>m(t).clearFilters())}," Clear All Filters ")):F("",!0),m(Hn).local.length>0?(v(),y(we,{key:1},[le[34]||(le[34]=d("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(v(!0),y(we,null,Ne(m(Hn).local,et=>(v(),y("label",{key:et.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[d("input",{type:"checkbox",checked:m(t).filteredBranches.includes(et.name),class:"accent-retro-cyan",onChange:lr=>m(t).toggleBranchFilter(et.name)},null,40,a2),d("span",l2,A(et.name),1),et.isHead?(v(),y("span",c2,"(HEAD)")):F("",!0)]))),128))],64)):F("",!0),(v(!0),y(we,null,Ne(m(Hn).remotes,(et,lr)=>(v(),y(we,{key:lr},[d("div",u2,A(lr),1),(v(!0),y(we,null,Ne(et,Ms=>(v(),y("label",{key:Ms.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[d("input",{type:"checkbox",checked:m(t).filteredBranches.includes(Ms.name),class:"accent-retro-cyan",onChange:Vh=>m(t).toggleBranchFilter(Ms.name)},null,40,h2),d("span",d2,A(Ms.name),1)]))),128))],64))),128))])):F("",!0)]),d("button",{class:_e(["flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors",{"animate-spin":m(t).isRefreshing}]),"aria-label":"Refresh",title:"Refresh",onClick:le[11]||(le[11]=et=>m(t).loadGitGraph(e.workingDirectory))},[ee(m(gs),{class:"w-4 h-4"})],2),d("button",{class:"flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors","aria-label":"Fetch all remotes",title:"Fetch All",onClick:Gn},[ee(m(up),{class:"w-4 h-4"})]),d("div",f2,[d("button",{class:_e(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",m(ar)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Manage remotes",title:"Remotes",onClick:le[12]||(le[12]=et=>ar.value=!m(ar))},[ee(m(Cc),{class:"w-4 h-4"})],2),m(ar)?(v(),y("div",m2,[ee(R,{remotes:m(t).remotes,onAdd:wi,onEdit:Vr,onDelete:Si,onClose:le[13]||(le[13]=et=>ar.value=!1)},null,8,["remotes"])])):F("",!0)]),m(Qn)&&e.isActive?(v(),y("div",{key:0,class:_e(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":m(t).isRefreshing}]),title:m(t).lastRefreshTime?`Last checked: ${new Date(m(t).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[d("span",{class:_e(["inline-block w-1.5 h-1.5 rounded-full mr-1",m(t).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),Ie(" "+A(m(Qn)),1)],10,p2)):F("",!0)]),d("div",{class:_e(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":m(t).selectedCommit||m(t).isUncommittedChangesSelected}])},[ee(_,{ref_key:"commitListRef",ref:$n,commits:m(t).filteredCommits,stashes:m(t).stashes,selectedCommit:m(t).selectedCommit,hasMore:m(t).hasMore,loading:m(t).loading,loadingMore:m(t).loadingMore,searchQuery:m(t).searchQuery,uncommittedChangesCount:m(t).uncommittedChangesCount,isUncommittedChangesSelected:m(t).isUncommittedChangesSelected,highlightBranches:m(bi),featureHighlightBranches:m(xi),featureMergeBases:m(Ss),previewHighlightBranches:m(Dt),previewMergeBases:m(or),currentBranchName:m(t).currentBranch?.name,localBranchNames:m(t).localBranchNames,graphStyle:m(t).graphStyle,muteNonAncestral:m(t).muteNonAncestral,columnVisibility:m(t).columnVisibility,onSelect:m(t).selectCommit,onLoadMore:m(t).loadMoreCommits,onBranchContextMenu:m(T),onCommitContextMenu:m(it),onTagContextMenu:m(he),onStashContextMenu:m(hi),onCompareSelect:Kn,onSelectUncommittedChanges:m(t).selectUncommittedChanges,onScrollStart:m(s).startInteraction,onScrollEnd:m(s).endInteraction},null,8,["commits","stashes","selectedCommit","hasMore","loading","loadingMore","searchQuery","uncommittedChangesCount","isUncommittedChangesSelected","highlightBranches","featureHighlightBranches","featureMergeBases","previewHighlightBranches","previewMergeBases","currentBranchName","localBranchNames","graphStyle","muteNonAncestral","columnVisibility","onSelect","onLoadMore","onBranchContextMenu","onCommitContextMenu","onTagContextMenu","onStashContextMenu","onSelectUncommittedChanges","onScrollStart","onScrollEnd"])],2),m(t).isComparing&&m(t).selectedCommit&&m(t).comparisonCommit?(v(),pe(X,{key:1,fromCommit:m(t).comparisonCommit,toCommit:m(t).selectedCommit,files:m(t).comparisonFiles,stats:m(t).comparisonStats,loading:m(t).comparisonLoading,onClose:m(t).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):m(t).selectedCommit?(v(),pe(ce,{key:2,commit:m(t).selectedCommit,files:m(t).selectedCommitFiles,stats:m(t).selectedCommitStats,loading:m(t).isLoadingDetails,detailPosition:m(t).detailViewPosition,onClose:m(t).clearSelection,onNavigateToCommit:Ts,onTogglePosition:m(t).toggleDetailViewPosition,onOpenFileDiff:le[14]||(le[14]=et=>m(t).selectedCommit&&m(t).openFileDiff(m(t).selectedCommit.hash,et))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):F("",!0),m(t).isUncommittedChangesSelected?(v(),pe(de,{key:3,stagedFiles:m(t).stagedFiles,unstagedFiles:m(t).unstagedFiles,isStaging:m(t).isStaging,isCommitting:m(t).isCommitting,onClose:m(t).clearSelection,onStageFiles:le[15]||(le[15]=et=>m(t).stageFiles(et)),onUnstageFiles:le[16]||(le[16]=et=>m(t).unstageFiles(et)),onStageAll:le[17]||(le[17]=()=>m(t).stageFiles([])),onUnstageAll:le[18]||(le[18]=()=>m(t).unstageFiles([])),onCommit:le[19]||(le[19]=et=>m(t).commitChanges(et))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):F("",!0)],64)),m(Fe).visible?(v(),pe(ae,{key:5,branchName:m(Fe).branch,isCurrentBranch:m(Fe).isCurrentBranch,isLocal:m(Fe).isLocal,x:m(Fe).x,y:m(Fe).y,onClose:m(M),onCheckout:m(D),onCreateBranch:m(ve),onDeleteBranch:m(xe),onRename:m(B),onMerge:m(Re),onRebase:m(Me),onPush:m(ue),onPull:m(ne),onFetch:m(Ce),onCopyName:m(q)},null,8,["branchName","isCurrentBranch","isLocal","x","y","onClose","onCheckout","onCreateBranch","onDeleteBranch","onRename","onMerge","onRebase","onPush","onPull","onFetch","onCopyName"])):F("",!0),m(Ze).visible&&m(Ze).commit?(v(),pe(fe,{key:6,commit:m(Ze).commit,x:m(Ze).x,y:m(Ze).y,onClose:m(Nt),onAddTag:m(sr),onCreateBranch:m(on),onCheckout:m(xr),onCherryPick:m(qn),onRevert:m(an),onMergeInto:m(jn),onReset:m(ln),onCopyHash:m(Sn),onCopySubject:m(Et)},null,8,["commit","x","y","onClose","onAddTag","onCreateBranch","onCheckout","onCherryPick","onRevert","onMergeInto","onReset","onCopyHash","onCopySubject"])):F("",!0),m(Wt).visible?(v(),pe(rt,{key:7,tagName:m(Wt).tag,x:m(Wt).x,y:m(Wt).y,onClose:m(ye),onViewDetails:m(Be),onDeleteTag:m(Ye),onPushTag:m(Ue),onCopyName:m(Ct)},null,8,["tagName","x","y","onClose","onViewDetails","onDeleteTag","onPushTag","onCopyName"])):F("",!0),m(Xr).visible&&m(Xr).stash?(v(),pe(at,{key:8,stashIndex:m(Xr).stash.index,stashMessage:m(Xr).stash.message,x:m(Xr).x,y:m(Xr).y,onClose:m(di),onApply:m(fi),onPop:m(mi),onDrop:m(pi),onCreateBranch:m(gi),onCopyName:m(Oi),onCopyHash:m(vi)},null,8,["stashIndex","stashMessage","x","y","onClose","onApply","onPop","onDrop","onCreateBranch","onCopyName","onCopyHash"])):F("",!0),m(ot).visible?(v(),pe(qt,{key:9,x:m(ot).x,y:m(ot).y,onClose:m(Ft),onStash:m(ir),onReset:m(yr),onClean:m(Yn)},null,8,["x","y","onClose","onStash","onReset","onClean"])):F("",!0),ee(ZS,{dialogs:m(i),store:m(t),remoteNames:m(cn),copyFeedback:m(Pe)},null,8,["dialogs","store","remoteNames","copyFeedback"])])}}}),v2=ws(O2,[["__scopeId","data-v-e2b31aba"]]),od=z1("/app-logo.svg"),b2={class:"flex items-start justify-between gap-2"},x2={class:"flex-1 min-w-0"},y2={class:"flex items-center gap-2"},k2={class:"font-mono text-sm text-retro-text truncate"},w2={class:"text-xs font-mono text-retro-muted mt-1 truncate"},S2={class:"flex items-center gap-1 flex-shrink-0"},$2={key:0,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-red",title:"Critical traceability gaps"},C2={key:1,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-yellow",title:"Major traceability gaps"},Q2={key:2,class:"text-[10px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},P2={key:3,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},T2={key:4,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},M2={key:5,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},A2={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},_2={key:0,class:"flex items-center gap-1"},R2=["title","disabled","onClick"],B2=Ve({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean},criticalAlerts:{},majorAlerts:{}},emits:["select","cascade","openChat","skill"],setup(r,{emit:e}){const t={DocumentCheckIcon:Sv,PuzzlePieceIcon:Jh,DocumentMagnifyingGlassIcon:Cv,WrenchScrewdriverIcon:Dv,SparklesIcon:ji,BeakerIcon:gv,ShieldCheckIcon:mp,CommandLineIcon:wv,CpuChipIcon:tv,LightBulbIcon:Rv},n=r,s=e,i=vr();function o(f){return t[f]||Jh}function a(f){return f.prerequisites.every(p=>n.feature.files.some(g=>g.filename===p))}function l(f){return f.prerequisites.filter(p=>!n.feature.files.some(g=>g.filename===p))}function c(f){return a(f)?`${f.name} (Shift+click: new conversation)`:`Requires: ${l(f).join(", ")}`}const u=J(()=>{const f=i.findConversationByFeature(n.feature.id);return f?i.isConversationStreaming(f.id):!1}),h=J(()=>n.isActive?["border-retro-cyan shadow-retro","feature-card-active","dark:bg-gradient-to-br dark:from-retro-cyan/10 dark:via-retro-panel dark:to-retro-magenta/5"]:["border-retro-border","feature-card-light","hover:border-retro-muted","dark:bg-gradient-to-br","dark:from-retro-panel dark:via-retro-panel dark:to-retro-cyan/5","dark:hover:from-retro-cyan/5 dark:hover:via-retro-panel dark:hover:to-retro-magenta/5"]);return(f,p)=>(v(),y("button",{type:"button",class:_e(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",m(h)]),onClick:p[5]||(p[5]=g=>s("select",r.feature.id))},[d("div",b2,[d("div",x2,[d("div",y2,[ee(m(Os),{class:_e(["h-4 w-4 flex-shrink-0 transition-colors duration-200",r.isActive?"text-retro-cyan":"text-retro-muted group-hover:text-retro-cyan"])},null,8,["class"]),d("span",k2,A(r.feature.id),1)]),d("p",w2,A(r.feature.name),1)]),d("div",S2,[r.criticalAlerts>0?(v(),y("span",$2,[p[6]||(p[6]=d("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-red"},null,-1)),Ie(" "+A(r.criticalAlerts),1)])):F("",!0),r.majorAlerts>0?(v(),y("span",C2,[p[7]||(p[7]=d("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-yellow"},null,-1)),Ie(" "+A(r.majorAlerts),1)])):F("",!0),r.feature.hasTasks?(v(),y("span",Q2,A(r.feature.completedTasks)+"/"+A(r.feature.totalTasks),1)):F("",!0),r.feature.hasSpec?(v(),y("span",P2)):F("",!0),r.feature.hasPlan?(v(),y("span",T2)):F("",!0),r.feature.hasTasks?(v(),y("span",M2)):F("",!0)])]),d("div",A2,[r.feature.hasSpec?(v(),y("div",_2,[d("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Clarify spec (Shift+click: new conversation)",onClick:p[0]||(p[0]=kr(g=>s("cascade",g,r.feature.id,"clarify"),["stop"]))},[ee(m(Zu),{class:"h-3.5 w-3.5"})]),d("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Plan → Tasks → Implement (Shift+click: new conversation)",onClick:p[1]||(p[1]=kr(g=>s("cascade",g,r.feature.id,"plan"),["stop"]))},[ee(m(Bu),{class:"h-3.5 w-3.5"})]),r.feature.hasPlan?(v(),y("button",{key:0,type:"button",class:"flex items-center justify-center p-1 bg-retro-yellow/20 text-retro-yellow rounded hover:bg-retro-yellow/30 transition-colors",title:"Tasks → Implement (Shift+click: new conversation)",onClick:p[2]||(p[2]=kr(g=>s("cascade",g,r.feature.id,"tasks"),["stop"]))},[ee(m(hp),{class:"h-3.5 w-3.5"})])):F("",!0),r.feature.hasTasks?(v(),y("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-magenta/20 text-retro-magenta rounded hover:bg-retro-magenta/30 transition-colors",title:"Implement (Shift+click: new conversation)",onClick:p[3]||(p[3]=kr(g=>s("cascade",g,r.feature.id,"implement"),["stop"]))},[ee(m(Ev),{class:"h-3.5 w-3.5"})])):F("",!0),r.skills.length>0?(v(),y(we,{key:2},[p[8]||(p[8]=d("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(v(!0),y(we,null,Ne(r.skills,g=>(v(),y("button",{key:g.id,type:"button",class:_e(["flex items-center justify-center p-1 rounded transition-colors",[a(g)&&!m(u)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",m(u)?"animate-pulse":""]]),title:c(g),disabled:!a(g)||m(u),onClick:kr(O=>s("skill",O,r.feature.id,g.id),["stop"])},[(v(),pe(ps(o(g.icon)),{class:"h-3.5 w-3.5"}))],10,R2))),128))],64)):F("",!0)])):F("",!0),r.feature.hasSpec?(v(),y("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-green/20 text-retro-green rounded hover:bg-retro-green/30 transition-colors",title:"Open new chat linked to this spec",onClick:p[4]||(p[4]=kr(g=>s("openChat",g,r.feature.id),["stop"]))},[ee(m(bv),{class:"h-3.5 w-3.5"})])):F("",!0)])],2))}});let Qc=[],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,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?vp:Qc).push(t=t+r[e])})();function Z2(r){if(r<768)return!1;for(let e=0,t=Qc.length;;){let n=e+t>>1;if(r<Qc[n])t=n;else if(r>=vp[n])e=n+1;else return!0;if(e==t)return!1}}function ad(r){return r>=127462&&r<=127487}const ld=8205;function E2(r,e,t=!0,n=!0){return(t?bp:D2)(r,e,n)}function bp(r,e,t){if(e==r.length)return e;e&&xp(r.charCodeAt(e))&&yp(r.charCodeAt(e-1))&&e--;let n=Al(r,e);for(e+=cd(n);e<r.length;){let s=Al(r,e);if(n==ld||s==ld||t&&Z2(s))e+=cd(s),n=s;else if(ad(s)){let i=0,o=e-2;for(;o>=0&&ad(Al(r,o));)i++,o-=2;if(i%2==0)break;e+=2}else break}return e}function D2(r,e,t){for(;e>0;){let n=bp(r,e-2,t);if(n<e)return n;e--}return 0}function Al(r,e){let t=r.charCodeAt(e);if(!yp(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return xp(n)?(t-55296<<10)+(n-56320)+65536:t}function xp(r){return r>=56320&&r<57344}function yp(r){return r>=55296&&r<56320}function cd(r){return r<65536?1:2}class tt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Us(this,e,t);let s=[];return this.decompose(0,e,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(t,this.length,s,1),Fr.from(s,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Us(this,e,t);let n=[];return this.decompose(e,t,n,0),Fr.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),s=new Li(this),i=new Li(e);for(let o=t,a=t;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=n)return!0}}iter(e=1){return new Li(this,e)}iterRange(e,t=this.length){return new kp(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;n=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new wp(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?tt.empty:e.length<=32?new vt(e):Fr.from(vt.split(e,[]))}}class vt extends tt{constructor(e,t=L2(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((t?n:a)>=e)return new X2(s,a,n,o);s=a+1,n++}}decompose(e,t,n,s){let i=e<=0&&t>=this.length?this:new vt(ud(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=n.pop(),a=ga(i.text,o.text.slice(),0,i.length);if(a.length<=32)n.push(new vt(a,o.length+i.length));else{let l=a.length>>1;n.push(new vt(a.slice(0,l)),new vt(a.slice(l)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof vt))return super.replace(e,t,n);[e,t]=Us(this,e,t);let s=ga(this.text,ga(n.text,ud(this.text,0,e)),t),i=this.length+n.length-(t-e);return s.length<=32?new vt(s,i):Fr.from(vt.split(s,[]),i)}sliceString(e,t=this.length,n=`
|
|
12
|
+
`){[e,t]=Us(this,e,t);let s="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>e&&o&&(s+=n),e<l&&t>i&&(s+=a.slice(Math.max(0,e-i),t-i)),i=l+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],s=-1;for(let i of e)n.push(i),s+=i.length+1,n.length==32&&(t.push(new vt(n,s)),n=[],s=-1);return s>-1&&t.push(new vt(n,s)),t}}class Fr extends tt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=n+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,n,s);s=a+1,n=l+1}}decompose(e,t,n,s){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(e<=l&&t>=o){let c=s&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?n.push(a):a.decompose(e-o,t-o,n,c)}o=l+1}}replace(e,t,n){if([e,t]=Us(this,e,t),n.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(e>=i&&t<=a){let l=o.replace(e-i,t-i,n),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[s]=l,new Fr(u,this.length-(t-e)+n.length)}return super.replace(i,a,l)}i=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
|
13
|
+
`){[e,t]=Us(this,e,t);let s="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let a=this.children[i],l=o+a.length;o>e&&i&&(s+=n),e<l&&t>o&&(s+=a.sliceString(e-o,t-o,n)),o=l+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Fr))return 0;let n=0,[s,i,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,i+=t){if(s==o||i==a)return n;let l=this.children[s],c=e.children[i];if(l!=c)return n+l.scanIdentical(c,t);n+=l.length+1}}static from(e,t=e.reduce((n,s)=>n+s.length+1,-1)){let n=0;for(let p of e)n+=p.lines;if(n<32){let p=[];for(let g of e)g.flatten(p);return new vt(p,t)}let s=Math.max(32,n>>5),i=s<<1,o=s>>1,a=[],l=0,c=-1,u=[];function h(p){let g;if(p.lines>i&&p instanceof Fr)for(let O of p.children)h(O);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof vt&&l&&(g=u[u.length-1])instanceof vt&&p.lines+g.lines<=32?(l+=p.lines,c+=p.length+1,u[u.length-1]=new vt(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>s&&f(),l+=p.lines,c+=p.length+1,u.push(p))}function f(){l!=0&&(a.push(u.length==1?u[0]:Fr.from(u,c)),c=-1,l=u.length=0)}for(let p of e)h(p);return f(),a.length==1?a[0]:new Fr(a,t)}}tt.empty=new vt([""],0);function L2(r){let e=-1;for(let t of r)e+=t.length+1;return e}function ga(r,e,t=0,n=1e9){for(let s=0,i=0,o=!0;i<r.length&&s<=n;i++){let a=r[i],l=s+a.length;l>=t&&(l>n&&(a=a.slice(0,n-s)),s<t&&(a=a.slice(t-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=l+1}return e}function ud(r,e,t){return ga(r,[""],e,t)}class Li{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof vt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,s=this.nodes[n],i=this.offsets[n],o=i>>1,a=s instanceof vt?s.text.length:s.children.length;if(o==(t>0?a:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
14
|
+
`,this;e--}else if(s instanceof vt){let l=s.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof vt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class kp{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Li(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=n?s:t<0?s.slice(s.length-n):s.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class wp{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(tt.prototype[Symbol.iterator]=function(){return this.iter()},Li.prototype[Symbol.iterator]=kp.prototype[Symbol.iterator]=wp.prototype[Symbol.iterator]=function(){return this});let X2=class{constructor(e,t,n,s){this.from=e,this.to=t,this.number=n,this.text=s}get length(){return this.to-this.from}};function Us(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function Pt(r,e,t=!0,n=!0){return E2(r,e,t,n)}function I2(r){return r>=56320&&r<57344}function V2(r){return r>=55296&&r<56320}function Kt(r,e){let t=r.charCodeAt(e);if(!V2(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return I2(n)?(t-55296<<10)+(n-56320)+65536:t}function Xu(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Ur(r){return r<65536?1:2}const Pc=/\r\n?|\n/;var _t=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(_t||(_t={}));class tn{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,s=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?(e(n,s,i),s+=i):s+=o,n+=i}}iterChangedRanges(e,t=!1){Tc(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];s<0?e.push(n,s):e.push(s,n)}return new tn(e)}composeDesc(e){return this.empty?e:e.empty?this:Sp(this,e)}mapDesc(e,t=!1){return e.empty?this:Mc(this,e,t)}mapPos(e,t=-1,n=_t.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=s+a;if(l<0){if(c>e)return i+(e-s);i+=a}else{if(n!=_t.Simple&&c>=e&&(n==_t.TrackDel&&s<e&&c>e||n==_t.TrackBefore&&s<e||n==_t.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==s||t<0?i:i+l;i+=l}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,t=e){for(let n=0,s=0;n<this.sections.length&&s<=t;){let i=this.sections[n++],o=this.sections[n++],a=s+i;if(o>=0&&s<=t&&a>=e)return s<e&&a>t?"cover":!0;s=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+n+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new tn(e)}static create(e){return new tn(e)}}class kt extends tn{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Tc(this,(t,n,s,i,o)=>e=e.replace(s,s+(n-t),o),!1),e}mapDesc(e,t=!1){return Mc(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let s=0,i=0;s<t.length;s+=2){let o=t[s],a=t[s+1];if(a>=0){t[s]=a,t[s+1]=o;let l=s>>1;for(;n.length<l;)n.push(tt.empty);n.push(o?e.slice(i,i+o):tt.empty)}i+=o}return new kt(t,n)}compose(e){return this.empty?e:e.empty?this:Sp(this,e,!0)}map(e,t=!1){return e.empty?this:Mc(this,e,t,!0)}iterChanges(e,t=!1){Tc(this,e,t)}get desc(){return tn.create(this.sections)}filter(e){let t=[],n=[],s=[],i=new Yi(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let u=Math.min(i.len,l-a);Xt(s,u,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;Xt(t,u,h),h>0&&Bn(n,t,i.text),i.forward(u),a+=u}let c=e[o++];for(;a<c;){if(i.done)break e;let u=Math.min(i.len,c-a);Xt(t,u,-1),Xt(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),a+=u}}return{changes:new kt(t,n),filtered:tn.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],s=this.sections[t+1];s<0?e.push(n):s==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let s=[],i=[],o=0,a=null;function l(u=!1){if(!u&&!s.length)return;o<t&&Xt(s,t-o,-1);let h=new kt(s,i);a=a?a.compose(h.map(a)):h,s=[],i=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof kt){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:f=h,insert:p}=u;if(h>f||h<0||f>t)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${t})`);let g=p?typeof p=="string"?tt.of(p.split(n||Pc)):p:tt.empty,O=g.length;if(h==f&&O==0)return;h<o&&l(),h>o&&Xt(s,h-o,-1),Xt(s,f-h,O),Bn(i,s,g),o=f}}return c(e),l(!a),a}static empty(e){return new kt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let s=0;s<e.length;s++){let i=e[s];if(typeof i=="number")t.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)t.push(i[0],0);else{for(;n.length<s;)n.push(tt.empty);n[s]=tt.of(i.slice(1)),t.push(i[0],n[s].length)}}}return new kt(t,n)}static createSet(e,t){return new kt(e,t)}}function Xt(r,e,t,n=!1){if(e==0&&t<=0)return;let s=r.length-2;s>=0&&t<=0&&t==r[s+1]?r[s]+=e:s>=0&&e==0&&r[s]==0?r[s+1]+=t:n?(r[s]+=e,r[s+1]+=t):r.push(e,t)}function Bn(r,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<n;)r.push(tt.empty);r.push(t)}}function Tc(r,e,t){let n=r.inserted;for(let s=0,i=0,o=0;o<r.sections.length;){let a=r.sections[o++],l=r.sections[o++];if(l<0)s+=a,i+=a;else{let c=s,u=i,h=tt.empty;for(;c+=a,u+=l,l&&n&&(h=h.append(n[o-2>>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)a=r.sections[o++],l=r.sections[o++];e(s,c,i,u,h),s=c,i=u}}}function Mc(r,e,t,n=!1){let s=[],i=n?[]:null,o=new Yi(r),a=new Yi(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Xt(s,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(Xt(s,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Xt(s,0,o.ins),i&&Bn(i,s,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);c+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Xt(s,c,l<o.i?o.ins:0),i&&l<o.i&&Bn(i,s,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return i?kt.createSet(s,i):tn.create(s);throw new Error("Mismatched change set lengths")}}}function Sp(r,e,t=!1){let n=[],s=t?[]:null,i=new Yi(r),o=new Yi(e);for(let a=!1;;){if(i.done&&o.done)return s?kt.createSet(n,s):tn.create(n);if(i.ins==0)Xt(n,i.len,0,a),i.next();else if(o.len==0&&!o.done)Xt(n,0,o.ins,a),s&&Bn(s,n,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),c=n.length;if(i.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Xt(n,l,u,a),s&&u&&Bn(s,n,o.text)}else o.ins==-1?(Xt(n,i.off?0:i.len,l,a),s&&Bn(s,n,i.textBit(l))):(Xt(n,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&Bn(s,n,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||n.length>c),i.forward2(l),o.forward(l)}}}}class Yi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?tt.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?tt.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class as{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,s;return this.empty?n=s=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new as(n,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return te.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return te.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return te.range(e.anchor,e.head)}static create(e,t,n){return new as(e,t,n)}}class te{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:te.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new te([this.main],0)}addRange(e,t=!0){return te.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,te.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new te(e.ranges.map(t=>as.fromJSON(t)),e.main)}static single(e,t=e){return new te([te.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;s<e.length;s++){let i=e[s];if(i.empty?i.from<=n:i.from<n)return te.normalized(e.slice(),t);n=i.to}return new te(e,t)}static cursor(e,t=0,n,s){return as.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(s??16777215)<<6)}static range(e,t,n,s){let i=(n??16777215)<<6|(s==null?7:Math.min(6,s));return t<e?as.create(t,e,48|i):as.create(e,t,(t>e?8:0)|i)}static normalized(e,t=0){let n=e[t];e.sort((s,i)=>s.from-i.from),t=e.indexOf(n);for(let s=1;s<e.length;s++){let i=e[s],o=e[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);s<=t&&t--,e.splice(--s,2,i.anchor>i.head?te.range(l,a):te.range(a,l))}}return new te(e,t)}}function $p(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Iu=0;class Qe{constructor(e,t,n,s,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=s,this.id=Iu++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new Qe(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Vu),!!e.static,e.enables)}of(e){return new Oa([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Oa(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Oa(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Vu(r,e){return r==e||r.length==e.length&&r.every((t,n)=>t===e[n])}class Oa{constructor(e,t,n,s){this.dependencies=e,this.facet=t,this.type=n,this.value=s,this.id=Iu++}dynamicSlot(e){var t;let n=this.value,s=this.facet.compareInput,i=this.id,o=e[i]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:(((t=e[h.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Ac(h,u)){let p=n(h);if(a?!hd(p,h.values[o],s):!s(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,f)=>{let p,g=f.config.address[i];if(g!=null){let O=_a(f,g);if(this.dependencies.every(b=>b instanceof Qe?f.facet(b)===h.facet(b):b instanceof Tt?f.field(b,!1)==h.field(b,!1):!0)||(a?hd(p=n(h),O,s):s(p=n(h),O)))return h.values[o]=O,0}else p=n(h);return h.values[o]=p,1}}}}function hd(r,e,t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!t(r[n],e[n]))return!1;return!0}function Ac(r,e){let t=!1;for(let n of e)Xi(r,n)&1&&(t=!0);return t}function z2(r,e,t){let n=t.map(l=>r[l.id]),s=t.map(l=>l.type),i=n.filter(l=>!(l&1)),o=r[e.id]>>1;function a(l){let c=[];for(let u=0;u<n.length;u++){let h=_a(l,n[u]);if(s[u]==2)for(let f of h)c.push(f);else c.push(h)}return e.combine(c)}return{create(l){for(let c of n)Xi(l,c);return l.values[o]=a(l),1},update(l,c){if(!Ac(l,i))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Ac(l,n),h=c.config.facets[e.id],f=c.facet(e);if(h&&!u&&Vu(t,h))return l.values[o]=f,0;let p=a(l);return e.compare(p,f)?(l.values[o]=f,0):(l.values[o]=p,1)}}}const Vo=Qe.define({static:!0});class Tt{constructor(e,t,n,s,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=s,this.spec=i,this.provides=void 0}static define(e){let t=new Tt(Iu++,e.create,e.update,e.compare||((n,s)=>n===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Vo).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,s)=>{let i=n.values[t],o=this.updateF(i,s);return this.compareF(i,o)?0:(n.values[t]=o,1)},reconfigure:(n,s)=>{let i=n.facet(Vo),o=s.facet(Vo),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(n.values[t]=a.create(n),1):s.config.address[this.id]!=null?(n.values[t]=s.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,Vo.of({field:this,create:e})]}get extension(){return this}}const ss={lowest:4,low:3,default:2,high:1,highest:0};function $i(r){return e=>new Cp(e,r)}const kn={highest:$i(ss.highest),high:$i(ss.high),default:$i(ss.default),low:$i(ss.low),lowest:$i(ss.lowest)};class Cp{constructor(e,t){this.inner=e,this.prec=t}}class pl{of(e){return new _c(this,e)}reconfigure(e){return pl.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class _c{constructor(e,t){this.compartment=e,this.inner=t}}class Aa{constructor(e,t,n,s,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let s=[],i=Object.create(null),o=new Map;for(let f of N2(e,t,o))f instanceof Tt?s.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of s)a[f.id]=c.length<<1,c.push(p=>f.slot(p));let u=n?.config.facets;for(let f in i){let p=i[f],g=p[0].facet,O=u&&u[f]||[];if(p.every(b=>b.type==0))if(a[g.id]=l.length<<1|1,Vu(O,p))l.push(n.facet(g));else{let b=g.combine(p.map(x=>x.value));l.push(n&&g.compare(b,n.facet(g))?n.facet(g):b)}else{for(let b of p)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=c.length<<1,c.push(x=>b.dynamicSlot(x)));a[g.id]=c.length<<1,c.push(b=>z2(b,g,p))}}let h=c.map(f=>f(a));return new Aa(e,o,h,a,l,i)}}function N2(r,e,t){let n=[[],[],[],[],[]],s=new Map;function i(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=n[l].indexOf(o);c>-1&&n[l].splice(c,1),o instanceof _c&&t.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof _c){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),i(c,a)}else if(o instanceof Cp)i(o.inner,o.prec);else if(o instanceof Tt)n[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof Oa)n[a].push(o),o.facet.extensions&&i(o.facet.extensions,ss.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(c,a)}}return i(r,ss.default),n.reduce((o,a)=>o.concat(a))}function Xi(r,e){if(e&1)return 2;let t=e>>1,n=r.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;r.status[t]=4;let s=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|s}function _a(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const Qp=Qe.define(),Rc=Qe.define({combine:r=>r.some(e=>e),static:!0}),Pp=Qe.define({combine:r=>r.length?r[0]:void 0,static:!0}),Tp=Qe.define(),Mp=Qe.define(),Ap=Qe.define(),_p=Qe.define({combine:r=>r.length?r[0]:!1});class wn{constructor(e,t){this.type=e,this.value=t}static define(){return new W2}}class W2{of(e){return new wn(this,e)}}class q2{constructor(e){this.map=e}of(e){return new We(this,e)}}class We{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new We(this.type,t)}is(e){return this.type==e}static define(e={}){return new q2(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let s of e){let i=s.map(t);i&&n.push(i)}return n}}We.reconfigure=We.define();We.appendConfig=We.define();class xt{constructor(e,t,n,s,i,o){this.startState=e,this.changes=t,this.selection=n,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,n&&$p(n,t.newLength),i.some(a=>a.type==xt.time)||(this.annotations=i.concat(xt.time.of(Date.now())))}static create(e,t,n,s,i,o){return new xt(e,t,n,s,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(xt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}xt.time=wn.define();xt.userEvent=wn.define();xt.addToHistory=wn.define();xt.remote=wn.define();function j2(r,e){let t=[];for(let n=0,s=0;;){let i,o;if(n<r.length&&(s==e.length||e[s]>=r[n]))i=r[n++],o=r[n++];else if(s<e.length)i=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<i?t.push(i,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Rp(r,e,t){var n;let s,i,o;return t?(s=e.changes,i=kt.empty(e.changes.length),o=r.changes.compose(e.changes)):(s=e.changes.map(r.changes),i=r.changes.mapDesc(e.changes,!0),o=r.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(i):(n=r.selection)===null||n===void 0?void 0:n.map(s),effects:We.mapEffects(r.effects,s).concat(We.mapEffects(e.effects,i)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function Bc(r,e,t){let n=e.selection,s=Xs(e.annotations);return e.userEvent&&(s=s.concat(xt.userEvent.of(e.userEvent))),{changes:e.changes instanceof kt?e.changes:kt.of(e.changes||[],t,r.facet(Pp)),selection:n&&(n instanceof te?n:te.single(n.anchor,n.head)),effects:Xs(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function Bp(r,e,t){let n=Bc(r,e.length?e[0]:{},r.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let i=1;i<e.length;i++){e[i].filter===!1&&(t=!1);let o=!!e[i].sequential;n=Rp(n,Bc(r,e[i],o?n.changes.newLength:r.doc.length),o)}let s=xt.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return F2(t?Y2(s):s)}function Y2(r){let e=r.startState,t=!0;for(let s of e.facet(Tp)){let i=s(r);if(i===!1){t=!1;break}Array.isArray(i)&&(t=t===!0?i:j2(t,i))}if(t!==!0){let s,i;if(t===!1)i=r.changes.invertedDesc,s=kt.empty(e.doc.length);else{let o=r.changes.filter(t);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}r=xt.create(e,s,r.selection&&r.selection.map(i),We.mapEffects(r.effects,i),r.annotations,r.scrollIntoView)}let n=e.facet(Mp);for(let s=n.length-1;s>=0;s--){let i=n[s](r);i instanceof xt?r=i:Array.isArray(i)&&i.length==1&&i[0]instanceof xt?r=i[0]:r=Bp(e,Xs(i),!1)}return r}function F2(r){let e=r.startState,t=e.facet(Ap),n=r;for(let s=t.length-1;s>=0;s--){let i=t[s](r);i&&Object.keys(i).length&&(n=Rp(n,Bc(e,i,r.changes.newLength),!0))}return n==r?r:xt.create(e,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const U2=[];function Xs(r){return r==null?U2:Array.isArray(r)?r:[r]}var pt=(function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r})(pt||(pt={}));const G2=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Zc;try{Zc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function H2(r){if(Zc)return Zc.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||G2.test(t)))return!0}return!1}function K2(r){return e=>{if(!/\S/.test(e))return pt.Space;if(H2(e))return pt.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return pt.Word;return pt.Other}}class He{constructor(e,t,n,s,i,o){this.config=e,this.doc=t,this.selection=n,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Xi(this,a<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Xi(this,n),_a(this,n)}update(...e){return Bp(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:s}=t;for(let a of e.effects)a.is(pl.reconfigure)?(t&&(s=new Map,t.compartments.forEach((l,c)=>s.set(c,l)),t=null),s.set(a.value.compartment,a.value.extension)):a.is(We.reconfigure)?(t=null,n=a.value):a.is(We.appendConfig)&&(t=null,n=Xs(n).concat(a.value));let i;t?i=e.startState.values.slice():(t=Aa.resolve(n,s,this),i=new He(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Rc)?e.newSelection:e.newSelection.asSingle();new He(t,e.newDoc,o,i,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:te.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),s=this.changes(n.changes),i=[n.range],o=Xs(n.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),u=c.map(s);for(let f=0;f<a;f++)i[f]=i[f].map(u);let h=s.mapDesc(c,!0);i.push(l.range.map(h)),s=s.compose(u),o=We.mapEffects(o,u).concat(We.mapEffects(Xs(l.effects),h))}return{changes:s,selection:te.create(i,t.mainIndex),effects:o}}changes(e=[]){return e instanceof kt?e:kt.of(e,this.doc.length,this.facet(He.lineSeparator))}toText(e){return tt.of(e.split(this.facet(He.lineSeparator)||Pc))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Xi(this,t),_a(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let s=e[n];s instanceof Tt&&this.config.address[s.id]!=null&&(t[n]=s.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(n){for(let i in n)if(Object.prototype.hasOwnProperty.call(e,i)){let o=n[i],a=e[i];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return He.create({doc:e.doc,selection:te.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Aa.resolve(e.extensions||[],new Map),n=e.doc instanceof tt?e.doc:tt.of((e.doc||"").split(t.staticFacet(He.lineSeparator)||Pc)),s=e.selection?e.selection instanceof te?e.selection:te.single(e.selection.anchor,e.selection.head):te.single(0);return $p(s,n.length),t.staticFacet(Rc)||(s=s.asSingle()),new He(t,n,s,t.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(He.tabSize)}get lineBreak(){return this.facet(He.lineSeparator)||`
|
|
15
|
+
`}get readOnly(){return this.facet(_p)}phrase(e,...t){for(let n of this.facet(He.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>t.length?n:t[i-1]})),e}languageDataAt(e,t,n=-1){let s=[];for(let i of this.facet(Qp))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return K2(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=Pt(t,o,!1);if(i(t.slice(l,o))!=pt.Word)break;o=l}for(;a<s;){let l=Pt(t,a);if(i(t.slice(a,l))!=pt.Word)break;a=l}return o==a?null:te.range(o+n,a+n)}}He.allowMultipleSelections=Rc;He.tabSize=Qe.define({combine:r=>r.length?r[0]:4});He.lineSeparator=Pp;He.readOnly=_p;He.phrases=Qe.define({compare(r,e){let t=Object.keys(r),n=Object.keys(e);return t.length==n.length&&t.every(s=>r[s]==e[s])}});He.languageData=Qp;He.changeFilter=Tp;He.transactionFilter=Mp;He.transactionExtender=Ap;pl.reconfigure=We.define();function nn(r,e,t={}){let n={};for(let s of r)for(let i of Object.keys(s)){let o=s[i],a=n[i];if(a===void 0)n[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,i))n[i]=t[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let s in e)n[s]===void 0&&(n[s]=e[s]);return n}class Dn{eq(e){return this==e}range(e,t=e){return Ec.create(e,t,this)}}Dn.prototype.startSide=Dn.prototype.endSide=0;Dn.prototype.point=!1;Dn.prototype.mapMode=_t.TrackDel;function zu(r,e){return r==e||r.constructor==e.constructor&&r.eq(e)}let Ec=class Zp{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Zp(e,t,n)}};function Dc(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Nu{constructor(e,t,n,s){this.from=e,this.to=t,this.value=n,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,s=0){let i=n?this.to:this.from;for(let o=s,a=i.length;;){if(o==a)return o;let l=o+a>>1,c=i[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,n,s){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i<o;i++)if(s(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(e,t){let n=[],s=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,h=this.to[l]+e,f,p;if(u==h){let g=t.mapPos(u,c.startSide,c.mapMode);if(g==null||(f=p=g,c.startSide!=c.endSide&&(p=t.mapPos(u,c.endSide),p<f)))continue}else if(f=t.mapPos(u,c.startSide),p=t.mapPos(h,c.endSide),f>p||f==p&&c.startSide>0&&c.endSide<=0)continue;(p-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,p-f)),n.push(c),s.push(f-o),i.push(p-o))}return{mapped:n.length?new Nu(s,i,n,a):null,pos:o}}}class Ge{constructor(e,t,n,s){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=s}static create(e,t,n,s){return new Ge(e,t,n,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:s=0,filterTo:i=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Dc)),this.isEmpty)return t.length?Ge.of(t):this;let a=new Ep(this,null,-1).goto(0),l=0,c=[],u=new bn;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];u.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||i<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Ec.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Ge.empty:this.nextLayer.update({add:c,filter:o,filterFrom:s,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)s=Math.max(s,l.maxPoint),t.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:h}=l.map(a,e);u&&(s=Math.max(s,u.maxPoint),t.push(u),n.push(h))}}let i=this.nextLayer.map(e);return t.length==0?i:new Ge(n,t,i||Ge.empty,s)}between(e,t,n){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(t>=i&&e<=i+o.length&&o.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Fi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Fi.from(e).goto(t)}static compare(e,t,n,s,i=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),a=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),l=dd(o,a,n),c=new Ci(o,l,i),u=new Ci(a,l,i);n.iterGaps((h,f,p)=>fd(c,h,u,f,p,s)),n.empty&&n.length==0&&fd(c,0,u,0,0,s)}static eq(e,t,n=0,s){s==null&&(s=999999999);let i=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=dd(i,o),l=new Ci(i,a,0).goto(n),c=new Ci(o,a,0).goto(n);for(;;){if(l.to!=c.to||!Lc(l.active,c.active)||l.point&&(!c.point||!zu(l.point,c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(e,t,n,s,i=-1){let o=new Ci(e,null,i).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);s.point(a,c,o.point,u,h,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>n)return l+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,t=!1){let n=new bn;for(let s of e instanceof Ec?[e]:t?J2(e):e)n.add(s.from,s.to,s.value);return n.finish()}static join(e){if(!e.length)return Ge.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let s=e[n];s!=Ge.empty;s=s.nextLayer)t=new Ge(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}Ge.empty=new Ge([],[],null,-1);function J2(r){if(r.length>1)for(let e=r[0],t=1;t<r.length;t++){let n=r[t];if(Dc(e,n)>0)return r.slice().sort(Dc);e=n}return r}Ge.empty.nextLayer=Ge.empty;class bn{finishChunk(e){this.chunks.push(new Nu(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new bn)).add(e,t,n)}addInner(e,t,n){let s=e-this.lastTo||n.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function dd(r,e,t){let n=new Map;for(let i of r)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&n.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of e)for(let o=0;o<i.chunk.length;o++){let a=n.get(i.chunk[o]);a!=null&&(t?t.mapPos(a):a)==i.chunkPos[o]&&!t?.touchesRange(a,a+i.chunk[o].length)&&s.add(i.chunk[o])}return s}class Ep{constructor(e,t,n,s=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Fi{constructor(e){this.heap=e}static from(e,t=null,n=-1){let s=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&s.push(new Ep(o,t,n,i));return s.length==1?s[0]:new Fi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)_l(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)_l(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),_l(this.heap,0)}}}function _l(r,e){for(let t=r[e];;){let n=(e<<1)+1;if(n>=r.length)break;let s=r[n];if(n+1<r.length&&s.compare(r[n+1])>=0&&(s=r[n+1],n++),t.compare(s)<0)break;r[n]=t,r[e]=s,e=n}}class Ci{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Fi.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){zo(this.active,e),zo(this.activeTo,e),zo(this.activeRank,e),this.minActive=md(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:s,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||s-this.activeTo[t])>0;)t++;No(this.active,t,n),No(this.activeTo,t,s),No(this.activeRank,t,i),e&&No(e,t,this.cursor.from),this.minActive=md(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),n&&zo(n,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let s=n.length-1;s>=0&&n[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function fd(r,e,t,n,s,i){r.goto(e),t.goto(n);let o=n+s,a=n,l=n-e,c=!!i.boundChange;for(let u=!1;;){let h=r.to+l-t.to,f=h||r.endSide-t.endSide,p=f<0?r.to+l:t.to,g=Math.min(p,o);if(r.point||t.point?(r.point&&t.point&&zu(r.point,t.point)&&Lc(r.activeForPoint(r.to),t.activeForPoint(t.to))||i.comparePoint(a,g,r.point,t.point),u=!1):(u&&i.boundChange(a),g>a&&!Lc(r.active,t.active)&&i.compareRange(a,g,r.active,t.active),c&&g<o&&(h||r.openEnd(p)!=t.openEnd(p))&&(u=!0)),p>o)break;a=p,f<=0&&r.next(),f>=0&&t.next()}}function Lc(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!=e[t]&&!zu(r[t],e[t]))return!1;return!0}function zo(r,e){for(let t=e,n=r.length-1;t<n;t++)r[t]=r[t+1];r.pop()}function No(r,e,t){for(let n=r.length-1;n>=e;n--)r[n+1]=r[n];r[e]=t}function md(r,e){let t=-1,n=1e9;for(let s=0;s<e.length;s++)(e[s]-n||r[s].endSide-r[t].endSide)<0&&(t=s,n=e[s]);return t}function Zr(r,e,t=r.length){let n=0;for(let s=0;s<t&&s<r.length;)r.charCodeAt(s)==9?(n+=e-n%e,s++):(n++,s=Pt(r,s));return n}function Xc(r,e,t,n){for(let s=0,i=0;;){if(i>=e)return s;if(s==r.length)break;i+=r.charCodeAt(s)==9?t-i%t:1,s=Pt(r,s)}return n===!0?-1:r.length}const Ic="ͼ",pd=typeof Symbol>"u"?"__"+Ic:Symbol.for(Ic),Vc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),gd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ln{constructor(e,t){this.rules=[];let{finish:n}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(O=>o.map(b=>O.replace(/&/,b))).reduce((O,b)=>O.concat(b)),g,l);else if(g&&typeof g=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(s(p),g,u,f)}else g!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,O=>"-"+O.toLowerCase())+": "+g+";")}(u.length||f)&&l.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)i(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
16
|
+
`)}static newName(){let e=gd[pd]||1;return gd[pd]=e+1,Ic+e.toString(36)}static mount(e,t,n){let s=e[Vc],i=n&&n.nonce;s?i&&s.setNonce(i):s=new e$(e,i),s.mount(Array.isArray(t)?t:[t],e)}}let Od=new Map;class e${constructor(e,t){let n=e.ownerDocument||e,s=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=Od.get(n);if(i)return e[Vc]=i;this.sheet=new s.CSSStyleSheet,Od.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Vc]=this}mount(e,t){let n=this.sheet,s=0,i=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),n)for(let c=0;c<a.rules.length;c++)n.insertRule(a.rules[c],s++)}else{for(;i<l;)s+=this.modules[i++].rules.length;s+=a.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
17
|
+
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Xn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ui={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},t$=typeof navigator<"u"&&/Mac/.test(navigator.platform),r$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var At=0;At<10;At++)Xn[48+At]=Xn[96+At]=String(At);for(var At=1;At<=24;At++)Xn[At+111]="F"+At;for(var At=65;At<=90;At++)Xn[At]=String.fromCharCode(At+32),Ui[At]=String.fromCharCode(At);for(var Rl in Xn)Ui.hasOwnProperty(Rl)||(Ui[Rl]=Xn[Rl]);function n$(r){var e=t$&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||r$&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Ui:Xn)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function lt(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];typeof s=="string"?r.setAttribute(n,s):s!=null&&(r[n]=s)}e++}for(;e<arguments.length;e++)Dp(r,arguments[e]);return r}function Dp(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Dp(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}let jt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},zc=typeof document<"u"?document:{documentElement:{style:{}}};const Nc=/Edge\/(\d+)/.exec(jt.userAgent),Lp=/MSIE \d/.test(jt.userAgent),Wc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(jt.userAgent),gl=!!(Lp||Wc||Nc),vd=!gl&&/gecko\/(\d+)/i.test(jt.userAgent),Bl=!gl&&/Chrome\/(\d+)/.exec(jt.userAgent),s$="webkitFontSmoothing"in zc.documentElement.style,qc=!gl&&/Apple Computer/.test(jt.vendor),bd=qc&&(/Mobile\/\w+/.test(jt.userAgent)||jt.maxTouchPoints>2);var Te={mac:bd||/Mac/.test(jt.platform),windows:/Win/.test(jt.platform),linux:/Linux|X11/.test(jt.platform),ie:gl,ie_version:Lp?zc.documentMode||6:Wc?+Wc[1]:Nc?+Nc[1]:0,gecko:vd,gecko_version:vd?+(/Firefox\/(\d+)/.exec(jt.userAgent)||[0,0])[1]:0,chrome:!!Bl,chrome_version:Bl?+Bl[1]:0,ios:bd,android:/Android\b/.test(jt.userAgent),webkit_version:s$?+(/\bAppleWebKit\/(\d+)/.exec(jt.userAgent)||[0,0])[1]:0,safari:qc,safari_version:qc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(jt.userAgent)||[0,0])[1]:0,tabSize:zc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Wu(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}const Ra=Object.create(null);function qu(r,e,t){if(r==e)return!0;r||(r=Ra),e||(e=Ra);let n=Object.keys(r),s=Object.keys(e);if(n.length-0!=s.length-0)return!1;for(let i of n)if(i!=t&&(s.indexOf(i)==-1||r[i]!==e[i]))return!1;return!0}function i$(r,e){for(let t=r.attributes.length-1;t>=0;t--){let n=r.attributes[t].name;e[n]==null&&r.removeAttribute(n)}for(let t in e){let n=e[t];t=="style"?r.style.cssText=n:r.getAttribute(t)!=n&&r.setAttribute(t,n)}}function xd(r,e,t){let n=!1;if(e)for(let s in e)t&&s in t||(n=!0,s=="style"?r.style.cssText="":r.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(n=!0,s=="style"?r.style.cssText=t[s]:r.setAttribute(s,t[s]));return n}function o$(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let n=r.attributes[t];e[n.name]=n.value}return e}class sn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Zt=(function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r})(Zt||(Zt={}));class Le extends Dn{constructor(e,t,n,s){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=s}get heightRelevant(){return!1}static mark(e){return new yo(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new vs(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,s;if(e.isBlockGap)n=-5e8,s=4e8;else{let{start:i,end:o}=Xp(e,t);n=(i?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new vs(e,n,s,t,e.widget||null,!0)}static line(e){return new ko(e)}static set(e,t=!1){return Ge.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Le.none=Ge.empty;class yo extends Le{constructor(e){let{start:t,end:n}=Xp(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Wu(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Ra}eq(e){return this==e||e instanceof yo&&this.tagName==e.tagName&&qu(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}yo.prototype.point=!1;class ko extends Le{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ko&&this.spec.class==e.spec.class&&qu(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}ko.prototype.mapMode=_t.TrackBefore;ko.prototype.point=!0;class vs extends Le{constructor(e,t,n,s,i,o){super(t,n,i,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?_t.TrackBefore:_t.TrackAfter:_t.TrackDel}get type(){return this.startSide!=this.endSide?Zt.WidgetRange:this.startSide<=0?Zt.WidgetBefore:Zt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof vs&&a$(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}vs.prototype.point=!0;function Xp(r,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=r;return t==null&&(t=r.inclusive),n==null&&(n=r.inclusive),{start:t??e,end:n??e}}function a$(r,e){return r==e||!!(r&&e&&r.compare(e))}function Is(r,e,t,n=0){let s=t.length-1;s>=0&&t[s]+n>=r?t[s]=Math.max(t[s],e):t.push(r,e)}class Gi extends Dn{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Gi&&this.tagName==e.tagName&&qu(this.attributes,e.attributes)}static create(e){return new Gi(e.tagName,e.attributes||Ra)}static set(e,t=!1){return Ge.of(e,t)}}Gi.prototype.startSide=Gi.prototype.endSide=-1;function Hi(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function jc(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function Ii(r,e){if(!e.anchorNode)return!1;try{return jc(r,e.anchorNode)}catch{return!1}}function va(r){return r.nodeType==3?Ki(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Vi(r,e,t,n){return t?yd(r,e,t,n,-1)||yd(r,e,t,n,1):!1}function In(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function Ba(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}function yd(r,e,t,n,s){for(;;){if(r==t&&e==n)return!0;if(e==(s<0?0:xn(r))){if(r.nodeName=="DIV")return!1;let i=r.parentNode;if(!i||i.nodeType!=1)return!1;e=In(r)+(s<0?0:1),r=i}else if(r.nodeType==1){if(r=r.childNodes[e+(s<0?-1:0)],r.nodeType==1&&r.contentEditable=="false")return!1;e=s<0?xn(r):0}else return!1}}function xn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Za(r,e){let t=e?r.left:r.right;return{left:t,right:t,top:r.top,bottom:r.bottom}}function l$(r){let e=r.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Ip(r,e){let t=e.width/r.offsetWidth,n=e.height/r.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-r.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-r.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function c$(r,e,t,n,s,i,o,a){let l=r.ownerDocument,c=l.defaultView||window;for(let u=r,h=!1;u&&!h;)if(u.nodeType==1){let f,p=u==l.body,g=1,O=1;if(p)f=l$(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let k=u.getBoundingClientRect();({scaleX:g,scaleY:O}=Ip(u,k)),f={left:k.left,right:k.left+u.clientWidth*g,top:k.top,bottom:k.top+u.clientHeight*O}}let b=0,x=0;if(s=="nearest")e.top<f.top?(x=e.top-(f.top+o),t>0&&e.bottom>f.bottom+x&&(x=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(x=e.bottom-f.bottom+o,t<0&&e.top-x<f.top&&(x=e.top-(f.top+o)));else{let k=e.bottom-e.top,w=f.bottom-f.top;x=(s=="center"&&k<=w?e.top+k/2-w/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-w+o)-f.top}if(n=="nearest"?e.left<f.left?(b=e.left-(f.left+i),t>0&&e.right>f.right+b&&(b=e.right-f.right+i)):e.right>f.right&&(b=e.right-f.right+i,t<0&&e.left<f.left+b&&(b=e.left-(f.left+i))):b=(n=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:n=="start"==a?e.left-i:e.right-(f.right-f.left)+i)-f.left,b||x)if(p)c.scrollBy(b,x);else{let k=0,w=0;if(x){let S=u.scrollTop;u.scrollTop+=x/O,w=(u.scrollTop-S)*O}if(b){let S=u.scrollLeft;u.scrollLeft+=b/g,k=(u.scrollLeft-S)*g}e={left:e.left-k,top:e.top-w,right:e.right-k,bottom:e.bottom-w},k&&Math.abs(k-b)<1&&(n="nearest"),w&&Math.abs(w-x)<1&&(s="nearest")}if(p)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function u$(r){let e=r.ownerDocument,t,n;for(let s=r.parentNode;s&&!(s==e.body||t&&n);)if(s.nodeType==1)!n&&s.scrollHeight>s.clientHeight&&(n=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:n}}class h${constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?xn(t):0),n,Math.min(e.focusOffset,n?xn(n):0))}set(e,t,n,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=s}}let ns=null;Te.safari&&Te.safari_version>=26&&(ns=!1);function Vp(r){if(r.setActive)return r.setActive();if(ns)return r.focus(ns);let e=[];for(let t=r;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(r.focus(ns==null?{get preventScroll(){return ns={preventScroll:!0},!0}}:void 0),!ns){ns=!1;for(let t=0;t<e.length;){let n=e[t++],s=e[t++],i=e[t++];n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=i&&(n.scrollLeft=i)}}}let kd;function Ki(r,e,t=e){let n=kd||(kd=document.createRange());return n.setEnd(r,t),n.setStart(r,e),n}function Vs(r,e,t,n){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=n);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,r.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,r.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function d$(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function f$(r,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,xn(t));;)if(n){if(t.nodeType!=1)return!1;let s=t.childNodes[n-1];s.contentEditable=="false"?n--:(t=s,n=xn(t))}else{if(t==r)return!0;n=In(t),t=t.parentNode}}function zp(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}function Np(r,e){for(let t=r,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=xn(t)}else if(t.parentNode&&!Ba(t))n=In(t),t=t.parentNode;else return null}}function Wp(r,e){for(let t=r,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!Ba(t))n=In(t)+1,t=t.parentNode;else return null}}class Br{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Br(e.parentNode,In(e),t)}static after(e,t){return new Br(e.parentNode,In(e)+1,t)}}var ht=(function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r})(ht||(ht={}));const bs=ht.LTR,ju=ht.RTL;function qp(r){let e=[];for(let t=0;t<r.length;t++)e.push(1<<+r[t]);return e}const m$=qp("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),p$=qp("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Yc=Object.create(null),Wr=[];for(let r of["()","[]","{}"]){let e=r.charCodeAt(0),t=r.charCodeAt(1);Yc[e]=t,Yc[t]=-e}function jp(r){return r<=247?m$[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?p$[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8204?256:64336<=r&&r<=65023?4:1}const g$=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Hr{get dir(){return this.level%2?ju:bs}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,s){let i=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==n)return o;(i<0||(s!=0?s<0?a.from<t:a.to>t:e[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function Yp(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.from!=s.from||n.to!=s.to||n.direction!=s.direction||!Yp(n.inner,s.inner))return!1}return!0}const ct=[];function O$(r,e,t,n,s){for(let i=0;i<=n.length;i++){let o=i?n[i-1].to:e,a=i<n.length?n[i].from:t,l=i?256:s;for(let c=o,u=l,h=l;c<a;c++){let f=jp(r.charCodeAt(c));f==512?f=u:f==8&&h==4&&(f=16),ct[c]=f==4?2:f,f&7&&(h=f),u=f}for(let c=o,u=l,h=l;c<a;c++){let f=ct[c];if(f==128)c<a-1&&u==ct[c+1]&&u&24?f=ct[c]=u:ct[c]=256;else if(f==64){let p=c+1;for(;p<a&&ct[p]==64;)p++;let g=c&&u==8||p<t&&ct[p]==8?h==1?1:8:256;for(let O=c;O<p;O++)ct[O]=g;c=p-1}else f==8&&h==1&&(ct[c]=1);u=f,f&7&&(h=f)}}}function v$(r,e,t,n,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=n.length;o++){let c=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let h=c,f,p,g;h<u;h++)if(p=Yc[f=r.charCodeAt(h)])if(p<0){for(let O=a-3;O>=0;O-=3)if(Wr[O+1]==-p){let b=Wr[O+2],x=b&2?s:b&4?b&1?i:s:0;x&&(ct[h]=ct[Wr[O]]=x),a=O;break}}else{if(Wr.length==189)break;Wr[a++]=h,Wr[a++]=f,Wr[a++]=l}else if((g=ct[h])==2||g==1){let O=g==s;l=O?0:1;for(let b=a-3;b>=0;b-=3){let x=Wr[b+2];if(x&2)break;if(O)Wr[b+2]|=2;else{if(x&4)break;Wr[b+2]|=4}}}}}function b$(r,e,t,n){for(let s=0,i=n;s<=t.length;s++){let o=s?t[s-1].to:r,a=s<t.length?t[s].from:e;for(let l=o;l<a;){let c=ct[l];if(c==256){let u=l+1;for(;;)if(u==a){if(s==t.length)break;u=t[s++].to,a=s<t.length?t[s].from:e}else if(ct[u]==256)u++;else break;let h=i==1,f=(u<e?ct[u]:n)==1,p=h==f?h?1:2:n;for(let g=u,O=s,b=O?t[O-1].to:r;g>l;)g==b&&(g=t[--O].from,b=O?t[O-1].to:r),ct[--g]=p;l=u}else i=c,l++}}}function Fc(r,e,t,n,s,i,o){let a=n%2?2:1;if(n%2==s%2)for(let l=e,c=0;l<t;){let u=!0,h=!1;if(c==i.length||l<i[c].from){let O=ct[l];O!=a&&(u=!1,h=O==16)}let f=!u&&a==1?[]:null,p=u?n:n+1,g=l;e:for(;;)if(c<i.length&&g==i[c].from){if(h)break e;let O=i[c];if(!u)for(let b=O.to,x=c+1;;){if(b==t)break e;if(x<i.length&&i[x].from==b)b=i[x++].to;else{if(ct[b]==a)break e;break}}if(c++,f)f.push(O);else{O.from>l&&o.push(new Hr(l,O.from,p));let b=O.direction==bs!=!(p%2);Uc(r,b?n+1:n,s,O.inner,O.from,O.to,o),l=O.to}g=O.to}else{if(g==t||(u?ct[g]!=a:ct[g]==a))break;g++}f?Fc(r,l,g,n+1,s,f,o):l<g&&o.push(new Hr(l,g,p)),l=g}else for(let l=t,c=i.length;l>e;){let u=!0,h=!1;if(!c||l>i[c-1].to){let O=ct[l-1];O!=a&&(u=!1,h=O==16)}let f=!u&&a==1?[]:null,p=u?n:n+1,g=l;e:for(;;)if(c&&g==i[c-1].to){if(h)break e;let O=i[--c];if(!u)for(let b=O.from,x=c;;){if(b==e)break e;if(x&&i[x-1].to==b)b=i[--x].from;else{if(ct[b-1]==a)break e;break}}if(f)f.push(O);else{O.to<l&&o.push(new Hr(O.to,l,p));let b=O.direction==bs!=!(p%2);Uc(r,b?n+1:n,s,O.inner,O.from,O.to,o),l=O.from}g=O.from}else{if(g==e||(u?ct[g-1]!=a:ct[g-1]==a))break;g--}f?Fc(r,g,l,n+1,s,f,o):g<l&&o.push(new Hr(g,l,p)),l=g}}function Uc(r,e,t,n,s,i,o){let a=e%2?2:1;O$(r,s,i,n,a),v$(r,s,i,n,a),b$(s,i,n,a),Fc(r,s,i,e,t,n,o)}function x$(r,e,t){if(!r)return[new Hr(0,0,e==ju?1:0)];if(e==bs&&!t.length&&!g$.test(r))return Fp(r.length);if(t.length)for(;r.length>ct.length;)ct[ct.length]=256;let n=[],s=e==bs?0:1;return Uc(r,s,s,t,0,r.length,n),n}function Fp(r){return[new Hr(0,r,0)]}let Up="";function y$(r,e,t,n,s){var i;let o=n.head-r.from,a=Hr.find(e,o,(i=n.bidiLevel)!==null&&i!==void 0?i:-1,n.assoc),l=e[a],c=l.side(s,t);if(o==c){let f=a+=s?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!s,t),c=l.side(s,t)}let u=Pt(r.text,o,l.forward(s,t));(u<l.from||u>l.to)&&(u=c),Up=r.text.slice(Math.min(o,u),Math.max(o,u));let h=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return h&&u==c&&h.level+(s?0:1)<l.level?te.cursor(h.side(!s,t)+r.from,h.forward(s,t)?1:-1,h.level):te.cursor(u+r.from,l.forward(s,t)?-1:1,l.level)}function k$(r,e,t){for(let n=e;n<t;n++){let s=jp(r.charCodeAt(n));if(s==1)return bs;if(s==2||s==4)return ju}return bs}const Gp=Qe.define(),Hp=Qe.define(),Kp=Qe.define(),Jp=Qe.define(),Gc=Qe.define(),eg=Qe.define(),tg=Qe.define(),Yu=Qe.define(),Fu=Qe.define(),rg=Qe.define({combine:r=>r.some(e=>e)}),ng=Qe.define({combine:r=>r.some(e=>e)}),sg=Qe.define();class zs{constructor(e,t="nearest",n="nearest",s=5,i=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new zs(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new zs(te.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Wo=We.define({map:(r,e)=>r.map(e)}),ig=We.define();function rr(r,e,t){let n=r.facet(Jp);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const mn=Qe.define({combine:r=>r.length?r[0]:!0});let w$=0;const Es=Qe.define({combine(r){return r.filter((e,t)=>{for(let n=0;n<t;n++)if(r[n].plugin==e.plugin)return!1;return!0})}});class bt{constructor(e,t,n,s,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Es.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Es.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:s,provide:i,decorations:o}=t||{};return new bt(w$++,e,n,s,a=>{let l=[];return o&&l.push(Ol.of(c=>{let u=c.plugin(a);return u?o(u):Le.none})),i&&l.push(i(a)),l})}static fromClass(e,t){return bt.define((n,s)=>new e(n,s),t)}}class Zl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(rr(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){rr(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){rr(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const og=Qe.define(),Uu=Qe.define(),Ol=Qe.define(),ag=Qe.define(),Gu=Qe.define(),wo=Qe.define(),lg=Qe.define();function wd(r,e){let t=r.state.facet(lg);if(!t.length)return t;let n=t.map(i=>i instanceof Function?i(r):i),s=[];return Ge.spans(n,e.from,e.to,{point(){},span(i,o,a,l){let c=i-e.from,u=o-e.from,h=s;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,g;if(p==null&&(p=k$(e.text,c,u)),l>0&&h.length&&(g=h[h.length-1]).to==c&&g.direction==p)g.to=u,h=g.inner;else{let O={from:c,to:u,direction:p,inner:[]};h.push(O),h=O.inner}}}}),s}const cg=Qe.define();function Hu(r){let e=0,t=0,n=0,s=0;for(let i of r.state.facet(cg)){let o=i(r);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:n,bottom:s}}const Ri=Qe.define();class wr{constructor(e,t,n,s){this.fromA=e,this.toA=t,this.fromB=n,this.toB=s}join(e){return new wr(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>n.toA)){if(s.toA<n.fromA)break;n=n.join(s),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let s=0,i=0,o=0;;){let a=s<e.length?e[s].fromB:1e9,l=i<t.length?t[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+o,h=c,f=u;for(;;)if(i<t.length&&t[i]<=h){let p=t[i+1];i+=2,h=Math.max(h,p);for(let g=s;g<e.length&&e[g].fromB<=h;g++)o=e[g].toA-e[g].toB;f=Math.max(f,p+o)}else if(s<e.length&&e[s].fromB<=h){let p=e[s++];h=Math.max(h,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;n.push(new wr(u,f,c,h))}return n}}class Ea{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=kt.empty(this.startState.doc.length);for(let i of n)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,a,l)=>s.push(new wr(i,o,a,l))),this.changedRanges=s}static create(e,t,n){return new Ea(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const S$=[];class yt{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return S$}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&i$(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let s of this.children){if(s==e)return n;n+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=In(this.dom),s=this.length?e>0:t>0;return new Br(this.parent.dom,n+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof bl)return e;return null}static get(e){return e.cmTile}}class vl extends yt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,s,i=e?.node==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,s=n?n.nextSibling:t.firstChild,i&&s!=a.dom&&(i.written=!0),a.dom.parentNode==t)for(;s&&s!=a.dom;)s=Sd(s);else t.insertBefore(a.dom,s);n=a.dom}for(s=n?n.nextSibling:t.firstChild,i&&s&&(i.written=!0);s;)s=Sd(s);this.length=o}}function Sd(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class bl extends vl{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=yt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,s=0,i=0;;)if(s==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,s=t.pop()}else{let o=n.children[s++];if(o instanceof pn)t.push(s),n=o,s=0;else{let a=i+o.length,l=e(o,i);if(l!==void 0)return l;i=a+o.breakAfter}}}resolveBlock(e,t){let n,s=-1,i,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(n=void 0)}(l<e||e==c&&(t<-1?a.length:a.covers(1)))&&(!n||!a.isWidget()&&n.isWidget())&&(n=a,s=e-l),(c>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=e-l)}}),!n&&!i)throw new Error("No tile at position "+e);return n&&t<0||!i?{tile:n,offset:s}:{tile:i,offset:o}}}class pn extends vl{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new pn(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class Gs extends vl{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let s=new Gs(t||document.createElement("div"),e);return(!t||!n)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,t,n){let s=null,i=-1,o=null,a=-1;function l(u,h){for(let f=0,p=0;f<u.children.length&&p<=h;f++){let g=u.children[f],O=p+g.length;O>=h&&(g.isComposite()?l(g,h-p):(!o||o.isHidden&&(t>0||n&&C$(o,g)))&&(O>h||g.flags&32)?(o=g,a=h-p):(p<h||g.flags&16&&!g.isHidden)&&(s=g,i=h-p)),p=O}}l(this,e);let c=(t<0?s:o)||s||o;return c?{tile:c,offset:c==s?i:a}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):$$(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:s,offset:i}=n;if(this.dom.contains(s.dom))return s.isText()?new Br(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:t);let o=n.tile.parent,a=!1;for(let l of o.children){if(a)return new Br(l.dom,0);l==n.tile&&(a=!0)}}return new Br(this.dom,0)}}function $$(r){let e=r.dom.lastChild;if(!e)return r.dom.getBoundingClientRect();let t=va(e);return t[t.length-1]||null}function C$(r,e){let t=r.coordsIn(0,1),n=e.coordsIn(0,1);return t&&n&&n.top<t.bottom}class er extends vl{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new er(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ls extends yt{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let s=e,i=e,o=0;e==0&&t<0||e==n&&t>=0?Te.chrome||Te.gecko||(e?(s--,o=1):i<n&&(i++,o=-1)):t<0?s--:i<n&&i++;let a=Ki(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return Te.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Za(l,o<0):l||null}static of(e,t){let n=new ls(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class xs extends yt{constructor(e,t,n,s){super(e,t,s),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let s=this.widget.coordsAt(this.dom,e,t);if(s)return s;if(n)return Za(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?i.length-1:0;o=i[l],!(e>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return Za(o,!a)}}get overrideDOMText(){if(!this.length)return tt.empty;let{root:e}=this;if(!e)return tt.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,s,i){return i||(i=e.toDOM(t),e.editable||(i.contentEditable="false")),new xs(i,n,e,s)}}class Da extends yt{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return tt.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class Q${constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:s,index:i,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(s.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(i==s.children.length){if(!e&&!a.length)break;n&&n.leave(s),o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++}else{let l=s.children[i],c=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!n||n.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,i++,e-=l.length):(a.push({tile:s,index:i}),s=l,i=0,n&&l.isComposite()&&n.enter(l))}else if(i==s.length)o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++;else if(e){let l=Math.min(e,s.length-i);n&&n.skip(s,i,i+l),e-=l,i+=l}else break;return this.tile=s,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class P${constructor(e,t,n,s){this.from=e,this.to=t,this.wrapper=n,this.rank=s}}class T${constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,s){var i;this.flushBuffer();let o=this.ensureMarks(t,n),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new ls(a.dom,a.text+e);l.parent=o}else o.append(s||ls.of(e,(i=this.cache.find(ls))===null||i===void 0?void 0:i.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?El(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let s=n;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],c=s.lastChild;if(c instanceof er&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(El(l.dom)),s=c;else{if(this.cache.reused.get(l)){let h=yt.get(l.dom);h&&h.setDOM(El(l.dom))}let u=er.of(l.mark,l.dom);s.append(u),s=u}this.cache.reused.set(l,2)}let i=yt.get(e.text);i&&this.cache.reused.set(i,2);let o=new ls(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,t,n){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let i=this.ensureMarks(t,n);!s&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=ug);let s=Gs.start(e,t||((n=this.cache.find(Gs))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let s=this.curLine;for(let i=e.length-1;i>=0;i--){let o=e[i],a;if(t>0&&(a=s.lastChild)&&a instanceof er&&a.mark.eq(o))s=a,t--;else{let l=er.of(o,(n=this.cache.find(er,c=>c.mark.eq(o)))===null||n===void 0?void 0:n.dom);s.append(l),s=l,t=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!$d(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Te.ios&&$d(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Dl,0,32)||new xs(Dl.toDOM(),0,Dl,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new P$(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let s=t.lastChild;if(n.from<this.pos&&s instanceof pn&&s.wrapper.eq(n.wrapper))t=s;else{let i=pn.of(n.wrapper,(e=this.cache.find(pn,o=>o.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(i),t=i}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Da,void 0,1);return n&&(n.flags=t),n||new Da(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class M${constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(e,s.length);return i?null:s.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const La=[xs,Gs,ls,er,Da,pn,bl];for(let r=0;r<La.length;r++)La[r].bucket=r;class A${constructor(e){this.view=e,this.buckets=La.map(()=>[]),this.index=La.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let s=e.bucket,i=this.buckets[s],o=this.index[s];for(let a=i.length-1;a>=0;a--){let l=(a+o)%i.length,c=i[l];if((!t||t(c))&&!this.reused.has(c))return i.splice(l,1),l<o&&this.index[s]--,this.reused.set(c,n),c}return null}findWidget(e,t,n){let s=this.buckets[0];if(s.length)for(let i=0,o=0;;i++){if(i==s.length){if(o)return null;o=1,i=0}let a=s[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return s.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==n?(this.reused.set(a,1),a):(this.reused.set(a,2),new xs(a.dom,t,e,a.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class _${constructor(e,t,n,s,i){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new A$(e),this.text=new M$(e.state.doc),this.builder=new T$(this.cache,new bl(e,e.contentDOM),Ge.iter(n)),this.cache.reused.set(t,2),this.old=new Q$(t),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let s=0,i=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let c=l-s;this.preserve(c,!o,!a),s=l,i+=c}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(i,a.toB)),i=a.toB,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let s=Z$(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?xs.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,s,i),i=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,s,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,i)),i=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Da)this.cache.add(o);else if(o instanceof er)this.builder.ensureLine(null),this.builder.addMark(o,s,i),this.cache.reused.set(o,1),i=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof er&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof er&&(s.shift(),i=Math.min(i,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,s=this.builder,i=0,o=Ge.spans(this.decorations,e,t,{point:(a,l,c,u,h,f)=>{if(c instanceof vs){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=u.length,h>u.length)s.continueWidget(l-a);else{let p=c.widget||(c.block?Hs.block:Hs.inline),g=R$(c),O=this.cache.findWidget(p,l-a,g)||xs.of(p,this.view,l-a,g);c.block?(c.startSide>0&&s.addLineStartIfNotCovered(n),s.addBlockWidget(O)):(s.ensureLine(n),s.addInlineWidget(O,u,h))}n=null}else n=B$(n,c);l>a&&this.text.skip(l-a)},span:(a,l,c,u)=>{for(let h=a;h<l;){let f=this.text.next(Math.min(512,l-h));f==null?(s.addLineStartIfNotCovered(n),s.addBreak(),h++):(s.ensureLine(n),s.addText(f,c,h==a?u:c.length),h+=f.length),n=null}}});s.addLineStartIfNotCovered(n),this.openWidget=o>i,this.openMarks=o}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let s=e.parentNode;;s=s.parentNode){let i=yt.get(s);if(s==this.view.contentDOM)break;i instanceof er?t.push(i):i?.isLine()?n=i:i instanceof pn||(s.nodeName=="DIV"&&!n&&s!=this.view.contentDOM?n=new Gs(s,ug):n||t.push(er.of(new yo({tagName:s.nodeName.toLowerCase(),attributes:o$(s)}),s)))}return{line:n,marks:t}}}function $d(r,e){let t=n=>{for(let s of n.children)if((e?s.isText():s.length)||t(s))return!0;return!1};return t(r)}function R$(r){let e=r.isReplace?(r.startSide<0?64:0)|(r.endSide>0?128:0):r.startSide>0?32:16;return r.block&&(e|=256),e}const ug={class:"cm-line"};function B$(r,e){let t=e.spec.attributes,n=e.spec.class;return!t&&!n||(r||(r={class:"cm-line"}),t&&Wu(t,r),n&&(r.class+=" "+n)),r}function Z$(r){let e=[];for(let t=r.parents.length;t>1;t--){let n=t==r.parents.length?r.tile:r.parents[t].tile;n instanceof er&&e.push(n.mark)}return e}function El(r){let e=yt.get(r);return e&&e.setDOM(r.cloneNode()),r}class Hs extends sn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Hs.inline=new Hs("span");Hs.block=new Hs("div");const Dl=new class extends sn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Cd{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Le.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new bl(e,e.contentDOM),this.updateInner([new wr(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:u,toA:h})=>h<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!W$(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?D$(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:h}=this.hasComposition;n=new wr(u,h,e.changes.mapPos(u,-1),e.changes.mapPos(h,1)).addToSet(n.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Te.ie||Te.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=I$(o,this.decorations,e.changes);l.length&&(n=wr.extendWithRanges(n,l));let c=z$(a,this.blockWrappers,e.changes);return c.length&&(n=wr.extendWithRanges(n,c)),i&&!n.some(u=>u.fromA<=i.range.fromA&&u.toA>=i.range.toA)&&(n=i.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let o=this.tile,a=new _$(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,t),Hc(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=Te.chrome||Te.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||n.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof Ll&&s.push(i.dom);n.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(ig)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,s=this.view.root.activeElement,i=s==n,o=!i&&!(this.view.state.facet(mn)||n.tabIndex>-1)&&Ii(n,this.view.observer.selectionRange)&&!(s&&n.contains(s));if(!(i||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Te.gecko&&l.empty&&!this.hasComposition&&E$(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new Br(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!Vi(c.node,c.offset,h.anchorNode,h.anchorOffset)||!Vi(u.node,u.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{Te.android&&Te.chrome&&n.contains(h.focusNode)&&N$(h.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let f=Hi(this.view.root);if(f)if(l.empty){if(Te.gecko){let p=L$(c.node,c.offset);if(p&&p!=3){let g=(p==1?Np:Wp)(c.node,c.offset);g&&(c=new Br(g.node,g.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(u.node,u.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([c,u]=[u,c]),p.setEnd(u.node,u.offset),p.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==n&&(n.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new Br(h.anchorNode,h.anchorOffset),this.impreciseHead=u.precise?null:new Br(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Vi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Hi(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(s,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let o=xn(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==n.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?i=e:i=e.nextSibling}if(i==n.dom.firstChild)return s;for(;i&&!yt.get(i);)i=i.nextSibling;if(!i)return s+n.length;for(let o=0,a=s;;o++){let l=n.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return n.isText()?e==n.dom?s+t:s+(t?n.length:0):s}domAtPos(e,t){let{tile:n,offset:s}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(s,t)}inlineDOMNearPos(e,t){let n,s=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=e)return!0;c.flags&16&&(i=!0)}else{let h=u+c.length;if(u<=e&&(n=c,s=e-u,i=h<e),h>=e&&!o&&(o=c,a=e-u,l=u>e),u>e&&o)return!0}}),!n&&!o?this.domAtPos(e,t):(i&&o?n=null:l&&n&&(o=null),n&&t<0||!o?n.domIn(s,t):o.domIn(a,t))}coordsAt(e,t){let{tile:n,offset:s}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof Ll?null:n.coordsInWidget(s,t,!0):n.coordsIn(s,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function s(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=Pt(i.text,o);if(a==o)return null;let l=Ki(i.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return s(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:s}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ht.LTR,c=0,u=(h,f,p)=>{for(let g=0;g<h.children.length&&!(f>s);g++){let O=h.children[g],b=f+O.length,x=O.dom.getBoundingClientRect(),{height:k}=x;if(p&&!g&&(c+=x.top-p.top),O instanceof pn)b>n&&u(O,f,x);else if(f>=n&&(c>0&&t.push(-c),t.push(k+c),c=0,o)){let w=O.dom.lastChild,S=w?va(w):[];if(S.length){let Q=S[S.length-1],L=l?Q.right-x.left:x.right-Q.left;L>a&&(a=L,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=b)}}p&&g==h.children.length-1&&(c+=p.bottom-x.bottom),f=b+O.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?ht.RTL:ht.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=va(c.dom);if(u.length!=1)return;a+=u[0].width,l=u[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),n,s,i;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=va(t.firstChild)[0];n=t.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,i=o&&o.height?o.height:n,t.remove()}),{lineHeight:n,charWidth:s,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,s=0;;s++){let i=s==t.viewports.length?null:t.viewports[s],o=i?i.from-1:this.view.state.doc.length;if(o>n){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Le.replace({widget:new Ll(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return Le.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ol).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),n=!1,s=this.view.state.facet(Gu).map((i,o)=>{let a=typeof i=="function";return a&&(n=!0),a?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=n,t.push(Ge.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(ag).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(sg))try{if(c(this.view,e.range,e))return!0}catch(u){rr(this.view.state,u,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!n)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,s.left),top:Math.min(n.top,s.top),right:Math.max(n.right,s.right),bottom:Math.max(n.bottom,s.bottom)});let i=Hu(this.view),o={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(c$(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==ht.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let c=this.view.docView.lineAt(t.head,1);c&&c.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=n=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Hc(this.tile)}}function Hc(r,e){let t=e?.get(r);if(t!=1){t==null&&r.destroy();for(let n of r.children)Hc(n,e)}}function E$(r){return r.node.nodeType==1&&r.node.firstChild&&(r.offset==0||r.node.childNodes[r.offset-1].contentEditable=="false")&&(r.offset==r.node.childNodes.length||r.node.childNodes[r.offset].contentEditable=="false")}function hg(r,e){let t=r.observer.selectionRange;if(!t.focusNode)return null;let n=Np(t.focusNode,t.focusOffset),s=Wp(t.focusNode,t.focusOffset),i=n||s;if(s&&n&&s.node!=n.node){let a=yt.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(r.docView.lastCompositionAfterCursor){let l=yt.get(n.node);!l||l.isText()&&l.text!=n.node.nodeValue||(i=s)}}if(r.docView.lastCompositionAfterCursor=i!=n,!i)return null;let o=e-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function D$(r,e,t){let n=hg(r,t);if(!n)return null;let{node:s,from:i,to:o}=n,a=s.nodeValue;if(/[\n\r]/.test(a)||r.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc;return{range:new wr(l.mapPos(i),l.mapPos(o),i,o),text:s}}function L$(r,e){return r.nodeType!=1?0:(e&&r.childNodes[e-1].contentEditable=="false"?1:0)|(e<r.childNodes.length&&r.childNodes[e].contentEditable=="false"?2:0)}let X$=class{constructor(){this.changes=[]}compareRange(e,t){Is(e,t,this.changes)}comparePoint(e,t){Is(e,t,this.changes)}boundChange(e){Is(e,e,this.changes)}};function I$(r,e,t){let n=new X$;return Ge.compare(r,e,t,n),n.changes}class V${constructor(){this.changes=[]}compareRange(e,t){Is(e,t,this.changes)}comparePoint(){}boundChange(e){Is(e,e,this.changes)}}function z$(r,e,t){let n=new V$;return Ge.compare(r,e,t,n),n.changes}function N$(r,e){for(let t=r;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function W$(r,e){let t=!1;return e&&r.iterChangedRanges((n,s)=>{n<e.to&&s>e.from&&(t=!0)}),t}class Ll extends sn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function q$(r,e,t=1){let n=r.charCategorizer(e),s=r.doc.lineAt(e),i=e-s.from;if(s.length==0)return te.cursor(e);i==0?t=1:i==s.length&&(t=-1);let o=i,a=i;t<0?o=Pt(s.text,i,!1):a=Pt(s.text,i);let l=n(s.text.slice(o,a));for(;o>0;){let c=Pt(s.text,o,!1);if(n(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=Pt(s.text,a);if(n(s.text.slice(a,c))!=l)break;a=c}return te.range(o+s.from,a+s.from)}function j$(r,e,t,n,s){let i=Math.round((n-e.left)*r.defaultCharacterWidth);if(r.lineWrapping&&t.height>r.defaultLineHeight*1.5){let a=r.viewState.heightOracle.textHeight,l=Math.floor((s-t.top-(r.defaultLineHeight-a)*.5)/a);i+=l*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(t.from,t.to);return t.from+Xc(o,i,r.state.tabSize)}function Kc(r,e,t){let n=r.lineBlockAt(e);if(Array.isArray(n.type)){let s;for(let i of n.type){if(i.from>e)break;if(!(i.to<e)){if(i.from<e&&i.to>e)return i;(!s||i.type==Zt.Text&&(s.type!=i.type||(t<0?i.from<e:i.to>e)))&&(s=i)}}return s||n}return n}function Y$(r,e,t,n){let s=Kc(r,e.head,e.assoc||-1),i=!n||s.type!=Zt.Text||!(r.lineWrapping||s.widgetLineBreaks)?null:r.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let o=r.dom.getBoundingClientRect(),a=r.textDirectionAt(s.from),l=r.posAtCoords({x:t==(a==ht.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return te.cursor(l,t?-1:1)}return te.cursor(t?s.to:s.from,t?-1:1)}function Qd(r,e,t,n){let s=r.state.doc.lineAt(e.head),i=r.bidiSpans(s),o=r.textDirectionAt(s.from);for(let a=e,l=null;;){let c=y$(s,i,o,a,t),u=Up;if(!c){if(s.number==(t?r.state.doc.lines:1))return a;u=`
|
|
18
|
+
`,s=r.state.doc.line(s.number+(t?1:-1)),i=r.bidiSpans(s),c=r.visualLineSide(s,!t)}if(l){if(!l(u))return a}else{if(!n)return c;l=n(u)}a=c}}function F$(r,e,t){let n=r.state.charCategorizer(e),s=n(t);return i=>{let o=n(i);return s==pt.Space&&(s=o),s==o}}function U$(r,e,t,n){let s=e.head,i=t?1:-1;if(s==(t?r.state.doc.length:0))return te.cursor(s,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(s,(e.empty?e.assoc:0)||(t?1:-1)),u=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let g=r.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(s-g.from))),a=(i<0?g.top:g.bottom)+u}let h=l.left+o,f=n??r.viewState.heightOracle.textHeight>>1,p=Jc(r,{x:h,y:a+f*i},!1,i);return te.cursor(p.pos,p.assoc,void 0,o)}function zi(r,e,t){for(;;){let n=0;for(let s of r)s.between(e-1,e+1,(i,o,a)=>{if(e>i&&e<o){let l=n||t||(e-i<o-e?-1:1);e=l<0?i:o,n=l}});if(!n)return e}}function dg(r,e){let t=null;for(let n=0;n<e.ranges.length;n++){let s=e.ranges[n],i=null;if(s.empty){let o=zi(r,s.from,0);o!=s.from&&(i=te.cursor(o,-1))}else{let o=zi(r,s.from,-1),a=zi(r,s.to,1);(o!=s.from||a!=s.to)&&(i=te.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(t||(t=e.ranges.slice()),t[n]=i)}return t?te.create(t,e.mainIndex):e}function Xl(r,e,t){let n=zi(r.state.facet(wo).map(s=>s(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:te.cursor(n,n<t.from?1:-1)}class Gr{constructor(e,t){this.pos=e,this.assoc=t}}function Jc(r,e,t,n){let s=r.contentDOM.getBoundingClientRect(),i=s.top+r.viewState.paddingTop,{x:o,y:a}=e,l=a-i,c;for(;;){if(l<0)return new Gr(0,1);if(l>r.viewState.docHeight)return new Gr(r.state.doc.length,-1);if(c=r.elementAtHeight(l),n==null)break;if(c.type==Zt.Text){if(n<0?c.to<r.viewport.from:c.from>r.viewport.to)break;let f=r.docView.coordsAt(n<0?c.from:c.to,n>0?-1:1);if(f&&(n<0?f.top<=l+i:f.bottom>=l+i))break}let h=r.viewState.heightOracle.textHeight/2;l=n>0?c.bottom+h:c.top-h}if(r.viewport.from>=c.to||r.viewport.to<=c.from){if(t)return null;if(c.type==Zt.Text){let h=j$(r,s,c,o,a);return new Gr(h,h==c.from?1:-1)}}if(c.type!=Zt.Text)return l<(c.top+c.bottom)/2?new Gr(c.from,1):new Gr(c.to,-1);let u=r.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=r.docView.lineAt(c.from,-2)),new G$(r,o,a,r.textDirectionAt(c.from)).scanTile(u,c.from)}class G${constructor(e,t,n,s){this.view=e,this.x=t,this.y=n,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:s}=this.bidiSpansAt(e);return s[Hr.find(s,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:s}=this.bidiSpansAt(e);return s[Hr.find(s,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:s}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+s.from<t)}scan(e,t){let n=0,s=e.length-1,i=new Set,o=this.bidiIn(e[0],e[s]),a,l,c=-1,u=1e9,h;e:for(;n<s;){let p=s-n,g=n+s>>1;t:if(i.has(g)){let b=n+Math.floor(Math.random()*p);for(let x=0;x<p;x++){if(!i.has(b)){g=b;break t}b++,b==s&&(b=n)}break e}i.add(g);let O=t(g);if(O)for(let b=0;b<O.length;b++){let x=O[b],k=0;if(x.bottom<this.y)(!a||a.bottom<x.bottom)&&(a=x),k=1;else if(x.top>this.y)(!l||l.top>x.top)&&(l=x),k=-1;else{let w=x.left>this.x?this.x-x.left:x.right<this.x?this.x-x.right:0,S=Math.abs(w);S<u&&(c=g,u=S,h=x),w&&(k=w<0==(this.baseDir==ht.LTR)?-1:1)}k==-1&&(!o||this.baseDirAt(e[g],1))?s=g:k==1&&(!o||this.baseDirAt(e[g+1],-1))&&(n=g+1)}}if(!h){let p=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(p.top+p.bottom)/2,this.scan(e,t)}let f=(o?this.dirAt(e[c],1):this.baseDir)==ht.LTR;return{i:c,after:this.x>(h.left+h.right)/2==f}}scanText(e,t){let n=[];for(let i=0;i<e.length;i=Pt(e.text,i))n.push(t+i);n.push(t+e.length);let s=this.scan(n,i=>{let o=n[i]-t,a=n[i+1]-t;return Ki(e.dom,o,a).getClientRects()});return s.after?new Gr(n[s.i+1],-1):new Gr(n[s.i],1)}scanTile(e,t){if(!e.length)return new Gr(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let n=[t];for(let a=0,l=t;a<e.children.length;a++)n.push(l+=e.children[a].length);let s=this.scan(n,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ki(l.dom,0,l.length)).getClientRects()}),i=e.children[s.i],o=n[s.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):s.after?new Gr(n[s.i+1],-1):new Gr(o,1)}}const Bi="";class H${constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(He.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bi}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let s=e;;){this.findPointBefore(n,s);let i=this.text.length;this.readNode(s);let o=yt.get(s),a=s.nextSibling;if(a==t){o?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let l=yt.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Ba(s))||Ba(a)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>i)&&!J$(a,t)&&this.lineBreak(),s=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(a=s.exec(t))&&(i=a.index,o=a[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);n=i+o}}readNode(e){let t=yt.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let s=n.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(K$(e,n.node,n.offset)?t:0))}}function K$(r,e,t){for(;;){if(!e||t<xn(e))return!1;if(e==r)return!0;t=In(e)+1,e=e.parentNode}}function J$(r,e){let t;for(;!(r==e||!r);r=r.nextSibling){let n=yt.get(r);if(!n?.isWidget())return!1;n&&(t||(t=[])).push(n)}if(t)for(let n of t){let s=n.overrideDOMText;if(s?.length)return!1}return!0}class Pd{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class e5{constructor(e,t,n,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=fg(e.docView.tile,t,n,0))){let a=i||o?[]:r5(e),l=new H$(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=n5(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=i&&i.node==a.focusNode&&i.offset==a.focusOffset||!jc(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!jc(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((Te.ios||Te.chrome)&&e.state.selection.main.empty&&l!=c&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(l,c),f=Math.max(l,c),p=u.from-h,g=u.to-f;(p==0||p==1||h==0)&&(g==0||g==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(te.range(c,l)):this.newSel=te.single(c,l)}}}function fg(r,e,t,n){if(r.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,c=n,u=n;l<r.children.length;l++){let h=r.children[l],f=c+h.length;if(c<e&&f>t)return fg(h,e,t,c);if(f>=e&&s==-1&&(s=l,i=c),c>t&&h.dom.parentNode==r.dom){o=l,a=u;break}u=f,c=f+h.breakAfter}return{from:i,to:a<0?n+r.length:a,startDOM:(s?r.children[s-1].dom.nextSibling:null)||r.dom.firstChild,endDOM:o<r.children.length&&o>=0?r.children[o].dom:null}}else return r.isText()?{from:n,to:n+r.length,startDOM:r.dom,endDOM:r.dom.nextSibling}:null}function mg(r,e){let t,{newSel:n}=e,s=r.state.selection.main,i=r.inputState.lastKeyTime>Date.now()-100?r.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=s.from,c=null;(i===8||Te.android&&e.text.length<a-o)&&(l=s.to,c="end");let u=pg(r.state.doc.sliceString(o,a,Bi),e.text,l-o,c);u&&(Te.chrome&&i==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Bi+Bi&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:tt.of(e.text.slice(u.from,u.toB).split(Bi))})}else n&&(!r.hasFocus&&r.state.facet(mn)||Xa(n,s))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!s.empty&&n&&n.main.empty?t={from:s.from,to:s.to,insert:r.state.doc.slice(s.from,s.to)}:(Te.mac||Te.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&r.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=te.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:tt.of([t.insert.toString().replace("."," ")])}):t&&t.from>=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:r.state.doc.slice(s.from,t.from).append(t.insert).append(r.state.doc.slice(t.to,s.to))}:r.state.doc.lineAt(s.from).to<s.to&&r.docView.lineHasWidget(s.to)&&r.inputState.insertingTextAt>Date.now()-50?t={from:s.from,to:s.to,insert:r.state.toText(r.inputState.insertingText)}:Te.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
|
|
19
|
+
`&&r.lineWrapping&&(n&&(n=te.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:tt.of([" "])}),t)return Ku(r,t,n,i);if(n&&!Xa(n,s)){let o=!1,a="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),a=r.inputState.lastSelectionOrigin,a=="select.pointer"&&(n=dg(r.state.facet(wo).map(l=>l(r)),n))),r.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function Ku(r,e,t,n=-1){if(Te.ios&&r.inputState.flushIOSKey(e))return!0;let s=r.state.selection.main;if(Te.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&r.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Vs(r.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Vs(r.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Vs(r.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,a=()=>o||(o=t5(r,e,t));return r.state.facet(eg).some(l=>l(r,e.from,e.to,i,a))||r.dispatch(a()),!0}function t5(r,e,t){let n,s=r.state,i=s.selection.main,o=-1;if(e.from==e.to&&e.from<i.from||e.from>i.to){let l=e.from<i.from?-1:1,c=l<0?i.from:i.to,u=zi(s.facet(wo).map(h=>h(r)),c,l);e.from==u&&(o=u)}if(o>-1)n={changes:e,selection:te.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&r.inputState.composing<0){let l=i.from<e.from?s.sliceDoc(i.from,e.from):"",c=i.to>e.to?s.sliceDoc(e.to,i.to):"";n=s.replaceSelection(r.state.toText(l+e.insert.sliceString(0,void 0,r.state.lineBreak)+c))}else{let l=s.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let u=r.state.sliceDoc(e.from,e.to),h,f=t&&hg(r,t.main.head);if(f){let g=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-g}}else h=r.state.doc.lineAt(i.head);let p=i.to-e.to;n=s.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:l,range:c||g.map(l)};let O=g.to-p,b=O-u.length;if(r.state.sliceDoc(b,O)!=u||O>=h.from&&b<=h.to)return{range:g};let x=s.changes({from:b,to:O,insert:e.insert}),k=g.to-i.to;return{changes:x,range:c?te.range(Math.max(0,c.anchor+k),Math.max(0,c.head+k)):g.map(x)}})}else n={changes:l,selection:c&&s.selection.replaceRange(c)}}let a="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,a+=".compose",r.inputState.compositionFirstChange&&(a+=".start",r.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:a,scrollIntoView:!0})}function pg(r,e,t,n){let s=Math.min(r.length,e.length),i=0;for(;i<s&&r.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==s&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,i-Math.min(o,a));t-=o+l-i}if(o<i&&r.length<e.length){let l=t<=i&&t>=o?i-t:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=t<=i&&t>=a?i-t:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function r5(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:i}=r.observer.selectionRange;return t&&(e.push(new Pd(t,n)),(s!=t||i!=n)&&e.push(new Pd(s,i))),e}function n5(r,e){if(r.length==0)return null;let t=r[0].pos,n=r.length==2?r[1].pos:t;return t>-1&&n>-1?te.single(t+e,n+e):null}function Xa(r,e){return e.head==r.main.head&&e.anchor==r.main.anchor}class s5{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Te.safari&&e.contentDOM.addEventListener("input",()=>null),Te.gecko&&b5(e.contentDOM.ownerDocument)}handleEvent(e){!d5(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let s of n.observers)s(this.view,t);for(let s of n.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=i5(e),n=this.handlers,s=this.view.contentDOM;for(let i in t)if(i!="scroll"){let o=!t[i].handlers.length,a=n[i];a&&o!=!a.handlers.length&&(s.removeEventListener(i,this.handleEvent),a=null),a||s.addEventListener(i,this.handleEvent,{passive:o})}for(let i in n)i!="scroll"&&!t[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Og.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Te.android&&Te.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Te.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=gg.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||o5.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Vs(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Te.safari&&!Te.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Td(r,e){return(t,n)=>{try{return e.call(r,n,t)}catch(s){rr(t.state,s)}}}function i5(r){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of r){let s=n.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&t(a).handlers.push(Td(n.value,l))}if(o)for(let a in o){let l=o[a];l&&t(a).observers.push(Td(n.value,l))}}for(let n in Er)t(n).handlers.push(Er[n]);for(let n in Tr)t(n).observers.push(Tr[n]);return e}const gg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],o5="dthko",Og=[16,17,18,20,91,92,224,225],qo=6;function jo(r){return Math.max(0,r)*.7+8}function a5(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class l5{constructor(e,t,n,s){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=u$(e.contentDOM),this.atoms=e.state.facet(wo).map(o=>o(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(He.allowMultipleSelections)&&c5(e,t),this.dragging=h5(e,t)&&xg(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&a5(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,s=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Hu(this.view);e.clientX-l.left<=s+qo?t=-jo(s-e.clientX):e.clientX+l.right>=o-qo&&(t=jo(e.clientX-o)),e.clientY-l.top<=i+qo?n=-jo(i-e.clientY):e.clientY+l.bottom>=a-qo&&(n=jo(e.clientY-a)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=dg(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function c5(r,e){let t=r.state.facet(Gp);return t.length?t[0](e):Te.mac?e.metaKey:e.ctrlKey}function u5(r,e){let t=r.state.facet(Hp);return t.length?t[0](e):Te.mac?!e.altKey:!e.ctrlKey}function h5(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let n=Hi(r.root);if(!n||n.rangeCount==0)return!0;let s=n.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function d5(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=r.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=yt.get(t))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const Er=Object.create(null),Tr=Object.create(null),vg=Te.ie&&Te.ie_version<15||Te.ios&&Te.webkit_version<604;function f5(r){let e=r.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{r.focus(),t.remove(),bg(r,t.value)},50)}function xl(r,e,t){for(let n of r.facet(e))t=n(t,r);return t}function bg(r,e){e=xl(r.state,Yu,e);let{state:t}=r,n,s=1,i=t.toText(e),o=i.lines==t.selection.ranges.length;if(eu!=null&&t.selection.ranges.every(l=>l.empty)&&eu==i.toString()){let l=-1;n=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let h=t.toText((o?i.line(s++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:te.cursor(c.from+h.length)}})}else o?n=t.changeByRange(l=>{let c=i.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:te.cursor(l.from+c.length)}}):n=t.replaceSelection(i);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Tr.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft};Er.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&r.inputState.tabFocusMode!=0&&(r.inputState.tabFocusMode=Date.now()+2e3),!1);Tr.touchstart=(r,e)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")};Tr.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")};Er.mousedown=(r,e)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of r.state.facet(Kp))if(t=n(r,e),t)break;if(!t&&e.button==0&&(t=p5(r,e)),t){let n=!r.hasFocus;r.inputState.startMouseSelection(new l5(r,e,t,n)),n&&r.observer.ignore(()=>{Vp(r.contentDOM);let i=r.root.activeElement;i&&!i.contains(r.contentDOM)&&i.blur()});let s=r.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else r.inputState.setSelectionOrigin("select.pointer");return!1};function Md(r,e,t,n){if(n==1)return te.cursor(e,t);if(n==2)return q$(r.state,e,t);{let s=r.docView.lineAt(e,t),i=r.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:i.from,a=s?s.posAtEnd:i.to;return a<r.state.doc.length&&a==i.to&&a++,te.range(o,a)}}const m5=Te.ie&&Te.ie_version<=11;let Ad=null,_d=0,Rd=0;function xg(r){if(!m5)return r.detail;let e=Ad,t=Rd;return Ad=r,Rd=Date.now(),_d=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(_d+1)%3:1}function p5(r,e){let t=r.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=xg(e),s=r.state.selection;return{update(i){i.docChanged&&(t.pos=i.changes.mapPos(t.pos),s=s.map(i.changes))},get(i,o,a){let l=r.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,u=Md(r,l.pos,l.assoc,n);if(t.pos!=l.pos&&!o){let h=Md(r,t.pos,t.assoc,n),f=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=f<u.from?te.range(f,p):te.range(p,f)}return o?s.replaceRange(s.main.extend(u.from,u.to)):a&&n==1&&s.ranges.length>1&&(c=g5(s,l.pos))?c:a?s.addRange(u):te.create([u])}}}function g5(r,e){for(let t=0;t<r.ranges.length;t++){let{from:n,to:s}=r.ranges[t];if(n<=e&&s>=e)return te.create(r.ranges.slice(0,t).concat(r.ranges.slice(t+1)),r.mainIndex==t?0:r.mainIndex-(r.mainIndex>t?1:0))}return null}Er.dragstart=(r,e)=>{let{selection:{main:t}}=r.state;if(e.target.draggable){let s=r.docView.tile.nearest(e.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=t.to||o<=t.from)&&(t=te.range(i,o))}}let{inputState:n}=r;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",xl(r.state,Fu,r.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Er.dragend=r=>(r.inputState.draggedContent=null,!1);function Bd(r,e,t,n){if(t=xl(r.state,Yu,t),!t)return;let s=r.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=r.inputState,o=n&&i&&u5(r,e)?{from:i.from,to:i.to}:null,a={from:s,insert:t},l=r.state.changes(o?[o,a]:a);r.focus(),r.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),r.inputState.draggedContent=null}Er.drop=(r,e)=>{if(!e.dataTransfer)return!1;if(r.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),s=0,i=()=>{++s==t.length&&Bd(r,e,n.filter(o=>o!=null).join(r.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[o]=a.result),i()},a.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Bd(r,e,n,!0),!0}return!1};Er.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=vg?null:e.clipboardData;return t?(bg(r,t.getData("text/plain")||t.getData("text/uri-list")),!0):(f5(r),!1)};function O5(r,e){let t=r.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),r.focus()},50)}function v5(r){let e=[],t=[],n=!1;for(let s of r.selection.ranges)s.empty||(e.push(r.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:i}of r.selection.ranges){let o=r.doc.lineAt(i);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(r.doc.length,o.to+1)})),s=o.number}n=!0}return{text:xl(r,Fu,e.join(r.lineBreak)),ranges:t,linewise:n}}let eu=null;Er.copy=Er.cut=(r,e)=>{if(!Ii(r.contentDOM,r.observer.selectionRange))return!1;let{text:t,ranges:n,linewise:s}=v5(r.state);if(!t&&!s)return!1;eu=s?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let i=vg?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",t),!0):(O5(r,t),!1)};const yg=wn.define();function kg(r,e){let t=[];for(let n of r.facet(tg)){let s=n(r,e);s&&t.push(s)}return t.length?r.update({effects:t,annotations:yg.of(!0)}):null}function wg(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=kg(r.state,e);t?r.dispatch(t):r.update([])}},10)}Tr.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),wg(r)};Tr.blur=r=>{r.observer.clearSelectionRange(),wg(r)};Tr.compositionstart=Tr.compositionupdate=r=>{r.observer.editContext||(r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0))};Tr.compositionend=r=>{r.observer.editContext||(r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,Te.chrome&&Te.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50))};Tr.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()};Er.beforeinput=(r,e)=>{var t,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(r.inputState.insertingText=e.data,r.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&r.observer.editContext){let i=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(i&&o.length){let a=o[0],l=r.posAtDOM(a.startContainer,a.startOffset),c=r.posAtDOM(a.endContainer,a.endOffset);return Ku(r,{from:l,to:c,insert:r.state.toText(i)},null),!0}}let s;if(Te.chrome&&Te.android&&(s=gg.find(i=>i.inputType==e.inputType))&&(r.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return Te.ios&&e.inputType=="deleteContentForward"&&r.observer.flushSoon(),Te.safari&&e.inputType=="insertText"&&r.inputState.composing>=0&&setTimeout(()=>Tr.compositionend(r,e),20),!1};const Zd=new Set;function b5(r){Zd.has(r)||(Zd.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const Ed=["pre-wrap","normal","pre-line","break-spaces"];let Ks=!1;function Dd(){Ks=!1}class x5{constructor(e){this.lineWrapping=e,this.doc=tt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ed.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s<0?n++:this.heightSamples[Math.floor(s*10)]||(t=!0,this.heightSamples[Math.floor(s*10)]=!0)}return t}refresh(e,t,n,s,i,o){let a=Ed.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=n,this.textHeight=s,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class y5{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Rr{constructor(e,t,n,s,i){this.from=e,this.length=t,this.top=n,this.height=s,this._content=i}get type(){return typeof this._content=="number"?Zt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof vs?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Rr(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ft=(function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r})(ft||(ft={}));const ba=.001;class Yt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>ba&&(Ks=!0),this.height=e)}replace(e,t,n){return Yt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,s){let i=this,o=n.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:h}=s[a],f=i.lineAt(l,ft.ByPosNoHeight,n.setDoc(t),0,0),p=f.to>=c?f:i.lineAt(c,ft.ByPosNoHeight,n,0,0);for(h+=p.to-c,c=p.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,u=s[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,ft.ByPosNoHeight,n,0,0));u+=f.from-l,l=f.from;let g=Ju.build(n.setDoc(o),e,u,h);i=Ia(i,i.replace(l,c,g))}return i.updateHeight(n,0)}static empty(){return new fr(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,s=0,i=0;for(;;)if(t==n)if(s>i*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),n+=1+a.break,s-=a.size}else if(i>s*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,i-=a.size}else break;else if(s<i){let a=e[t++];a&&(s+=a.size)}else{let a=e[--n];a&&(i+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new w5(Yt.of(e.slice(0,t)),o,Yt.of(e.slice(n)))}}function Ia(r,e){return r==e?r:(r.constructor!=e.constructor&&(Ks=!0),e)}Yt.prototype.size=1;const k5=Le.replace({});class Sg extends Yt{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Rr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,s){return this.spaceAbove&&e<n+this.spaceAbove?new Rr(s,0,n,this.spaceAbove,k5):this.mainBlock(n,s)}lineAt(e,t,n,s,i){let o=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,n,s,i).join(o):o}forEachLine(e,t,n,s,i,o){e<=i+this.length&&t>=i&&o(this.lineAt(0,ft.ByPos,n,s,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class fr extends Sg{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new Rr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let s=n[0];return n.length==1&&(s instanceof fr||s instanceof Mt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Mt?s=new fr(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Yt.of(n)}updateHeight(e,t=0,n=!1,s){return s&&s.from<=t&&s.more?this.setMeasuredHeight(s):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Mt extends Yt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,i=s-n+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:n,lastLine:s,perLine:o,perChar:a}}blockAt(e,t,n,s){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,s);if(t.lineWrapping){let c=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),u=t.doc.lineAt(c),h=a+u.length*l,f=Math.max(n,e-h/2);return new Rr(u.from,u.length,f,h,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((e-n)/a))),{from:u,length:h}=t.doc.line(i+c);return new Rr(u,h,n+a*c,a,0)}}lineAt(e,t,n,s,i){if(t==ft.ByHeight)return this.blockAt(e,n,s,i);if(t==ft.ByPosNoHeight){let{from:p,to:g}=n.doc.lineAt(e);return new Rr(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i),c=n.doc.lineAt(e),u=a+c.length*l,h=c.number-o,f=s+a*h+l*(c.from-i-h);return new Rr(c.from,c.length,Math.max(s,Math.min(f,s+this.height-u)),u,0)}forEachLine(e,t,n,s,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(n,i);for(let u=e,h=s;u<=t;){let f=n.doc.lineAt(u);if(u==e){let g=f.number-a;h+=l*g+c*(e-i-g)}let p=l+c*f.length;o(new Rr(f.from,f.length,h,p,0)),h+=p,u=f.to+1}}replace(e,t,n){let s=this.length-t;if(s>0){let i=n[n.length-1];i instanceof Mt?n[n.length-1]=new Mt(i.length+s):n.push(null,new Mt(s-1))}if(e>0){let i=n[0];i instanceof Mt?n[0]=new Mt(e+i.length):n.unshift(new Mt(e-1),null)}return Yt.of(n)}decomposeLeft(e,t){t.push(new Mt(e-1),null)}decomposeRight(e,t){t.push(null,new Mt(this.length-e-1))}updateHeight(e,t=0,n=!1,s){let i=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],a=Math.max(t,s.from),l=-1;for(s.from>t&&o.push(new Mt(s.from-t-1).updateHeight(e,t));a<=i&&s.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=s.heights[s.index++],f=0;h<0&&(f=-h,h=s.heights[s.index++]),l==-1?l=h:Math.abs(h-l)>=ba&&(l=-2);let p=new fr(u,h,f);p.outdated=!1,o.push(p),a+=u+1}a<=i&&o.push(null,new Mt(i-a).updateHeight(e,a));let c=Yt.of(o);return(l<0||Math.abs(c.height-this.height)>=ba||Math.abs(l-this.heightMetrics(e,t).perLine)>=ba)&&(Ks=!0),Ia(this,c)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class w5 extends Yt{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,s){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,s):this.right.blockAt(e,t,i,s+this.left.length+this.break)}lineAt(e,t,n,s,i){let o=s+this.left.height,a=i+this.left.length+this.break,l=t==ft.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,n,s,i):this.right.lineAt(e,t,n,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=t==ft.ByPosNoHeight?ft.ByPosNoHeight:ft.ByPos;return l?c.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,s,i).join(c)}forEachLine(e,t,n,s,i,o){let a=s+this.left.height,l=i+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,s,i,o),t>=l&&this.right.forEachLine(e,t,n,a,l,o);else{let c=this.lineAt(l,ft.ByPos,n,s,i);e<c.from&&this.left.forEachLine(e,c.from-1,n,s,i,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,a,l,o)}}replace(e,t,n){let s=this.left.length+this.break;if(t<s)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let a of n)i.push(a);if(e>0&&Ld(i,o-1),t<this.length){let a=i.length;this.decomposeRight(t,i),Ld(i,a)}return Yt.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,s=n+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<s&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Yt.of(this.break?[e,null,t]:[e,t]):(this.left=Ia(this.left,e),this.right=Ia(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,s){let{left:i,right:o}=this,a=t+i.length+this.break,l=null;return s&&s.from<=t+i.length&&s.more?l=i=i.updateHeight(e,t,n,s):i.updateHeight(e,t,n),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,n,s):o.updateHeight(e,a,n),l?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ld(r,e){let t,n;r[e]==null&&(t=r[e-1])instanceof Mt&&(n=r[e+1])instanceof Mt&&r.splice(e-1,3,new Mt(t.length+1+n.length))}const S5=5;class Ju{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof fr?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new fr(n-this.pos,-1,0)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let s=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Sg(o,s,n)):(o||i||s>=S5)&&this.addLineDeco(s,i,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new fr(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Mt(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof fr)return e;let t=new fr(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let s=this.ensureLine();s.length+=n,s.collapsed+=n,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof fr)&&!this.isCovered?this.nodes.push(new fr(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let s of this.nodes)s instanceof fr&&s.updateHeight(this.oracle,n),n+=s?s.length:1;return this.nodes}static build(e,t,n,s){let i=new Ju(n,e);return Ge.spans(t,n,s,i,0),i.finish(n)}}function $5(r,e,t){let n=new C5;return Ge.compare(r,e,t,n,0),n.changes}class C5{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,s){(e<t||n&&n.heightRelevant||s&&s.heightRelevant)&&Is(e,t,this.changes,5)}}function Q5(r,e){let t=r.getBoundingClientRect(),n=r.ownerDocument,s=n.defaultView||window,i=Math.max(0,t.left),o=Math.min(s.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(s.innerHeight,t.bottom);for(let c=r.parentNode;c&&c!=n.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let f=u.getBoundingClientRect();i=Math.max(i,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==r.parentNode?s.innerHeight:l,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:i-t.left,right:Math.max(i,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function P5(r){let e=r.getBoundingClientRect(),t=r.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function T5(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Il{constructor(e,t,n,s){this.from=e,this.to=t,this.size=n,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],i=t[n];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(e,t){return Le.replace({widget:new M5(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class M5 extends sn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Xd{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Id,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ht.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Uu).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new x5(t),this.stateDeco=Vd(e),this.heightMap=Yt.empty().applyChanges(this.stateDeco,tt.empty,this.heightOracle.setDoc(e.doc),[new wr(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Le.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let s=n?t.head:t.anchor;if(!e.some(({from:i,to:o})=>s>=i&&s<=o)){let{from:i,to:o}=this.lineBlockAt(s);e.push(new Yo(i,o))}}return this.viewports=e.sort((n,s)=>n.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Id:new eh(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Zi(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Vd(this.state);let s=e.changedRanges,i=wr.extendWithRanges(s,$5(n,this.stateDeco,e?e.changes:kt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Dd(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Ks)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(ng)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ht.RTL:ht.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let{scaleX:S,scaleY:Q}=Ip(t,a);(S>.005&&Math.abs(this.scaleX-S)>.005||Q>.005&&Math.abs(this.scaleY-Q)>.005)&&(this.scaleX=S,this.scaleY=Q,c|=16,o=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=zp(e.scrollDOM);let g=(this.printing?T5:Q5)(t,this.paddingTop),O=g.top-this.pixelViewport.top,b=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(l=!0)),!this.inView&&!this.scrollTarget&&!P5(e.dom))return 0;let k=a.width;if((this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let S=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(S)&&(o=!0),o||s.lineWrapping&&Math.abs(k-this.contentDOMWidth)>s.charWidth){let{lineHeight:Q,charWidth:L,textHeight:E}=e.docView.measureTextSize();o=Q>0&&s.refresh(i,Q,L,E,Math.max(5,k/L),S),o&&(e.docView.minWidth=0,c|=16)}O>0&&b>0?u=Math.max(O,b):O<0&&b<0&&(u=Math.min(O,b)),Dd();for(let Q of this.viewports){let L=Q.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(Q);this.heightMap=(o?Yt.empty().applyChanges(this.stateDeco,tt.empty,this.heightOracle,[new wr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new y5(Q.from,L))}Ks&&(c|=2)}let w=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Yo(s.lineAt(o-n*1e3,ft.ByHeight,i,0,0).from,s.lineAt(a+(1-n)*1e3,ft.ByHeight,i,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=s.lineAt(c,ft.ByPos,i,0,0),f;t.y=="center"?f=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<l.from?f=h.top:f=h.bottom-u,l=new Yo(s.lineAt(f-1e3/2,ft.ByHeight,i,0,0).from,s.lineAt(f+u+1e3/2,ft.ByHeight,i,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),s=t.mapPos(e.to,1);return new Yo(this.heightMap.lineAt(n,ft.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,ft.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,ft.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,ft.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=a+Math.max(10,Math.min(n,250)))&&s>o-2*1e3&&i<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let s of e)t.touchesRange(s.from,s.to)||n.push(new Il(t.mapPos(s.from),t.mapPos(s.to),s.size,s.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,s=n?1e4:2e3,i=s>>1,o=s<<1;if(this.defaultTextDirection!=ht.LTR&&!n)return[];let a=[],l=(u,h,f,p)=>{if(h-u<i)return;let g=this.state.selection.main,O=[g.from];g.empty||O.push(g.to);for(let x of O)if(x>u&&x<h){l(u,x-10,f,p),l(x+10,h,f,p);return}let b=_5(e,x=>x.from>=f.from&&x.to<=f.to&&Math.abs(x.from-u)<i&&Math.abs(x.to-h)<i&&!O.some(k=>x.from<k&&x.to>k));if(!b){if(h<f.to&&t&&n&&t.visibleRanges.some(w=>w.from<=h&&w.to>=h)){let w=t.moveToLineBoundary(te.cursor(h),!1,!0).head;w>u&&(h=w)}let x=this.gapSize(f,u,h,p),k=n||x<2e6?x:2e6;b=new Il(u,h,x,k)}a.push(b)},c=u=>{if(u.length<o||u.type!=Zt.Text)return;let h=A5(u.from,u.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(n){let O=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,x;if(f!=null){let k=Uo(h,f),w=((this.visibleBottom-this.visibleTop)/2+O)/u.height;b=k-w,x=k+w}else b=(this.visibleTop-u.top-O)/u.height,x=(this.visibleBottom-u.top+O)/u.height;p=Fo(h,b),g=Fo(h,x)}else{let O=h.total*this.heightOracle.charWidth,b=s*this.heightOracle.charWidth,x=0;if(O>2e6)for(let L of e)L.from>=u.from&&L.from<u.to&&L.size!=L.displaySize&&L.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=L.size-L.displaySize);let k=this.pixelViewport.left+x,w=this.pixelViewport.right+x,S,Q;if(f!=null){let L=Uo(h,f),E=((w-k)/2+b)/O;S=L-E,Q=L+E}else S=(k-b)/O,Q=(w+b)/O;p=Fo(h,S),g=Fo(h,Q)}p>u.from&&l(u.from,p,u,h),g<u.to&&l(g,u.to,u,h)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(e,t,n,s){let i=Uo(s,n)-Uo(s,t);return this.heightOracle.lineWrapping?e.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(e){Il.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Le.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Ge.spans(t,this.viewport.from,this.viewport.to,{span(i,o){n.push({from:i,to:o})},point(){}},20);let s=0;if(n.length!=this.visibleRanges.length)s=12;else for(let i=0;i<n.length&&!(s&8);i++){let o=this.visibleRanges[i],a=n[i];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=n,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Zi(this.heightMap.lineAt(e,ft.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Zi(this.heightMap.lineAt(this.scaler.fromDOM(e),ft.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Zi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Yo{constructor(e,t){this.from=e,this.to=t}}function A5(r,e,t){let n=[],s=r,i=0;return Ge.spans(t,r,e,{span(){},point(o,a){o>s&&(n.push({from:s,to:o}),i+=o-s),s=a}},20),s<e&&(n.push({from:s,to:e}),i+=e-s),{total:i,ranges:n}}function Fo({total:r,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(r*t);for(let s=0;;s++){let{from:i,to:o}=e[s],a=o-i;if(n<=a)return i+n;n-=a}}function Uo(r,e){let t=0;for(let{from:n,to:s}of r.ranges){if(e<=s){t+=e-n;break}t+=s-n}return t/r.total}function _5(r,e){for(let t of r)if(e(t))return t}const Id={toDOM(r){return r},fromDOM(r){return r},scale:1,eq(r){return r==this}};function Vd(r){let e=r.facet(Ol).filter(n=>typeof n!="function"),t=r.facet(Gu).filter(n=>typeof n!="function");return t.length&&e.push(Ge.join(t)),e}class eh{constructor(e,t,n){let s=0,i=0,o=0;this.viewports=n.map(({from:a,to:l})=>{let c=t.lineAt(a,ft.ByPos,e,0,0).top,u=t.lineAt(l,ft.ByPos,e,0,0).bottom;return s+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(e){for(let t=0,n=0,s=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return s+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,s=i.domBottom}}fromDOM(e){for(let t=0,n=0,s=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-s)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,s=i.domBottom}}eq(e){return e instanceof eh?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function Zi(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),n=e.toDOM(r.bottom);return new Rr(r.from,r.length,t,n-t,Array.isArray(r._content)?r._content.map(s=>Zi(s,e)):r._content)}const Go=Qe.define({combine:r=>r.join(" ")}),tu=Qe.define({combine:r=>r.indexOf(!0)>-1}),ru=Ln.newName(),$g=Ln.newName(),Cg=Ln.newName(),Qg={"&light":"."+$g,"&dark":"."+Cg};function nu(r,e,t){return new Ln(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,s=>{if(s=="&")return r;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):r+" "+n}})}const R5=nu("."+ru,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Qg),B5={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Vl=Te.ie&&Te.ie_version<=11;class Z5{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new h$,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(Te.ie&&Te.ie_version<=11||Te.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Te.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Te.chrome&&Te.chrome_version<126)&&(this.editContext=new D5(e),e.state.facet(mn)&&(e.contentDOM.editContext=this.editContext.editContext)),Vl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,s=this.selectionRange;if(n.state.facet(mn)?n.root.activeElement!=this.dom:!Ii(this.dom,s))return;let i=s.anchorNode&&n.docView.tile.nearest(s.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Te.ie&&Te.ie_version<=11||Te.android&&Te.chrome)&&!n.state.selection.main.empty&&s.focusNode&&Vi(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Hi(e.root);if(!t)return!1;let n=Te.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&E5(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let s=Ii(this.dom,n);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&f$(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,B5),Vl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Vl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Vs(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,s=!1;for(let i of e){let o=this.readMutation(i);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:s}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),s=this.selectionChanged&&Ii(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new e5(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,s=mg(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Xa(this.view.state.selection,t.newSel.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=zd(t,e.previousSibling||e.target.previousSibling,-1),s=zd(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(mn)!=e.state.facet(mn)&&(e.view.contentDOM.editContext=e.state.facet(mn)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zd(r,e,t){for(;e;){let n=yt.get(e);if(n&&n.parent==r)return n;let s=e.parentNode;e=s!=r.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function Nd(r,e){let t=e.startContainer,n=e.startOffset,s=e.endContainer,i=e.endOffset,o=r.docView.domAtPos(r.state.selection.main.anchor,1);return Vi(o.node,o.offset,s,i)&&([t,n,s,i]=[s,i,t,n]),{anchorNode:t,anchorOffset:n,focusNode:s,focusOffset:i}}function E5(r,e){if(e.getComposedRanges){let s=e.getComposedRanges(r.root)[0];if(s)return Nd(r,s)}let t=null;function n(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return r.contentDOM.addEventListener("beforeinput",n,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",n,!0),t?Nd(r,t):null}class D5{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let s=e.state.selection.main,{anchor:i,head:o}=s,a=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>n.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let u=pg(e.state.sliceDoc(a,l),n.text,(c?s.from:s.to)-a,c?"end":null);if(!u){let f=te.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Xa(f,s)||e.dispatch({selection:f,userEvent:"select"});return}let h={from:u.from+a,to:u.toA+a,insert:tt.of(n.text.slice(u.from,u.toB).split(`
|
|
20
|
+
`))};if((Te.mac||Te.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:tt.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);Ku(e,h,te.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let s=[],i=null;for(let o=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);o<a;o++){let l=e.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,s.push(i)}t.updateCharacterBounds(n.rangeStart,s)},this.handlers.textformatupdate=n=>{let s=[];for(let i of n.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(Le.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:ig.of(Le.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let s=Hi(n.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,o,a,l,c)=>{if(n)return;let u=c.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,t+=u,this.to+=u;return}else s=null,this.revertPending(e.state);if(i+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),s&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(n,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Se{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(s=>s.forEach(i=>n(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||d$(e.parent)||document,this.viewState=new Xd(e.state||He.create(e)),e.scrollTo&&e.scrollTo.is(Wo)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Es).map(s=>new Zl(s));for(let s of this.plugins)s.update(this);this.observer=new Z5(this),this.inputState=new s5(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Cd(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof xt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,s,i=this.state;for(let f of e){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(yg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=kg(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(He.phrases)!=this.state.facet(He.phrases))return this.setState(i);s=Ea.create(this,i,e),s.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:p}=f.state.selection;h=new zs(p.empty?p:te.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of f.effects)p.is(Wo)&&(h=p.value.clip(this.state))}this.viewState.update(s,h),this.bidiCache=Va.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Ri)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Go)!=s.state.facet(Go)&&(this.viewState.mustMeasureContent=!0),(t||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let f of this.state.facet(Gc))try{f(s)}catch(p){rr(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!mg(this,u)&&c.force&&Vs(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Xd(e),this.plugins=e.facet(Es).map(n=>new Zl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Cd(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Es),n=e.state.facet(Es);if(t!=n){let s=[];for(let i of n){let o=t.indexOf(i);if(o<0)s.push(new Zl(i));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){rr(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,s=n.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(zp(n))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);i=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(g){return rr(this.state,g),Wd}}),h=Ea.create(this,this.state,[]),f=!1;h.flags|=l,t?t.flags|=l:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(u[p]!=Wd)try{let g=c[p];g.write&&g.write(u[p],this)}catch(g){rr(this.state,g)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(g>1||g<-1){s=s+g,n.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Gc))a(t)}get themeClasses(){return ru+" "+(this.state.facet(tu)?Cg:$g)+" "+this.state.facet(Go)}updateAttrs(){let e=qd(this,og,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(mn)?"true":"false",class:"cm-content",style:`${Te.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),qd(this,Uu,t);let n=this.observer.ignore(()=>{let s=xd(this.contentDOM,this.contentAttrs,t),i=xd(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let s of n.effects)if(s.is(Se.announce)){t&&(this.announceDOM.textContent=""),t=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ri);let e=this.state.facet(Se.cspNonce);Ln.mount(this.root,this.styleModules.concat(R5).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Xl(this,e,Qd(this,e,t,n))}moveByGroup(e,t){return Xl(this,e,Qd(this,e,t,n=>F$(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return te.cursor(i.side(t,s)+e.from,i.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return Y$(this,e,t,n)}moveVertically(e,t,n){return Xl(this,e,U$(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Jc(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Jc(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),o=i[Hr.find(i,e-s.from,-1,t)];return Za(n,o.dir==ht.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(rg)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>L5)return Fp(e.length);let t=this.textDirectionAt(e.from),n;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==t&&(i.fresh||Yp(i.isolates,n=wd(this,e))))return i.order;n||(n=wd(this,e));let s=x$(e.text,t,n);return this.bidiCache.push(new Va(e.from,e.to,t,n,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Te.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Vp(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Wo.of(new zs(typeof e=="number"?te.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Wo.of(new zs(te.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return bt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return bt.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Ln.newName(),s=[Go.of(n),Ri.of(nu(`.${n}`,e))];return t&&t.dark&&s.push(tu.of(!0)),s}static baseTheme(e){return kn.lowest(Ri.of(nu("."+ru,e,Qg)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),s=n&&yt.get(n)||yt.get(e);return((t=s?.root)===null||t===void 0?void 0:t.view)||null}}Se.styleModule=Ri;Se.inputHandler=eg;Se.clipboardInputFilter=Yu;Se.clipboardOutputFilter=Fu;Se.scrollHandler=sg;Se.focusChangeEffect=tg;Se.perLineTextDirection=rg;Se.exceptionSink=Jp;Se.updateListener=Gc;Se.editable=mn;Se.mouseSelectionStyle=Kp;Se.dragMovesSelection=Hp;Se.clickAddsSelectionRange=Gp;Se.decorations=Ol;Se.blockWrappers=ag;Se.outerDecorations=Gu;Se.atomicRanges=wo;Se.bidiIsolatedRanges=lg;Se.scrollMargins=cg;Se.darkTheme=tu;Se.cspNonce=Qe.define({combine:r=>r.length?r[0]:""});Se.contentAttributes=Uu;Se.editorAttributes=og;Se.lineWrapping=Se.contentAttributes.of({class:"cm-lineWrapping"});Se.announce=We.define();const L5=4096,Wd={};class Va{constructor(e,t,n,s,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=s,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some(i=>i.fresh))return e;let n=[],s=e.length?e[e.length-1].dir:ht.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir==s&&!t.touchesRange(o.from,o.to)&&n.push(new Va(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function qd(r,e,t){for(let n=r.state.facet(e),s=n.length-1;s>=0;s--){let i=n[s],o=typeof i=="function"?i(r):i;o&&Wu(o,t)}return t}const X5=Te.mac?"mac":Te.windows?"win":Te.linux?"linux":"key";function I5(r,e){const t=r.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let s,i,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))s=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(n="Alt-"+n),i&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ho(r,e,t){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t!==!1&&e.shiftKey&&(r="Shift-"+r),r}const V5=kn.default(Se.domEventHandlers({keydown(r,e){return Tg(Pg(e.state),r,e,"editor")}})),So=Qe.define({enables:V5}),jd=new WeakMap;function Pg(r){let e=r.facet(So),t=jd.get(e);return t||jd.set(e,t=W5(e.reduce((n,s)=>n.concat(s),[]))),t}function z5(r,e,t){return Tg(Pg(r.state),e,r,t)}let Rn=null;const N5=4e3;function W5(r,e=X5){let t=Object.create(null),n=Object.create(null),s=(o,a)=>{let l=n[o];if(l==null)n[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,u)=>{var h,f;let p=t[o]||(t[o]=Object.create(null)),g=a.split(/ (?!$)/).map(x=>I5(x,e));for(let x=1;x<g.length;x++){let k=g.slice(0,x).join(" ");s(k,!0),p[k]||(p[k]={preventDefault:!0,stopPropagation:!1,run:[w=>{let S=Rn={view:w,prefix:k,scope:o};return setTimeout(()=>{Rn==S&&(Rn=null)},N5),!0}]})}let O=g.join(" ");s(O,!1);let b=p[O]||(p[O]={preventDefault:!1,stopPropagation:!1,run:((f=(h=p._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});l&&b.run.push(l),c&&(b.preventDefault=!0),u&&(b.stopPropagation=!0)};for(let o of r){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in u)u[f].run.push(p=>h(p,su))}let l=o[e]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}let su=null;function Tg(r,e,t,n){su=e;let s=n$(e),i=Kt(s,0),o=Ur(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;Rn&&Rn.view==t&&Rn.scope==n&&(a=Rn.prefix+" ",Og.indexOf(e.keyCode)<0&&(c=!0,Rn=null));let h=new Set,f=b=>{if(b){for(let x of b.run)if(!h.has(x)&&(h.add(x),x(t)))return b.stopPropagation&&(u=!0),!0;b.preventDefault&&(b.stopPropagation&&(u=!0),c=!0)}return!1},p=r[n],g,O;return p&&(f(p[a+Ho(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Te.windows&&e.ctrlKey&&e.altKey)&&!(Te.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(g=Xn[e.keyCode])&&g!=s?(f(p[a+Ho(g,e,!0)])||e.shiftKey&&(O=Ui[e.keyCode])!=s&&O!=g&&f(p[a+Ho(O,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+Ho(s,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),su=null,l}class $o{constructor(e,t,n,s,i){this.className=e,this.left=t,this.top=n,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let s=e.coordsAtPos(n.head,n.assoc||1);if(!s)return[];let i=Mg(e);return[new $o(t,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return q5(e,t,n)}}function Mg(r){let e=r.scrollDOM.getBoundingClientRect();return{left:(r.textDirection==ht.LTR?e.left:e.right-r.scrollDOM.clientWidth*r.scaleX)-r.scrollDOM.scrollLeft*r.scaleX,top:e.top-r.scrollDOM.scrollTop*r.scaleY}}function Yd(r,e,t,n){let s=r.coordsAtPos(e,t*2);if(!s)return n;let i=r.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=r.posAtCoords({x:i.left+1,y:o}),l=r.posAtCoords({x:i.right-1,y:o});return a==null||l==null?n:{from:Math.max(n.from,Math.min(a,l)),to:Math.min(n.to,Math.max(a,l))}}function q5(r,e,t){if(t.to<=r.viewport.from||t.from>=r.viewport.to)return[];let n=Math.max(t.from,r.viewport.from),s=Math.min(t.to,r.viewport.to),i=r.textDirection==ht.LTR,o=r.contentDOM,a=o.getBoundingClientRect(),l=Mg(r),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=a.right-(u?parseInt(u.paddingRight):0),p=Kc(r,n,1),g=Kc(r,s,-1),O=p.type==Zt.Text?p:null,b=g.type==Zt.Text?g:null;if(O&&(r.lineWrapping||p.widgetLineBreaks)&&(O=Yd(r,n,1,O)),b&&(r.lineWrapping||g.widgetLineBreaks)&&(b=Yd(r,s,-1,b)),O&&b&&O.from==b.from&&O.to==b.to)return k(w(t.from,t.to,O));{let Q=O?w(t.from,null,O):S(p,!1),L=b?w(null,t.to,b):S(g,!0),E=[];return(O||p).to<(b||g).from-(O&&b?1:0)||p.widgetLineBreaks>1&&Q.bottom+r.defaultLineHeight/2<L.top?E.push(x(h,Q.bottom,f,L.top)):Q.bottom<L.top&&r.elementAtHeight((Q.bottom+L.top)/2).type==Zt.Text&&(Q.bottom=L.top=(Q.bottom+L.top)/2),k(Q).concat(E).concat(k(L))}function x(Q,L,E,G){return new $o(e,Q-l.left,L-l.top,Math.max(0,E-Q),G-L)}function k({top:Q,bottom:L,horizontal:E}){let G=[];for(let oe=0;oe<E.length;oe+=2)G.push(x(E[oe],Q,E[oe+1],L));return G}function w(Q,L,E){let G=1e9,oe=-1e9,ie=[];function j(U,W,N,I,z){let be=r.coordsAtPos(U,U==E.to?-2:2),K=r.coordsAtPos(N,N==E.from?2:-2);!be||!K||(G=Math.min(be.top,K.top,G),oe=Math.max(be.bottom,K.bottom,oe),z==ht.LTR?ie.push(i&&W?h:be.left,i&&I?f:K.right):ie.push(!i&&I?h:K.left,!i&&W?f:be.right))}let V=Q??E.from,Z=L??E.to;for(let U of r.visibleRanges)if(U.to>V&&U.from<Z)for(let W=Math.max(U.from,V),N=Math.min(U.to,Z);;){let I=r.state.doc.lineAt(W);for(let z of r.bidiSpans(I)){let be=z.from+I.from,K=z.to+I.from;if(be>=N)break;K>W&&j(Math.max(be,W),Q==null&&be<=V,Math.min(K,N),L==null&&K>=Z,z.dir)}if(W=I.to+1,W>=N)break}return ie.length==0&&j(V,Q==null,Z,L==null,r.textDirection),{top:G,bottom:oe,horizontal:ie}}function S(Q,L){let E=a.top+(L?Q.top:Q.bottom);return{top:E,bottom:E,horizontal:[]}}}function j5(r,e){return r.constructor==e.constructor&&r.eq(e)}class Y5{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(xa)!=e.state.facet(xa)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(xa);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!j5(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[n].constructor&&s.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,Te.safari&&Te.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const xa=Qe.define();function Ag(r){return[bt.define(e=>new Y5(e,r)),xa.of(r)]}const Ji=Qe.define({combine(r){return nn(r,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function F5(r={}){return[Ji.of(r),U5,G5,H5,ng.of(!0)]}function _g(r){return r.startState.facet(Ji)!=r.state.facet(Ji)}const U5=Ag({above:!0,markers(r){let{state:e}=r,t=e.facet(Ji),n=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:te.cursor(s.head,s.head>s.anchor?-1:1);for(let l of $o.forRange(r,o,a))n.push(l)}}return n},update(r,e){r.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=_g(r);return t&&Fd(r.state,e),r.docChanged||r.selectionSet||t},mount(r,e){Fd(e.state,r)},class:"cm-cursorLayer"});function Fd(r,e){e.style.animationDuration=r.facet(Ji).cursorBlinkRate+"ms"}const G5=Ag({above:!1,markers(r){return r.state.selection.ranges.map(e=>e.empty?[]:$o.forRange(r,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(r,e){return r.docChanged||r.selectionSet||r.viewportChanged||_g(r)},class:"cm-selectionLayer"}),H5=kn.highest(Se.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Rg=We.define({map(r,e){return r==null?null:e.mapPos(r)}}),Ei=Tt.define({create(){return null},update(r,e){return r!=null&&(r=e.changes.mapPos(r)),e.effects.reduce((t,n)=>n.is(Rg)?n.value:t,r)}}),K5=bt.fromClass(class{constructor(r){this.view=r,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(r){var e;let t=r.state.field(Ei);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(r.startState.field(Ei)!=t||r.docChanged||r.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:r}=this,e=r.state.field(Ei),t=e!=null&&r.coordsAtPos(e);if(!t)return null;let n=r.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+r.scrollDOM.scrollLeft*r.scaleX,top:t.top-n.top+r.scrollDOM.scrollTop*r.scaleY,height:t.bottom-t.top}}drawCursor(r){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;r?(this.cursor.style.left=r.left/e+"px",this.cursor.style.top=r.top/t+"px",this.cursor.style.height=r.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(r){this.view.state.field(Ei)!=r&&this.view.dispatch({effects:Rg.of(r)})}},{eventObservers:{dragover(r){this.setDropPos(this.view.posAtCoords({x:r.clientX,y:r.clientY}))},dragleave(r){(r.target==this.view.contentDOM||!this.view.contentDOM.contains(r.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function J5(){return[Ei,K5]}function Ud(r,e,t,n,s){e.lastIndex=0;for(let i=r.iterRange(t,n),o=t,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=e.exec(i.value);)s(o+a.index,a)}function eC(r,e){let t=r.visibleRanges;if(t.length==1&&t[0].from==r.viewport.from&&t[0].to==r.viewport.to)return t;let n=[];for(let{from:s,to:i}of t)s=Math.max(r.state.doc.lineAt(s).from,s-e),i=Math.min(r.state.doc.lineAt(i).to,i+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=i:n.push({from:s,to:i});return n}class tC{constructor(e){const{regexp:t,decoration:n,decorate:s,boundary:i,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(a,l,c,u)=>s(u,c,c+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,c,u)=>{let h=n(a,l,c);h&&u(c,c+a[0].length,h)};else if(n)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let t=new bn,n=t.add.bind(t);for(let{from:s,to:i}of eC(e,this.maxLength))Ud(e.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(n=Math.min(a,n),s=Math.max(l,s))}),e.viewportMoved||s-n>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),n,s):t}updateRange(e,t,n,s){for(let i of e.visibleRanges){let o=Math.max(i.from,n),a=Math.min(i.to,s);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(i.from,l.from),h=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let f=[],p,g=(O,b,x)=>f.push(x.range(O,b));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,g);else Ud(e.state.doc,this.regexp,u,h,(O,b)=>this.addMatch(b,e,O,g));t=t.update({filterFrom:u,filterTo:h,filter:(O,b)=>O<u||b>h,add:f})}}return t}}const iu=/x/.unicode!=null?"gu":"g",rC=new RegExp(`[\0-\b
|
|
21
|
+
--\u2028\u2029\uFEFF-]`,iu),nC={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let zl=null;function sC(){var r;if(zl==null&&typeof document<"u"&&document.body){let e=document.body.style;zl=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return zl||!1}const ya=Qe.define({combine(r){let e=nn(r,{render:null,specialChars:rC,addSpecialChars:null});return(e.replaceTabs=!sC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,iu)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,iu)),e}});function iC(r={}){return[ya.of(r),oC()]}let Gd=null;function oC(){return Gd||(Gd=bt.fromClass(class{constructor(r){this.view=r,this.decorations=Le.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(ya)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new tC({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:s}=t.state,i=Kt(e[0],0);if(i==9){let o=s.lineAt(n),a=t.state.tabSize,l=Zr(o.text,a,n-o.from);return Le.replace({widget:new uC((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Le.replace({widget:new cC(r,i)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(ya);r.startState.facet(ya)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}const aC="•";function lC(r){return r>=32?aC:r==10?"":String.fromCharCode(9216+r)}class cC extends sn{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=lC(this.code),n=e.state.phrase("Control character")+" "+(nC[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,n,t);if(s)return s;let i=document.createElement("span");return i.textContent=t,i.title=n,i.setAttribute("aria-label",n),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class uC extends sn{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function hC(){return fC}const dC=Le.line({class:"cm-activeLine"}),fC=bt.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let n of r.state.selection.ranges){let s=r.lineBlockAt(n.head);s.from>e&&(t.push(dC.range(s.from)),e=s.from)}return Le.set(t)}},{decorations:r=>r.decorations}),ou=2e3;function mC(r,e,t){let n=Math.min(e.line,t.line),s=Math.max(e.line,t.line),i=[];if(e.off>ou||t.off>ou||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=n;l<=s;l++){let c=r.doc.line(l);c.length<=a&&i.push(te.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=n;l<=s;l++){let c=r.doc.line(l),u=Xc(c.text,o,r.tabSize,!0);if(u<0)i.push(te.cursor(c.to));else{let h=Xc(c.text,a,r.tabSize);i.push(te.range(c.from+u,c.from+h))}}}return i}function pC(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function Hd(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),n=r.state.doc.lineAt(t),s=t-n.from,i=s>ou?-1:s==n.length?pC(r,e.clientX):Zr(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:i,off:s}}function gC(r,e){let t=Hd(r,e),n=r.state.selection;return t?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(i);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(s.changes)}},get(s,i,o){let a=Hd(r,s);if(!a)return n;let l=mC(r.state,t,a);return l.length?o?te.create(l.concat(n.ranges)):te.create(l):n}}:null}function OC(r){let e=(t=>t.altKey&&t.button==0);return Se.mouseSelectionStyle.of((t,n)=>e(n)?gC(t,n):null)}const vC={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},bC={style:"cursor: crosshair"};function xC(r={}){let[e,t]=vC[r.key||"Alt"],n=bt.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[n,Se.contentAttributes.of(s=>{var i;return!((i=s.plugin(n))===null||i===void 0)&&i.isDown?bC:null})]}const Ko="-10000px";class Bg{constructor(e,t,n,s){this.facet=t,this.createTooltipView=n,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=n(o,i))}update(e,t){var n;let s=e.state.facet(this.facet),i=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<i.length;l++){let c=i[l],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=t[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(n=l.destroy)===null||n===void 0||n.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function yC(r){let e=r.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Nl=Qe.define({combine:r=>{var e,t,n;return{position:Te.ios?"absolute":((e=r.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=r.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=r.find(s=>s.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||yC}}}),Kd=new WeakMap,th=bt.fromClass(class{constructor(r){this.view=r,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=r.state.facet(Nl);this.position=e.position,this.parent=e.parent,this.classes=r.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Bg(r,rh,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),r.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let r of this.manager.tooltipViews)this.intersectionObserver.observe(r.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(r){r.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(r,this.above);e&&this.observeIntersection();let t=e||r.geometryChanged,n=r.state.facet(Nl);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(r,e){let t=r.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),r.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=Ko,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var r,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(r=n.destroy)===null||r===void 0||r.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let r=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Te.safari){let o=i.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(r=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:r,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),s=Hu(this.view);return{visible:{left:n.left+s.left,top:n.top+s.top,right:n.right-s.right,bottom:n.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Nl).tooltipSpace(this.view),scaleX:r,scaleY:e,makeAbsolute:t}}writeMeasure(r){var e;if(r.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:n,scaleX:s,scaleY:i}=r,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=r.pos[a],f=r.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(t.top,n.top)||h.top>=Math.min(t.bottom,n.bottom)||h.right<Math.max(t.left,n.left)-.1||h.left>Math.min(t.right,n.right)+.1)){u.style.top=Ko;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,O=f.right-f.left,b=(e=Kd.get(c))!==null&&e!==void 0?e:f.bottom-f.top,x=c.offset||wC,k=this.view.textDirection==ht.LTR,w=f.width>n.right-n.left?k?n.left:n.right-f.width:k?Math.max(n.left,Math.min(h.left-(p?14:0)+x.x,n.right-O)):Math.min(Math.max(n.left,h.left-O+(p?14:0)-x.x),n.right-O),S=this.above[a];!l.strictSide&&(S?h.top-b-g-x.y<n.top:h.bottom+b+g+x.y>n.bottom)&&S==n.bottom-h.bottom>h.top-n.top&&(S=this.above[a]=!S);let Q=(S?h.top-n.top:n.bottom-h.bottom)-g;if(Q<b&&c.resize!==!1){if(Q<this.view.defaultLineHeight){u.style.top=Ko;continue}Kd.set(c,b),u.style.height=(b=Q)/i+"px"}else u.style.height&&(u.style.height="");let L=S?h.top-b-g-x.y:h.bottom+g+x.y,E=w+O;if(c.overlap!==!0)for(let G of o)G.left<E&&G.right>w&&G.top<L+b&&G.bottom>L&&(L=S?G.top-b-2-g:G.bottom+g+2);if(this.position=="absolute"?(u.style.top=(L-r.parent.top)/i+"px",Jd(u,(w-r.parent.left)/s)):(u.style.top=L/i+"px",Jd(u,w/s)),p){let G=h.left+(k?x.x:-x.x)-(w+14-7);p.style.left=G/s+"px"}c.overlap!==!0&&o.push({left:w,top:L,right:E,bottom:L+b}),u.classList.toggle("cm-tooltip-above",S),u.classList.toggle("cm-tooltip-below",!S),c.positioned&&c.positioned(r.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let r of this.manager.tooltipViews)r.dom.style.top=Ko}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Jd(r,e){let t=parseInt(r.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(r.style.left=e+"px")}const kC=Se.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),wC={x:0,y:0},rh=Qe.define({enables:[th,kC]}),za=Qe.define({combine:r=>r.reduce((e,t)=>e.concat(t),[])});class yl{static create(e){return new yl(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Bg(e,za,(t,n)=>this.createHostedView(t,n),t=>t.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let s=n[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SC=rh.compute([za],r=>{let e=r.facet(za);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var n;return(n=t.end)!==null&&n!==void 0?n:t.pos})),create:yl.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class $C{constructor(e,t,n,s,i){this.view=e,this.source=t,this.field=n,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let s,i=1;if(n.isWidget())s=n.posAtStart;else{if(s=e.posAtCoords(t),s==null)return;let a=e.coordsAtPos(s);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(u=>u.from<=s&&u.to>=s),c=l&&l.dir==ht.RTL?-1:1;i=t.x<a.left?-c:c}let o=this.source(e,s,i);if(o?.then){let a=this.pending={pos:s};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>rr(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(th),t=e?e.manager.tooltips.findIndex(n=>n.create==yl.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!CC(i.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(n=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&n!==void 0?n:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!QC(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Jo=4;function CC(r,e){let{left:t,right:n,top:s,bottom:i}=r.getBoundingClientRect(),o;if(o=r.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),i=Math.max(a.bottom,i)}return e.clientX>=t-Jo&&e.clientX<=n+Jo&&e.clientY>=s-Jo&&e.clientY<=i+Jo}function QC(r,e,t,n,s,i){let o=r.scrollDOM.getBoundingClientRect(),a=r.documentTop+r.documentPadding.top+r.contentHeight;if(o.left>n||o.right<n||o.top>s||Math.min(o.bottom,a)<s)return!1;let l=r.posAtCoords({x:n,y:s},!1);return l>=e&&l<=t}function PC(r,e={}){let t=We.define(),n=Tt.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(i,o))),i.docChanged)){let o=[];for(let a of s){let l=i.changes.mapPos(a.pos,-1,_t.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=i.changes.mapPos(c.end)),o.push(c)}}s=o}for(let o of i.effects)o.is(t)&&(s=o.value),o.is(TC)&&(s=[]);return s},provide:s=>za.from(s)});return{active:n,extension:[n,bt.define(s=>new $C(s,r,n,t,e.hoverTime||300)),SC]}}function Zg(r,e){let t=r.plugin(th);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}const TC=We.define(),ef=Qe.define({combine(r){let e,t;for(let n of r)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function nh(r,e){let t=r.plugin(Eg),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const Eg=bt.fromClass(class{constructor(r){this.input=r.state.facet(eo),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(r));let e=r.state.facet(ef);this.top=new ea(r,!0,e.topContainer),this.bottom=new ea(r,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(r){let e=r.state.facet(ef);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ea(r.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ea(r.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=r.state.facet(eo);if(t!=this.input){let n=t.filter(l=>l),s=[],i=[],o=[],a=[];for(let l of n){let c=this.specs.indexOf(l),u;c<0?(u=l(r.view),a.push(u)):(u=this.panels[c],u.update&&u.update(r)),s.push(u),(u.top?i:o).push(u)}this.specs=n,this.panels=s,this.top.sync(i),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let n of this.panels)n.update&&n.update(r)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:r=>Se.scrollMargins.of(e=>{let t=e.plugin(r);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class ea{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=tf(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=tf(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function tf(r){let e=r.nextSibling;return r.remove(),e}const eo=Qe.define({enables:Eg});function MC(r,e){let t,n=new Promise(o=>t=o),s=o=>AC(o,e,t);r.state.field(Wl,!1)?r.dispatch({effects:Dg.of(s)}):r.dispatch({effects:We.appendConfig.of(Wl.init(()=>[s]))});let i=Lg.of(s);return{close:i,result:n.then(o=>((r.win.queueMicrotask||(l=>r.win.setTimeout(l,10)))(()=>{r.state.field(Wl).indexOf(s)>-1&&r.dispatch({effects:i})}),o))}}const Wl=Tt.define({create(){return[]},update(r,e){for(let t of e.effects)t.is(Dg)?r=[t.value].concat(r):t.is(Lg)&&(r=r.filter(n=>n!=t.value));return r},provide:r=>eo.computeN([r],e=>e.field(r))}),Dg=We.define(),Lg=We.define();function AC(r,e,t){let n=e.content?e.content(r,()=>o(null)):null;if(!n){if(n=lt("form"),e.input){let a=lt("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),n.appendChild(lt("label",(e.label||"")+": ",a))}else n.appendChild(document.createTextNode(e.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(lt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=n.nodeName=="FORM"?[n]:n.querySelectorAll("form");for(let a=0;a<s.length;a++){let l=s[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let i=lt("div",n,lt("button",{onclick:()=>o(null),"aria-label":r.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(i.className=e.class),i.classList.add("cm-dialog");function o(a){i.contains(i.ownerDocument.activeElement)&&r.focus(),t(a)}return{dom:i,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=n.querySelector(e.focus):a=n.querySelector("input")||n.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class yn extends Dn{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}yn.prototype.elementClass="";yn.prototype.toDOM=void 0;yn.prototype.mapMode=_t.TrackBefore;yn.prototype.startSide=yn.prototype.endSide=-1;yn.prototype.point=!0;const ka=Qe.define(),_C=Qe.define(),RC={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ni=Qe.define();function BC(r){return[Xg(),Ni.of({...RC,...r})]}const rf=Qe.define({combine:r=>r.some(e=>e)});function Xg(r){return[ZC]}const ZC=bt.fromClass(class{constructor(r){this.view=r,this.domAfter=null,this.prevViewport=r.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=r.state.facet(Ni).map(e=>new sf(r,e)),this.fixed=!r.state.facet(rf);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),r.scrollDOM.insertBefore(this.dom,r.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(r){if(this.updateGutters(r)){let e=this.prevViewport,t=r.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}if(r.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(rf)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=r.view.viewport}syncGutters(r){let e=this.dom.nextSibling;r&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=Ge.iter(this.view.state.facet(ka),this.view.viewport.from),n=[],s=this.gutters.map(i=>new EC(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==Zt.Text&&o){au(t,n,a.from);for(let l of s)l.line(this.view,a,n);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(i.type==Zt.Text){au(t,n,i.from);for(let o of s)o.line(this.view,i,n)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();r&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(r){let e=r.startState.facet(Ni),t=r.state.facet(Ni),n=r.docChanged||r.heightChanged||r.viewportChanged||!Ge.eq(r.startState.facet(ka),r.state.facet(ka),r.view.viewport.from,r.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(r)&&(n=!0);else{n=!0;let s=[];for(let i of t){let o=e.indexOf(i);o<0?s.push(new sf(this.view,i)):(this.gutters[o].update(r),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return n}destroy(){for(let r of this.gutters)r.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:r=>Se.scrollMargins.of(e=>{let t=e.plugin(r);if(!t||t.gutters.length==0||!t.fixed)return null;let n=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==ht.LTR?{left:n,right:s}:{right:n,left:s}})});function nf(r){return Array.isArray(r)?r:[r]}function au(r,e,t){for(;r.value&&r.from<=t;)r.from==t&&e.push(r.value),r.next()}class EC{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ge.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:s}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let a=new Ig(e,o,i,n);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let s=[];au(this.cursor,s,t.from),n.length&&(s=s.concat(n));let i=this.gutter.config.lineMarker(e,t,s);i&&s.unshift(i);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),s=n?[n]:null;for(let i of e.state.facet(_C)){let o=i(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class sf{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,s=>{let i=s.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,a,s)&&s.preventDefault()});this.markers=nf(t.markers(e)),t.initialSpacer&&(this.spacer=new Ig(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=nf(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let n=e.view.viewport;return!Ge.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Ig{constructor(e,t,n,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,s)}update(e,t,n,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),DC(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let n="cm-gutterElement",s=this.dom.firstChild;for(let i=0,o=0;;){let a=o,l=i<t.length?t[i++]:null,c=!1;if(l){let u=l.elementClass;u&&(n+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(s);let h=s.nextSibling;s.remove(),s=h}}if(!l)break;l.toDOM&&(c?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),c&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function DC(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].compare(e[t]))return!1;return!0}const LC=Qe.define(),XC=Qe.define(),Ds=Qe.define({combine(r){return nn(r,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let s in t){let i=n[s],o=t[s];n[s]=i?(a,l,c)=>i(a,l,c)||o(a,l,c):o}return n}})}});class ql extends yn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function jl(r,e){return r.state.facet(Ds).formatNumber(e,r.state)}const IC=Ni.compute([Ds],r=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(LC)},lineMarker(e,t,n){return n.some(s=>s.toDOM)?null:new ql(jl(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let s of e.state.facet(XC)){let i=s(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Ds)!=e.state.facet(Ds),initialSpacer(e){return new ql(jl(e,of(e.state.doc.lines)))},updateSpacer(e,t){let n=jl(t.view,of(t.view.state.doc.lines));return n==e.number?e:new ql(n)},domEventHandlers:r.facet(Ds).domEventHandlers,side:"before"}));function VC(r={}){return[Ds.of(r),Xg(),IC]}function of(r){let e=9;for(;e<r;)e=e*10+9;return e}const zC=new class extends yn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},NC=ka.compute(["selection"],r=>{let e=[],t=-1;for(let n of r.selection.ranges){let s=r.doc.lineAt(n.head).from;s>t&&(t=s,e.push(zC.range(s)))}return Ge.of(e)});function WC(){return NC}const Vg=1024;let qC=0;class Sr{constructor(e,t){this.from=e,this.to=t}}class qe{constructor(e={}){this.id=qC++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=$t.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}qe.closedBy=new qe({deserialize:r=>r.split(" ")});qe.openedBy=new qe({deserialize:r=>r.split(" ")});qe.group=new qe({deserialize:r=>r.split(" ")});qe.isolate=new qe({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});qe.contextHash=new qe({perNode:!0});qe.lookAhead=new qe({perNode:!0});qe.mounted=new qe({perNode:!0});class Ns{constructor(e,t,n,s=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=s}static get(e){return e&&e.props&&e.props[qe.mounted.id]}}const jC=Object.create(null);class $t{constructor(e,t,n,s=0){this.name=e,this.props=t,this.id=n,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):jC,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new $t(e.name||"",t,e.id,n);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[i[0].id]=i[1]}}return s}prop(e){return this.props[e.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(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(qe.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let s of n.split(" "))t[s]=e[n];return n=>{for(let s=n.prop(qe.group),i=-1;i<(s?s.length:0);i++){let o=t[i<0?n.name:s[i]];if(o)return o}}}}$t.none=new $t("",Object.create(null),0,8);class Co{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let s=null;for(let i of e){let o=i(n);if(o){s||(s=Object.assign({},n.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}t.push(s?new $t(n.name,s,n.id,n.flags):n)}return new Co(t)}}const ta=new WeakMap,af=new WeakMap;var st;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed"})(st||(st={}));class nt{constructor(e,t,n,s,i){if(this.type=e,this.children=t,this.positions=n,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Ns.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let s=n.toString();s&&(t&&(t+=","),t+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Na(this.topNode,e)}cursorAt(e,t=0,n=0){let s=ta.get(this)||this.topNode,i=new Na(s);return i.moveTo(e,t),ta.set(this,i._tree),i}get topNode(){return new Vt(this,0,0,null)}resolve(e,t=0){let n=to(ta.get(this)||this.topNode,e,t,!1);return ta.set(this,n),n}resolveInner(e,t=0){let n=to(af.get(this)||this.topNode,e,t,!0);return af.set(this,n),n}resolveStack(e,t=0){return UC(this,e,t)}iterate(e){let{enter:t,leave:n,from:s=0,to:i=this.length}=e,o=e.mode||0,a=(o&st.IncludeAnonymous)>0;for(let l=this.cursor(o|st.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:oh($t.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,s)=>new nt(this.type,t,n,s,this.propValues),e.makeTree||((t,n,s)=>new nt($t.none,t,n,s)))}static build(e){return GC(e)}}nt.empty=new nt($t.none,[],[],0);class sh{constructor(e,t){this.buffer=e,this.index=t}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 sh(this.buffer,this.index)}}class Vn{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return $t.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],s=this.set.types[t],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,t,n,s,i){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(zg(i,s,o[l+1],o[l+2])&&(a=l,n>0));l=o[l+3]);return a}slice(e,t,n){let s=this.buffer,i=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){i[l++]=s[a++],i[l++]=s[a++]-n;let c=i[l++]=s[a++]-n;i[l++]=s[a++]-e,o=Math.max(o,c)}return new Vn(i,o,this.set)}}function zg(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function to(r,e,t,n){for(var s;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!n&&r instanceof Vt&&r.index<0?null:r.parent;if(!o)return r;r=o}let i=n?0:st.IgnoreOverlays;if(n)for(let o=r,a=o.parent;a;o=a,a=o.parent)o instanceof Vt&&o.index<0&&((s=a.enter(e,t,i))===null||s===void 0?void 0:s.from)!=o.from&&(r=a);for(;;){let o=r.enter(e,t,i);if(!o)return r;r=o}}class Ng{cursor(e=0){return new Na(this,e)}getChild(e,t=null,n=null){let s=lf(this,e,t,n);return s.length?s[0]:null}getChildren(e,t=null,n=null){return lf(this,e,t,n)}resolve(e,t=0){return to(this,e,t,!1)}resolveInner(e,t=0){return to(this,e,t,!0)}matchContext(e){return lu(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(n=t,t=s.prevSibling):t=s}return n}get node(){return this}get next(){return this.parent}}class Vt extends Ng{constructor(e,t,n,s){super(),this._tree=e,this.from=t,this.index=n,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,s,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=t>0?a.length:-1;e!=c;e+=t){let u=a[e],h=l[e]+o.from,f;if(!(!(i&st.EnterBracketed&&u instanceof nt&&(f=Ns.get(u))&&!f.overlay&&f.bracketed&&n>=h&&n<=h+u.length)&&!zg(s,n,h,h+u.length))){if(u instanceof Vn){if(i&st.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,t,n-h,s);if(p>-1)return new Kr(new YC(o,u,e,h),null,p)}else if(i&st.IncludeAnonymous||!u.type.isAnonymous||ih(u)){let p;if(!(i&st.IgnoreMounts)&&(p=Ns.get(u))&&!p.overlay)return new Vt(p.tree,h,e,o);let g=new Vt(u,h,e,o);return i&st.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(t<0?u.children.length-1:0,t,n,s,i)}}}if(i&st.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let s;if(!(n&st.IgnoreOverlays)&&(s=Ns.get(this._tree))&&s.overlay){let i=e-this.from,o=n&st.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((t>0||o?a<=i:a<i)&&(t<0||o?l>=i:l>i))return new Vt(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}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 lf(r,e,t,n){let s=r.cursor(),i=[];if(!s.firstChild())return i;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return i}for(;;){if(n!=null&&s.type.is(n))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return n==null?i:[]}}function lu(r,e,t=e.length-1){for(let n=r;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class YC{constructor(e,t,n,s){this.parent=e,this.buffer=t,this.index=n,this.start=s}}class Kr extends Ng{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(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new Kr(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&st.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new Kr(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Kr(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Kr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,s=this.index+4,i=n.buffer[this.index+3];if(i>s){let o=n.buffer[this.index+1];e.push(n.slice(s,i,o)),t.push(0)}return new nt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Wg(r){if(!r.length)return null;let e=0,t=r[0];for(let i=1;i<r.length;i++){let o=r[i];(o.from>t.from||o.to<t.to)&&(t=o,e=i)}let n=t instanceof Vt&&t.index<0?null:t.parent,s=r.slice();return n?s[e]=n:s.splice(e,1),new FC(s,t)}class FC{constructor(e,t){this.heads=e,this.node=t}get next(){return Wg(this.heads)}}function UC(r,e,t){let n=r.resolveInner(e,t),s=null;for(let i=n instanceof Vt?n:n.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[n])).push(o.resolve(e,t)),i=o}else{let o=Ns.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Vt(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[n])).push(to(a,e,t,!1))}}return s?Wg(s):n}class Na{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~st.EnterBracketed,e instanceof Vt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=n+s.buffer[e+1],this.to=n+s.buffer[e+2],!0}yield(e){return e?e instanceof Vt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&st.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let s=n<0?0:this.stack[n]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(s)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:t,parent:n}=s)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let i=t+e,o=e<0?-1:n._tree.children.length;i!=o;i+=e){let a=n._tree.children[i];if(this.mode&st.IncludeAnonymous||a instanceof Vn||!a.type.isAnonymous||ih(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,n=i+1;break e}s=this.stack[--i]}for(let s=n;s<this.stack.length;s++)t=new Kr(this.buffer,t,this.stack[s]);return this.bufferNode=new Kr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&t&&t(this),s=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,s=!0}}}matchContext(e){if(!this.buffer)return lu(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let s=e.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return lu(this._tree,e,s);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function ih(r){return r.children.some(e=>e instanceof Vn||!e.type.isAnonymous||ih(e))}function GC(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:s=Vg,reused:i=[],minRepeatType:o=n.types.length}=r,a=Array.isArray(t)?new sh(t,t.length):t,l=n.types,c=0,u=0;function h(Q,L,E,G,oe,ie){let{id:j,start:V,end:Z,size:U}=a,W=u,N=c;if(U<0)if(a.next(),U==-1){let H=i[j];E.push(H),G.push(V-Q);return}else if(U==-3){c=j;return}else if(U==-4){u=j;return}else throw new RangeError(`Unrecognized record size: ${U}`);let I=l[j],z,be,K=V-Q;if(Z-V<=s&&(be=b(a.pos-L,oe))){let H=new Uint16Array(be.size-be.skip),re=a.pos-be.size,Oe=H.length;for(;a.pos>re;)Oe=x(be.start,H,Oe);z=new Vn(H,Z-be.start,n),K=be.start-Q}else{let H=a.pos-U;a.next();let re=[],Oe=[],ge=j>=o?j:-1,$e=0,Pe=Z;for(;a.pos>H;)ge>=0&&a.id==ge&&a.size>=0?(a.end<=Pe-s&&(g(re,Oe,V,$e,a.end,Pe,ge,W,N),$e=re.length,Pe=a.end),a.next()):ie>2500?f(V,H,re,Oe):h(V,H,re,Oe,ge,ie+1);if(ge>=0&&$e>0&&$e<re.length&&g(re,Oe,V,$e,V,Pe,ge,W,N),re.reverse(),Oe.reverse(),ge>-1&&$e>0){let Fe=p(I,N);z=oh(I,re,Oe,0,re.length,0,Z-V,Fe,Fe)}else z=O(I,re,Oe,Z-V,W-Z,N)}E.push(z),G.push(K)}function f(Q,L,E,G){let oe=[],ie=0,j=-1;for(;a.pos>L;){let{id:V,start:Z,end:U,size:W}=a;if(W>4)a.next();else{if(j>-1&&Z<j)break;j<0&&(j=U-s),oe.push(V,Z,U),ie++,a.next()}}if(ie){let V=new Uint16Array(ie*4),Z=oe[oe.length-2];for(let U=oe.length-3,W=0;U>=0;U-=3)V[W++]=oe[U],V[W++]=oe[U+1]-Z,V[W++]=oe[U+2]-Z,V[W++]=W;E.push(new Vn(V,oe[2]-Z,n)),G.push(Z-Q)}}function p(Q,L){return(E,G,oe)=>{let ie=0,j=E.length-1,V,Z;if(j>=0&&(V=E[j])instanceof nt){if(!j&&V.type==Q&&V.length==oe)return V;(Z=V.prop(qe.lookAhead))&&(ie=G[j]+V.length+Z)}return O(Q,E,G,oe,ie,L)}}function g(Q,L,E,G,oe,ie,j,V,Z){let U=[],W=[];for(;Q.length>G;)U.push(Q.pop()),W.push(L.pop()+E-oe);Q.push(O(n.types[j],U,W,ie-oe,V-ie,Z)),L.push(oe-E)}function O(Q,L,E,G,oe,ie,j){if(ie){let V=[qe.contextHash,ie];j=j?[V].concat(j):[V]}if(oe>25){let V=[qe.lookAhead,oe];j=j?[V].concat(j):[V]}return new nt(Q,L,E,G,j)}function b(Q,L){let E=a.fork(),G=0,oe=0,ie=0,j=E.end-s,V={size:0,start:0,skip:0};e:for(let Z=E.pos-Q;E.pos>Z;){let U=E.size;if(E.id==L&&U>=0){V.size=G,V.start=oe,V.skip=ie,ie+=4,G+=4,E.next();continue}let W=E.pos-U;if(U<0||W<Z||E.start<j)break;let N=E.id>=o?4:0,I=E.start;for(E.next();E.pos>W;){if(E.size<0)if(E.size==-3||E.size==-4)N+=4;else break e;else E.id>=o&&(N+=4);E.next()}oe=I,G+=U,ie+=N}return(L<0||G==Q)&&(V.size=G,V.start=oe,V.skip=ie),V.size>4?V:void 0}function x(Q,L,E){let{id:G,start:oe,end:ie,size:j}=a;if(a.next(),j>=0&&G<o){let V=E;if(j>4){let Z=a.pos-(j-4);for(;a.pos>Z;)E=x(Q,L,E)}L[--E]=V,L[--E]=ie-Q,L[--E]=oe-Q,L[--E]=G}else j==-3?c=G:j==-4&&(u=G);return E}let k=[],w=[];for(;a.pos>0;)h(r.start||0,r.bufferStart||0,k,w,-1,0);let S=(e=r.length)!==null&&e!==void 0?e:k.length?w[0]+k[0].length:0;return new nt(l[r.topID],k.reverse(),w.reverse(),S)}const cf=new WeakMap;function wa(r,e){if(!r.isAnonymous||e instanceof Vn||e.type!=r)return 1;let t=cf.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof nt)){t=1;break}t+=wa(r,n)}cf.set(e,t)}return t}function oh(r,e,t,n,s,i,o,a,l){let c=0;for(let g=n;g<s;g++)c+=wa(r,e[g]);let u=Math.ceil(c*1.5/8),h=[],f=[];function p(g,O,b,x,k){for(let w=b;w<x;){let S=w,Q=O[w],L=wa(r,g[w]);for(w++;w<x;w++){let E=wa(r,g[w]);if(L+E>=u)break;L+=E}if(w==S+1){if(L>u){let E=g[S];p(E.children,E.positions,0,E.children.length,O[S]+k);continue}h.push(g[S])}else{let E=O[w-1]+g[w-1].length-Q;h.push(oh(r,g,O,S,w,Q,E,null,l))}f.push(Q+k-i)}}return p(e,t,n,s,0),(a||l)(h,f,o)}class qg{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Kr?this.setBuffer(e.context.buffer,e.index,t):e instanceof Vt&&this.map.set(e.tree,t)}get(e){return e instanceof Kr?this.getBuffer(e.context.buffer,e.index):e instanceof Vt?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class gn{constructor(e,t,n,s,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let s=[new gn(0,e.length,e,0,!1,n)];for(let i of t)i.to>e.length&&s.push(i);return s}static applyChanges(e,t,n=128){if(!t.length)return e;let s=[],i=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<t.length?t[a]:null,h=u?u.fromA:1e9;if(h-l>=n)for(;o&&o.from<h;){let f=o;if(l>=f.from||h<=f.to||c){let p=Math.max(f.from,l)-c,g=Math.min(f.to,h)-c;f=p>=g?null:new gn(p,g,f.tree,f.offset+c,a>0,!!u)}if(f&&s.push(f),o.to>h)break;o=i<e.length?e[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}}class ah{startParse(e,t,n){return typeof e=="string"&&(e=new HC(e)),n=n?n.length?n.map(s=>new Sr(s.from,s.to)):[new Sr(0,0)]:[new Sr(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let s=this.startParse(e,t,n);for(;;){let i=s.advance();if(i)return i}}}class HC{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function jg(r){return(e,t,n,s)=>new JC(e,r,t,n,s)}class uf{constructor(e,t,n,s,i,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=s,this.target=i,this.from=o}}function hf(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class KC{constructor(e,t,n,s,i,o,a,l){this.parser=e,this.predicate=t,this.mounts=n,this.index=s,this.start=i,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const cu=new qe({perNode:!0});class JC{constructor(e,t,n,s,i){this.nest=t,this.input=n,this.fragments=s,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new nt(n.type,n.children,n.positions,n.length,n.propValues.concat([[cu,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[qe.mounted.id]=new Ns(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new rQ(this.fragments),t=null,n=null,s=new Na(new Vt(this.baseTree,this.ranges[0].from,0,null),st.IncludeAnonymous|st.IgnoreMounts);e:for(let i,o;;){let a=!0,l;if(this.stoppedAt!=null&&s.from>=this.stoppedAt)a=!1;else if(e.hasNode(s)){if(t){let c=t.mounts.find(u=>u.frag.from<=s.from&&u.frag.to>=s.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,f=u.to+c.pos;h>=s.from&&f<=s.to&&!t.ranges.some(p=>p.from<f&&p.to>h)&&t.ranges.push({from:h,to:f})}}a=!1}else if(n&&(o=eQ(n.ranges,s.from,s.to)))a=o!=2;else if(!s.type.isAnonymous&&(i=this.nest(s,this.input))&&(s.from<s.to||!i.overlay)){s.tree||(tQ(s),t&&t.depth++,n&&n.depth++);let c=e.findMounts(s.from,i.parser);if(typeof i.overlay=="function")t=new KC(i.parser,i.overlay,c,this.inner.length,s.from,!!i.bracketed,s.tree,t);else{let u=mf(this.ranges,i.overlay||(s.from<s.to?[new Sr(s.from,s.to)]:[]));u.length&&hf(u),(u.length||!i.overlay)&&this.inner.push(new uf(i.parser,u.length?i.parser.startParse(this.input,pf(c,u),u):i.parser.startParse(""),i.overlay?i.overlay.map(h=>new Sr(h.from-s.from,h.to-s.from)):null,!!i.bracketed,s.tree,u.length?u[0].from:s.from)),i.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else if(t&&(l=t.predicate(s))&&(l===!0&&(l=new Sr(s.from,s.to)),l.from<l.to)){let c=t.ranges.length-1;c>=0&&t.ranges[c].to==l.from?t.ranges[c]={from:t.ranges[c].from,to:l.to}:t.ranges.push(l)}if(a&&s.firstChild())t&&t.depth++,n&&n.depth++;else for(;!s.nextSibling();){if(!s.parent())break e;if(t&&!--t.depth){let c=mf(this.ranges,t.ranges);c.length&&(hf(c),this.inner.splice(t.index,0,new uf(t.parser,t.parser.startParse(this.input,pf(t.mounts,c),c),t.ranges.map(u=>new Sr(u.from-t.start,u.to-t.start)),t.bracketed,t.target,c[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function eQ(r,e,t){for(let n of r){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function df(r,e,t,n,s,i){if(e<t){let o=r.buffer[e+1];n.push(r.slice(e,t,o)),s.push(o-i)}}function tQ(r){let{node:e}=r,t=[],n=e.context.buffer;do t.push(r.index),r.parent();while(!r.tree);let s=r.tree,i=s.children.indexOf(n),o=s.children[i],a=o.buffer,l=[i];function c(u,h,f,p,g,O){let b=t[O],x=[],k=[];df(o,u,b,x,k,p);let w=a[b+1],S=a[b+2];l.push(x.length);let Q=O?c(b+4,a[b+3],o.set.types[a[b]],w,S-w,O-1):e.toTree();return x.push(Q),k.push(w-p),df(o,a[b+3],h,x,k,p),new nt(f,x,k,g)}s.children[i]=c(0,a.length,$t.none,0,o.length,t.length-1);for(let u of l){let h=r.tree.children[u],f=r.tree.positions[u];r.yield(new Vt(h,f+r.from,u,r._tree))}}class ff{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(st.IncludeAnonymous|st.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,st.IgnoreOverlays|st.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof nt)t=t.children[0];else break}return!1}}let rQ=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(cu))!==null&&t!==void 0?t:n.to,this.inner=new ff(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(cu))!==null&&e!==void 0?e:t.to,this.inner=new ff(t.tree,-t.offset)}}findMounts(e,t){var n;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let i=this.inner.cursor.node;i;i=i.parent){let o=(n=i.tree)===null||n===void 0?void 0:n.prop(qe.mounted);if(o&&o.parser==t)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=i.to)break;l.tree==this.curFrag.tree&&s.push({frag:l,pos:i.from-l.offset,mount:o})}}}return s}};function mf(r,e){let t=null,n=e;for(let s=1,i=0;s<r.length;s++){let o=r[s-1].to,a=r[s].from;for(;i<n.length;i++){let l=n[i];if(l.from>=a)break;l.to<=o||(t||(n=t=e.slice()),l.from<o?(t[i]=new Sr(l.from,o),l.to>a&&t.splice(i+1,0,new Sr(a,l.to))):l.to>a?t[i--]=new Sr(a,l.to):t.splice(i--,1))}}return n}function nQ(r,e,t,n){let s=0,i=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=s==r.length?1e9:o?r[s].to:r[s].from,h=i==e.length?1e9:a?e[i].to:e[i].from;if(o!=a){let f=Math.max(l,t),p=Math.min(u,h,n);f<p&&c.push(new Sr(f,p))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,s++):o=!0),h==l&&(a?(a=!1,i++):a=!0)}return c}function pf(r,e){let t=[];for(let{pos:n,mount:s,frag:i}of r){let o=n+(s.overlay?s.overlay[0].from:0),a=o+s.tree.length,l=Math.max(i.from,o),c=Math.min(i.to,a);if(s.overlay){let u=s.overlay.map(f=>new Sr(f.from+n,f.to+n)),h=nQ(e,u,l,c);for(let f=0,p=l;;f++){let g=f==h.length,O=g?c:h[f].from;if(O>p&&t.push(new gn(p,O,s.tree,-o,i.from>=p||i.openStart,i.to<=O||i.openEnd)),g)break;p=h[f].to}}else t.push(new gn(l,c,s.tree,-o,i.from>=o||i.openStart,i.to<=a||i.openEnd))}return t}let sQ=0;class pr{constructor(e,t,n,s){this.name=e,this.set=t,this.base=n,this.modified=s,this.id=sQ++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof pr&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new pr(n,[],null,[]);if(s.set.push(s),t)for(let i of t.set)s.set.push(i);return s}static defineModifier(e){let t=new Wa(e);return n=>n.modified.indexOf(t)>-1?n:Wa.get(n.base||n,n.modified.concat(t).sort((s,i)=>s.id-i.id))}}let iQ=0;class Wa{constructor(e){this.name=e,this.instances=[],this.id=iQ++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&oQ(t,a.modified));if(n)return n;let s=[],i=new pr(e.name,s,e,t);for(let a of t)a.instances.push(i);let o=aQ(t);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(Wa.get(a,l));return i}}function oQ(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function aQ(r){let e=[[]];for(let t=0;t<r.length;t++)for(let n=0,s=e.length;n<s;n++)e.push(e[n].concat(r[t]));return e.sort((t,n)=>n.length-t.length)}function oi(r){let e=Object.create(null);for(let t in r){let n=r[t];Array.isArray(n)||(n=[n]);for(let s of t.split(" "))if(s){let i=[],o=2,a=s;for(let h=0;;){if(a=="..."&&h>0&&h+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==s.length)break;let p=s[h++];if(h==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);a=s.slice(h)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);let u=new ro(n,o,l>0?i.slice(0,l):null);e[c]=u.sort(e[c])}}return Yg.add(e)}const Yg=new qe({combine(r,e){let t,n,s;for(;r||e;){if(!r||e&&r.depth>=e.depth?(s=e,e=e.next):(s=r,r=r.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let i=new ro(s.tags,s.mode,s.context);t?t.next=i:n=i,t=i}return n}});class ro{constructor(e,t,n,s){this.tags=e,this.mode=t,this.context=n,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}ro.empty=new ro([],2,null);function Fg(r,e){let t=Object.create(null);for(let i of r)if(!Array.isArray(i.tag))t[i.tag.id]=i.class;else for(let o of i.tag)t[o.id]=i.class;let{scope:n,all:s=null}=e||{};return{style:i=>{let o=s;for(let a of i)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:n}}function lQ(r,e){let t=null;for(let n of r){let s=n.style(e);s&&(t=t?t+" "+s:s)}return t}function cQ(r,e,t,n=0,s=r.length){let i=new uQ(n,Array.isArray(e)?e:[e],t);i.highlightRange(r.cursor(),n,s,"",i.highlighters),i.flush(s)}class uQ{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,s,i){let{type:o,from:a,to:l}=e;if(a>=n||l<=t)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=s,u=hQ(e)||ro.empty,h=lQ(i,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(s+=(s?" ":"")+h)),this.startSpan(Math.max(t,a),c),u.opaque)return;let f=e.tree&&e.tree.prop(qe.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(b=>!b.scope||b.scope(f.tree.type)),O=e.firstChild();for(let b=0,x=a;;b++){let k=b<f.overlay.length?f.overlay[b]:null,w=k?k.from+a:l,S=Math.max(t,x),Q=Math.min(n,w);if(S<Q&&O)for(;e.from<Q&&(this.highlightRange(e,S,Q,s,i),this.startSpan(Math.min(Q,e.to),c),!(e.to>=w||!e.nextSibling())););if(!k||w>n)break;x=k.to+a,x>t&&(this.highlightRange(p.cursor(),Math.max(t,k.from+a),Math.min(n,x),"",g),this.startSpan(Math.min(n,x),c))}O&&e.parent()}else if(e.firstChild()){f&&(s="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,s,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function hQ(r){let e=r.type.prop(Yg);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const ke=pr.define,ra=ke(),An=ke(),gf=ke(An),Of=ke(An),_n=ke(),na=ke(_n),Yl=ke(_n),Yr=ke(),Jn=ke(Yr),qr=ke(),jr=ke(),uu=ke(),Qi=ke(uu),sa=ke(),$={comment:ra,lineComment:ke(ra),blockComment:ke(ra),docComment:ke(ra),name:An,variableName:ke(An),typeName:gf,tagName:ke(gf),propertyName:Of,attributeName:ke(Of),className:ke(An),labelName:ke(An),namespace:ke(An),macroName:ke(An),literal:_n,string:na,docString:ke(na),character:ke(na),attributeValue:ke(na),number:Yl,integer:ke(Yl),float:ke(Yl),bool:ke(_n),regexp:ke(_n),escape:ke(_n),color:ke(_n),url:ke(_n),keyword:qr,self:ke(qr),null:ke(qr),atom:ke(qr),unit:ke(qr),modifier:ke(qr),operatorKeyword:ke(qr),controlKeyword:ke(qr),definitionKeyword:ke(qr),moduleKeyword:ke(qr),operator:jr,derefOperator:ke(jr),arithmeticOperator:ke(jr),logicOperator:ke(jr),bitwiseOperator:ke(jr),compareOperator:ke(jr),updateOperator:ke(jr),definitionOperator:ke(jr),typeOperator:ke(jr),controlOperator:ke(jr),punctuation:uu,separator:ke(uu),bracket:Qi,angleBracket:ke(Qi),squareBracket:ke(Qi),paren:ke(Qi),brace:ke(Qi),content:Yr,heading:Jn,heading1:ke(Jn),heading2:ke(Jn),heading3:ke(Jn),heading4:ke(Jn),heading5:ke(Jn),heading6:ke(Jn),contentSeparator:ke(Yr),list:ke(Yr),quote:ke(Yr),emphasis:ke(Yr),strong:ke(Yr),link:ke(Yr),monospace:ke(Yr),strikethrough:ke(Yr),inserted:ke(),deleted:ke(),changed:ke(),invalid:ke(),meta:sa,documentMeta:ke(sa),annotation:ke(sa),processingInstruction:ke(sa),definition:pr.defineModifier("definition"),constant:pr.defineModifier("constant"),function:pr.defineModifier("function"),standard:pr.defineModifier("standard"),local:pr.defineModifier("local"),special:pr.defineModifier("special")};for(let r in $){let e=$[r];e instanceof pr&&(e.name=r)}Fg([{tag:$.link,class:"tok-link"},{tag:$.heading,class:"tok-heading"},{tag:$.emphasis,class:"tok-emphasis"},{tag:$.strong,class:"tok-strong"},{tag:$.keyword,class:"tok-keyword"},{tag:$.atom,class:"tok-atom"},{tag:$.bool,class:"tok-bool"},{tag:$.url,class:"tok-url"},{tag:$.labelName,class:"tok-labelName"},{tag:$.inserted,class:"tok-inserted"},{tag:$.deleted,class:"tok-deleted"},{tag:$.literal,class:"tok-literal"},{tag:$.string,class:"tok-string"},{tag:$.number,class:"tok-number"},{tag:[$.regexp,$.escape,$.special($.string)],class:"tok-string2"},{tag:$.variableName,class:"tok-variableName"},{tag:$.local($.variableName),class:"tok-variableName tok-local"},{tag:$.definition($.variableName),class:"tok-variableName tok-definition"},{tag:$.special($.variableName),class:"tok-variableName2"},{tag:$.definition($.propertyName),class:"tok-propertyName tok-definition"},{tag:$.typeName,class:"tok-typeName"},{tag:$.namespace,class:"tok-namespace"},{tag:$.className,class:"tok-className"},{tag:$.macroName,class:"tok-macroName"},{tag:$.propertyName,class:"tok-propertyName"},{tag:$.operator,class:"tok-operator"},{tag:$.comment,class:"tok-comment"},{tag:$.meta,class:"tok-meta"},{tag:$.invalid,class:"tok-invalid"},{tag:$.punctuation,class:"tok-punctuation"}]);var Fl;const cs=new qe;function lh(r){return Qe.define({combine:r?e=>e.concat(r):void 0})}const ch=new qe;class $r{constructor(e,t,n=[],s=""){this.data=e,this.name=s,He.prototype.hasOwnProperty("tree")||Object.defineProperty(He.prototype,"tree",{get(){return dt(this)}}),this.parser=t,this.extension=[zn.of(this),He.languageData.of((i,o,a)=>{let l=vf(i,o,a),c=l.type.prop(cs);if(!c)return[];let u=i.facet(c),h=l.type.prop(ch);if(h){let f=l.resolve(o-l.from,a);for(let p of h)if(p.test(f,i)){let g=i.facet(p.facet);return p.type=="replace"?g:g.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return vf(e,t,n).type.prop(cs)==this.data}findRegions(e){let t=e.facet(zn);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],s=(i,o)=>{if(i.prop(cs)==this.data){n.push({from:o,to:o+i.length});return}let a=i.prop(qe.mounted);if(a){if(a.tree.prop(cs)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+i.length});return}else if(a.overlay){let l=n.length;if(s(a.tree,a.overlay[0].from+o),n.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof nt&&s(c,i.positions[l]+o)}};return s(dt(e),0),n}get allowsNesting(){return!0}}$r.setState=We.define();function vf(r,e,t){let n=r.facet(zn),s=dt(r).topNode;if(!n||n.allowsNesting)for(let i=s;i;i=i.enter(e,t,st.ExcludeBuffers|st.EnterBracketed))i.type.isTop&&(s=i);return s}class Js extends $r{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=lh(e.languageData);return new Js(t,e.parser.configure({props:[cs.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Js(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function dt(r){let e=r.field($r.state,!1);return e?e.tree:nt.empty}class dQ{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Pi=null;class no{constructor(e,t,n=[],s,i,o,a,l){this.parser=e,this.state=t,this.fragments=n,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new no(e,t,[],nt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new dQ(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=nt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(gn.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(gn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Pi;Pi=this;try{return e()}finally{Pi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=bf(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,f)=>l.push({fromA:c,toA:u,fromB:h,toB:f})),n=gn.applyChanges(n,l),s=nt.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new no(this.parser,t,n,s,i,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:s,to:i}=this.skipped[n];s<e.to&&i>e.from&&(this.fragments=bf(this.fragments,s,i),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ah{createParse(t,n,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=Pi;if(l){for(let c of s)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new nt($t.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Pi}}function bf(r,e,t){return gn.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class ei{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new ei(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=no.create(e.facet(zn).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new ei(n)}}$r.state=Tt.define({create:ei.init,update(r,e){for(let t of e.effects)if(t.is($r.setState))return t.value;return e.startState.facet(zn)!=e.state.facet(zn)?ei.init(e.state):r.apply(e)}});let Ug=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Ug=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ul=typeof navigator<"u"&&(!((Fl=navigator.scheduling)===null||Fl===void 0)&&Fl.isInputPending)?()=>navigator.scheduling.isInputPending():null,fQ=bt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field($r.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($r.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Ug(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:s}}=this.view,i=n.field($r.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ul?Math.max(25,e.timeRemaining()-5):1e9),a=i.context.treeLen<s&&n.doc.length>s+1e3,l=i.context.work(()=>Ul&&Ul()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:$r.setState.of(new ei(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>rr(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),zn=Qe.define({combine(r){return r.length?r[0]:null},enables:r=>[$r.state,fQ,Se.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class so{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class qa{constructor(e,t,n,s,i,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=s,this.loadFunc=i,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new qa(e.name,(e.alias||[]).concat(e.name).map(s=>s.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let s of e)if(s.filename&&s.filename.test(t))return s;let n=/\.([^.]+)$/.exec(t);if(n){for(let s of e)if(s.extensions.indexOf(n[1])>-1)return s}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let s of e)if(s.alias.some(i=>i==t))return s;if(n)for(let s of e)for(let i of s.alias){let o=t.indexOf(i);if(o>-1&&(i.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+i.length])))return s}return null}}const mQ=Qe.define(),Qo=Qe.define({combine:r=>{if(!r.length)return" ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function ja(r){let e=r.facet(Qo);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function io(r,e){let t="",n=r.tabSize,s=r.facet(Qo)[0];if(s==" "){for(;e>=n;)t+=" ",e-=n;s=" "}for(let i=0;i<e;i++)t+=s;return t}function uh(r,e){r instanceof He&&(r=new kl(r));for(let n of r.state.facet(mQ)){let s=n(r,e);if(s!==void 0)return s}let t=dt(r.state);return t.length>=e?pQ(r,t,e):null}class kl{constructor(e,t={}){this.state=e,this.options=t,this.unit=ja(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=n.from&&s<=n.to?i&&s==e?{text:"",from:e}:(t<0?s<e:s<=e)?{text:n.text.slice(s-n.from),from:s}:{text:n.text.slice(0,s-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:s}=this.lineAt(e,t);return n.slice(e-s,Math.min(n.length,e+100-s))}column(e,t=1){let{text:n,from:s}=this.lineAt(e,t),i=this.countColumn(n,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return Zr(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:s}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Po=new qe;function pQ(r,e,t){let n=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=n.node){let i=[];for(let o=s;o&&!(o.from<n.node.from||o.to>n.node.to||o.from==n.node.from&&o.type==n.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)n={node:i[o],next:n}}return Gg(n,r,t)}function Gg(r,e,t){for(let n=r;n;n=n.next){let s=OQ(n.node);if(s)return s(hh.create(e,t,n))}return 0}function gQ(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function OQ(r){let e=r.type.prop(Po);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(qe.closedBy))){let s=r.lastChild,i=s&&n.indexOf(s.name)>-1;return o=>Hg(o,!0,1,void 0,i&&!gQ(o)?s.from:void 0)}return r.parent==null?vQ:null}function vQ(){return 0}class hh extends kl{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new hh(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(bQ(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Gg(this.context.next,this.base,this.pos)}}function bQ(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function xQ(r){let e=r.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let s=r.options.simulateBreak,i=r.state.doc.lineAt(t.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(t.to-i.from))[0].length;return{from:t.from,to:t.to+c}}a=l.to}}function yQ({closing:r,align:e=!0,units:t=1}){return n=>Hg(n,e,t,r)}function Hg(r,e,t,n,s){let i=r.textAfter,o=i.match(/^\s*/)[0].length,a=n&&i.slice(o,o+n.length)==n||s==r.pos+o,l=e?xQ(r):null;return l?a?r.column(l.from):r.column(l.to):r.baseIndent+(a?0:r.unit*t)}const kQ=r=>r.baseIndent;function Sa({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const wQ=200;function SQ(){return He.transactionFilter.of(r=>{if(!r.docChanged||!r.isUserEvent("input.type")&&!r.isUserEvent("input.complete"))return r;let e=r.startState.languageDataAt("indentOnInput",r.startState.selection.main.head);if(!e.length)return r;let t=r.newDoc,{head:n}=r.newSelection.main,s=t.lineAt(n);if(n>s.from+wQ)return r;let i=t.sliceString(s.from,n);if(!e.some(c=>c.test(i)))return r;let{state:o}=r,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=uh(o,u.from);if(h==null)continue;let f=/^\s*/.exec(u.text)[0],p=io(o,h);f!=p&&l.push({from:u.from,to:u.from+f.length,insert:p})}return l.length?[r,{changes:l,sequential:!0}]:r})}const Kg=Qe.define(),ai=new qe;function Jg(r){let e=r.firstChild,t=r.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?r.to:t.from}:null}function $Q(r,e,t){let n=dt(r);if(n.length<t)return null;let s=n.resolveStack(t,1),i=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(i&&a.from<e)break;let l=a.type.prop(ai);if(l&&(a.to<n.length-50||n.length==r.doc.length||!CQ(a))){let c=l(a,r);c&&c.from<=t&&c.from>=e&&c.to>t&&(i=c)}}return i}function CQ(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function Ya(r,e,t){for(let n of r.facet(Kg)){let s=n(r,e,t);if(s)return s}return $Q(r,e,t)}function eO(r,e){let t=e.mapPos(r.from,1),n=e.mapPos(r.to,-1);return t>=n?void 0:{from:t,to:n}}const wl=We.define({map:eO}),To=We.define({map:eO});function tO(r){let e=[];for(let{head:t}of r.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(r.lineBlockAt(t));return e}const ys=Tt.define({create(){return Le.none},update(r,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,n)=>r=xf(r,t,n)),r=r.map(e.changes);for(let t of e.effects)if(t.is(wl)&&!QQ(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(sO),s=n?Le.replace({widget:new BQ(n(e.state,t.value))}):yf;r=r.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(To)&&(r=r.update({filter:(n,s)=>t.value.from!=n||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(r=xf(r,e.selection.main.head)),r},provide:r=>Se.decorations.from(r),toJSON(r,e){let t=[];return r.between(0,e.doc.length,(n,s)=>{t.push(n,s)}),t},fromJSON(r){if(!Array.isArray(r)||r.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<r.length;){let n=r[t++],s=r[t++];if(typeof n!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(yf.range(n,s))}return Le.set(e,!0)}});function xf(r,e,t=e){let n=!1;return r.between(e,t,(s,i)=>{s<t&&i>e&&(n=!0)}),n?r.update({filterFrom:e,filterTo:t,filter:(s,i)=>s>=t||i<=e}):r}function Fa(r,e,t){var n;let s=null;return(n=r.field(ys,!1))===null||n===void 0||n.between(e,t,(i,o)=>{(!s||s.from>i)&&(s={from:i,to:o})}),s}function QQ(r,e,t){let n=!1;return r.between(e,e,(s,i)=>{s==e&&i==t&&(n=!0)}),n}function rO(r,e){return r.field(ys,!1)?e:e.concat(We.appendConfig.of(iO()))}const PQ=r=>{for(let e of tO(r)){let t=Ya(r.state,e.from,e.to);if(t)return r.dispatch({effects:rO(r.state,[wl.of(t),nO(r,t)])}),!0}return!1},TQ=r=>{if(!r.state.field(ys,!1))return!1;let e=[];for(let t of tO(r)){let n=Fa(r.state,t.from,t.to);n&&e.push(To.of(n),nO(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function nO(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,s=r.state.doc.lineAt(e.to).number;return Se.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${s}.`)}const MQ=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let s=r.lineBlockAt(n),i=Ya(e,s.from,s.to);i&&t.push(wl.of(i)),n=(i?r.lineBlockAt(i.to):s).to+1}return t.length&&r.dispatch({effects:rO(r.state,t)}),!!t.length},AQ=r=>{let e=r.state.field(ys,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,s)=>{t.push(To.of({from:n,to:s}))}),r.dispatch({effects:t}),!0},_Q=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:PQ},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:TQ},{key:"Ctrl-Alt-[",run:MQ},{key:"Ctrl-Alt-]",run:AQ}],RQ={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},sO=Qe.define({combine(r){return nn(r,RQ)}});function iO(r){return[ys,DQ]}function oO(r,e){let{state:t}=r,n=t.facet(sO),s=o=>{let a=r.lineBlockAt(r.posAtDOM(o.target)),l=Fa(r.state,a.from,a.to);l&&r.dispatch({effects:To.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(r,s,e);let i=document.createElement("span");return i.textContent=n.placeholderText,i.setAttribute("aria-label",t.phrase("folded code")),i.title=t.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const yf=Le.replace({widget:new class extends sn{toDOM(r){return oO(r,null)}}});class BQ extends sn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return oO(e,this.value)}}const ZQ={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Gl extends yn{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function EQ(r={}){let e={...ZQ,...r},t=new Gl(e,!0),n=new Gl(e,!1),s=bt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(zn)!=o.state.facet(zn)||o.startState.field(ys,!1)!=o.state.field(ys,!1)||dt(o.startState)!=dt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new bn;for(let l of o.viewportLineBlocks){let c=Fa(o.state,l.from,l.to)?n:Ya(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:i}=e;return[s,BC({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Ge.empty},initialSpacer(){return new Gl(e,!1)},domEventHandlers:{...i,click:(o,a,l)=>{if(i.click&&i.click(o,a,l))return!0;let c=Fa(o.state,a.from,a.to);if(c)return o.dispatch({effects:To.of(c)}),!0;let u=Ya(o.state,a.from,a.to);return u?(o.dispatch({effects:wl.of(u)}),!0):!1}}}),iO()]}const DQ=Se.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 Mo{constructor(e,t){this.specs=e;let n;function s(a){let l=Ln.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const i=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof $r?a=>a.prop(cs)==o.data:o?a=>a==o:void 0,this.style=Fg(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=n?new Ln(n):null,this.themeType=t.themeType}static define(e,t){return new Mo(e,t||{})}}const hu=Qe.define(),aO=Qe.define({combine(r){return r.length?[r[0]]:null}});function Hl(r){let e=r.facet(hu);return e.length?e:r.facet(aO)}function lO(r,e){let t=[XQ],n;return r instanceof Mo&&(r.module&&t.push(Se.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(aO.of(r)):n?t.push(hu.computeN([Se.darkTheme],s=>s.facet(Se.darkTheme)==(n=="dark")?[r]:[])):t.push(hu.of(r)),t}class LQ{constructor(e){this.markCache=Object.create(null),this.tree=dt(e.state),this.decorations=this.buildDeco(e,Hl(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=dt(e.state),n=Hl(e.state),s=n!=Hl(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!s&&t.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return Le.none;let n=new bn;for(let{from:s,to:i}of e.visibleRanges)cQ(this.tree,t,(o,a,l)=>{n.add(o,a,this.markCache[l]||(this.markCache[l]=Le.mark({class:l})))},s,i);return n.finish()}}const XQ=kn.high(bt.fromClass(LQ,{decorations:r=>r.decorations})),IQ=Mo.define([{tag:$.meta,color:"#404740"},{tag:$.link,textDecoration:"underline"},{tag:$.heading,textDecoration:"underline",fontWeight:"bold"},{tag:$.emphasis,fontStyle:"italic"},{tag:$.strong,fontWeight:"bold"},{tag:$.strikethrough,textDecoration:"line-through"},{tag:$.keyword,color:"#708"},{tag:[$.atom,$.bool,$.url,$.contentSeparator,$.labelName],color:"#219"},{tag:[$.literal,$.inserted],color:"#164"},{tag:[$.string,$.deleted],color:"#a11"},{tag:[$.regexp,$.escape,$.special($.string)],color:"#e40"},{tag:$.definition($.variableName),color:"#00f"},{tag:$.local($.variableName),color:"#30a"},{tag:[$.typeName,$.namespace],color:"#085"},{tag:$.className,color:"#167"},{tag:[$.special($.variableName),$.macroName],color:"#256"},{tag:$.definition($.propertyName),color:"#00c"},{tag:$.comment,color:"#940"},{tag:$.invalid,color:"#f00"}]),VQ=Se.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),cO=1e4,uO="()[]{}",hO=Qe.define({combine(r){return nn(r,{afterCursor:!0,brackets:uO,maxScanDistance:cO,renderMatch:WQ})}}),zQ=Le.mark({class:"cm-matchingBracket"}),NQ=Le.mark({class:"cm-nonmatchingBracket"});function WQ(r){let e=[],t=r.matched?zQ:NQ;return e.push(t.range(r.start.from,r.start.to)),r.end&&e.push(t.range(r.end.from,r.end.to)),e}function kf(r){let e=[],t=r.facet(hO);for(let n of r.selection.ranges){if(!n.empty)continue;let s=Jr(r,n.head,-1,t)||n.head>0&&Jr(r,n.head-1,1,t)||t.afterCursor&&(Jr(r,n.head,1,t)||n.head<r.doc.length&&Jr(r,n.head+1,-1,t));s&&(e=e.concat(t.renderMatch(s,r)))}return Le.set(e,!0)}const qQ=bt.fromClass(class{constructor(r){this.paused=!1,this.decorations=kf(r.state)}update(r){(r.docChanged||r.selectionSet||this.paused)&&(r.view.composing?(this.decorations=this.decorations.map(r.changes),this.paused=!0):(this.decorations=kf(r.state),this.paused=!1))}},{decorations:r=>r.decorations}),jQ=[qQ,VQ];function YQ(r={}){return[hO.of(r),jQ]}const dO=new qe;function du(r,e,t){let n=r.prop(e<0?qe.openedBy:qe.closedBy);if(n)return n;if(r.name.length==1){let s=t.indexOf(r.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function fu(r){let e=r.type.prop(dO);return e?e(r.node):r}function Jr(r,e,t,n={}){let s=n.maxScanDistance||cO,i=n.brackets||uO,o=dt(r),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=du(l.type,t,i);if(c&&l.from<l.to){let u=fu(l);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return FQ(r,e,t,l,u,c,i)}}return UQ(r,e,t,o,a.type,s,i)}function FQ(r,e,t,n,s,i,o){let a=n.parent,l={from:s.from,to:s.to},c=0,u=a?.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let h=fu(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(du(u.type,t,o))c++;else if(du(u.type,-t,o)){if(c==0){let h=fu(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function UQ(r,e,t,n,s,i,o){let a=t<0?r.sliceDoc(e-1,e):r.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},u=r.doc.iterRange(e,t>0?r.doc.length:0),h=0;for(let f=0;!u.next().done&&f<=i;){let p=u.value;t<0&&(f+=p.length);let g=e+f*t;for(let O=t>0?0:p.length-1,b=t>0?p.length:-1;O!=b;O+=t){let x=o.indexOf(p[O]);if(!(x<0||n.resolveInner(g+O,1).type!=s))if(x%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:g+O,to:g+O+1},matched:x>>1==l>>1};h--}}t>0&&(f+=p.length)}return u.done?{start:c,matched:!1}:null}const GQ=Object.create(null),wf=[$t.none],Sf=[],$f=Object.create(null),HQ=Object.create(null);for(let[r,e]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"]])HQ[r]=KQ(GQ,e);function Kl(r,e){Sf.indexOf(r)>-1||(Sf.push(r),console.warn(e))}function KQ(r,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=r[c]||$[c];u?typeof u=="function"?l.length?l=l.map(u):Kl(c,`Modifier ${c} used at start of tag`):l.length?Kl(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:Kl(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+t.map(a=>a.id),i=$f[s];if(i)return i.id;let o=$f[s]=$t.define({id:wf.length,name:n,props:[oi({[n]:t})]});return wf.push(o),o.id}ht.RTL,ht.LTR;const JQ=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=fh(r.state,t.from);return n.line?eP(r):n.block?rP(r):!1};function dh(r,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=r(e,t);return s?(n(t.update(s)),!0):!1}}const eP=dh(iP,0),tP=dh(fO,0),rP=dh((r,e)=>fO(r,e,sP(e)),0);function fh(r,e){let t=r.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Ti=50;function nP(r,{open:e,close:t},n,s){let i=r.sliceDoc(n-Ti,n),o=r.sliceDoc(s,s+Ti),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,h;s-n<=2*Ti?u=h=r.sliceDoc(n,s):(u=r.sliceDoc(n,n+Ti),h=r.sliceDoc(s-Ti,s));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(h)[0].length,g=h.length-p-t.length;return u.slice(f,f+e.length)==e&&h.slice(g,g+t.length)==t?{open:{pos:n+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:s-p-t.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function sP(r){let e=[];for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from),s=t.to<=n.to?n:r.doc.lineAt(t.to);s.from>n.from&&s.from==t.to&&(s=t.to==n.to+1?n:r.doc.lineAt(t.to-1));let i=e.length-1;i>=0&&e[i].to>n.from?e[i].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}function fO(r,e,t=e.selection.ranges){let n=t.map(i=>fh(e,i.from).block);if(!n.every(i=>i))return null;let s=t.map((i,o)=>nP(e,n[o],i.from,i.to));if(r!=2&&!s.every(i=>i))return{changes:e.changes(t.map((i,o)=>s[o]?[]:[{from:i.from,insert:n[o].open+" "},{from:i.to,insert:" "+n[o].close}]))};if(r!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=n[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function iP(r,e,t=e.selection.ranges){let n=[],s=-1;e:for(let{from:i,to:o}of t){let a=n.length,l=1e9,c;for(let u=i;u<=o;){let h=e.doc.lineAt(u);if(c==null&&(c=fh(e,h.from).line,!c))continue e;if(h.from>s&&(i==o||o>h.from)){s=h.from;let f=/^\s*/.exec(h.text)[0].length,p=f==h.length,g=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<l&&(l=f),n.push({line:h,comment:g,token:c,indent:f,empty:p,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=l);n.length==a+1&&(n[a].single=!0)}if(r!=2&&n.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of n)(h||!u)&&i.push({from:a.from+c,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(r!=1&&n.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const mu=wn.define(),oP=wn.define(),aP=Qe.define(),mO=Qe.define({combine(r){return nn(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,s)=>e(n,s)||t(n,s)})}}),pO=Tt.define({create(){return en.empty},update(r,e){let t=e.state.facet(mO),n=e.annotation(mu);if(n){let l=nr.fromTransaction(e,n.selection),c=n.side,u=c==0?r.undone:r.done;return l?u=Ua(u,u.length,t.minDepth,l):u=vO(u,e.startState.selection),new en(c==0?n.rest:u,c==0?u:n.rest)}let s=e.annotation(oP);if((s=="full"||s=="before")&&(r=r.isolate()),e.annotation(xt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let i=nr.fromTransaction(e),o=e.annotation(xt.time),a=e.annotation(xt.userEvent);return i?r=r.addChanges(i,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(s=="full"||s=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new en(r.done.map(nr.fromJSON),r.undone.map(nr.fromJSON))}});function lP(r={}){return[pO,mO.of(r),Se.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?gO:e.inputType=="historyRedo"?pu:null;return n?(e.preventDefault(),n(t)):!1}})]}function Sl(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let s=t.field(pO,!1);if(!s)return!1;let i=s.pop(r,t,e);return i?(n(i),!0):!1}}const gO=Sl(0,!1),pu=Sl(1,!1),cP=Sl(0,!0),uP=Sl(1,!0);class nr{constructor(e,t,n,s,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new nr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new nr(e.changes&&kt.fromJSON(e.changes),[],e.mapped&&tn.fromJSON(e.mapped),e.startSelection&&te.fromJSON(e.startSelection),e.selectionsAfter.map(te.fromJSON))}static fromTransaction(e,t){let n=Cr;for(let s of e.startState.facet(aP)){let i=s(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new nr(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Cr)}static selection(e){return new nr(void 0,Cr,void 0,void 0,e)}}function Ua(r,e,t,n){let s=e+1>t+20?e-t-1:0,i=r.slice(s,e);return i.push(n),i}function hP(r,e){let t=[],n=!1;return r.iterChangedRanges((s,i)=>t.push(s,i)),e.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],u=t[l++];a>=c&&o<=u&&(n=!0)}}),n}function dP(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function OO(r,e){return r.length?e.length?r.concat(e):r:e}const Cr=[],fP=200;function vO(r,e){if(r.length){let t=r[r.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-fP));return n.length&&n[n.length-1].eq(e)?r:(n.push(e),Ua(r,r.length-1,1e9,t.setSelAfter(n)))}else return[nr.selection([e])]}function mP(r){let e=r[r.length-1],t=r.slice();return t[r.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Jl(r,e){if(!r.length)return r;let t=r.length,n=Cr;for(;t;){let s=pP(r[t-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let i=r.slice(0,t);return i[t-1]=s,i}else e=s.mapped,t--,n=s.selectionsAfter}return n.length?[nr.selection(n)]:Cr}function pP(r,e,t){let n=OO(r.selectionsAfter.length?r.selectionsAfter.map(a=>a.map(e)):Cr,t);if(!r.changes)return nr.selection(n);let s=r.changes.map(e),i=e.mapDesc(r.changes,!0),o=r.mapped?r.mapped.composeDesc(i):i;return new nr(s,We.mapEffects(r.effects,e),o,r.startSelection.map(i),n)}const gP=/^(input\.type|delete)($|\.)/;class en{constructor(e,t,n=0,s=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new en(this.done,this.undone):this}addChanges(e,t,n,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||gP.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,hP(a.changes,e.changes))||n=="input.type.compose")?o=Ua(o,o.length-1,s.minDepth,new nr(e.changes.compose(a.changes),OO(We.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Cr)):o=Ua(o,o.length,s.minDepth,e),new en(o,Cr,t,n)}addSelection(e,t,n,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Cr;return i.length>0&&t-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&dP(i[i.length-1],e)?this:new en(vO(this.done,e),this.undone,t,n)}addMapping(e){return new en(Jl(this.done,e),Jl(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:mu.of({side:e,rest:mP(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?Cr:s.slice(0,s.length-1);return i.mapped&&(a=Jl(a,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:mu.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}en.empty=new en(Cr,Cr);const OP=[{key:"Mod-z",run:gO,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:pu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:pu,preventDefault:!0},{key:"Mod-u",run:cP,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:uP,preventDefault:!0}];function li(r,e){return te.create(r.ranges.map(e),r.mainIndex)}function Dr(r,e){return r.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Lr({state:r,dispatch:e},t){let n=li(r.selection,t);return n.eq(r.selection,!0)?!1:(e(Dr(r,n)),!0)}function $l(r,e){return te.cursor(e?r.to:r.from)}function bO(r,e){return Lr(r,t=>t.empty?r.moveByChar(t,e):$l(t,e))}function zt(r){return r.textDirectionAt(r.state.selection.main.head)==ht.LTR}const xO=r=>bO(r,!zt(r)),yO=r=>bO(r,zt(r));function kO(r,e){return Lr(r,t=>t.empty?r.moveByGroup(t,e):$l(t,e))}const vP=r=>kO(r,!zt(r)),bP=r=>kO(r,zt(r));function xP(r,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(r.sliceDoc(e.from,e.to)))||e.firstChild}function Cl(r,e,t){let n=dt(r).resolveInner(e.head),s=t?qe.closedBy:qe.openedBy;for(let l=e.head;;){let c=t?n.childAfter(l):n.childBefore(l);if(!c)break;xP(r,c,s)?n=c:l=t?c.to:c.from}let i=n.type.prop(s),o,a;return i&&(o=t?Jr(r,n.from,1):Jr(r,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,te.cursor(a,t?-1:1)}const yP=r=>Lr(r,e=>Cl(r.state,e,!zt(r))),kP=r=>Lr(r,e=>Cl(r.state,e,zt(r)));function wO(r,e){return Lr(r,t=>{if(!t.empty)return $l(t,e);let n=r.moveVertically(t,e);return n.head!=t.head?n:r.moveToLineBoundary(t,e)})}const SO=r=>wO(r,!1),$O=r=>wO(r,!0);function CO(r){let e=r.scrollDOM.clientHeight<r.scrollDOM.scrollHeight-2,t=0,n=0,s;if(e){for(let i of r.state.facet(Se.scrollMargins)){let o=i(r);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(n=Math.max(o?.bottom,n))}s=r.scrollDOM.clientHeight-t-n}else s=(r.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(r.defaultLineHeight,s-5)}}function QO(r,e){let t=CO(r),{state:n}=r,s=li(n.selection,o=>o.empty?r.moveVertically(o,e,t.height):$l(o,e));if(s.eq(n.selection))return!1;let i;if(t.selfScroll){let o=r.coordsAtPos(n.selection.main.head),a=r.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(i=Se.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return r.dispatch(Dr(n,s),{effects:i}),!0}const Cf=r=>QO(r,!1),gu=r=>QO(r,!0);function Wn(r,e,t){let n=r.lineBlockAt(e.head),s=r.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?n.to:n.from)&&(s=r.moveToLineBoundary(e,t,!1)),!t&&s.head==n.from&&n.length){let i=/^\s*/.exec(r.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(s=te.cursor(n.from+i))}return s}const wP=r=>Lr(r,e=>Wn(r,e,!0)),SP=r=>Lr(r,e=>Wn(r,e,!1)),$P=r=>Lr(r,e=>Wn(r,e,!zt(r))),CP=r=>Lr(r,e=>Wn(r,e,zt(r))),QP=r=>Lr(r,e=>te.cursor(r.lineBlockAt(e.head).from,1)),PP=r=>Lr(r,e=>te.cursor(r.lineBlockAt(e.head).to,-1));function TP(r,e,t){let n=!1,s=li(r.selection,i=>{let o=Jr(r,i.head,-1)||Jr(r,i.head,1)||i.head>0&&Jr(r,i.head-1,1)||i.head<r.doc.length&&Jr(r,i.head+1,-1);if(!o||!o.end)return i;n=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return te.cursor(a)});return n?(e(Dr(r,s)),!0):!1}const MP=({state:r,dispatch:e})=>TP(r,e);function Mr(r,e){let t=li(r.state.selection,n=>{let s=e(n);return te.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(r.state.selection)?!1:(r.dispatch(Dr(r.state,t)),!0)}function PO(r,e){return Mr(r,t=>r.moveByChar(t,e))}const TO=r=>PO(r,!zt(r)),MO=r=>PO(r,zt(r));function AO(r,e){return Mr(r,t=>r.moveByGroup(t,e))}const AP=r=>AO(r,!zt(r)),_P=r=>AO(r,zt(r)),RP=r=>Mr(r,e=>Cl(r.state,e,!zt(r))),BP=r=>Mr(r,e=>Cl(r.state,e,zt(r)));function _O(r,e){return Mr(r,t=>r.moveVertically(t,e))}const RO=r=>_O(r,!1),BO=r=>_O(r,!0);function ZO(r,e){return Mr(r,t=>r.moveVertically(t,e,CO(r).height))}const Qf=r=>ZO(r,!1),Pf=r=>ZO(r,!0),ZP=r=>Mr(r,e=>Wn(r,e,!0)),EP=r=>Mr(r,e=>Wn(r,e,!1)),DP=r=>Mr(r,e=>Wn(r,e,!zt(r))),LP=r=>Mr(r,e=>Wn(r,e,zt(r))),XP=r=>Mr(r,e=>te.cursor(r.lineBlockAt(e.head).from)),IP=r=>Mr(r,e=>te.cursor(r.lineBlockAt(e.head).to)),Tf=({state:r,dispatch:e})=>(e(Dr(r,{anchor:0})),!0),Mf=({state:r,dispatch:e})=>(e(Dr(r,{anchor:r.doc.length})),!0),Af=({state:r,dispatch:e})=>(e(Dr(r,{anchor:r.selection.main.anchor,head:0})),!0),_f=({state:r,dispatch:e})=>(e(Dr(r,{anchor:r.selection.main.anchor,head:r.doc.length})),!0),VP=({state:r,dispatch:e})=>(e(r.update({selection:{anchor:0,head:r.doc.length},userEvent:"select"})),!0),zP=({state:r,dispatch:e})=>{let t=Ql(r).map(({from:n,to:s})=>te.range(n,Math.min(s+1,r.doc.length)));return e(r.update({selection:te.create(t),userEvent:"select"})),!0},NP=({state:r,dispatch:e})=>{let t=li(r.selection,n=>{let s=dt(r),i=s.resolveStack(n.from,1);if(n.empty){let o=s.resolveStack(n.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&o.next)return te.range(a.to,a.from)}return n});return t.eq(r.selection)?!1:(e(Dr(r,t)),!0)};function EO(r,e){let{state:t}=r,n=t.selection,s=t.selection.ranges.slice();for(let i of t.selection.ranges){let o=t.doc.lineAt(i.head);if(e?o.to<r.state.doc.length:o.from>0)for(let a=i;;){let l=r.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==n.ranges.length?!1:(r.dispatch(Dr(t,te.create(s,s.length-1))),!0)}const WP=r=>EO(r,!1),qP=r=>EO(r,!0),jP=({state:r,dispatch:e})=>{let t=r.selection,n=null;return t.ranges.length>1?n=te.create([t.main]):t.main.empty||(n=te.create([te.cursor(t.main.head)])),n?(e(Dr(r,n)),!0):!1};function Ao(r,e){if(r.state.readOnly)return!1;let t="delete.selection",{state:n}=r,s=n.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=e(i);l<o?(t="delete.backward",l=ia(r,l,!1)):l>o&&(t="delete.forward",l=ia(r,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=ia(r,o,!1),a=ia(r,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:te.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(r.dispatch(n.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?Se.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function ia(r,e,t){if(r instanceof Se)for(let n of r.state.facet(Se.atomicRanges).map(s=>s(r)))n.between(e,e,(s,i)=>{s<e&&i>e&&(e=t?i:s)});return e}const DO=(r,e,t)=>Ao(r,n=>{let s=n.from,{state:i}=r,o=i.doc.lineAt(s),a,l;if(t&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let c=Zr(a,i.tabSize),u=c%ja(i)||ja(i);for(let h=0;h<u&&a[a.length-1-h]==" ";h++)s--;l=s}else l=Pt(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=Pt(o.text,l-o.from,!1,!1)+o.from);return l}),Ou=r=>DO(r,!1,!0),LO=r=>DO(r,!0,!1),XO=(r,e)=>Ao(r,t=>{let n=t.head,{state:s}=r,i=s.doc.lineAt(n),o=s.charCategorizer(n);for(let a=null;;){if(n==(e?i.to:i.from)){n==t.head&&i.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let l=Pt(i.text,n-i.from,e)+i.from,c=i.text.slice(Math.min(n,l)-i.from,Math.max(n,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||n!=t.head)&&(a=u),n=l}return n}),IO=r=>XO(r,!1),YP=r=>XO(r,!0),FP=r=>Ao(r,e=>{let t=r.lineBlockAt(e.head).to;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),UP=r=>Ao(r,e=>{let t=r.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),GP=r=>Ao(r,e=>{let t=r.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),HP=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:tt.of(["",""])},range:te.cursor(n.from)}));return e(r.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},KP=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>{if(!n.empty||n.from==0||n.from==r.doc.length)return{range:n};let s=n.from,i=r.doc.lineAt(s),o=s==i.from?s-1:Pt(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:Pt(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:r.doc.slice(s,a).append(r.doc.slice(o,s))},range:te.cursor(a)}});return t.changes.empty?!1:(e(r.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Ql(r){let e=[],t=-1;for(let n of r.selection.ranges){let s=r.doc.lineAt(n.from),i=r.doc.lineAt(n.to);if(!n.empty&&n.to==i.from&&(i=r.doc.lineAt(n.to-1)),t>=s.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(n)}else e.push({from:s.from,to:i.to,ranges:[n]});t=i.number+1}return e}function VO(r,e,t){if(r.readOnly)return!1;let n=[],s=[];for(let i of Ql(r)){if(t?i.to==r.doc.length:i.from==0)continue;let o=r.doc.lineAt(t?i.to+1:i.from-1),a=o.length+1;if(t){n.push({from:i.to,to:o.to},{from:i.from,insert:o.text+r.lineBreak});for(let l of i.ranges)s.push(te.range(Math.min(r.doc.length,l.anchor+a),Math.min(r.doc.length,l.head+a)))}else{n.push({from:o.from,to:i.from},{from:i.to,insert:r.lineBreak+o.text});for(let l of i.ranges)s.push(te.range(l.anchor-a,l.head-a))}}return n.length?(e(r.update({changes:n,scrollIntoView:!0,selection:te.create(s,r.selection.mainIndex),userEvent:"move.line"})),!0):!1}const JP=({state:r,dispatch:e})=>VO(r,e,!1),e3=({state:r,dispatch:e})=>VO(r,e,!0);function zO(r,e,t){if(r.readOnly)return!1;let n=[];for(let i of Ql(r))t?n.push({from:i.from,insert:r.doc.slice(i.from,i.to)+r.lineBreak}):n.push({from:i.to,insert:r.lineBreak+r.doc.slice(i.from,i.to)});let s=r.changes(n);return e(r.update({changes:s,selection:r.selection.map(s,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const t3=({state:r,dispatch:e})=>zO(r,e,!1),r3=({state:r,dispatch:e})=>zO(r,e,!0),n3=r=>{if(r.state.readOnly)return!1;let{state:e}=r,t=e.changes(Ql(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),n=li(e.selection,s=>{let i;if(r.lineWrapping){let o=r.lineBlockAt(s.head),a=r.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+r.documentTop-a.bottom+r.defaultLineHeight/2)}return r.moveVertically(s,!0,i)}).map(t);return r.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function s3(r,e){if(/\(\)|\[\]|\{\}/.test(r.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=dt(r).resolveInner(e),n=t.childBefore(e),s=t.childAfter(e),i;return n&&s&&n.to<=e&&s.from>=e&&(i=n.type.prop(qe.closedBy))&&i.indexOf(s.name)>-1&&r.doc.lineAt(n.to).from==r.doc.lineAt(s.from).from&&!/\S/.test(r.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const Rf=NO(!1),i3=NO(!0);function NO(r){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{let{from:i,to:o}=s,a=e.doc.lineAt(i),l=!r&&i==o&&s3(e,i);r&&(i=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new kl(e,{simulateBreak:i,simulateDoubleBreak:!!l}),u=uh(c,i);for(u==null&&(u=Zr(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",io(e,u)];return l&&h.push(io(e,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:tt.of(h)},range:te.cursor(i+1+h[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function mh(r,e){let t=-1;return r.changeByRange(n=>{let s=[];for(let o=n.from;o<=n.to;){let a=r.doc.lineAt(o);a.number>t&&(n.empty||n.to>a.from)&&(e(a,s,n),t=a.number),o=a.to+1}let i=r.changes(s);return{changes:s,range:te.range(i.mapPos(n.anchor,1),i.mapPos(n.head,1))}})}const o3=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=Object.create(null),n=new kl(r,{overrideIndentation:i=>{let o=t[i];return o??-1}}),s=mh(r,(i,o,a)=>{let l=uh(n,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=io(r,l);(c!=u||a.from<i.from+c.length)&&(t[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||e(r.update(s,{userEvent:"indent"})),!0},a3=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(mh(r,(t,n)=>{n.push({from:t.from,insert:r.facet(Qo)})}),{userEvent:"input.indent"})),!0),l3=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(mh(r,(t,n)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let i=Zr(s,r.tabSize),o=0,a=io(r,Math.max(0,i-ja(r)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),c3=r=>(r.setTabFocusMode(),!0),u3=[{key:"Ctrl-b",run:xO,shift:TO,preventDefault:!0},{key:"Ctrl-f",run:yO,shift:MO},{key:"Ctrl-p",run:SO,shift:RO},{key:"Ctrl-n",run:$O,shift:BO},{key:"Ctrl-a",run:QP,shift:XP},{key:"Ctrl-e",run:PP,shift:IP},{key:"Ctrl-d",run:LO},{key:"Ctrl-h",run:Ou},{key:"Ctrl-k",run:FP},{key:"Ctrl-Alt-h",run:IO},{key:"Ctrl-o",run:HP},{key:"Ctrl-t",run:KP},{key:"Ctrl-v",run:gu}],h3=[{key:"ArrowLeft",run:xO,shift:TO,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:vP,shift:AP,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:$P,shift:DP,preventDefault:!0},{key:"ArrowRight",run:yO,shift:MO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:bP,shift:_P,preventDefault:!0},{mac:"Cmd-ArrowRight",run:CP,shift:LP,preventDefault:!0},{key:"ArrowUp",run:SO,shift:RO,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Tf,shift:Af},{mac:"Ctrl-ArrowUp",run:Cf,shift:Qf},{key:"ArrowDown",run:$O,shift:BO,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Mf,shift:_f},{mac:"Ctrl-ArrowDown",run:gu,shift:Pf},{key:"PageUp",run:Cf,shift:Qf},{key:"PageDown",run:gu,shift:Pf},{key:"Home",run:SP,shift:EP,preventDefault:!0},{key:"Mod-Home",run:Tf,shift:Af},{key:"End",run:wP,shift:ZP,preventDefault:!0},{key:"Mod-End",run:Mf,shift:_f},{key:"Enter",run:Rf,shift:Rf},{key:"Mod-a",run:VP},{key:"Backspace",run:Ou,shift:Ou,preventDefault:!0},{key:"Delete",run:LO,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:IO,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:YP,preventDefault:!0},{mac:"Mod-Backspace",run:UP,preventDefault:!0},{mac:"Mod-Delete",run:GP,preventDefault:!0}].concat(u3.map(r=>({mac:r.key,run:r.run,shift:r.shift}))),d3=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:yP,shift:RP},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:kP,shift:BP},{key:"Alt-ArrowUp",run:JP},{key:"Shift-Alt-ArrowUp",run:t3},{key:"Alt-ArrowDown",run:e3},{key:"Shift-Alt-ArrowDown",run:r3},{key:"Mod-Alt-ArrowUp",run:WP},{key:"Mod-Alt-ArrowDown",run:qP},{key:"Escape",run:jP},{key:"Mod-Enter",run:i3},{key:"Alt-l",mac:"Ctrl-l",run:zP},{key:"Mod-i",run:NP,preventDefault:!0},{key:"Mod-[",run:l3},{key:"Mod-]",run:a3},{key:"Mod-Alt-\\",run:o3},{key:"Shift-Mod-k",run:n3},{key:"Shift-Mod-\\",run:MP},{key:"Mod-/",run:JQ},{key:"Alt-A",run:tP},{key:"Ctrl-m",mac:"Shift-Alt-m",run:c3}].concat(h3),Bf=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r;class ti{constructor(e,t,n=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=i?a=>i(Bf(a)):Bf,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Kt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Xu(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Ur(e);let s=this.normalize(t);if(s.length)for(let i=0,o=n;;i++){let a=s.charCodeAt(i),l=this.match(a,o,this.bufferPos+this.bufferStart);if(i==s.length-1){if(l)return this.value=l,this;break}o==n&&i<t.length&&t.charCodeAt(i)==a&&o++}}}match(e,t,n){let s=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[i+1],to:n}:(this.matches[i]++,a=!0)),a||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:t,to:n}:this.matches.push(1,t)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(ti.prototype[Symbol.iterator]=function(){return this});const WO={from:-1,to:-1,match:/.*/.exec("")},ph="gm"+(/x/.unicode==null?"":"u");class qO{constructor(e,t,n,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=WO,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new jO(e,t,n,s,i);this.re=new RegExp(t,ph+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=Ga(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,s=n+t[0].length;if(this.matchPos=Ga(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const ec=new WeakMap;class Ws{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let s=ec.get(e);if(!s||s.from>=n||s.to<=t){let a=new Ws(t,e.sliceString(t,n));return ec.set(e,a),a}if(s.from==t&&s.to==n)return s;let{text:i,from:o}=s;return o>t&&(i=e.sliceString(t,o)+i,o=t),s.to<n&&(i+=e.sliceString(s.to,n)),ec.set(e,new Ws(o,i)),new Ws(t,i.slice(t-o,n-o))}}class jO{constructor(e,t,n,s,i){this.text=e,this.to=i,this.done=!1,this.value=WO,this.matchPos=Ga(e,s),this.re=new RegExp(t,ph+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=Ws.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,s=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this.matchPos=Ga(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ws.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(qO.prototype[Symbol.iterator]=jO.prototype[Symbol.iterator]=function(){return this});function f3(r){try{return new RegExp(r,ph),!0}catch{return!1}}function Ga(r,e){if(e>=r.length)return e;let t=r.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}const m3=r=>{let{state:e}=r,t=String(e.doc.lineAt(r.state.selection.main.head).number),{close:n,result:s}=MC(r,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){r.dispatch({effects:n});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,h]=o,f=u?+u.slice(1):0,p=c?+c:a.number;if(c&&h){let b=p/100;l&&(b=b*(l=="-"?-1:1)+a.number/e.doc.lines),p=Math.round(e.doc.lines*b)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let g=e.doc.line(Math.max(1,Math.min(e.doc.lines,p))),O=te.cursor(g.from+Math.max(0,Math.min(f,g.length)));r.dispatch({effects:[n,Se.scrollIntoView(O.from,{y:"center"})],selection:O})}),!0},p3={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},g3=Qe.define({combine(r){return nn(r,p3,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function O3(r){return[k3,y3]}const v3=Le.mark({class:"cm-selectionMatch"}),b3=Le.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Zf(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=pt.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=pt.Word)}function x3(r,e,t,n){return r(e.sliceDoc(t,t+1))==pt.Word&&r(e.sliceDoc(n-1,n))==pt.Word}const y3=bt.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.selectionSet||r.docChanged||r.viewportChanged)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=r.state.facet(g3),{state:t}=r,n=t.selection;if(n.ranges.length>1)return Le.none;let s=n.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return Le.none;let l=t.wordAt(s.head);if(!l)return Le.none;o=t.charCategorizer(s.head),i=t.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return Le.none;if(e.wholeWords){if(i=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Zf(o,t,s.from,s.to)&&x3(o,t,s.from,s.to)))return Le.none}else if(i=t.sliceDoc(s.from,s.to),!i)return Le.none}let a=[];for(let l of r.visibleRanges){let c=new ti(t.doc,i,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||Zf(o,t,u,h))&&(s.empty&&u<=s.from&&h>=s.to?a.push(b3.range(u,h)):(u>=s.to||h<=s.from)&&a.push(v3.range(u,h)),a.length>e.maxMatches))return Le.none}}return Le.set(a)}},{decorations:r=>r.decorations}),k3=Se.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),w3=({state:r,dispatch:e})=>{let{selection:t}=r,n=te.create(t.ranges.map(s=>r.wordAt(s.head)||te.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(r.update({selection:n})),!0)};function S3(r,e){let{main:t,ranges:n}=r.selection,s=r.wordAt(t.head),i=s&&s.from==t.from&&s.to==t.to;for(let o=!1,a=new ti(r.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new ti(r.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(l=>l.from==a.value.from))continue;if(i){let l=r.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const $3=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(i=>i.from===i.to))return w3({state:r,dispatch:e});let n=r.sliceDoc(t[0].from,t[0].to);if(r.selection.ranges.some(i=>r.sliceDoc(i.from,i.to)!=n))return!1;let s=S3(r,n);return s?(e(r.update({selection:r.selection.addRange(te.range(s.from,s.to),!1),effects:Se.scrollIntoView(s.to)})),!0):!1},ci=Qe.define({combine(r){return nn(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new X3(e),scrollToMatch:e=>Se.scrollIntoView(e)})}});class YO{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||f3(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
22
|
+
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new A3(this):new P3(this)}getCursor(e,t=0,n){let s=e.doc?e:He.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?Bs(this,s,t,n):Rs(this,s,t,n)}}class FO{constructor(e){this.spec=e}}function C3(r,e,t){return(n,s,i,o)=>{if(t&&!t(n,s,i,o))return!1;let a=n>=o&&s<=o+i.length?i.slice(n-o,s-o):e.doc.sliceString(n,s);return r(a,e,n,s)}}function Rs(r,e,t,n){let s;return r.wholeWord&&(s=Q3(e.doc,e.charCategorizer(e.selection.main.head))),r.test&&(s=C3(r.test,e,s)),new ti(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:i=>i.toLowerCase(),s)}function Q3(r,e){return(t,n,s,i)=>((i>t||i+s.length<n)&&(i=Math.max(0,t-2),s=r.sliceString(i,Math.min(r.length,n+2))),(e(Ha(s,t-i))!=pt.Word||e(Ka(s,t-i))!=pt.Word)&&(e(Ka(s,n-i))!=pt.Word||e(Ha(s,n-i))!=pt.Word))}class P3 extends FO{constructor(e){super(e)}nextMatch(e,t,n){let s=Rs(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let i=Math.min(e.doc.length,t+this.spec.unquoted.length);s=Rs(this.spec,e,0,i).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==n?null:s.value}prevMatchInRange(e,t,n){for(let s=n;;){let i=Math.max(t,s-1e4-this.spec.unquoted.length),o=Rs(this.spec,e,i,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==t)return null;s-=1e4}}prevMatch(e,t,n){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Rs(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let i=Rs(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function T3(r,e,t){return(n,s,i)=>(!t||t(n,s,i))&&r(i[0],e,n,s)}function Bs(r,e,t,n){let s;return r.wholeWord&&(s=M3(e.charCategorizer(e.selection.main.head))),r.test&&(s=T3(r.test,e,s)),new qO(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:s},t,n)}function Ha(r,e){return r.slice(Pt(r,e,!1),e)}function Ka(r,e){return r.slice(e,Pt(r,e))}function M3(r){return(e,t,n)=>!n[0].length||(r(Ha(n.input,n.index))!=pt.Word||r(Ka(n.input,n.index))!=pt.Word)&&(r(Ka(n.input,n.index+n[0].length))!=pt.Word||r(Ha(n.input,n.index+n[0].length))!=pt.Word)}class A3 extends FO{nextMatch(e,t,n){let s=Bs(this.spec,e,n,e.doc.length).next();return s.done&&(s=Bs(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,n){for(let s=1;;s++){let i=Math.max(t,n-s*1e4),o=Bs(this.spec,e,i,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==t||a.from>i+10))return a;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let i=+n.slice(0,s);if(i>0&&i<e.match.length)return e.match[i]+n.slice(s)}return t})}matchAll(e,t){let n=Bs(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let i=Bs(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const oo=We.define(),gh=We.define(),Zn=Tt.define({create(r){return new tc(vu(r).create(),null)},update(r,e){for(let t of e.effects)t.is(oo)?r=new tc(t.value.create(),r.panel):t.is(gh)&&(r=new tc(r.query,t.value?Oh:null));return r},provide:r=>eo.from(r,e=>e.panel)});class tc{constructor(e,t){this.query=e,this.panel=t}}const _3=Le.mark({class:"cm-searchMatch"}),R3=Le.mark({class:"cm-searchMatch cm-searchMatch-selected"}),B3=bt.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(Zn))}update(r){let e=r.state.field(Zn);(e!=r.startState.field(Zn)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return Le.none;let{view:t}=this,n=new bn;for(let s=0,i=t.visibleRanges,o=i.length;s<o;s++){let{from:a,to:l}=i[s];for(;s<o-1&&l>i[s+1].from-500;)l=i[++s].to;r.highlight(t.state,a,l,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);n.add(c,u,h?R3:_3)})}return n.finish()}},{decorations:r=>r.decorations});function _o(r){return e=>{let t=e.state.field(Zn,!1);return t&&t.query.spec.valid?r(e,t):HO(e)}}const Ja=_o((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let s=te.single(n.from,n.to),i=r.state.facet(ci);return r.dispatch({selection:s,effects:[vh(r,n),i.scrollToMatch(s.main,r)],userEvent:"select.search"}),GO(r),!0}),el=_o((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,s=e.prevMatch(t,n,n);if(!s)return!1;let i=te.single(s.from,s.to),o=r.state.facet(ci);return r.dispatch({selection:i,effects:[vh(r,s),o.scrollToMatch(i.main,r)],userEvent:"select.search"}),GO(r),!0}),Z3=_o((r,{query:e})=>{let t=e.matchAll(r.state,1e3);return!t||!t.length?!1:(r.dispatch({selection:te.create(t.map(n=>te.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),E3=({state:r,dispatch:e})=>{let t=r.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:s}=t.main,i=[],o=0;for(let a=new ti(r.doc,r.sliceDoc(n,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==n&&(o=i.length),i.push(te.range(a.value.from,a.value.to))}return e(r.update({selection:te.create(i,o),userEvent:"select.search.matches"})),!0},Ef=_o((r,{query:e})=>{let{state:t}=r,{from:n,to:s}=t.selection.main;if(t.readOnly)return!1;let i=e.nextMatch(t,n,n);if(!i)return!1;let o=i,a=[],l,c,u=[];o.from==n&&o.to==s&&(c=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),u.push(Se.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+".")));let h=r.state.changes(a);return o&&(l=te.single(o.from,o.to).map(h),u.push(vh(r,o)),u.push(t.facet(ci).scrollToMatch(l.main,r))),r.dispatch({changes:h,selection:l,effects:u,userEvent:"input.replace"}),!0}),D3=_o((r,{query:e})=>{if(r.state.readOnly)return!1;let t=e.matchAll(r.state,1e9).map(s=>{let{from:i,to:o}=s;return{from:i,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let n=r.state.phrase("replaced $ matches",t.length)+".";return r.dispatch({changes:t,effects:Se.announce.of(n),userEvent:"input.replace.all"}),!0});function Oh(r){return r.state.facet(ci).createPanel(r)}function vu(r,e){var t,n,s,i,o;let a=r.selection.main,l=a.empty||a.to>a.from+100?"":r.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=r.facet(ci);return new YO({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:c.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function UO(r){let e=nh(r,Oh);return e&&e.dom.querySelector("[main-field]")}function GO(r){let e=UO(r);e&&e==r.root.activeElement&&e.select()}const HO=r=>{let e=r.state.field(Zn,!1);if(e&&e.panel){let t=UO(r);if(t&&t!=r.root.activeElement){let n=vu(r.state,e.query.spec);n.valid&&r.dispatch({effects:oo.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[gh.of(!0),e?oo.of(vu(r.state,e.query.spec)):We.appendConfig.of(V3)]});return!0},KO=r=>{let e=r.state.field(Zn,!1);if(!e||!e.panel)return!1;let t=nh(r,Oh);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:gh.of(!1)}),!0},L3=[{key:"Mod-f",run:HO,scope:"editor search-panel"},{key:"F3",run:Ja,shift:el,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ja,shift:el,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:KO,scope:"editor search-panel"},{key:"Mod-Shift-l",run:E3},{key:"Mod-Alt-g",run:m3},{key:"Mod-d",run:$3,preventDefault:!0}];class X3{constructor(e){this.view=e;let t=this.query=e.state.field(Zn).query.spec;this.commit=this.commit.bind(this),this.searchField=lt("input",{value:t.search,placeholder:cr(e,"Find"),"aria-label":cr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=lt("input",{value:t.replace,placeholder:cr(e,"Replace"),"aria-label":cr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=lt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=lt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=lt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(s,i,o){return lt("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=lt("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>Ja(e),[cr(e,"next")]),n("prev",()=>el(e),[cr(e,"previous")]),n("select",()=>Z3(e),[cr(e,"all")]),lt("label",null,[this.caseField,cr(e,"match case")]),lt("label",null,[this.reField,cr(e,"regexp")]),lt("label",null,[this.wordField,cr(e,"by word")]),...e.state.readOnly?[]:[lt("br"),this.replaceField,n("replace",()=>Ef(e),[cr(e,"replace")]),n("replaceAll",()=>D3(e),[cr(e,"replace all")])],lt("button",{name:"close",onclick:()=>KO(e),"aria-label":cr(e,"close"),type:"button"},["×"])])}commit(){let e=new YO({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:oo.of(e)}))}keydown(e){z5(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?el:Ja)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ef(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(oo)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ci).top}}function cr(r,e){return r.state.phrase(e)}const oa=30,aa=/[\s\.,:;?!]/;function vh(r,{from:e,to:t}){let n=r.state.doc.lineAt(e),s=r.state.doc.lineAt(t).to,i=Math.max(n.from,e-oa),o=Math.min(s,t+oa),a=r.state.sliceDoc(i,o);if(i!=n.from){for(let l=0;l<oa;l++)if(!aa.test(a[l+1])&&aa.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-oa;l--)if(!aa.test(a[l-1])&&aa.test(a[l])){a=a.slice(0,l);break}}return Se.announce.of(`${r.state.phrase("current match")}. ${a} ${r.state.phrase("on line")} ${n.number}.`)}const I3=Se.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),V3=[Zn,kn.low(B3),I3];class bh{constructor(e,t,n,s){this.state=e,this.pos=t,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=dt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),s=t.text.slice(n-t.from,this.pos-t.from),i=s.search(e0(e,!1));return i<0?null:{from:n+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Df(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function z3(r){let e=Object.create(null),t=Object.create(null);for(let{label:s}of r){e[s[0]]=!0;for(let i=1;i<s.length;i++)t[s[i]]=!0}let n=Df(e)+Df(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function JO(r){let e=r.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:z3(e);return s=>{let i=s.matchBefore(n);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:t}:null}}function N3(r,e){return t=>{for(let n=dt(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class Lf{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function ms(r){return r.selection.main.from}function e0(r,e){var t;let{source:n}=r,s=e&&n[0]!="^",i=n[n.length-1]!="$";return!s&&!i?r:new RegExp(`${s?"^":""}(?:${n})${i?"$":""}`,(t=r.flags)!==null&&t!==void 0?t:r.ignoreCase?"i":"")}const xh=wn.define();function W3(r,e,t,n){let{main:s}=r.selection,i=t-s.from,o=n-s.from;return{...r.changeByRange(a=>{if(a!=s&&t!=n&&r.sliceDoc(a.from+i,a.from+o)!=r.sliceDoc(t,n))return{range:a};let l=r.toText(e);return{changes:{from:a.from+i,to:n==s.from?a.to:a.from+o,insert:l},range:te.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Xf=new WeakMap;function q3(r){if(!Array.isArray(r))return r;let e=Xf.get(r);return e||Xf.set(r,e=JO(r)),e}const tl=We.define(),ao=We.define();class j3{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Kt(e,t),s=Ur(n);this.chars.push(n);let i=e.slice(t,t+s),o=i.toUpperCase();this.folded.push(Kt(o==i?i.toLowerCase():o,0)),t+=s}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:s,precise:i,byWord:o}=this;if(t.length==1){let k=Kt(e,0),w=Ur(k),S=w==e.length?0:-100;if(k!=t[0])if(k==n[0])S+=-200;else return null;return this.ret(S,[0,w])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,c=0;if(a<0){for(let k=0,w=Math.min(e.length,200);k<w&&c<l;){let S=Kt(e,k);(S==t[c]||S==n[c])&&(s[c++]=k),k+=Ur(S)}if(c<l)return null}let u=0,h=0,f=!1,p=0,g=-1,O=-1,b=/[a-z]/.test(e),x=!0;for(let k=0,w=Math.min(e.length,200),S=0;k<w&&h<l;){let Q=Kt(e,k);a<0&&(u<l&&Q==t[u]&&(i[u++]=k),p<l&&(Q==t[p]||Q==n[p]?(p==0&&(g=k),O=k+1,p++):p=0));let L,E=Q<255?Q>=48&&Q<=57||Q>=97&&Q<=122?2:Q>=65&&Q<=90?1:0:(L=Xu(Q))!=L.toLowerCase()?1:L!=L.toUpperCase()?2:0;(!k||E==1&&b||S==0&&E!=0)&&(t[h]==Q||n[h]==Q&&(f=!0)?o[h++]=k:o.length&&(x=!1)),S=E,k+=Ur(Q)}return h==l&&o[0]==0&&x?this.result(-100+(f?-200:0),o,e):p==l&&g==0?this.ret(-200-e.length+(O==e.length?0:-100),[0,O]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[g,O]):h==l?this.result(-100+(f?-200:0)+-700+(x?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],i=0;for(let o of t){let a=o+(this.astral?Ur(Kt(n,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-n.length,s)}}class Y3{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Qt=Qe.define({combine(r){return nn(r,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:F3,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>If(e(n),t(n)),optionClass:(e,t)=>n=>If(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function If(r,e){return r?e?r+" "+e:r:e}function F3(r,e,t,n,s,i){let o=r.textDirection==ht.RTL,a=o,l=!1,c="top",u,h,f=e.left-s.left,p=s.right-e.right,g=n.right-n.left,O=n.bottom-n.top;if(a&&f<Math.min(g,p)?a=!1:!a&&p<Math.min(g,f)&&(a=!0),g<=(a?f:p))u=Math.max(s.top,Math.min(t.top,s.bottom-O))-e.top,h=Math.min(400,a?f:p);else{l=!0,h=Math.min(400,(o?e.right:s.right-e.left)-30);let k=s.bottom-e.bottom;k>=O||k>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let b=(e.bottom-e.top)/i.offsetHeight,x=(e.right-e.left)/i.offsetWidth;return{style:`${c}: ${u/b}px; max-width: ${h/x}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function U3(r){let e=r.addToOptions.slice();return r.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<i.length;){let u=i[c++],h=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(u,h))),f.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function rc(r,e,t){if(r<=t)return{from:0,to:r};if(e<0&&(e=0),e<=r>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.floor((r-e)/t);return{from:r-(n+1)*t,to:r-n*t}}class G3{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:i,selected:o}=s.open,a=e.state.facet(Qt);this.optionContent=U3(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=rc(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(t).open;for(let u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Qt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:ao.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:i,selected:o,disabled:a}=n.open;(!s.open||s.open.options!=i)&&(this.range=rc(i.length,o,e.state.facet(Qt).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),a!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=rc(t.options.length,t.selected,this.view.state.facet(Qt).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>rr(this.view.state,a,"completion info")):(this.addInfoPane(o,s),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;n.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&K3(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,t.bottom)-10||s.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(Qt).positionInfo(this.view,t,s,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=i&&(o>n.from||n.from==0))if(i=f,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=f}}const u=s.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let f of this.optionContent){let p=f(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function H3(r,e){return t=>new G3(t,r,e)}function K3(r,e){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/r.offsetHeight;n.top<t.top?r.scrollTop-=(t.top-n.top)/s:n.bottom>t.bottom&&(r.scrollTop+=(n.bottom-t.bottom)/s)}function Vf(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function J3(r,e){let t=[],n=null,s=null,i=u=>{t.push(u);let{section:h}=u.completion;if(h){n||(n=[]);let f=typeof h=="string"?h:h.name;n.some(p=>p.name==f)||n.push(typeof h=="string"?{name:f}:h)}},o=e.facet(Qt);for(let u of r)if(u.hasResult()){let h=u.result.getMatch;if(u.result.filter===!1)for(let f of u.result.options)i(new Lf(f,u.source,h?h(f):[],1e9-t.length));else{let f=e.sliceDoc(u.from,u.to),p,g=o.filterStrict?new Y3(f):new j3(f);for(let O of u.result.options)if(p=g.match(O.label)){let b=O.displayLabel?h?h(O,p.matched):[]:p.matched,x=p.score+(O.boost||0);if(i(new Lf(O,u.source,b,x)),typeof O.section=="object"&&O.section.rank==="dynamic"){let{name:k}=O.section;s||(s=Object.create(null)),s[k]=Math.max(x,s[k]||-1e9)}}}}if(n){let u=Object.create(null),h=0,f=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?s[g.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(p.name<g.name?-1:1);for(let p of n.sort(f))h-=1e5,u[p.name]=h;for(let p of t){let{section:g}=p.completion;g&&(p.score+=u[typeof g=="string"?g:g.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of t.sort((h,f)=>f.score-h.score||c(h.completion,f.completion))){let h=u.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(u):Vf(u.completion)>Vf(l)&&(a[a.length-1]=u),l=u.completion}return a}class Ls{constructor(e,t,n,s,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Ls(this.options,zf(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,i,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=J3(e,t);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=t.facet(Qt).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new Ls(a,zf(n,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:iT,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new Ls(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ls(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class rl{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new rl(nT,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Qt),i=(n.override||t.languageDataAt("autocomplete",ms(t)).map(q3)).map(l=>(this.active.find(u=>u.source==l)||new Qr(l,this.active.some(u=>u.state!=0)?1:0)).update(e,n));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(yh));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!eT(i,this.active)||a?o=Ls.build(i,t,this.id,o,n,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Qr(l.source,0):l));for(let l of e.effects)l.is(r0)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new rl(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tT:rT}}function eT(r,e){if(r==e)return!0;for(let t=0,n=0;;){for(;t<r.length&&!r[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let s=t==r.length,i=n==e.length;if(s||i)return s==i;if(r[t++].result!=e[n++].result)return!1}}const tT={"aria-autocomplete":"list"},rT={};function zf(r,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":r};return e>-1&&(t["aria-activedescendant"]=r+"-"+e),t}const nT=[];function t0(r,e){if(r.isUserEvent("input.complete")){let n=r.annotation(xh);if(n&&e.activateOnCompletion(n))return 12}let t=r.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:r.isUserEvent("delete.backward")?2:r.selection?8:r.docChanged?16:0}class Qr{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=t0(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new Qr(s.source,0)),n&4&&s.state==0&&(s=new Qr(this.source,1)),s=s.updateFor(e,n);for(let i of e.effects)if(i.is(tl))s=new Qr(s.source,1,i.value);else if(i.is(ao))s=new Qr(s.source,0);else if(i.is(yh))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ms(e.state))}}class qs extends Qr{constructor(e,t,n,s,i,o){super(e,3,t),this.limit=n,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=ms(e.state);if(a>o||!s||t&2&&(ms(e.startState)==this.from||a<this.limit))return new Qr(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);return sT(s.validFor,e.state,i,o)?new qs(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new bh(e.state,a,!1)))?new qs(this.source,this.explicit,l,s,s.from,(n=s.to)!==null&&n!==void 0?n:ms(e.state)):new Qr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new qs(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Qr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function sT(r,e,t,n){if(!r)return!1;let s=e.sliceDoc(t,n);return typeof r=="function"?r(s,t,n,e):e0(r,!0).test(s)}const yh=We.define({map(r,e){return r.map(t=>t.map(e))}}),r0=We.define(),Jt=Tt.define({create(){return rl.start()},update(r,e){return r.update(e)},provide:r=>[rh.from(r,e=>e.tooltip),Se.contentAttributes.from(r,e=>e.attrs)]});function kh(r,e){const t=e.completion.apply||e.completion.label;let n=r.state.field(Jt).active.find(s=>s.source==e.source);return n instanceof qs?(typeof t=="string"?r.dispatch({...W3(r.state,t,n.from,n.to),annotations:xh.of(e.completion)}):t(r,e.completion,n.from,n.to),!0):!1}const iT=H3(Jt,kh);function la(r,e="option"){return t=>{let n=t.state.field(Jt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(Qt).interactionDelay)return!1;let s=1,i;e=="page"&&(i=Zg(t,n.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+s*(r?1:-1):r?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:r0.of(a)}),!0}}const oT=r=>{let e=r.state.field(Jt,!1);return r.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<r.state.facet(Qt).interactionDelay?!1:kh(r,e.open.options[e.open.selected])},nc=r=>r.state.field(Jt,!1)?(r.dispatch({effects:tl.of(!0)}),!0):!1,aT=r=>{let e=r.state.field(Jt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:ao.of(null)}),!0)};class lT{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const cT=50,uT=1e3,hT=bt.fromClass(class{constructor(r){this.view=r,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of r.state.field(Jt).active)e.isPending&&this.startQuery(e)}update(r){let e=r.state.field(Jt),t=r.state.facet(Qt);if(!r.selectionSet&&!r.docChanged&&r.startState.field(Jt)==e)return;let n=r.transactions.some(i=>{let o=t0(i,t);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(n||o.context.abortOnDocChange&&r.docChanged||o.updates.length+r.transactions.length>cT&&Date.now()-o.time>uT){for(let a of o.context.abortListeners)try{a()}catch(l){rr(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...r.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),r.transactions.some(i=>i.effects.some(o=>o.is(tl)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of r.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:r}=this.view,e=r.field(Jt);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Qt).updateSyncTime))}startQuery(r){let{state:e}=this.view,t=ms(e),n=new bh(e,t,r.explicit,this.view),s=new lT(r,n);this.running.push(s),Promise.resolve(r.source(n)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:ao.of(null)}),rr(this.view.state,i)})}scheduleAccept(){this.running.every(r=>r.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Qt).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Qt),n=this.view.state.field(Jt);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=ms(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new qs(i.active.source,i.active.explicit,l,i.done,i.done.from,(r=i.done.to)!==null&&r!==void 0?r:a);for(let u of i.updates)c=c.update(u,t);if(c.hasResult()){e.push(c);continue}}let o=n.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Qr(i.active.source,0);for(let l of i.updates)a=a.update(l,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:yh.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field(Jt,!1);if(e&&e.tooltip&&this.view.state.facet(Qt).closeOnBlur){let t=e.open&&Zg(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ao.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:tl.of(!1)}),20),this.composing=0}}}),dT=typeof navigator=="object"&&/Win/.test(navigator.platform),fT=kn.highest(Se.domEventHandlers({keydown(r,e){let t=e.state.field(Jt,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||r.key.length>1||r.ctrlKey&&!(dT&&r.altKey)||r.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(o=>o.source==n.source),i=n.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(r.key)>-1&&kh(e,n),!1}})),n0=Se.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class mT{constructor(e,t,n,s){this.field=e,this.line=t,this.from=n,this.to=s}}class wh{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,_t.TrackDel),n=e.mapPos(this.to,1,_t.TrackDel);return t==null||n==null?null:new wh(this.field,t,n)}}class Sh{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],s=[t],i=e.doc.lineAt(t),o=/^\s*/.exec(i.text)[0];for(let l of this.lines){if(n.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let h=0;h<u;h++)c+=e.facet(Qo);s.push(t+c.length-u),l=c+l.slice(u)}n.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new wh(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],s=[],i;for(let o of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=i[1]?+i[1]:null,l=i[2]||i[3]||"",c=-1,u=l.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h<t.length;h++)(a!=null?t[h].seq==a:u&&t[h].name==u)&&(c=h);if(c<0){let h=0;for(;h<t.length&&(a==null||t[h].seq!=null&&t[h].seq<a);)h++;t.splice(h,0,{seq:a,name:u}),c=h;for(let f of s)f.field>=c&&f.field++}for(let h of s)if(h.line==n.length&&h.from>i.index){let f=i[2]?3+(i[1]||"").length:2;h.from-=f,h.to-=f}s.push(new mT(c,n.length,i.index,i.index+u.length)),o=o.slice(0,i.index)+l+o.slice(i.index+i[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of s)u.line==n.length&&u.from>c&&(u.from--,u.to--);return l}),n.push(o)}return new Sh(n,s)}}let pT=Le.widget({widget:new class extends sn{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),gT=Le.mark({class:"cm-snippetField"});class ui{constructor(e,t){this.ranges=e,this.active=t,this.deco=Le.set(e.map(n=>(n.from==n.to?pT:gT).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;t.push(s)}return new ui(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const Ro=We.define({map(r,e){return r&&r.map(e)}}),OT=We.define(),lo=Tt.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(Ro))return t.value;if(t.is(OT)&&r)return new ui(r.ranges,t.value)}return r&&e.docChanged&&(r=r.map(e.changes)),r&&e.selection&&!r.selectionInsideField(e.selection)&&(r=null),r},provide:r=>Se.decorations.from(r,e=>e?e.deco:Le.none)});function $h(r,e){return te.create(r.filter(t=>t.field==e).map(t=>te.range(t.from,t.to)))}function vT(r){let e=Sh.parse(r);return(t,n,s,i)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),{main:l}=t.state.selection,c={changes:{from:s,to:i==l.from?l.to:i,insert:tt.of(o)},scrollIntoView:!0,annotations:n?[xh.of(n),xt.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=$h(a,0)),a.some(u=>u.field>0)){let u=new ui(a,0),h=c.effects=[Ro.of(u)];t.state.field(lo,!1)===void 0&&h.push(We.appendConfig.of([lo,wT,ST,n0]))}t.dispatch(t.state.update(c))}}function s0(r){return({state:e,dispatch:t})=>{let n=e.field(lo,!1);if(!n||r<0&&n.active==0)return!1;let s=n.active+r,i=r>0&&!n.ranges.some(o=>o.field==s+r);return t(e.update({selection:$h(n.ranges,s),effects:Ro.of(i?null:new ui(n.ranges,s)),scrollIntoView:!0})),!0}}const bT=({state:r,dispatch:e})=>r.field(lo,!1)?(e(r.update({effects:Ro.of(null)})),!0):!1,xT=s0(1),yT=s0(-1),kT=[{key:"Tab",run:xT,shift:yT},{key:"Escape",run:bT}],Nf=Qe.define({combine(r){return r.length?r[0]:kT}}),wT=kn.highest(So.compute([Nf],r=>r.facet(Nf)));function Gt(r,e){return{...e,apply:vT(r)}}const ST=Se.domEventHandlers({mousedown(r,e){let t=e.state.field(lo,!1),n;if(!t||(n=e.posAtCoords({x:r.clientX,y:r.clientY}))==null)return!1;let s=t.ranges.find(i=>i.from<=n&&i.to>=n);return!s||s.field==t.active?!1:(e.dispatch({selection:$h(t.ranges,s.field),effects:Ro.of(t.ranges.some(i=>i.field>s.field)?new ui(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),co={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},us=We.define({map(r,e){let t=e.mapPos(r,-1,_t.TrackAfter);return t??void 0}}),Ch=new class extends Dn{};Ch.startSide=1;Ch.endSide=-1;const i0=Tt.define({create(){return Ge.empty},update(r,e){if(r=r.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);r=r.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(us)&&(r=r.update({add:[Ch.range(t.value,t.value+1)]}));return r}});function $T(){return[QT,i0]}const sc="()[]{}<>«»»«[]{}";function o0(r){for(let e=0;e<sc.length;e+=2)if(sc.charCodeAt(e)==r)return sc.charAt(e+1);return Xu(r<128?r:r+1)}function a0(r,e){return r.languageDataAt("closeBrackets",e)[0]||co}const CT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),QT=Se.inputHandler.of((r,e,t,n)=>{if((CT?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let s=r.state.selection.main;if(n.length>2||n.length==2&&Ur(Kt(n,0))==1||e!=s.from||t!=s.to)return!1;let i=MT(r.state,n);return i?(r.dispatch(i),!0):!1}),PT=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=a0(r,r.selection.main.head).brackets||co.brackets,s=null,i=r.changeByRange(o=>{if(o.empty){let a=AT(r.doc,o.head);for(let l of n)if(l==a&&Pl(r.doc,o.head)==o0(Kt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:te.cursor(o.head-l.length)}}return{range:s=o}});return s||e(r.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},TT=[{key:"Backspace",run:PT}];function MT(r,e){let t=a0(r,r.selection.main.head),n=t.brackets||co.brackets;for(let s of n){let i=o0(Kt(s,0));if(e==s)return i==s?BT(r,s,n.indexOf(s+s+s)>-1,t):_T(r,s,i,t.before||co.before);if(e==i&&l0(r,r.selection.main.from))return RT(r,s,i)}return null}function l0(r,e){let t=!1;return r.field(i0).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function Pl(r,e){let t=r.sliceString(e,e+2);return t.slice(0,Ur(Kt(t,0)))}function AT(r,e){let t=r.sliceString(e-2,e);return Ur(Kt(t,0))==t.length?t:t.slice(1)}function _T(r,e,t,n){let s=null,i=r.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:us.of(o.to+e.length),range:te.range(o.anchor+e.length,o.head+e.length)};let a=Pl(r.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:us.of(o.head+e.length),range:te.cursor(o.head+e.length)}:{range:s=o}});return s?null:r.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function RT(r,e,t){let n=null,s=r.changeByRange(i=>i.empty&&Pl(r.doc,i.head)==t?{changes:{from:i.head,to:i.head+t.length,insert:t},range:te.cursor(i.head+t.length)}:n={range:i});return n?null:r.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function BT(r,e,t,n){let s=n.stringPrefixes||co.stringPrefixes,i=null,o=r.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:us.of(a.to+e.length),range:te.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Pl(r.doc,l),u;if(c==e){if(Wf(r,l))return{changes:{insert:e+e,from:l},effects:us.of(l+e.length),range:te.cursor(l+e.length)};if(l0(r,l)){let f=t&&r.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:te.cursor(l+f.length)}}}else{if(t&&r.sliceDoc(l-2*e.length,l)==e+e&&(u=qf(r,l-2*e.length,s))>-1&&Wf(r,u))return{changes:{insert:e+e+e+e,from:l},effects:us.of(l+e.length),range:te.cursor(l+e.length)};if(r.charCategorizer(l)(c)!=pt.Word&&qf(r,l,s)>-1&&!ZT(r,l,e,s))return{changes:{insert:e+e,from:l},effects:us.of(l+e.length),range:te.cursor(l+e.length)}}return{range:i=a}});return i?null:r.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Wf(r,e){let t=dt(r).resolveInner(e+1);return t.parent&&t.from==e}function ZT(r,e,t,n){let s=dt(r).resolveInner(e,-1),i=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=r.sliceDoc(s.from,Math.min(s.to,s.from+t.length+i)),l=a.indexOf(t);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>t.length+l;){if(r.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function qf(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=pt.Word)return e;for(let s of t){let i=e-s.length;if(r.sliceDoc(i,e)==s&&n(r.sliceDoc(i-1,i))!=pt.Word)return i}return-1}function ET(r={}){return[fT,Jt,Qt.of(r),hT,DT,n0]}const c0=[{key:"Ctrl-Space",run:nc},{mac:"Alt-`",run:nc},{mac:"Alt-i",run:nc},{key:"Escape",run:aT},{key:"ArrowDown",run:la(!0)},{key:"ArrowUp",run:la(!1)},{key:"PageDown",run:la(!0,"page")},{key:"PageUp",run:la(!1,"page")},{key:"Enter",run:oT}],DT=kn.highest(So.computeN([Qt],r=>r.facet(Qt).defaultKeymap?[c0]:[]));class jf{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class is{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let s=n.facet(uo).markerFilter;s&&(e=s(e,n));let i=e.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new bn,a=[],l=0,c=n.doc.iter(),u=0,h=n.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let O,b;if(a.length)O=l,b=a.reduce((w,S)=>Math.min(w,S.to),g&&g.from>O?g.from:1e8);else{if(O=g.from,O>h)break;b=g.to,a.push(g),p++}for(;p<i.length;){let w=i[p];if(w.from==O&&(w.to>w.from||w.to==O))a.push(w),p++,b=Math.min(w.to,b);else{b=Math.min(w.from,b);break}}b=Math.min(b,h);let x=!1;if(a.some(w=>w.from==O&&(w.to==b||b==h))&&(x=O==b,!x&&b-O<10)){let w=O-(u+c.value.length);w>0&&(c.next(w),u=O);for(let S=O;;){if(S>=b){x=!0;break}if(!c.lineBreak&&u+c.value.length>S)break;S=u+c.value.length,u+=c.value.length,c.next()}}let k=GT(a);if(x)o.add(O,O,Le.widget({widget:new jT(k),diagnostics:a.slice()}));else{let w=a.reduce((S,Q)=>Q.markClass?S+" "+Q.markClass:S,"");o.add(O,b,Le.mark({class:"cm-lintRange cm-lintRange-"+k+w,diagnostics:a.slice(),inclusiveEnd:a.some(S=>S.to>b)}))}if(l=b,l==h)break;for(let w=0;w<a.length;w++)a[w].to<=l&&a.splice(w--,1)}let f=o.finish();return new is(f,t,Nn(f))}}function Nn(r,e=null,t=0){let n=null;return r.between(t,1e9,(s,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!n)n=new jf(s,i,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new jf(n.from,i,n.diagnostic)}}),n}function LT(r,e){let t=e.pos,n=e.end||t,s=r.state.facet(uo).hideOn(r,t,n);if(s!=null)return s;let i=r.startState.doc.lineAt(e.pos);return!!(r.effects.some(o=>o.is(u0))||r.changes.touchesRange(i.from,Math.max(i.to,n)))}function XT(r,e){return r.field(gr,!1)?e:e.concat(We.appendConfig.of(HT))}const u0=We.define(),Qh=We.define(),h0=We.define(),gr=Tt.define({create(){return new is(Le.none,null,null)},update(r,e){if(e.docChanged&&r.diagnostics.size){let t=r.diagnostics.map(e.changes),n=null,s=r.panel;if(r.selected){let i=e.changes.mapPos(r.selected.from,1);n=Nn(t,r.selected.diagnostic,i)||Nn(t,null,i)}!t.size&&s&&e.state.facet(uo).autoPanel&&(s=null),r=new is(t,s,n)}for(let t of e.effects)if(t.is(u0)){let n=e.state.facet(uo).autoPanel?t.value.length?ho.open:null:r.panel;r=is.init(t.value,n,e.state)}else t.is(Qh)?r=new is(r.diagnostics,t.value?ho.open:null,r.selected):t.is(h0)&&(r=new is(r.diagnostics,r.panel,t.value));return r},provide:r=>[eo.from(r,e=>e.panel),Se.decorations.from(r,e=>e.diagnostics)]}),IT=Le.mark({class:"cm-lintRange cm-lintRange-active"});function VT(r,e,t){let{diagnostics:n}=r.state.field(gr),s,i=-1,o=-1;n.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0)))return s=u.diagnostics,i=l,o=c,!1});let a=r.state.facet(uo).tooltipFilter;return s&&a&&(s=a(s,r.state)),s?{pos:i,end:o,above:r.state.doc.lineAt(i).to<o,create(){return{dom:zT(r,s)}}}:null}function zT(r,e){return lt("ul",{class:"cm-tooltip-lint"},e.map(t=>f0(r,t,!1)))}const NT=r=>{let e=r.state.field(gr,!1);(!e||!e.panel)&&r.dispatch({effects:XT(r.state,[Qh.of(!0)])});let t=nh(r,ho.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Yf=r=>{let e=r.state.field(gr,!1);return!e||!e.panel?!1:(r.dispatch({effects:Qh.of(!1)}),!0)},WT=r=>{let e=r.state.field(gr,!1);if(!e)return!1;let t=r.state.selection.main,n=Nn(e.diagnostics,null,t.to+1);return!n&&(n=Nn(e.diagnostics,null,0),!n||n.from==t.from&&n.to==t.to)?!1:(r.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},qT=[{key:"Mod-Shift-m",run:NT,preventDefault:!0},{key:"F8",run:WT}],uo=Qe.define({combine(r){return{sources:r.map(e=>e.source).filter(e=>e!=null),...nn(r.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ff,tooltipFilter:Ff,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,s,i)=>e(n,s,i)||t(n,s,i):e:t,autoPanel:(e,t)=>e||t})}}});function Ff(r,e){return r?e?(t,n)=>e(r(t,n),n):r:e}function d0(r){let e=[];if(r)e:for(let{name:t}of r){for(let n=0;n<t.length;n++){let s=t[n];if(/[a-zA-Z]/.test(s)&&!e.some(i=>i.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function f0(r,e,t){var n;let s=t?d0(e.actions):[];return lt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},lt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(r):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((i,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let g=Nn(r.state.field(gr).diagnostics,e);g&&i.apply(r,g.from,g.to)},{name:c}=i,u=s[o]?c.indexOf(s[o]):-1,h=u<0?c:[c.slice(0,u),lt("u",c.slice(u,u+1)),c.slice(u+1)],f=i.markClass?" "+i.markClass:"";return lt("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${s[o]})"`}.`},h)}),e.source&<("div",{class:"cm-diagnosticSource"},e.source))}class jT extends sn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return lt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Uf{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=f0(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ho{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)Yf(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=d0(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=Nn(this.view.state.field(gr).diagnostics,i);l&&i.actions[a].apply(e,l.from,l.to)}}else return;s.preventDefault()}},n=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=lt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=lt("div",{class:"cm-panel-lint"},this.list,lt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Yf(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(gr).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(gr),n=0,s=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let h=-1,f;for(let p=n;p<this.items.length;p++)if(this.items[p].diagnostic==u){h=p;break}h<0?(f=new Uf(this.view,u),this.items.splice(n,0,f),s=!0):(f=this.items[h],h>n&&(this.items.splice(n,h-n),s=!0)),t&&f.diagnostic==t.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),i=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new Uf(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(gr),n=Nn(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:h0.of(n)})}static open(e){return new ho(e)}}function YT(r,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(r)}</svg>')`}function ca(r){return YT(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${r}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const FT=Se.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ca("#d11")},".cm-lintRange-warning":{backgroundImage:ca("orange")},".cm-lintRange-info":{backgroundImage:ca("#999")},".cm-lintRange-hint":{backgroundImage:ca("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function UT(r){return r=="error"?4:r=="warning"?3:r=="info"?2:1}function GT(r){let e="hint",t=1;for(let n of r){let s=UT(n.severity);s>t&&(t=s,e=n.severity)}return e}const HT=[gr,Se.decorations.compute([gr],r=>{let{selected:e,panel:t}=r.field(gr);return!e||!t||e.from==e.to?Le.none:Le.set([IT.range(e.from,e.to)])}),PC(VT,{hideOn:LT}),FT],KT=[VC(),WC(),iC(),lP(),EQ(),F5(),J5(),He.allowMultipleSelections.of(!0),SQ(),lO(IQ,{fallback:!0}),YQ(),$T(),ET(),OC(),xC(),hC(),O3(),So.of([...TT,...d3,...L3,...OP,..._Q,...c0,...qT])];class nl{static create(e,t,n,s,i){let o=s+(s<<8)+e+(t<<4)|0;return new nl(e,t,n,o,i,[],[])}constructor(e,t,n,s,i,o,a){this.type=e,this.value=t,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[qe.contextHash,s]]}addChild(e,t){e.prop(qe.contextHash)!=this.hash&&(e=new nt(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new nt(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(s,i,o)=>new nt($t.none,s,i,o,this.hashProp)})}}var me;(function(r){r[r.Document=1]="Document",r[r.CodeBlock=2]="CodeBlock",r[r.FencedCode=3]="FencedCode",r[r.Blockquote=4]="Blockquote",r[r.HorizontalRule=5]="HorizontalRule",r[r.BulletList=6]="BulletList",r[r.OrderedList=7]="OrderedList",r[r.ListItem=8]="ListItem",r[r.ATXHeading1=9]="ATXHeading1",r[r.ATXHeading2=10]="ATXHeading2",r[r.ATXHeading3=11]="ATXHeading3",r[r.ATXHeading4=12]="ATXHeading4",r[r.ATXHeading5=13]="ATXHeading5",r[r.ATXHeading6=14]="ATXHeading6",r[r.SetextHeading1=15]="SetextHeading1",r[r.SetextHeading2=16]="SetextHeading2",r[r.HTMLBlock=17]="HTMLBlock",r[r.LinkReference=18]="LinkReference",r[r.Paragraph=19]="Paragraph",r[r.CommentBlock=20]="CommentBlock",r[r.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",r[r.Escape=22]="Escape",r[r.Entity=23]="Entity",r[r.HardBreak=24]="HardBreak",r[r.Emphasis=25]="Emphasis",r[r.StrongEmphasis=26]="StrongEmphasis",r[r.Link=27]="Link",r[r.Image=28]="Image",r[r.InlineCode=29]="InlineCode",r[r.HTMLTag=30]="HTMLTag",r[r.Comment=31]="Comment",r[r.ProcessingInstruction=32]="ProcessingInstruction",r[r.Autolink=33]="Autolink",r[r.HeaderMark=34]="HeaderMark",r[r.QuoteMark=35]="QuoteMark",r[r.ListMark=36]="ListMark",r[r.LinkMark=37]="LinkMark",r[r.EmphasisMark=38]="EmphasisMark",r[r.CodeMark=39]="CodeMark",r[r.CodeText=40]="CodeText",r[r.CodeInfo=41]="CodeInfo",r[r.LinkTitle=42]="LinkTitle",r[r.LinkLabel=43]="LinkLabel",r[r.URL=44]="URL"})(me||(me={}));class JT{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}}class eM{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Wi(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let s=t;s<e;s++)n+=this.text.charCodeAt(s)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e="";for(let t=0;t<this.basePos;t++)e+=" ";return e+this.text.slice(this.basePos)}}function Gf(r,e,t){if(t.pos==t.text.length||r!=e.block&&t.indent>=e.stack[t.depth+1].value+t.baseIndent)return!0;if(t.indent>=t.baseIndent+4)return!1;let n=(r.type==me.OrderedList?Mh:Th)(t,e,!1);return n>0&&(r.type!=me.BulletList||Ph(t,e,!1)<0)&&t.text.charCodeAt(t.pos+n-1)==r.value}const m0={[me.Blockquote](r,e,t){return t.next!=62?!1:(t.markers.push(Ke(me.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1)),t.moveBase(t.pos+(Ar(t.text.charCodeAt(t.pos+1))?2:1)),r.end=e.lineStart+t.text.length,!0)},[me.ListItem](r,e,t){return t.indent<t.baseIndent+r.value&&t.next>-1?!1:(t.moveBaseColumn(t.baseIndent+r.value),!0)},[me.OrderedList]:Gf,[me.BulletList]:Gf,[me.Document](){return!0}};function Ar(r){return r==32||r==9||r==10||r==13}function Wi(r,e=0){for(;e<r.length&&Ar(r.charCodeAt(e));)e++;return e}function Hf(r,e,t){for(;e>t&&Ar(r.charCodeAt(e-1));)e--;return e}function p0(r){if(r.next!=96&&r.next!=126)return-1;let e=r.pos+1;for(;e<r.text.length&&r.text.charCodeAt(e)==r.next;)e++;if(e<r.pos+3)return-1;if(r.next==96){for(let t=e;t<r.text.length;t++)if(r.text.charCodeAt(t)==96)return-1}return e}function g0(r){return r.next!=62?-1:r.text.charCodeAt(r.pos+1)==32?2:1}function Ph(r,e,t){if(r.next!=42&&r.next!=45&&r.next!=95)return-1;let n=1;for(let s=r.pos+1;s<r.text.length;s++){let i=r.text.charCodeAt(s);if(i==r.next)n++;else if(!Ar(i))return-1}return t&&r.next==45&&b0(r)>-1&&r.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(w0.SetextHeading)>-1||n<3?-1:1}function O0(r,e){for(let t=r.stack.length-1;t>=0;t--)if(r.stack[t].type==e)return!0;return!1}function Th(r,e,t){return(r.next==45||r.next==43||r.next==42)&&(r.pos==r.text.length-1||Ar(r.text.charCodeAt(r.pos+1)))&&(!t||O0(e,me.BulletList)||r.skipSpace(r.pos+2)<r.text.length)?1:-1}function Mh(r,e,t){let n=r.pos,s=r.next;for(;s>=48&&s<=57;){n++;if(n==r.text.length)return-1;s=r.text.charCodeAt(n)}return n==r.pos||n>r.pos+9||s!=46&&s!=41||n<r.text.length-1&&!Ar(r.text.charCodeAt(n+1))||t&&!O0(e,me.OrderedList)&&(r.skipSpace(n+1)==r.text.length||n>r.pos+1||r.next!=49)?-1:n+1-r.pos}function v0(r){if(r.next!=35)return-1;let e=r.pos+1;for(;e<r.text.length&&r.text.charCodeAt(e)==35;)e++;if(e<r.text.length&&r.text.charCodeAt(e)!=32)return-1;let t=e-r.pos;return t>6?-1:t}function b0(r){if(r.next!=45&&r.next!=61||r.indent>=r.baseIndent+4)return-1;let e=r.pos+1;for(;e<r.text.length&&r.text.charCodeAt(e)==r.next;)e++;let t=e;for(;e<r.text.length&&Ar(r.text.charCodeAt(e));)e++;return e==r.text.length?t:-1}const bu=/^[ \t]*$/,x0=/-->/,y0=/\?>/,xu=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,x0],[/^\s*<\?/,y0],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,bu],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,bu]];function k0(r,e,t){if(r.next!=60)return-1;let n=r.text.slice(r.pos);for(let s=0,i=xu.length-(t?1:0);s<i;s++)if(xu[s][0].test(n))return s;return-1}function Kf(r,e){let t=r.countIndent(e,r.pos,r.indent),n=r.countIndent(r.skipSpace(e),e,t);return n>=t+5?t+1:n}function Mn(r,e,t){let n=r.length-1;n>=0&&r[n].to==e&&r[n].type==me.CodeText?r[n].to=t:r.push(Ke(me.CodeText,e,t))}const ua={LinkReference:void 0,IndentedCode(r,e){let t=e.baseIndent+4;if(e.indent<t)return!1;let n=e.findColumn(t),s=r.lineStart+n,i=r.lineStart+e.text.length,o=[],a=[];for(Mn(o,s,i);r.nextLine()&&e.depth>=r.stack.length;)if(e.pos==e.text.length){Mn(a,r.lineStart-1,r.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<t)break;{if(a.length){for(let c of a)c.type==me.CodeText?Mn(o,c.from,c.to):o.push(c);a=[]}Mn(o,r.lineStart-1,r.lineStart);for(let c of e.markers)o.push(c);i=r.lineStart+e.text.length;let l=r.lineStart+e.findColumn(e.baseIndent+4);l<i&&Mn(o,l,i)}}return a.length&&(a=a.filter(l=>l.type!=me.CodeText),a.length&&(e.markers=a.concat(e.markers))),r.addNode(r.buffer.writeElements(o,-s).finish(me.CodeBlock,i-s),s),!0},FencedCode(r,e){let t=p0(e);if(t<0)return!1;let n=r.lineStart+e.pos,s=e.next,i=t-e.pos,o=e.skipSpace(t),a=Hf(e.text,e.text.length,o),l=[Ke(me.CodeMark,n,n+i)];o<a&&l.push(Ke(me.CodeInfo,r.lineStart+o,r.lineStart+a));for(let c=!0,u=!0,h=!1;r.nextLine()&&e.depth>=r.stack.length;c=!1){let f=e.pos;if(e.indent-e.baseIndent<4)for(;f<e.text.length&&e.text.charCodeAt(f)==s;)f++;if(f-e.pos>=i&&e.skipSpace(f)==e.text.length){for(let p of e.markers)l.push(p);u&&h&&Mn(l,r.lineStart-1,r.lineStart),l.push(Ke(me.CodeMark,r.lineStart+e.pos,r.lineStart+f)),r.nextLine();break}else{h=!0,c||(Mn(l,r.lineStart-1,r.lineStart),u=!1);for(let O of e.markers)l.push(O);let p=r.lineStart+e.basePos,g=r.lineStart+e.text.length;p<g&&(Mn(l,p,g),u=!1)}}return r.addNode(r.buffer.writeElements(l,-n).finish(me.FencedCode,r.prevLineEnd()-n),n),!0},Blockquote(r,e){let t=g0(e);return t<0?!1:(r.startContext(me.Blockquote,e.pos),r.addNode(me.QuoteMark,r.lineStart+e.pos,r.lineStart+e.pos+1),e.moveBase(e.pos+t),null)},HorizontalRule(r,e){if(Ph(e,r,!1)<0)return!1;let t=r.lineStart+e.pos;return r.nextLine(),r.addNode(me.HorizontalRule,t),!0},BulletList(r,e){let t=Th(e,r,!1);if(t<0)return!1;r.block.type!=me.BulletList&&r.startContext(me.BulletList,e.basePos,e.next);let n=Kf(e,e.pos+1);return r.startContext(me.ListItem,e.basePos,n-e.baseIndent),r.addNode(me.ListMark,r.lineStart+e.pos,r.lineStart+e.pos+t),e.moveBaseColumn(n),null},OrderedList(r,e){let t=Mh(e,r,!1);if(t<0)return!1;r.block.type!=me.OrderedList&&r.startContext(me.OrderedList,e.basePos,e.text.charCodeAt(e.pos+t-1));let n=Kf(e,e.pos+t);return r.startContext(me.ListItem,e.basePos,n-e.baseIndent),r.addNode(me.ListMark,r.lineStart+e.pos,r.lineStart+e.pos+t),e.moveBaseColumn(n),null},ATXHeading(r,e){let t=v0(e);if(t<0)return!1;let n=e.pos,s=r.lineStart+n,i=Hf(e.text,e.text.length,n),o=i;for(;o>n&&e.text.charCodeAt(o-1)==e.next;)o--;(o==i||o==n||!Ar(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=r.buffer.write(me.HeaderMark,0,t).writeElements(r.parser.parseInline(e.text.slice(n+t+1,o),s+t+1),-s);o<e.text.length&&a.write(me.HeaderMark,o-n,i-n);let l=a.finish(me.ATXHeading1-1+t,e.text.length-n);return r.nextLine(),r.addNode(l,s),!0},HTMLBlock(r,e){let t=k0(e,r,!1);if(t<0)return!1;let n=r.lineStart+e.pos,s=xu[t][1],i=[],o=s!=bu;for(;!s.test(e.text)&&r.nextLine();){if(e.depth<r.stack.length){o=!1;break}for(let c of e.markers)i.push(c)}o&&r.nextLine();let a=s==x0?me.CommentBlock:s==y0?me.ProcessingInstructionBlock:me.HTMLBlock,l=r.prevLineEnd();return r.addNode(r.buffer.writeElements(i,-n).finish(a,l-n),n),!0},SetextHeading:void 0};class tM{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let s=n.content+`
|
|
23
|
+
`+t.scrub(),i=this.advance(s);return i>-1&&i<s.length?this.complete(e,n,i):!1}finish(e,t){return(this.stage==2||this.stage==3)&&Wi(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,Ke(me.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(_0(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Ke(me.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(M0(e,Wi(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Wi(e,this.pos),n=0;if(t>this.pos){let s=A0(e,t,this.start);if(s){let i=ic(e,s.to-this.start);i>0&&(this.nextStage(s),n=i)}}return n||(n=ic(e,this.pos)),n>0&&n<e.length?n:-1}else return ic(e,this.pos)}}}function ic(r,e){for(;e<r.length;e++){let t=r.charCodeAt(e);if(t==10)break;if(!Ar(t))return-1}return e}class rM{nextLine(e,t,n){let s=t.depth<e.stack.length?-1:b0(t),i=t.next;if(s<0)return!1;let o=Ke(me.HeaderMark,e.lineStart+t.pos,e.lineStart+s);return e.nextLine(),e.addLeafElement(n,Ke(i==61?me.SetextHeading1:me.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}}const w0={LinkReference(r,e){return e.content.charCodeAt(0)==91?new tM(e):null},SetextHeading(){return new rM}},nM=[(r,e)=>v0(e)>=0,(r,e)=>p0(e)>=0,(r,e)=>g0(e)>=0,(r,e)=>Th(e,r,!0)>=0,(r,e)=>Mh(e,r,!0)>=0,(r,e)=>Ph(e,r,!0)>=0,(r,e)=>k0(e,r,!0)>=0],sM={text:"",end:0};class iM{constructor(e,t,n,s){this.parser=e,this.input=t,this.ranges=s,this.line=new eM,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=s[s.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=s[0].from,this.block=nl.create(me.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new lM(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let s=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!s||e.markers[n].from<s.end);){let i=e.markers[n++];this.addNode(i.type,i.from,i.to)}if(!s)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let s=n(this,e);if(s!=!1){if(s==!0)return null;e.forward();continue e}}break}let t=new JT(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let s=n(this,t);s&&t.parsers.push(s)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
|
24
|
+
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=R0(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=sM;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let n=this.absoluteLineStart,s=this.rangeI;for(;this.ranges[s].to<t.end;){s++;let i=this.ranges[s].from,o=this.lineChunkAt(i);t.end=i+o.length,t.text=t.text.slice(0,this.ranges[s-1].to-n)+o,n=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let s=this.stack[e.depth],i=this.parser.skipContextMarkup[s.type];if(!i)throw new Error("Unhandled block context "+me[s.type]);let o=this.line.markers.length;if(!i(s,this,e)){this.line.markers.length>o&&(s.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
|
25
|
+
`?"":t;else{let s=t.indexOf(`
|
|
26
|
+
`);n=s<0?t:t.slice(0,s)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=nl.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e=="number"&&(e=new nt(this.parser.nodeSet.types[e],ri,ri,(n??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(ku(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?S0(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let t=ku(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(me.Paragraph,e.content.length),e.start)}elt(e,t,n,s){return typeof e=="string"?Ke(this.parser.getNodeType(e),t,n,s):new Q0(e,t)}get buffer(){return new C0(this.parser.nodeSet)}}function S0(r,e,t,n,s){let i=r[e].to,o=[],a=[],l=t.from+n;function c(u,h){for(;h?u>=i:u>i;){let f=r[e+1].from-i;n+=f,u+=f,e++,i=r[e].to}}for(let u=t.firstChild;u;u=u.nextSibling){c(u.from+n,!0);let h=u.from+n,f,p=s.get(u.tree);p?f=p:u.to+n>i?(f=S0(r,e,u,n,s),c(u.to+n,!1)):f=u.toTree(),o.push(f),a.push(h-l)}return c(t.to+n,!1),new nt(t.type,o,a,t.to+n-l,t.tree?t.tree.propValues:void 0)}class Tl extends ah{constructor(e,t,n,s,i,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=s,this.endLeafBlock=i,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let u of e.types)this.nodeTypes[u.name]=u.id}createParse(e,t,n){let s=new iM(this,e,t,n);for(let i of this.wrappers)s=i(s,e,t,n);return s}configure(e){let t=yu(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:s}=this,i=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),u=this.endLeafBlock.slice(),h=this.wrappers;if(Mi(t.defineNodes)){s=Object.assign({},s);let f=n.types.slice(),p;for(let g of t.defineNodes){let{name:O,block:b,composite:x,style:k}=typeof g=="string"?{name:g}:g;if(f.some(Q=>Q.name==O))continue;x&&(s[f.length]=(Q,L,E)=>x(L,E,Q.value));let w=f.length,S=x?["Block","BlockContext"]:b?w>=me.ATXHeading1&&w<=me.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push($t.define({id:w,name:O,props:S&&[[qe.group,S]]})),k&&(p||(p={}),Array.isArray(k)||k instanceof pr?p[O]=k:Object.assign(p,k))}n=new Co(f),p&&(n=n.extend(oi(p)))}if(Mi(t.props)&&(n=n.extend(...t.props)),Mi(t.remove))for(let f of t.remove){let p=this.blockNames.indexOf(f),g=this.inlineNames.indexOf(f);p>-1&&(i[p]=o[p]=void 0),g>-1&&(l[g]=void 0)}if(Mi(t.parseBlock))for(let f of t.parseBlock){let p=a.indexOf(f.name);if(p>-1)i[p]=f.parse,o[p]=f.leaf;else{let g=f.before?ha(a,f.before):f.after?ha(a,f.after)+1:a.length-1;i.splice(g,0,f.parse),o.splice(g,0,f.leaf),a.splice(g,0,f.name)}f.endLeaf&&u.push(f.endLeaf)}if(Mi(t.parseInline))for(let f of t.parseInline){let p=c.indexOf(f.name);if(p>-1)l[p]=f.parse;else{let g=f.before?ha(c,f.before):f.after?ha(c,f.after)+1:c.length-1;l.splice(g,0,f.parse),c.splice(g,0,f.name)}}return t.wrap&&(h=h.concat(t.wrap)),new Tl(n,i,o,a,u,s,l,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new Ah(this,e,t);e:for(let s=t;s<n.end;){let i=n.char(s);for(let o of this.inlineParsers)if(o){let a=o(n,i,s);if(a>=0){s=a;continue e}}s++}return n.resolveMarkers(0)}}function Mi(r){return r!=null&&r.length>0}function yu(r){if(!Array.isArray(r))return r;if(r.length==0)return null;let e=yu(r[0]);if(r.length==1)return e;let t=yu(r.slice(1));if(!t||!e)return e||t;let n=(o,a)=>(o||ri).concat(a||ri),s=e.wrap,i=t.wrap;return{props:n(e.props,t.props),defineNodes:n(e.defineNodes,t.defineNodes),parseBlock:n(e.parseBlock,t.parseBlock),parseInline:n(e.parseInline,t.parseInline),remove:n(e.remove,t.remove),wrap:s?i?(o,a,l,c)=>s(i(o,a,l,c),a,l,c):s:i}}function ha(r,e){let t=r.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}let $0=[$t.none];for(let r=1,e;e=me[r];r++)$0[r]=$t.define({id:r,name:e,props:r>=me.Escape?[]:[[qe.group,r in m0?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const ri=[];class C0{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,s=0){return this.content.push(e,t,n,4+s*4),this}writeElements(e,t=0){for(let n of e)n.writeTo(this,t);return this}finish(e,t){return nt.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}}let fo=class{constructor(e,t,n,s=ri){this.type=e,this.from=t,this.to=n,this.children=s}writeTo(e,t){let n=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-n)}toTree(e){return new C0(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class Q0{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return ri}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}}function Ke(r,e,t,n){return new fo(r,e,t,n)}const P0={resolve:"Emphasis",mark:"EmphasisMark"},T0={resolve:"Emphasis",mark:"EmphasisMark"},os={},sl={};class mr{constructor(e,t,n,s){this.type=e,this.from=t,this.to=n,this.side=s}}const Jf="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let mo=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{mo=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const oc={Escape(r,e,t){if(e!=92||t==r.end-1)return-1;let n=r.char(t+1);for(let s=0;s<Jf.length;s++)if(Jf.charCodeAt(s)==n)return r.append(Ke(me.Escape,t,t+2));return-1},Entity(r,e,t){if(e!=38)return-1;let n=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(r.slice(t+1,t+31));return n?r.append(Ke(me.Entity,t,t+1+n[0].length)):-1},InlineCode(r,e,t){if(e!=96||t&&r.char(t-1)==96)return-1;let n=t+1;for(;n<r.end&&r.char(n)==96;)n++;let s=n-t,i=0;for(;n<r.end;n++)if(r.char(n)==96){if(i++,i==s&&r.char(n+1)!=96)return r.append(Ke(me.InlineCode,t,n+1,[Ke(me.CodeMark,t,t+s),Ke(me.CodeMark,n+1-s,n+1)]))}else i=0;return-1},HTMLTag(r,e,t){if(e!=60||t==r.end-1)return-1;let n=r.slice(t+1,r.end),s=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(n);if(s)return r.append(Ke(me.Autolink,t,t+1+s[0].length,[Ke(me.LinkMark,t,t+1),Ke(me.URL,t+1,t+s[0].length),Ke(me.LinkMark,t+s[0].length,t+1+s[0].length)]));let i=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(n);if(i)return r.append(Ke(me.Comment,t,t+1+i[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return r.append(Ke(me.ProcessingInstruction,t,t+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?r.append(Ke(me.HTMLTag,t,t+1+a[0].length)):-1},Emphasis(r,e,t){if(e!=95&&e!=42)return-1;let n=t+1;for(;r.char(n)==e;)n++;let s=r.slice(t-1,t),i=r.slice(n,n+1),o=mo.test(s),a=mo.test(i),l=/\s|^$/.test(s),c=/\s|^$/.test(i),u=!c&&(!a||l||o),h=!l&&(!o||c||a),f=u&&(e==42||!h||o),p=h&&(e==42||!u||a);return r.append(new mr(e==95?P0:T0,t,n,(f?1:0)|(p?2:0)))},HardBreak(r,e,t){if(e==92&&r.char(t+1)==10)return r.append(Ke(me.HardBreak,t,t+2));if(e==32){let n=t+1;for(;r.char(n)==32;)n++;if(r.char(n)==10&&n>=t+2)return r.append(Ke(me.HardBreak,t,n+1))}return-1},Link(r,e,t){return e==91?r.append(new mr(os,t,t+1,1)):-1},Image(r,e,t){return e==33&&r.char(t+1)==91?r.append(new mr(sl,t,t+2,1)):-1},LinkEnd(r,e,t){if(e!=93)return-1;for(let n=r.parts.length-1;n>=0;n--){let s=r.parts[n];if(s instanceof mr&&(s.type==os||s.type==sl)){if(!s.side||r.skipSpace(s.to)==t&&!/[(\[]/.test(r.slice(t+1,t+2)))return r.parts[n]=null,-1;let i=r.takeContent(n),o=r.parts[n]=oM(r,i,s.type==os?me.Link:me.Image,s.from,t+1);if(s.type==os)for(let a=0;a<n;a++){let l=r.parts[a];l instanceof mr&&l.type==os&&(l.side=0)}return o.to}}return-1}};function oM(r,e,t,n,s){let{text:i}=r,o=r.char(s),a=s;if(e.unshift(Ke(me.LinkMark,n,n+(t==me.Image?2:1))),e.push(Ke(me.LinkMark,s-1,s)),o==40){let l=r.skipSpace(s+1),c=M0(i,l-r.offset,r.offset),u;c&&(l=r.skipSpace(c.to),l!=c.to&&(u=A0(i,l-r.offset,r.offset),u&&(l=r.skipSpace(u.to)))),r.char(l)==41&&(e.push(Ke(me.LinkMark,s,s+1)),a=l+1,c&&e.push(c),u&&e.push(u),e.push(Ke(me.LinkMark,l,a)))}else if(o==91){let l=_0(i,s-r.offset,r.offset,!1);l&&(e.push(l),a=l.to)}return Ke(t,n,a,e)}function M0(r,e,t){if(r.charCodeAt(e)==60){for(let s=e+1;s<r.length;s++){let i=r.charCodeAt(s);if(i==62)return Ke(me.URL,e+t,s+1+t);if(i==60||i==10)return!1}return null}else{let s=0,i=e;for(let o=!1;i<r.length;i++){let a=r.charCodeAt(i);if(Ar(a))break;if(o)o=!1;else if(a==40)s++;else if(a==41){if(!s)break;s--}else a==92&&(o=!0)}return i>e?Ke(me.URL,e+t,i+t):i==r.length?null:!1}}function A0(r,e,t){let n=r.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let s=n==40?41:n;for(let i=e+1,o=!1;i<r.length;i++){let a=r.charCodeAt(i);if(o)o=!1;else{if(a==s)return Ke(me.LinkTitle,e+t,i+1+t);a==92&&(o=!0)}}return null}function _0(r,e,t,n){for(let s=!1,i=e+1,o=Math.min(r.length,i+999);i<o;i++){let a=r.charCodeAt(i);if(s)s=!1;else{if(a==93)return n?!1:Ke(me.LinkLabel,e+t,i+1+t);if(n&&!Ar(a)&&(n=!1),a==91)return!1;a==92&&(s=!0)}}return null}class Ah{constructor(e,t,n){this.parser=e,this.text=t,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,s,i){return this.append(new mr(e,t,n,(s?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof mr&&(t.type==os||t.type==sl))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n<this.parts.length;n++){let s=this.parts[n];if(!(s instanceof mr&&s.type.resolve&&s.side&2))continue;let i=s.type==P0||s.type==T0,o=s.to-s.from,a,l=n-1;for(;l>=e;l--){let O=this.parts[l];if(O instanceof mr&&O.side&1&&O.type==s.type&&!(i&&(s.side&1||O.side&2)&&(O.to-O.from+o)%3==0&&((O.to-O.from)%3||o%3))){a=O;break}}if(!a)continue;let c=s.type.resolve,u=[],h=a.from,f=s.to;if(i){let O=Math.min(2,a.to-a.from,o);h=a.to-O,f=s.from+O,c=O==1?"Emphasis":"StrongEmphasis"}a.type.mark&&u.push(this.elt(a.type.mark,h,a.to));for(let O=l+1;O<n;O++)this.parts[O]instanceof fo&&u.push(this.parts[O]),this.parts[O]=null;s.type.mark&&u.push(this.elt(s.type.mark,s.from,f));let p=this.elt(c,h,f,u);this.parts[l]=i&&a.from!=h?new mr(a.type,a.from,h,a.side):null,(this.parts[n]=i&&s.to!=f?new mr(s.type,f,s.to,s.side):null)?this.parts.splice(n,0,p):this.parts[n]=p}let t=[];for(let n=e;n<this.parts.length;n++){let s=this.parts[n];s instanceof fo&&t.push(s)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof mr&&n.type==e&&n.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}getDelimiterAt(e){let t=this.parts[e];return t instanceof mr?t:null}skipSpace(e){return Wi(this.text,e-this.offset)+this.offset}elt(e,t,n,s){return typeof e=="string"?Ke(this.parser.getNodeType(e),t,n,s):new Q0(e,t)}}Ah.linkStart=os;Ah.imageStart=sl;function ku(r,e){if(!e.length)return r;if(!r.length)return e;let t=r.slice(),n=0;for(let s of e){for(;n<t.length&&t[n].to<s.to;)n++;if(n<t.length&&t[n].from<s.from){let i=t[n];i instanceof fo&&(t[n]=new fo(i.type,i.from,i.to,ku(i.children,[s])))}else t.splice(n++,0,s)}return t}const aM=[me.CodeBlock,me.ListItem,me.OrderedList,me.BulletList];let lM=class{constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let i=this.fragment.to;for(;i>0&&this.input.read(i-1,i)!=`
|
|
27
|
+
`;)i--;this.fragmentEnd=i?i-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let s=e+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=t;if(!n.childAfter(s))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(qe.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=o,c=a;for(;;){if(t.to-n>s){if(t.type.isAnonymous&&t.firstChild())continue;break}let u=R0(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,u);else{let h=new nt(e.parser.nodeSet.types[me.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,u)}if(t.type.is("Block")&&(aM.indexOf(t.type.id)<0?(o=t.to-n,a=e.block.children.length):(o=l,a=c),l=t.to-n,c=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}};function R0(r,e){let t=r;for(let n=1;n<e.length;n++){let s=e[n-1].to,i=e[n].from;s<r&&(t-=i-s)}return t}const cM=oi({"Blockquote/...":$.quote,HorizontalRule:$.contentSeparator,"ATXHeading1/... SetextHeading1/...":$.heading1,"ATXHeading2/... SetextHeading2/...":$.heading2,"ATXHeading3/...":$.heading3,"ATXHeading4/...":$.heading4,"ATXHeading5/...":$.heading5,"ATXHeading6/...":$.heading6,"Comment CommentBlock":$.comment,Escape:$.escape,Entity:$.character,"Emphasis/...":$.emphasis,"StrongEmphasis/...":$.strong,"Link/... Image/...":$.link,"OrderedList/... BulletList/...":$.list,"BlockQuote/...":$.quote,"InlineCode CodeText":$.monospace,"URL Autolink":$.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":$.processingInstruction,"CodeInfo LinkLabel":$.labelName,LinkTitle:$.string,Paragraph:$.content}),uM=new Tl(new Co($0).extend(cM),Object.keys(ua).map(r=>ua[r]),Object.keys(ua).map(r=>w0[r]),Object.keys(ua),nM,m0,Object.keys(oc).map(r=>oc[r]),Object.keys(oc),[]);function hM(r,e,t){let n=[];for(let s=r.firstChild,i=e;;s=s.nextSibling){let o=s?s.from:t;if(o>i&&n.push({from:i,to:o}),!s)break;i=s.to}return n}function dM(r){let{codeParser:e,htmlParser:t}=r;return{wrap:jg((s,i)=>{let o=s.type.id;if(e&&(o==me.CodeBlock||o==me.FencedCode)){let a="";if(o==me.FencedCode){let c=s.node.getChild(me.CodeInfo);c&&(a=i.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==me.CodeText,bracketed:o==me.FencedCode}}else if(t&&(o==me.HTMLBlock||o==me.HTMLTag||o==me.CommentBlock))return{parser:t,overlay:hM(s.node,s.from,s.to)};return null})}}const fM={resolve:"Strikethrough",mark:"StrikethroughMark"},mM={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":$.strikethrough}},{name:"StrikethroughMark",style:$.processingInstruction}],parseInline:[{name:"Strikethrough",parse(r,e,t){if(e!=126||r.char(t+1)!=126||r.char(t+2)==126)return-1;let n=r.slice(t-1,t),s=r.slice(t+2,t+3),i=/\s|^$/.test(n),o=/\s|^$/.test(s),a=mo.test(n),l=mo.test(s);return r.addDelimiter(fM,t,t+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function qi(r,e,t=0,n,s=0){let i=0,o=!0,a=-1,l=-1,c=!1,u=()=>{n.push(r.elt("TableCell",s+a,s+l,r.parser.parseInline(e.slice(a,l),s+a)))};for(let h=t;h<e.length;h++){let f=e.charCodeAt(h);f==124&&!c?((!o||a>-1)&&i++,o=!1,n&&(a>-1&&u(),n.push(r.elt("TableDelimiter",h+s,h+s+1))),a=l=-1):(c||f!=32&&f!=9)&&(a<0&&(a=h),l=h+1),c=!c&&f==92}return a>-1&&(i++,n&&u()),i}function em(r,e){for(let t=e;t<r.length;t++){let n=r.charCodeAt(t);if(n==124)return!0;n==92&&t++}return!1}const B0=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class tm{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let s;if((t.next==45||t.next==58||t.next==124)&&B0.test(s=t.text.slice(t.pos))){let i=[];qi(e,n.content,0,i,n.start)==qi(e,s,t.pos)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,i),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let s=[];qi(e,t.text,t.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,s))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}}const pM={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":$.heading}},"TableRow",{name:"TableCell",style:$.content},{name:"TableDelimiter",style:$.processingInstruction}],parseBlock:[{name:"Table",leaf(r,e){return em(e.content,0)?new tm:null},endLeaf(r,e,t){if(t.parsers.some(s=>s instanceof tm)||!em(e.text,e.basePos))return!1;let n=r.peekLine();return B0.test(n)&&qi(r,e.text,e.basePos)==qi(r,n,e.basePos)},before:"SetextHeading"}]};class gM{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}}const OM={defineNodes:[{name:"Task",block:!0,style:$.list},{name:"TaskMarker",style:$.atom}],parseBlock:[{name:"TaskList",leaf(r,e){return/^\[[ xX]\][ \t]/.test(e.content)&&r.parentType().name=="ListItem"?new gM:null},after:"SetextHeading"}]},rm=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,nm=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,vM=/[\w-]+\.[\w-]+($|\/)/,sm=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,im=/\/[a-zA-Z\d@.]+/gy;function om(r,e,t,n){let s=0;for(let i=e;i<t;i++)r[i]==n&&s++;return s}function bM(r,e){nm.lastIndex=e;let t=nm.exec(r);if(!t||vM.exec(t[0])[0].indexOf("_")>-1)return-1;let n=e+t[0].length;for(;;){let s=r[n-1],i;if(/[?!.,:*_~]/.test(s)||s==")"&&om(r,e,n,")")>om(r,e,n,"("))n--;else if(s==";"&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(r.slice(e,n))))n=e+i.index;else break}return n}function am(r,e){sm.lastIndex=e;let t=sm.exec(r);if(!t)return-1;let n=t[0][t[0].length-1];return n=="_"||n=="-"?-1:e+t[0].length-(n=="."?1:0)}const xM={parseInline:[{name:"Autolink",parse(r,e,t){let n=t-r.offset;if(n&&/\w/.test(r.text[n-1]))return-1;rm.lastIndex=n;let s=rm.exec(r.text),i=-1;if(!s)return-1;if(s[1]||s[2]){if(i=bM(r.text,n+s[0].length),i>-1&&r.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(r.text.slice(n,i));i=n+o[0].length}}else s[3]?i=am(r.text,n):(i=am(r.text,n+s[0].length),i>-1&&s[0]=="xmpp:"&&(im.lastIndex=i,s=im.exec(r.text),s&&(i=s.index+s[0].length)));return i<0?-1:(r.addElement(r.elt("URL",t,i+r.offset)),i+r.offset)}}]},yM=[pM,OM,mM,xM];function Z0(r,e,t){return(n,s,i)=>{if(s!=r||n.char(i+1)==r)return-1;let o=[n.elt(t,i,i+1)];for(let a=i+1;a<n.end;a++){let l=n.char(a);if(l==r)return n.addElement(n.elt(e,i,a+1,o.concat(n.elt(t,a,a+1))));if(l==92&&o.push(n.elt("Escape",a,a+++2)),Ar(l))break}return-1}}const kM={defineNodes:[{name:"Superscript",style:$.special($.content)},{name:"SuperscriptMark",style:$.processingInstruction}],parseInline:[{name:"Superscript",parse:Z0(94,"Superscript","SuperscriptMark")}]},wM={defineNodes:[{name:"Subscript",style:$.special($.content)},{name:"SubscriptMark",style:$.processingInstruction}],parseInline:[{name:"Subscript",parse:Z0(126,"Subscript","SubscriptMark")}]},SM={defineNodes:[{name:"Emoji",style:$.character}],parseInline:[{name:"Emoji",parse(r,e,t){let n;return e!=58||!(n=/^[a-zA-Z_0-9]+:/.exec(r.slice(t+1,r.end)))?-1:r.addElement(r.elt("Emoji",t,t+1+n[0].length))}}]};var lm={};class il{constructor(e,t,n,s,i,o,a,l,c,u=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=s,this.pos=i,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let s=e.parser.context;return new il(e,[],t,n,n,0,[],0,s?new cm(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,s=e&65535,{parser:i}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(s);if(a&&(this.score+=a),n==0){this.pushState(i.getGoto(this.state,s,!0),this.reducePos),s<i.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let l=this.stack.length-(n-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let h=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-h;if(s<i.minRepeatTerm||e&131072){let p=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=i.getGoto(p,s,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(s,c)}storeNode(e,t,n,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==n)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>n;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=s}}shift(e,t,n,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:o}=this.p;this.pos=s;let a=o.stateFlag(i,1);!a&&(s>n||t<=o.maxNode)&&(this.reducePos=s),this.pushState(i,a?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,s,4)}else this.pos=s,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,s,4)}apply(e,t,n,s){e&65536?this.reduce(e):this.shift(e,t,n,s)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(n,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new il(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new $M(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if((n&65536)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let i=0,o;i<t.length;i+=2)(o=t[i+1])!=this.state&&this.p.parser.hasAction(o,e)&&s.push(t[i],o);if(this.stack.length<120)for(let i=0;s.length<8&&i<t.length;i+=2){let o=t[i+1];s.some((a,l)=>l&1&&a==o)||s.push(t[i],o)}t=s}let n=[];for(let s=0;s<t.length&&n.length<4;s+=2){let i=t[s+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[s],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let n=t>>19,s=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(s,i)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-i;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=n(o,i+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new cm(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class cm{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class $M{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class ol{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ol(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}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]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ol(this.stack,this.pos,this.index)}}function Di(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,s=0;n<r.length;){let i=0;for(;;){let o=r.charCodeAt(n++),a=!1;if(o==126){i=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}t?t[s++]=i:t=new e(i)}return t}class $a{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const um=new $a;class CM{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=um,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,s=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!s)return null;let o=this.ranges[--s];i-=n.from-o.to,n=o}for(;t<0?i>n.to:i>=n.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];i+=o.from-n.to,n=o}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,s;if(t>=0&&t<this.chunk.length)n=this.pos+e,s=this.chunk.charCodeAt(t);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(n=i,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),s=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),s}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=um,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(n+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return n}}class js{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;E0(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}js.prototype.contextual=js.prototype.fallback=js.prototype.extend=!1;class al{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Di(e):e}token(e,t){let n=e.pos,s=0;for(;;){let i=e.next<0,o=e.resolveOffset(1,1);if(E0(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(i||s++,o==null)break;e.reset(o,e.token)}s&&(e.reset(n,e.token),e.acceptToken(this.elseToken,s))}}al.prototype.contextual=js.prototype.fallback=js.prototype.extend=!1;class br{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function E0(r,e,t,n,s,i){let o=0,a=1<<n,{dialect:l}=t.p.parser;e:for(;(a&r[o])!=0;){let c=r[o+1];for(let p=o+3;p<c;p+=2)if((r[p+1]&a)>0){let g=r[p];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||QM(g,e.token.value,s,i))){e.acceptToken(g);break}}let u=e.next,h=0,f=r[o+2];if(e.next<0&&f>h&&r[c+f*3-3]==65535){o=r[c+f*3-1];continue e}for(;h<f;){let p=h+f>>1,g=c+p+(p<<1),O=r[g],b=r[g+1]||65536;if(u<O)f=p;else if(u>=b)h=p+1;else{o=r[g+2],e.advance();continue e}}break}}function hm(r,e,t){for(let n=e,s;(s=r[n])!=65535;n++)if(s==t)return n-e;return-1}function QM(r,e,t,n){let s=hm(t,n,e);return s<0||hm(t,n,r)<s}const ur=typeof process<"u"&&lm&&/\bparse\b/.test(lm.LOG);let ac=null;function dm(r,e,t){let n=r.cursor(st.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}class PM{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?dm(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?dm(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],s=this.index[t];if(s==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[s],o=this.start[t]+n.positions[s];if(o>e)return this.nextStart=o,null;if(i instanceof nt){if(o==e){if(o<this.safeFrom)return null;let a=o+i.length;if(a<=this.safeTo){let l=i.prop(qe.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[t]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+i.length}}}class TM{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new $a)}getActions(e){let t=0,n=null,{parser:s}=e.p,{tokenizers:i}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<i.length;c++){if((1<<c&o)==0)continue;let u=i[c],h=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let f=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!u.extend&&(n=h,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new $a,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new $a,{pos:n,p:s}=e;return t.start=n,t.end=Math.min(n+1,s.stream.end),t.value=n==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,n){let s=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(s,e),n),e.value>-1){let{parser:i}=n.p;for(let o=0;o<i.specialized.length;o++)if(i.specialized[o]==e.value){let a=i.specializers[o](this.stream.read(e.start,e.end),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,n,s){for(let i=0;i<s;i+=3)if(this.actions[i]==e)return s;return this.actions[s++]=e,this.actions[s++]=t,this.actions[s++]=n,s}addActions(e,t,n,s){let{state:i}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(i,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=fn(a,c+2);else{s==0&&a[c+1]==2&&(s=this.putAction(fn(a,c+2),t,n,s));break}a[c]==t&&(s=this.putAction(fn(a,c+1),t,n,s))}return s}}class MM{constructor(e,t,n,s){this.parser=e,this.input=t,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new CM(t,s),this.tokens=new TM(e,this.stream),this.topTerm=e.top[1];let{from:i}=s[0];this.stacks=[il.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new PM(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)n.push(a);else{if(this.advanceStack(a,n,e))continue;{s||(s=[],i=[]),s.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!n.length){let o=s&&_M(s);if(o)return ur&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ur&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,n);if(o)return ur&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,l)=>l.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let a=n[o];for(let l=o+1;l<n.length;l++){let c=n[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)n.splice(l--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,a)=>a.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let s=e.pos,{parser:i}=this,o=ur?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(s);h;){let f=this.parser.nodeSet.types[h.type.id]==h.type?i.getGoto(e.state,h.type.id):-1;if(f>-1&&h.length&&(!c||(h.prop(qe.contextHash)||0)==u))return e.useNode(h,f),ur&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(h.type.id)})`),!0;if(!(h instanceof nt)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof nt&&h.positions[0]==0)h=p;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),ur&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],h=l[c++],f=l[c++],p=c==l.length||!n,g=p?e:e.split(),O=this.tokens.mainToken;if(g.apply(u,h,O?O.start:g.pos,f),ur&&console.log(o+this.stackID(g)+` (via ${(u&65536)==0?"shift":`reduce of ${i.getName(u&65535)}`} for ${i.getName(h)} @ ${s}${g==e?"":", split"})`),p)return!0;g.pos>s?t.push(g):n.push(g)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return fm(e,t),!0}}runRecovery(e,t,n){let s=null,i=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],u=ur?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),ur&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let h=a.split(),f=u;for(let p=0;p<10&&h.forceReduce()&&(ur&&console.log(f+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));p++)ur&&(f=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))ur&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),ur&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),fm(a,n)):(!s||s.score<h.score)&&(s=h)}return s}stackToTree(e){return e.close(),nt.build({buffer:ol.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(ac||(ac=new WeakMap)).get(e);return t||ac.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function fm(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class AM{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const lc=r=>r;class D0{constructor(e){this.start=e.start,this.shift=e.shift||lc,this.reduce=e.reduce||lc,this.reuse=e.reuse||lc,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ni extends ah{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),s=[];for(let a=0;a<t.length;a++)s.push([]);function i(a,l,c){s[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=qe[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)i(u,l,a[c++]);else{let h=a[c+-u];for(let f=-u;f>0;f--)i(a[c++],l,h);c++}}}this.nodeSet=new Co(t.map((a,l)=>$t.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Vg;let o=Di(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(mm),this.states=Di(e.states,Uint32Array),this.data=Di(e.stateData),this.goto=Di(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new js(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let s=new MM(this,e,t,n);for(let i of this.wrappers)s=i(s,e,t,n);return s}getGoto(e,t,n=!1){let s=this.goto;if(t>=s[0])return-1;for(let i=s[t+1];;){let o=s[i++],a=o&1,l=s[i++];if(a&&n)return l;for(let c=i+(o>>1);i<c;i++)if(s[i]==e)return l;if(a)return-1}}hasAction(e,t){let n=this.data;for(let s=0;s<2;s++)for(let i=this.stateSlot(e,s?2:1),o;;i+=3){if((o=n[i])==65535)if(n[i+1]==1)o=n[i=fn(n,i+2)];else{if(n[i+1]==2)return fn(n,i+2);break}if(o==t||o==0)return fn(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),s=n?t(n):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=fn(this.data,i+2);else break;s=t(fn(this.data,i+1))}return s}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=fn(this.data,n+2);else break;if((this.data[n+2]&1)==0){let s=this.data[n+1];t.some((i,o)=>o&1&&i==s)||t.push(this.data[n],s)}}return t}configure(e){let t=Object.assign(Object.create(ni.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let s=e.tokenizers.find(i=>i.from==n);return s?s.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,s)=>{let i=e.specializers.find(a=>a.from==n.external);if(!i)return n;let o=Object.assign(Object.assign({},n),{external:i.to});return t.specializers[s]=mm(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let i of e.split(" ")){let o=t.indexOf(i);o>=0&&(n[o]=!0)}let s=null;for(let i=0;i<t.length;i++)if(!n[i])for(let o=this.dialects[t[i]],a;(a=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[a]=1;return new AM(e,n,s)}static deserialize(e){return new ni(e)}}function fn(r,e){return r[e]|r[e+1]<<16}function _M(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function mm(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}const RM=55,BM=1,ZM=56,EM=2,DM=57,LM=3,pm=4,XM=5,_h=6,L0=7,X0=8,I0=9,V0=10,IM=11,VM=12,zM=13,cc=58,NM=14,WM=15,gm=59,z0=21,qM=23,N0=24,jM=25,wu=27,W0=28,YM=29,FM=32,UM=35,GM=37,HM=38,KM=0,JM=1,e4={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},t4={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Om={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function r4(r){return r==45||r==46||r==58||r>=65&&r<=90||r==95||r>=97&&r<=122||r>=161}let vm=null,bm=null,xm=0;function Su(r,e){let t=r.pos+e;if(xm==t&&bm==r)return vm;let n=r.peek(e),s="";for(;r4(n);)s+=String.fromCharCode(n),n=r.peek(++e);return bm=r,xm=t,vm=s?s.toLowerCase():n==n4||n==s4?void 0:null}const q0=60,ll=62,Rh=47,n4=63,s4=33,i4=45;function ym(r,e){this.name=r,this.parent=e}const o4=[_h,V0,L0,X0,I0],a4=new D0({start:null,shift(r,e,t,n){return o4.indexOf(e)>-1?new ym(Su(n,1)||"",r):r},reduce(r,e){return e==z0&&r?r.parent:r},reuse(r,e,t,n){let s=e.type.id;return s==_h||s==GM?new ym(Su(n,1)||"",r):r},strict:!1}),l4=new br((r,e)=>{if(r.next!=q0){r.next<0&&e.context&&r.acceptToken(cc);return}r.advance();let t=r.next==Rh;t&&r.advance();let n=Su(r,0);if(n===void 0)return;if(!n)return r.acceptToken(t?WM:NM);let s=e.context?e.context.name:null;if(t){if(n==s)return r.acceptToken(IM);if(s&&t4[s])return r.acceptToken(cc,-2);if(e.dialectEnabled(KM))return r.acceptToken(VM);for(let i=e.context;i;i=i.parent)if(i.name==n)return;r.acceptToken(zM)}else{if(n=="script")return r.acceptToken(L0);if(n=="style")return r.acceptToken(X0);if(n=="textarea")return r.acceptToken(I0);if(e4.hasOwnProperty(n))return r.acceptToken(V0);s&&Om[s]&&Om[s][n]?r.acceptToken(cc,-1):r.acceptToken(_h)}},{contextual:!0}),c4=new br(r=>{for(let e=0,t=0;;t++){if(r.next<0){t&&r.acceptToken(gm);break}if(r.next==i4)e++;else if(r.next==ll&&e>=2){t>=3&&r.acceptToken(gm,-2);break}else e=0;r.advance()}});function u4(r){for(;r;r=r.parent)if(r.name=="svg"||r.name=="math")return!0;return!1}const h4=new br((r,e)=>{if(r.next==Rh&&r.peek(1)==ll){let t=e.dialectEnabled(JM)||u4(e.context);r.acceptToken(t?XM:pm,2)}else r.next==ll&&r.acceptToken(pm,1)});function Bh(r,e,t){let n=2+r.length;return new br(s=>{for(let i=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(i==0&&s.next==q0||i==1&&s.next==Rh||i>=2&&i<n&&s.next==r.charCodeAt(i-2))i++,o++;else if(i==n&&s.next==ll){a>o?s.acceptToken(e,-o):s.acceptToken(t,-(o-2));break}else if((s.next==10||s.next==13)&&a){s.acceptToken(e,1);break}else i=o=0;s.advance()}})}const d4=Bh("script",RM,BM),f4=Bh("style",ZM,EM),m4=Bh("textarea",DM,LM),p4=oi({"Text RawText IncompleteTag IncompleteCloseTag":$.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":$.angleBracket,TagName:$.tagName,"MismatchedCloseTag/TagName":[$.tagName,$.invalid],AttributeName:$.attributeName,"AttributeValue UnquotedAttributeValue":$.attributeValue,Is:$.definitionOperator,"EntityReference CharacterReference":$.character,Comment:$.blockComment,ProcessingInst:$.processingInstruction,DoctypeDecl:$.documentMeta}),g4=ni.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'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g!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:a4,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent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(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[d4,f4,m4,h4,l4,c4,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function j0(r,e){let t=Object.create(null);for(let n of r.getChildren(N0)){let s=n.getChild(jM),i=n.getChild(wu)||n.getChild(W0);s&&(t[e.read(s.from,s.to)]=i?i.type.id==wu?e.read(i.from+1,i.to-1):e.read(i.from,i.to):"")}return t}function km(r,e){let t=r.getChild(qM);return t?e.read(t.from,t.to):" "}function uc(r,e,t){let n;for(let s of t)if(!s.attrs||s.attrs(n||(n=j0(r.node.parent.firstChild,e))))return{parser:s.parser,bracketed:!0};return null}function Y0(r=[],e=[]){let t=[],n=[],s=[],i=[];for(let a of r)(a.tag=="script"?t:a.tag=="style"?n:a.tag=="textarea"?s:i).push(a);let o=e.length?Object.create(null):null;for(let a of e)(o[a.name]||(o[a.name]=[])).push(a);return jg((a,l)=>{let c=a.type.id;if(c==YM)return uc(a,l,t);if(c==FM)return uc(a,l,n);if(c==UM)return uc(a,l,s);if(c==z0&&i.length){let u=a.node,h=u.firstChild,f=h&&km(h,l),p;if(f){for(let g of i)if(g.tag==f&&(!g.attrs||g.attrs(p||(p=j0(h,l))))){let O=u.lastChild,b=O.type.id==HM?O.from:u.to;if(b>h.to)return{parser:g.parser,overlay:[{from:h.to,to:b}]}}}}if(o&&c==N0){let u=a.node,h;if(h=u.firstChild){let f=o[l.read(h.from,h.to)];if(f)for(let p of f){if(p.tagName&&p.tagName!=km(u.parent,l))continue;let g=u.lastChild;if(g.type.id==wu){let O=g.from+1,b=g.lastChild,x=g.to-(b&&b.isError?0:1);if(x>O)return{parser:p.parser,overlay:[{from:O,to:x}],bracketed:!0}}else if(g.type.id==W0)return{parser:p.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}const O4=122,wm=1,v4=123,b4=124,F0=2,x4=125,y4=3,k4=4,U0=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],w4=58,S4=40,G0=95,$4=91,Ca=45,C4=46,Q4=35,P4=37,T4=38,M4=92,A4=10,_4=42;function po(r){return r>=65&&r<=90||r>=97&&r<=122||r>=161}function Zh(r){return r>=48&&r<=57}function Sm(r){return Zh(r)||r>=97&&r<=102||r>=65&&r<=70}const H0=(r,e,t)=>(n,s)=>{for(let i=!1,o=0,a=0;;a++){let{next:l}=n;if(po(l)||l==Ca||l==G0||i&&Zh(l))!i&&(l!=Ca||a>0)&&(i=!0),o===a&&l==Ca&&o++,n.advance();else if(l==M4&&n.peek(1)!=A4){if(n.advance(),Sm(n.next)){do n.advance();while(Sm(n.next));n.next==32&&n.advance()}else n.next>-1&&n.advance();i=!0}else{i&&n.acceptToken(o==2&&s.canShift(F0)?e:l==S4?t:r);break}}},R4=new br(H0(v4,F0,b4)),B4=new br(H0(x4,y4,k4)),Z4=new br(r=>{if(U0.includes(r.peek(-1))){let{next:e}=r;(po(e)||e==G0||e==Q4||e==C4||e==_4||e==$4||e==w4&&po(r.peek(1))||e==Ca||e==T4)&&r.acceptToken(O4)}}),E4=new br(r=>{if(!U0.includes(r.peek(-1))){let{next:e}=r;if(e==P4&&(r.advance(),r.acceptToken(wm)),po(e)){do r.advance();while(po(r.next)||Zh(r.next));r.acceptToken(wm)}}}),D4=oi({"AtKeyword import charset namespace keyframes media supports":$.definitionKeyword,"from to selector":$.keyword,NamespaceName:$.namespace,KeyframeName:$.labelName,KeyframeRangeName:$.operatorKeyword,TagName:$.tagName,ClassName:$.className,PseudoClassName:$.constant($.className),IdName:$.labelName,"FeatureName PropertyName":$.propertyName,AttributeName:$.attributeName,NumberLiteral:$.number,KeywordQuery:$.keyword,UnaryQueryOp:$.operatorKeyword,"CallTag ValueName":$.atom,VariableName:$.variableName,Callee:$.operatorKeyword,Unit:$.unit,"UniversalSelector NestingSelector":$.definitionOperator,"MatchOp CompareOp":$.compareOperator,"ChildOp SiblingOp, LogicOp":$.logicOperator,BinOp:$.arithmeticOperator,Important:$.modifier,Comment:$.blockComment,ColorLiteral:$.color,"ParenthesizedContent StringLiteral":$.string,":":$.punctuation,"PseudoOp #":$.derefOperator,"; ,":$.separator,"( )":$.paren,"[ ]":$.squareBracket,"{ }":$.brace}),L4={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},X4={__proto__:null,or:98,and:98,not:106,only:106,layer:170},I4={__proto__:null,selector:112,layer:166},V4={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},z4={__proto__:null,to:207},N4=ni.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#E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$^!xR%f$`R#n!]!U!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QQ!qdR$X!rQ!PVR#TrQ#S!PR$i#TQ!SWR#VsQ!UXR#WtQ{UQ!wgQ#^yQ#o!_Q$U!nQ$[!uQ$_!yQ%e$^Q&Y%aQ&]%fR&v&XSjPzQ!}kQ$c!{R%k$dZiPkz!{$dR$P!gQ%}%SR&z&mR!rdR!teR$Z!tS%a$Y%bR&t&WV%_$Y%b&WQ#PmR$g#PQ`OSkPzU!a`k$dR$d!{Q$p#aY%p$p%u&d&l'QQ%u$sQ&d%qQ&l%zR'Q&xQ#t!cQ#v!dQ#x!eV$}#t#v#xQ%X$RR&T%XQ%y$zS&k%y&yR&y&lQ%r$pR&e%rQ%n$mR&c%nQyUR#]yQ%i$aR&_%iQ!|jS$e!|$fR$f!}Q&n%}R&{&nQ#k!ZR$x#kQ%b$YR&Z%bQ&X%aR&u&X__OP`kz!{$d^UOP`kz!{$dQ!VYQ!WZQ#XuQ#YvQ#ZwQ#[xQ$]!vQ$m#`R&b%mR$q#aQ!gaQ!oc[#q!c!d!e#t#v#xQ$a!zd$o#a$p$s%q%u%z&d&l&x'QQ$r#cQ%R#{S%g$a%iQ%l$kQ&^%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles",maxTerm:143,nodeProps:[["isolate",-2,5,36,""],["openedBy",20,"(",28,"[",31,"{"],["closedBy",21,")",29,"]",32,"}"]],propSources:[D4],skippedNodes:[0,5,106],repeatNodeCount:15,tokenData:"JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qp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SmYOy%Qz;'S%Q;'S;=`%c<%lO%QnHcSl^Oy%Qz;'S%Q;'S;=`%c<%lO%QjHtSpYOy%Qz;'S%Q;'S;=`%c<%lO%QjIVSoYOy%Qz;'S%Q;'S;=`%c<%lO%QfIhU!mQOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Q`I}P;=`<%l$q",tokenizers:[Z4,E4,R4,B4,1,2,3,4,new al("m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~",28,129)],topRules:{StyleSheet:[0,6],Styles:[1,105]},dynamicPrecedences:{76:1},specialized:[{term:124,get:r=>L4[r]||-1},{term:125,get:r=>X4[r]||-1},{term:4,get:r=>I4[r]||-1},{term:25,get:r=>V4[r]||-1},{term:123,get:r=>z4[r]||-1}],tokenPrec:1963});let hc=null;function dc(){if(!hc&&typeof document=="object"&&document.body){let{style:r}=document.body,e=[],t=new Set;for(let n in r)n!="cssText"&&n!="cssFloat"&&typeof r[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())),t.has(n)||(e.push(n),t.add(n)));hc=e.sort().map(n=>({type:"property",label:n,apply:n+": "}))}return hc||[]}const $m=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(r=>({type:"class",label:r})),Cm=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(r=>({type:"keyword",label:r})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(r=>({type:"constant",label:r}))),W4=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(r=>({type:"type",label:r})),q4=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(r=>({type:"keyword",label:r})),dn=/^(\w[\w-]*|-\w[\w-]*|)$/,j4=/^-(-[\w-]*)?$/;function Y4(r,e){var t;if((r.name=="("||r.type.isError)&&(r=r.parent||r),r.name!="ArgList")return!1;let n=(t=r.parent)===null||t===void 0?void 0:t.firstChild;return n?.name!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}const Qm=new qg,F4=["Declaration"];function U4(r){for(let e=r;;){if(e.type.isTop)return e;if(!(e=e.parent))return r}}function K0(r,e,t){if(e.to-e.from>4096){let n=Qm.get(e);if(n)return n;let s=[],i=new Set,o=e.cursor(st.IncludeAnonymous);if(o.firstChild())do for(let a of K0(r,o.node,t))i.has(a.label)||(i.add(a.label),s.push(a));while(o.nextSibling());return Qm.set(e,s),s}else{let n=[],s=new Set;return e.cursor().iterate(i=>{var o;if(t(i)&&i.matchContext(F4)&&((o=i.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=r.sliceString(i.from,i.to);s.has(a)||(s.add(a),n.push({label:a,type:"variable"}))}}),n}}const G4=r=>e=>{let{state:t,pos:n}=e,s=dt(t).resolveInner(n,-1),i=s.type.isError&&s.from==s.to-1&&t.doc.sliceString(s.from,s.to)=="-";if(s.name=="PropertyName"||(i||s.name=="TagName")&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dc(),validFor:dn};if(s.name=="ValueName")return{from:s.from,options:Cm,validFor:dn};if(s.name=="PseudoClassName")return{from:s.from,options:$m,validFor:dn};if(r(s)||(e.explicit||i)&&Y4(s,t.doc))return{from:r(s)||i?s.from:n,options:K0(t.doc,U4(s),r),validFor:j4};if(s.name=="TagName"){for(let{parent:l}=s;l;l=l.parent)if(l.name=="Block")return{from:s.from,options:dc(),validFor:dn};return{from:s.from,options:W4,validFor:dn}}if(s.name=="AtKeyword")return{from:s.from,options:q4,validFor:dn};if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:n,options:$m,validFor:dn}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:n,options:Cm,validFor:dn}:o.name=="Block"||o.name=="Styles"?{from:n,options:dc(),validFor:dn}:null},H4=G4(r=>r.name=="VariableName"),cl=Js.define({name:"css",parser:N4.configure({props:[Po.add({Declaration:Sa()}),ai.add({"Block KeyframeList":Jg})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function K4(){return new so(cl,cl.data.of({autocomplete:H4}))}const J4=316,eA=317,Pm=1,tA=2,rA=3,nA=4,sA=318,iA=320,oA=321,aA=5,lA=6,cA=0,$u=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],J0=125,uA=59,Cu=47,hA=42,dA=43,fA=45,mA=60,pA=44,gA=63,OA=46,vA=91,bA=new D0({start:!1,shift(r,e){return e==aA||e==lA||e==iA?r:e==oA},strict:!1}),xA=new br((r,e)=>{let{next:t}=r;(t==J0||t==-1||e.context)&&r.acceptToken(sA)},{contextual:!0,fallback:!0}),yA=new br((r,e)=>{let{next:t}=r,n;$u.indexOf(t)>-1||t==Cu&&((n=r.peek(1))==Cu||n==hA)||t!=J0&&t!=uA&&t!=-1&&!e.context&&r.acceptToken(J4)},{contextual:!0}),kA=new br((r,e)=>{r.next==vA&&!e.context&&r.acceptToken(eA)},{contextual:!0}),wA=new br((r,e)=>{let{next:t}=r;if(t==dA||t==fA){if(r.advance(),t==r.next){r.advance();let n=!e.context&&e.canShift(Pm);r.acceptToken(n?Pm:tA)}}else t==gA&&r.peek(1)==OA&&(r.advance(),r.advance(),(r.next<48||r.next>57)&&r.acceptToken(rA))},{contextual:!0});function fc(r,e){return r>=65&&r<=90||r>=97&&r<=122||r==95||r>=192||!e&&r>=48&&r<=57}const SA=new br((r,e)=>{if(r.next!=mA||!e.dialectEnabled(cA)||(r.advance(),r.next==Cu))return;let t=0;for(;$u.indexOf(r.next)>-1;)r.advance(),t++;if(fc(r.next,!0)){for(r.advance(),t++;fc(r.next,!1);)r.advance(),t++;for(;$u.indexOf(r.next)>-1;)r.advance(),t++;if(r.next==pA)return;for(let n=0;;n++){if(n==7){if(!fc(r.next,!0))return;break}if(r.next!="extends".charCodeAt(n))break;r.advance(),t++}}r.acceptToken(nA,-t)}),$A=oi({"get set async static":$.modifier,"for while do if else switch try catch finally return throw break continue default case defer":$.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":$.operatorKeyword,"let var const using function class extends":$.definitionKeyword,"import export from":$.moduleKeyword,"with debugger new":$.keyword,TemplateString:$.special($.string),super:$.atom,BooleanLiteral:$.bool,this:$.self,null:$.null,Star:$.modifier,VariableName:$.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":$.function($.variableName),VariableDefinition:$.definition($.variableName),Label:$.labelName,PropertyName:$.propertyName,PrivatePropertyName:$.special($.propertyName),"CallExpression/MemberExpression/PropertyName":$.function($.propertyName),"FunctionDeclaration/VariableDefinition":$.function($.definition($.variableName)),"ClassDeclaration/VariableDefinition":$.definition($.className),"NewExpression/VariableName":$.className,PropertyDefinition:$.definition($.propertyName),PrivatePropertyDefinition:$.definition($.special($.propertyName)),UpdateOp:$.updateOperator,"LineComment Hashbang":$.lineComment,BlockComment:$.blockComment,Number:$.number,String:$.string,Escape:$.escape,ArithOp:$.arithmeticOperator,LogicOp:$.logicOperator,BitOp:$.bitwiseOperator,CompareOp:$.compareOperator,RegExp:$.regexp,Equals:$.definitionOperator,Arrow:$.function($.punctuation),": Spread":$.punctuation,"( )":$.paren,"[ ]":$.squareBracket,"{ }":$.brace,"InterpolationStart InterpolationEnd":$.special($.brace),".":$.derefOperator,", ;":$.separator,"@":$.meta,TypeName:$.typeName,TypeDefinition:$.definition($.typeName),"type enum interface implements namespace module declare":$.definitionKeyword,"abstract global Privacy readonly override":$.modifier,"is keyof unique infer asserts":$.operatorKeyword,JSXAttributeValue:$.attributeValue,JSXText:$.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":$.angleBracket,"JSXIdentifier JSXNameSpacedName":$.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":$.attributeName,"JSXBuiltin/JSXIdentifier":$.standard($.tagName)}),CA={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},QA={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},PA={__proto__:null,"<":193},TA=ni.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`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h*YS(U#W(^U(Z#Z+Z/mS-['X+[T.O(T.TV'^!e%i*ZQ$lfR)x$qT)m$l)nR4V/UT*_$x*bT*h${*YQ0w+fQ1g,VQ3_.fQ5t1iQ6P1qQ7X3cQ8r6SQ9c7WQ:^8qQ:p9bQ;Z:`Q;c:rQ;n;[R;q;dnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&l!VR,h&itmOXst!U!V!Z#d%m&i&r&t&u&w,s,x2[2_R,o&oT%lm,oR1k,XR,g&gQ&U|S+}&V&WR1^,OR+s&PT&p!W&sT&q!W&sT2^,x2_",nodeNames:"⚠ ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:bA,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[$A],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c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jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:r=>CA[r]||-1},{term:343,get:r=>QA[r]||-1},{term:95,get:r=>PA[r]||-1}],tokenPrec:15201}),e1=[Gt("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Gt("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Gt("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Gt("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Gt("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Gt(`try {
|
|
28
|
+
\${}
|
|
29
|
+
} catch (\${error}) {
|
|
30
|
+
\${}
|
|
31
|
+
}`,{label:"try",detail:"/ catch block",type:"keyword"}),Gt("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Gt(`if (\${}) {
|
|
32
|
+
\${}
|
|
33
|
+
} else {
|
|
34
|
+
\${}
|
|
35
|
+
}`,{label:"if",detail:"/ else block",type:"keyword"}),Gt(`class \${name} {
|
|
36
|
+
constructor(\${params}) {
|
|
37
|
+
\${}
|
|
38
|
+
}
|
|
39
|
+
}`,{label:"class",detail:"definition",type:"keyword"}),Gt('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Gt('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],MA=e1.concat([Gt("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Gt("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Gt("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Tm=new qg,t1=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ai(r){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,r),!0}}const AA=["FunctionDeclaration"],_A={FunctionDeclaration:Ai("function"),ClassDeclaration:Ai("class"),ClassExpression:()=>!0,EnumDeclaration:Ai("constant"),TypeAliasDeclaration:Ai("type"),NamespaceDeclaration:Ai("namespace"),VariableDefinition(r,e){r.matchContext(AA)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function r1(r,e){let t=Tm.get(e);if(t)return t;let n=[],s=!0;function i(o,a){let l=r.sliceString(o.from,o.to);n.push({label:l,type:a})}return e.cursor(st.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let a=_A[o.name];if(a&&a(o,i)||t1.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of r1(r,o.node))n.push(a);return!1}}),Tm.set(e,n),n}const Mm=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,n1=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function RA(r){let e=dt(r.state).resolveInner(r.pos,-1);if(n1.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Mm.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let n=[];for(let s=e;s;s=s.parent)t1.has(s.name)&&(n=n.concat(r1(r.state.doc,s)));return{options:n,from:t?e.from:r.pos,validFor:Mm}}const rn=Js.define({name:"javascript",parser:TA.configure({props:[Po.add({IfStatement:Sa({except:/^\s*({|else\b)/}),TryStatement:Sa({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:kQ,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:n?1:2)*r.unit},Block:yQ({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":Sa({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),ai.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Jg,BlockComment(r){return{from:r.from+2,to:r.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),s1={test:r=>/^JSX/.test(r.name),facet:lh({commentTokens:{block:{open:"{/*",close:"*/}"}}})},i1=rn.configure({dialect:"ts"},"typescript"),o1=rn.configure({dialect:"jsx",props:[ch.add(r=>r.isTop?[s1]:void 0)]}),a1=rn.configure({dialect:"jsx ts",props:[ch.add(r=>r.isTop?[s1]:void 0)]},"typescript");let l1=r=>({label:r,type:"keyword"});const c1="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(l1),BA=c1.concat(["declare","implements","private","protected","public"].map(l1));function ZA(r={}){let e=r.jsx?r.typescript?a1:o1:r.typescript?i1:rn,t=r.typescript?MA.concat(BA):e1.concat(c1);return new so(e,[rn.data.of({autocomplete:N3(n1,JO(t))}),rn.data.of({autocomplete:RA}),r.jsx?LA:[]])}function EA(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function Am(r,e,t=r.length){for(let n=e?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return r.sliceString(n.from,Math.min(n.to,t));return""}const DA=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),LA=Se.inputHandler.of((r,e,t,n,s)=>{if((DA?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||n!=">"&&n!="/"||!rn.isActiveAt(r.state,e,-1))return!1;let i=s(),{state:o}=i,a=o.changeByRange(l=>{var c;let{head:u}=l,h=dt(o).resolveInner(u-1,-1),f;if(h.name=="JSXStartTag"&&(h=h.parent),!(o.doc.sliceString(u-1,u)!=n||h.name=="JSXAttributeValue"&&h.to>u)){if(n==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:u,insert:"</>"}};if(n=="/"&&h.name=="JSXStartCloseTag"){let p=h.parent,g=p.parent;if(g&&p.from==u-2&&((f=Am(o.doc,g.firstChild,u))||((c=g.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let O=`${f}>`;return{range:te.cursor(u+O.length,-1),changes:{from:u,insert:O}}}}else if(n==">"){let p=EA(h);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(u,u+2))&&(f=Am(o.doc,p,u)))return{range:l,changes:{from:u,insert:`</${f}>`}}}}return{range:l}});return a.changes.empty?!1:(r.dispatch([i,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),_i=["_blank","_self","_top","_parent"],mc=["ascii","utf-8","utf-16","latin1","latin1"],pc=["get","post","put","delete"],gc=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],hr=["true","false"],De={},XA={a:{attrs:{href:null,ping:null,type:null,media:null,target:_i,hreflang:null}},abbr:De,address:De,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:De,aside:De,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:De,base:{attrs:{href:null,target:_i}},bdi:De,bdo:De,blockquote:{attrs:{cite:null}},body:De,br:De,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:gc,formmethod:pc,formnovalidate:["novalidate"],formtarget:_i,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:De,center:De,cite:De,code:De,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:De,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:De,div:De,dl:De,dt:De,em:De,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:De,figure:De,footer:De,form:{attrs:{action:null,name:null,"accept-charset":mc,autocomplete:["on","off"],enctype:gc,method:pc,novalidate:["novalidate"],target:_i}},h1:De,h2:De,h3:De,h4:De,h5:De,h6:De,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:De,hgroup:De,hr:De,html:{attrs:{manifest:null}},i:De,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:gc,formmethod:pc,formnovalidate:["novalidate"],formtarget:_i,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:De,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:De,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:De,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:mc,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:De,noscript:De,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:De,param:{attrs:{name:null,value:null}},pre:De,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:De,rt:De,ruby:De,samp:De,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:mc}},section:De,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:De,source:{attrs:{src:null,type:null,media:null}},span:De,strong:De,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:De,summary:De,sup:De,table:De,tbody:De,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:De,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:De,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:De,time:{attrs:{datetime:null}},title:De,tr:De,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:De,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:De},u1={accesskey:null,class:null,contenteditable:hr,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:hr,autocorrect:hr,autocapitalize:hr,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":hr,"aria-autocomplete":["inline","list","both","none"],"aria-busy":hr,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":hr,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":hr,"aria-hidden":hr,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":hr,"aria-multiselectable":hr,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":hr,"aria-relevant":null,"aria-required":hr,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},h1="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(r=>"on"+r);for(let r of h1)u1[r]=null;class go{constructor(e,t){this.tags={...XA,...e},this.globalAttrs={...u1,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}go.default=new go;function si(r,e,t=r.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?r.sliceString(s.from,Math.min(s.to,t)):""}function ii(r,e=!1){for(;r;r=r.parent)if(r.name=="Element")if(e)e=!1;else return r;return null}function d1(r,e,t){let n=t.tags[si(r,ii(e))];return n?.children||t.allTags}function Eh(r,e){let t=[];for(let n=ii(e);n&&!n.type.isTop;n=ii(n.parent)){let s=si(r,n);if(s&&n.lastChild.name=="CloseTag")break;s&&t.indexOf(s)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&t.push(s)}return t}const f1=/^[:\-\.\w\u00b7-\uffff]*$/;function _m(r,e,t,n,s){let i=/\s*>/.test(r.sliceDoc(s,s+5))?"":">",o=ii(t,t.name=="StartTag"||t.name=="TagName");return{from:n,to:s,options:d1(r.doc,o,e).map(a=>({label:a,type:"type"})).concat(Eh(r.doc,t).map((a,l)=>({label:"/"+a,apply:"/"+a+i,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Rm(r,e,t,n){let s=/\s*>/.test(r.sliceDoc(n,n+5))?"":">";return{from:t,to:n,options:Eh(r.doc,e).map((i,o)=>({label:i,apply:i+s,type:"type",boost:99-o})),validFor:f1}}function IA(r,e,t,n){let s=[],i=0;for(let o of d1(r.doc,t,e))s.push({label:"<"+o,type:"type"});for(let o of Eh(r.doc,t))s.push({label:"</"+o+">",type:"type",boost:99-i++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function VA(r,e,t,n,s){let i=ii(t),o=i?e.tags[si(r.doc,i)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:s,options:l.map(c=>({label:c,type:"property"})),validFor:f1}}function zA(r,e,t,n,s){var i;let o=(i=t.parent)===null||i===void 0?void 0:i.getChild("AttributeName"),a=[],l;if(o){let c=r.sliceDoc(o.from,o.to),u=e.globalAttrs[c];if(!u){let h=ii(t),f=h?e.tags[si(r.doc,h)]:null;u=f?.attrs&&f.attrs[c]}if(u){let h=r.sliceDoc(n,s).toLowerCase(),f='"',p='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,f="",p=r.sliceDoc(s,s+1)==h[0]?"":h[0],h=h.slice(1),n++):l=/^[^\s<>='"]*$/;for(let g of u)a.push({label:g,apply:f+g+p,type:"constant"})}}return{from:n,to:s,options:a,validFor:l}}function m1(r,e){let{state:t,pos:n}=e,s=dt(t).resolveInner(n,-1),i=s.resolve(n);for(let o=n,a;i==s&&(a=s.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.from<l.to)break;i=s=a,o=l.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?Rm(t,s,s.from,n):_m(t,r,s,s.from,n):s.name=="StartTag"||s.name=="IncompleteTag"?_m(t,r,s,n,n):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?Rm(t,s,n,n):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?VA(t,r,s,s.name=="AttributeName"?s.from:n,n):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?zA(t,r,s,s.name=="Is"?n:s.from,n):e.explicit&&(i.name=="Element"||i.name=="Text"||i.name=="Document")?IA(t,r,s,n):null}function NA(r){return m1(go.default,r)}function WA(r){let{extraTags:e,extraGlobalAttributes:t}=r,n=t||e?new go(e,t):go.default;return s=>m1(n,s)}const qA=rn.parser.configure({top:"SingleExpression"}),p1=[{tag:"script",attrs:r=>r.type=="text/typescript"||r.lang=="ts",parser:i1.parser},{tag:"script",attrs:r=>r.type=="text/babel"||r.type=="text/jsx",parser:o1.parser},{tag:"script",attrs:r=>r.type=="text/typescript-jsx",parser:a1.parser},{tag:"script",attrs(r){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type)},parser:qA},{tag:"script",attrs(r){return!r.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type)},parser:rn.parser},{tag:"style",attrs(r){return(!r.lang||r.lang=="css")&&(!r.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type))},parser:cl.parser}],g1=[{name:"style",parser:cl.parser.configure({top:"Styles"})}].concat(h1.map(r=>({name:r,parser:rn.parser}))),O1=Js.define({name:"html",parser:g4.configure({props:[Po.add({Element(r){let e=/^(\s*)(<\/)?/.exec(r.textAfter);return r.node.to<=r.pos+e[0].length?r.continue():r.lineIndent(r.node.from)+(e[2]?0:r.unit)},"OpenTag CloseTag SelfClosingTag"(r){return r.column(r.node.from)+r.unit},Document(r){if(r.pos+/\s*/.exec(r.textAfter)[0].length<r.node.to)return r.continue();let e=null,t;for(let n=r.node;;){let s=n.lastChild;if(!s||s.name!="Element"||s.to!=n.to)break;e=n=s}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?r.lineIndent(e.from)+r.unit:null}}),ai.add({Element(r){let e=r.firstChild,t=r.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:r.to}}}),dO.add({"OpenTag CloseTag":r=>r.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Qa=O1.configure({wrap:Y0(p1,g1)});function jA(r={}){let e="",t;r.matchClosingTags===!1&&(e="noMatch"),r.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(r.nestedLanguages&&r.nestedLanguages.length||r.nestedAttributes&&r.nestedAttributes.length)&&(t=Y0((r.nestedLanguages||[]).concat(p1),(r.nestedAttributes||[]).concat(g1)));let n=t?O1.configure({wrap:t,dialect:e}):e?Qa.configure({dialect:e}):Qa;return new so(n,[Qa.data.of({autocomplete:WA(r)}),r.autoCloseTags!==!1?YA:[],ZA().support,K4().support])}const Bm=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),YA=Se.inputHandler.of((r,e,t,n,s)=>{if(r.composing||r.state.readOnly||e!=t||n!=">"&&n!="/"||!Qa.isActiveAt(r.state,e,-1))return!1;let i=s(),{state:o}=i,a=o.changeByRange(l=>{var c,u,h;let f=o.doc.sliceString(l.from-1,l.to)==n,{head:p}=l,g=dt(o).resolveInner(p,-1),O;if(f&&n==">"&&g.name=="EndTag"){let b=g.parent;if(((u=(c=b.parent)===null||c===void 0?void 0:c.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(O=si(o.doc,b.parent,p))&&!Bm.has(O)){let x=p+(o.doc.sliceString(p,p+1)===">"?1:0),k=`</${O}>`;return{range:l,changes:{from:p,to:x,insert:k}}}}else if(f&&n=="/"&&g.name=="IncompleteCloseTag"){let b=g.parent;if(g.from==p-2&&((h=b.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(O=si(o.doc,b,p))&&!Bm.has(O)){let x=p+(o.doc.sliceString(p,p+1)===">"?1:0),k=`${O}>`;return{range:te.cursor(p+k.length,-1),changes:{from:p,to:x,insert:k}}}}return{range:l}});return a.changes.empty?!1:(r.dispatch([i,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),v1=lh({commentTokens:{block:{open:"<!--",close:"-->"}}}),b1=new qe,x1=uM.configure({props:[ai.add(r=>!r.is("Block")||r.is("Document")||Qu(r)!=null||FA(r)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),b1.add(Qu),Po.add({Document:()=>null}),cs.add({Document:v1})]});function Qu(r){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(r.name);return e?+e[1]:void 0}function FA(r){return r.name=="OrderedList"||r.name=="BulletList"}function UA(r,e){let t=r;for(;;){let n=t.nextSibling,s;if(!n||(s=Qu(n.type))!=null&&s<=e)break;t=n}return t.to}const GA=Kg.of((r,e,t)=>{for(let n=dt(r).resolveInner(t,-1);n&&!(n.from<e);n=n.parent){let s=n.type.prop(b1);if(s==null)continue;let i=UA(n,s);if(i>t)return{from:t,to:i}}return null});function Dh(r){return new $r(v1,r,[],"markdown")}const HA=Dh(x1),KA=x1.configure([yM,wM,kM,SM,{props:[ai.add({Table:(r,e)=>({from:e.doc.lineAt(r.from).to,to:r.to})})]}]),ul=Dh(KA);function JA(r,e){return t=>{if(t&&r){let n=null;if(t=/\S*/.exec(t)[0],typeof r=="function"?n=r(t):n=qa.matchLanguageName(r,t,!0),n instanceof qa)return n.support?n.support.language.parser:no.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class Oc{constructor(e,t,n,s,i,o,a){this.node=e,this.from=t,this.to=n,this.spaceBefore=s,this.spaceAfter=i,this.type=o,this.item=a}blank(e,t=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length<e;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(t?this.spaceAfter:"")}}marker(e,t){let n=this.node.name=="OrderedList"?String(+k1(this.item,e)[2]+t):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function y1(r,e){let t=[],n=[];for(let s=r;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&t.push(s)}for(let s=t.length-1;s>=0;s--){let i=t[s],o,a=e.lineAt(i.from),l=i.from-a.from;if(i.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))n.push(new Oc(i,l,l+o[0].length,"",o[1],">",null));else if(i.name=="ListItem"&&i.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=o[3],u=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),u-=4),n.push(new Oc(i.parent,l,l+u,o[1],c,o[2],i))}else if(i.name=="ListItem"&&i.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=o[4],u=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),u-=4);let h=o[2];o[3]&&(h+=o[3].replace(/[xX]/," ")),n.push(new Oc(i.parent,l,l+u,o[1],c,h,i))}}return n}function k1(r,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(r.from,r.from+10))}function vc(r,e,t,n=0){for(let s=-1,i=r;;){if(i.name=="ListItem"){let a=k1(i,e),l=+a[2];if(s>=0){if(l!=s+1)return;t.push({from:i.from+a[1].length,to:i.from+a[0].length,insert:String(s+2+n)})}s=l}let o=i.nextSibling;if(!o)break;i=o}}function Lh(r,e){let t=/^[ \t]*/.exec(r)[0].length;if(!t||e.facet(Qo)!=" ")return r;let n=Zr(r,4,t),s="";for(let i=n;i>0;)i>=4?(s+=" ",i-=4):(s+=" ",i--);return s+r.slice(t)}const e_=(r={})=>({state:e,dispatch:t})=>{let n=dt(e),{doc:s}=e,i=null,o=e.changeByRange(a=>{if(!a.empty||!ul.isActiveAt(e,a.from,-1)&&!ul.isActiveAt(e,a.from,1))return i={range:a};let l=a.from,c=s.lineAt(l),u=y1(n.resolveInner(l,-1),s);for(;u.length&&u[u.length-1].from>l-c.from;)u.pop();if(!u.length)return i={range:a};let h=u[u.length-1];if(h.to-h.spaceAfter.length>l-c.from)return i={range:a};let f=l>=h.to-h.spaceAfter.length&&!/\S/.test(c.text.slice(h.to));if(h.item&&f){let x=h.node.firstChild,k=h.node.getChild("ListItem","ListItem");if(x.to>=l||k&&k.to<l||c.from>0&&!/[^\s>]/.test(s.lineAt(c.from-1).text)||r.nonTightLists===!1){let w=u.length>1?u[u.length-2]:null,S,Q="";w&&w.item?(S=c.from+w.from,Q=w.marker(s,1)):S=c.from+(w?w.to:0);let L=[{from:S,to:l,insert:Q}];return h.node.name=="OrderedList"&&vc(h.item,s,L,-2),w&&w.node.name=="OrderedList"&&vc(w.item,s,L),{range:te.cursor(S+Q.length),changes:L}}else{let w=Em(u,e,c);return{range:te.cursor(l+w.length+1),changes:{from:c.from,insert:w+e.lineBreak}}}}if(h.node.name=="Blockquote"&&f&&c.from){let x=s.lineAt(c.from-1),k=/>\s*$/.exec(x.text);if(k&&k.index==h.from){let w=e.changes([{from:x.from+k.index,to:x.to},{from:c.from+h.from,to:c.to}]);return{range:a.map(w),changes:w}}}let p=[];h.node.name=="OrderedList"&&vc(h.item,s,p);let g=h.item&&h.item.from<c.from,O="";if(!g||/^[\s\d.)\-+*>]*/.exec(c.text)[0].length>=h.to)for(let x=0,k=u.length-1;x<=k;x++)O+=x==k&&!g?u[x].marker(s,1):u[x].blank(x<k?Zr(c.text,4,u[x+1].from)-O.length:null);let b=l;for(;b>c.from&&/\s/.test(c.text.charAt(b-c.from-1));)b--;return O=Lh(O,e),r_(h.node,e.doc)&&(O=Em(u,e,c)+e.lineBreak+O),p.push({from:b,to:l,insert:e.lineBreak+O}),{range:te.cursor(b+O.length+1),changes:p}});return i?!1:(t(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},t_=e_();function Zm(r){return r.name=="QuoteMark"||r.name=="ListMark"}function r_(r,e){if(r.name!="OrderedList"&&r.name!="BulletList")return!1;let t=r.firstChild,n=r.getChild("ListItem","ListItem");if(!n)return!1;let s=e.lineAt(t.to),i=e.lineAt(n.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1)<i.number}function Em(r,e,t){let n="";for(let s=0,i=r.length-2;s<=i;s++)n+=r[s].blank(s<i?Zr(t.text,4,r[s+1].from)-n.length:null,s<i);return Lh(n,e)}function n_(r,e){let t=r.resolveInner(e,-1),n=e;Zm(t)&&(n=t.from,t=t.parent);for(let s;s=t.childBefore(n);)if(Zm(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")t=s.lastChild,n=t.to;else break;return t}const s_=({state:r,dispatch:e})=>{let t=dt(r),n=null,s=r.changeByRange(i=>{let o=i.from,{doc:a}=r;if(i.empty&&ul.isActiveAt(r,i.from)){let l=a.lineAt(o),c=y1(n_(t,o),a);if(c.length){let u=c[c.length-1],h=u.to-u.spaceAfter.length+(u.spaceAfter?1:0);if(o-l.from>h&&!/\S/.test(l.text.slice(h,o-l.from)))return{range:te.cursor(l.from+h),changes:{from:l.from+h,to:o}};if(o-l.from==h&&(!u.item||l.from<=u.item.from||!/\S/.test(l.text.slice(0,u.to)))){let f=l.from+u.from;if(u.item&&u.node.from<u.item.from&&/\S/.test(l.text.slice(u.from,u.to))){let p=u.blank(Zr(l.text,4,u.to)-Zr(l.text,4,u.from));return f==l.from&&(p=Lh(p,r)),{range:te.cursor(f+p.length),changes:{from:f,to:l.from+u.to,insert:p}}}if(f<o)return{range:te.cursor(f),changes:{from:f,to:o}}}}}return n={range:i}});return n?!1:(e(r.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},i_=[{key:"Enter",run:t_},{key:"Backspace",run:s_}],w1=jA({matchClosingTags:!1});function o_(r={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:n=!0,base:{parser:s}=HA,completeHTMLTags:i=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=w1}=r;if(!(s instanceof Tl))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=r.extensions?[r.extensions]:[],c=[a.support,GA],u;o&&c.push(u_),t instanceof so?(c.push(t.support),u=t.language):t&&(u=t);let h=e||u?JA(e,u):void 0;l.push(dM({codeParser:h,htmlParser:a.language.parser})),n&&c.push(kn.high(So.of(i_)));let f=Dh(s.configure(l));return i&&c.push(f.data.of({autocomplete:a_})),new so(f,c)}function a_(r){let{state:e,pos:t}=r,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!n)return null;let s=dt(e).resolveInner(t,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:t-n[0].length,to:t,options:l_(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let bc=null;function l_(){if(bc)return bc;let r=NA(new bh(He.create({extensions:w1}),0,!0));return bc=r?r.options:[]}const c_=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,u_=Se.domEventHandlers({paste:(r,e)=>{var t;let{main:n}=e.state.selection;if(n.empty)return!1;let s=(t=r.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!ul.isActiveAt(e.state,n.from,1)))return!1;let i=dt(e.state),o=!1;return i.iterate({from:n.from,to:n.to,enter:a=>{(a.from>n.from||c_.test(a.name))&&(o=!0)},leave:a=>{a.to<n.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),h_="#e5c07b",Dm="#e06c75",d_="#56b6c2",f_="#ffffff",Pa="#abb2bf",Pu="#7d8799",m_="#61afef",p_="#98c379",Lm="#d19a66",g_="#c678dd",O_="#21252b",Xm="#2c313a",Im="#282c34",xc="#353a42",v_="#3E4451",Vm="#528bff",b_=Se.theme({"&":{color:Pa,backgroundColor:Im},".cm-content":{caretColor:Vm},".cm-cursor, .cm-dropCursor":{borderLeftColor:Vm},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:v_},".cm-panels":{backgroundColor:O_,color:Pa},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Im,color:Pu,border:"none"},".cm-activeLineGutter":{backgroundColor:Xm},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:xc},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:xc,borderBottomColor:xc},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Xm,color:Pa}}},{dark:!0}),x_=Mo.define([{tag:$.keyword,color:g_},{tag:[$.name,$.deleted,$.character,$.propertyName,$.macroName],color:Dm},{tag:[$.function($.variableName),$.labelName],color:m_},{tag:[$.color,$.constant($.name),$.standard($.name)],color:Lm},{tag:[$.definition($.name),$.separator],color:Pa},{tag:[$.typeName,$.className,$.number,$.changed,$.annotation,$.modifier,$.self,$.namespace],color:h_},{tag:[$.operator,$.operatorKeyword,$.url,$.escape,$.regexp,$.link,$.special($.string)],color:d_},{tag:[$.meta,$.comment],color:Pu},{tag:$.strong,fontWeight:"bold"},{tag:$.emphasis,fontStyle:"italic"},{tag:$.strikethrough,textDecoration:"line-through"},{tag:$.link,color:Pu,textDecoration:"underline"},{tag:$.heading,fontWeight:"bold",color:Dm},{tag:[$.atom,$.bool,$.special($.variableName)],color:Lm},{tag:[$.processingInstruction,$.string,$.inserted],color:p_},{tag:$.invalid,color:f_}]),y_=[b_,lO(x_)],k_=Ve({__name:"MarkdownCodeEditor",props:{modelValue:{},readOnly:{type:Boolean,default:!1},lineToReveal:{default:null}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,s=P(null);let i=null,o=!1,a=null;const l=We.define(),c=We.define(),u=Tt.define({create(){return Le.none},update(g,O){let b=g.map(O.changes);for(const x of O.effects)if(x.is(c)&&(b=Le.none),x.is(l)){const k=Math.max(1,Math.min(x.value,O.state.doc.lines)),w=O.state.doc.line(k);b=Le.set([Le.line({class:"cm-target-line"}).range(w.from)])}return b},provide:g=>Se.decorations.from(g)});function h(){i&&(a&&clearTimeout(a),a=setTimeout(()=>{i&&i.dispatch({effects:c.of(void 0)})},1600))}function f(g){if(!i)return;const O=Math.max(1,Math.min(g,i.state.doc.lines)),b=i.state.doc.line(O);i.dispatch({selection:{anchor:b.from},effects:[Se.scrollIntoView(b.from,{y:"center"}),l.of(O)]}),i.focus(),h()}function p(g,O){return He.create({doc:g,extensions:[KT,o_(),y_,Se.lineWrapping,u,Se.updateListener.of(b=>{!b.docChanged||o||n("update:modelValue",b.state.doc.toString())}),Se.theme({"&":{height:"100%",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",fontSize:"13px",backgroundColor:"rgb(var(--color-retro-black))",color:"rgb(var(--color-retro-text))"},".cm-scroller":{overflow:"auto",lineHeight:"1.6"},".cm-gutters":{backgroundColor:"rgb(var(--color-retro-dark))",color:"rgb(var(--color-retro-subtle))",borderRight:"1px solid rgb(var(--color-retro-border))"},".cm-content":{caretColor:"rgb(var(--color-retro-cyan))",padding:"12px 0"},".cm-activeLine":{backgroundColor:"rgba(34, 211, 238, 0.08)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"rgba(34, 211, 238, 0.22)"}}),He.readOnly.of(O)]})}return gt(()=>{s.value&&(i=new Se({state:p(t.modelValue,t.readOnly),parent:s.value}),t.lineToReveal&&f(t.lineToReveal))}),ze(()=>t.modelValue,g=>{if(!i)return;const O=i.state.doc.toString();O!==g&&(o=!0,i.dispatch({changes:{from:0,to:O.length,insert:g}}),o=!1)}),ze(()=>t.lineToReveal,g=>{g&&f(g)}),N1(()=>{a&&clearTimeout(a),i&&(i.destroy(),i=null)}),(g,O)=>(v(),y("div",{ref_key:"rootRef",ref:s,class:"h-full w-full"},null,512))}}),w_=ws(k_,[["__scopeId","data-v-d77d4160"]]),S_={class:"fixed inset-0 z-50 flex items-center justify-center"},$_={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},C_={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},Q_={class:"flex items-center gap-3 min-w-0"},P_={class:"text-sm font-mono font-bold text-retro-cyan truncate"},T_={class:"text-xs font-mono text-retro-subtle"},M_={class:"flex items-center gap-2"},A_=["disabled"],__={class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},R_=["onClick"],B_={class:"flex-1 min-h-0 overflow-y-auto"},Z_={key:0,class:"p-5 max-w-6xl mx-auto"},E_={key:0,class:"flex items-center justify-center py-12"},D_={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},L_={class:"text-sm font-mono text-retro-red"},X_={key:2,class:"space-y-4"},I_={key:0,class:"rounded border border-retro-cyan/40 bg-retro-cyan/10 px-3 py-2 text-xs font-mono text-retro-cyan"},V_={class:"grid grid-cols-2 lg:grid-cols-5 gap-2"},z_={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},N_={class:"text-sm font-mono text-retro-text"},W_={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},q_={class:"text-sm font-mono text-retro-cyan"},j_={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},Y_={class:"text-sm font-mono text-retro-yellow"},F_={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},U_={class:"text-sm font-mono text-retro-green"},G_={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},H_={class:"text-sm font-mono text-retro-text"},K_={class:"rounded border border-retro-border bg-retro-panel px-3 py-3"},J_={class:"flex items-center justify-between gap-2 mb-2"},eR={class:"text-[11px] font-mono text-retro-subtle"},tR={key:0,class:"text-xs font-mono text-retro-green"},rR={key:1,class:"space-y-2"},nR={class:"uppercase tracking-wide mr-2"},sR={class:"rounded border border-retro-border bg-retro-panel p-3 overflow-x-auto"},iR={class:"min-w-[760px]"},oR={class:"text-retro-text"},aR=["disabled","onClick"],lR=["disabled","onClick"],cR=["disabled","onClick"],uR={class:"text-retro-muted"},hR={key:1,class:"flex items-center justify-center py-12"},dR={key:2,class:"flex flex-col items-center justify-center py-12 text-center px-4"},fR={class:"text-sm font-mono text-retro-red"},mR={key:3,class:"flex flex-col items-center justify-center py-12 text-center"},pR={key:4,class:"h-full flex flex-col"},gR=["innerHTML"],OR=Ve({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(r,{emit:e}){const t=r,n=e,s=vo(),{renderMarkdown:i}=Jm(),o=P(t.feature.files[0]?.filename||""),a=P("document"),l=P(""),c=P(!1),u=P(null),h=P(!1),f=P(""),p=P(!1),g=P(null),O=P(null),b=P(!1),x=P(null),k=P(null),w=J(()=>{const I={critical:0,major:1,minor:2};return[...k.value?.alerts??[]].sort((z,be)=>I[z.severity]-I[be.severity])});function S(I){return I.status==="covered"?"text-retro-green border-retro-green/40 bg-retro-green/10":I.status==="partial"?"text-retro-yellow border-retro-yellow/40 bg-retro-yellow/10":"text-retro-red border-retro-red/40 bg-retro-red/10"}function Q(I){return I.severity==="critical"?"text-retro-red border-retro-red/40 bg-retro-red/10":I.severity==="major"?"text-retro-yellow border-retro-yellow/40 bg-retro-yellow/10":"text-retro-cyan border-retro-cyan/40 bg-retro-cyan/10"}async function L(){b.value=!0,x.value=null;try{k.value=await $fetch(`/api/specs/traceability/${t.feature.id}`)}catch{x.value="Failed to load traceability data",k.value=null}finally{b.value=!1}}async function E(I=o.value){if(I){c.value=!0,u.value=null;try{const z=`/api/specs/${t.feature.id}/${I}`,be=await $fetch(z);l.value=be.content}catch{u.value="Failed to load file",l.value=""}finally{c.value=!1}}}function G(){E()}const oe=J(()=>l.value?i(l.value):"");function ie(I){O.value=null,a.value="document",h.value&&(h.value=!1),o.value=I,E()}function j(){h.value&&U(),a.value="traceability",!k.value&&!b.value&&L()}async function V(I,z,be){z&&(o.value!==I?(o.value=I,await E(I)):l.value||await E(I),a.value="document",h.value=!0,f.value=l.value,g.value=null,O.value={filename:I,line:z,requirementId:be},await It(),g.value=z)}function Z(){f.value=l.value,g.value=null,h.value=!0}function U(){h.value=!1,f.value=""}async function W(){p.value=!0;try{const I=`/api/specs/${t.feature.id}/${o.value}`;await $fetch(I,{method:"PUT",body:{content:f.value}}),l.value=f.value,h.value=!1,s.success("Saved")}catch{s.error("Failed to save")}finally{p.value=!1}}function N(I){I.key==="Escape"&&(h.value?U():n("close"))}return gt(()=>{window.addEventListener("keydown",N),E(),L()}),wt(()=>{window.removeEventListener("keydown",N)}),(I,z)=>{const be=w_;return v(),pe(Pr,{to:"body"},[d("div",S_,[d("div",{class:"absolute inset-0 bg-black/80",onClick:z[0]||(z[0]=K=>n("close"))}),d("div",$_,[d("div",C_,[d("div",Q_,[d("span",P_,A(r.feature.name),1),d("span",T_,A(r.feature.id),1)]),d("div",M_,[m(h)?(v(),y(we,{key:0},[d("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-muted transition-colors",onClick:U}," Cancel "),d("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-cyan text-retro-cyan hover:bg-retro-cyan/10 transition-colors disabled:opacity-50",disabled:m(p),onClick:W},A(m(p)?"Saving...":"Save"),9,A_)],64)):m(a)==="document"&&m(l)&&!m(c)&&!m(u)?(v(),y("button",{key:1,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Edit",onClick:Z},[ee(m(dp),{class:"h-4 w-4"})])):F("",!0),d("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (ESC)",onClick:z[1]||(z[1]=K=>n("close"))},[ee(m(St),{class:"h-4 w-4"})])])]),d("div",__,[d("button",{type:"button",class:_e(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap flex items-center gap-1",[m(a)==="traceability"?"border-retro-magenta text-retro-magenta bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:j},[ee(m(vv),{class:"h-3.5 w-3.5"}),z[3]||(z[3]=Ie(" Traceability ",-1))],2),(v(!0),y(we,null,Ne(r.feature.files,K=>(v(),y("button",{key:K.filename,type:"button",class:_e(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[m(a)==="document"&&m(o)===K.filename?"border-retro-cyan text-retro-cyan bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:H=>ie(K.filename)},A(K.label),11,R_))),128))]),d("div",B_,[m(a)==="traceability"?(v(),y("div",Z_,[m(b)?(v(),y("div",E_,[...z[4]||(z[4]=[d("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading traceability...",-1)])])):m(x)?(v(),y("div",D_,[d("p",L_,A(m(x)),1),d("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:L}," Retry ")])):m(k)?(v(),y("div",X_,[m(O)?(v(),y("div",I_," Jump target: "+A(m(O).requirementId)+" → "+A(m(O).filename)+":"+A(m(O).line),1)):F("",!0),d("div",V_,[d("div",z_,[z[5]||(z[5]=d("p",{class:"text-[11px] font-mono text-retro-subtle"},"FR total",-1)),d("p",N_,A(m(k).summary.frTotal),1)]),d("div",W_,[z[6]||(z[6]=d("p",{class:"text-[11px] font-mono text-retro-subtle"},"Plan coverage",-1)),d("p",q_,A(m(k).summary.frWithPlan)+"/"+A(m(k).summary.frTotal),1)]),d("div",j_,[z[7]||(z[7]=d("p",{class:"text-[11px] font-mono text-retro-subtle"},"Task mapping",-1)),d("p",Y_,A(m(k).summary.frWithTasks)+"/"+A(m(k).summary.frTotal),1)]),d("div",F_,[z[8]||(z[8]=d("p",{class:"text-[11px] font-mono text-retro-subtle"},"Fully covered",-1)),d("p",U_,A(m(k).summary.frFullyCovered)+"/"+A(m(k).summary.frTotal),1)]),d("div",G_,[z[9]||(z[9]=d("p",{class:"text-[11px] font-mono text-retro-subtle"},"Task progress",-1)),d("p",H_,A(m(k).summary.taskCompleted)+"/"+A(m(k).summary.taskTotal),1)])]),d("div",K_,[d("div",J_,[z[10]||(z[10]=d("h3",{class:"text-xs font-mono text-retro-text"},"Gap Alerts",-1)),d("span",eR,A(m(w).length)+" issues",1)]),m(w).length===0?(v(),y("div",tR," No traceability gaps detected. ")):(v(),y("div",rR,[(v(!0),y(we,null,Ne(m(w),K=>(v(),y("div",{key:K.id,class:_e(["rounded border px-2.5 py-2 text-xs font-mono",Q(K)])},[d("span",nR,A(K.severity),1),d("span",null,A(K.message),1)],2))),128))]))]),d("div",sR,[d("div",iR,[z[11]||(z[11]=d("div",{class:"grid grid-cols-[140px_1fr_1fr_1fr_120px] gap-2 text-[11px] font-mono text-retro-subtle px-2 pb-2 border-b border-retro-border"},[d("span",null,"Requirement"),d("span",null,"Spec"),d("span",null,"Plan"),d("span",null,"Tasks"),d("span",null,"Progress")],-1)),(v(!0),y(we,null,Ne(m(k).requirements,K=>(v(),y("div",{key:K.id,class:"grid grid-cols-[140px_1fr_1fr_1fr_120px] gap-2 items-center px-2 py-2 border-b border-retro-border/60 text-xs font-mono"},[d("span",oR,A(K.id),1),d("button",{type:"button",class:"h-6 rounded border border-retro-green/40 bg-retro-green/10 flex items-center px-2 text-retro-green disabled:opacity-50 disabled:cursor-not-allowed",disabled:!K.locations.specLine,onClick:H=>V("spec.md",K.locations.specLine,K.id)},[d("span",null,A(K.locations.specLine?`L${K.locations.specLine}`:"Defined"),1)],8,aR),d("button",{type:"button",class:_e(["h-6 rounded border flex items-center px-2 disabled:opacity-50 disabled:cursor-not-allowed",K.inPlan?"text-retro-cyan border-retro-cyan/40 bg-retro-cyan/10":"text-retro-subtle border-retro-border bg-retro-black/50"]),disabled:!K.locations.planLine,onClick:H=>V("plan.md",K.locations.planLine,K.id)},[d("span",null,A(K.locations.planLine?`L${K.locations.planLine}`:K.inPlan?"Linked":"Missing"),1)],10,lR),d("button",{type:"button",class:_e(["h-6 rounded border flex items-center px-2 disabled:opacity-50 disabled:cursor-not-allowed",S(K)]),disabled:K.locations.taskLines.length===0,onClick:H=>V("tasks.md",K.locations.taskLines[0],K.id)},[d("span",null,A(K.locations.taskLines.length>0?`L${K.locations.taskLines[0]}`:K.inTasks?"Mapped":"Missing"),1)],10,cR),d("span",uR,A(K.taskCompleted)+"/"+A(K.taskTotal),1)]))),128))])])])):F("",!0)])):m(c)?(v(),y("div",hR,[...z[12]||(z[12]=[d("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):m(u)?(v(),y("div",dR,[d("p",fR,A(m(u)),1),d("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:G}," Retry ")])):r.feature.files.length===0?(v(),y("div",mR,[...z[13]||(z[13]=[d("p",{class:"text-sm font-mono text-retro-muted"},"No spec files found",-1),d("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," This feature directory has no .md files ",-1)])])):m(h)?(v(),y("div",pR,[ee(be,{modelValue:m(f),"onUpdate:modelValue":z[2]||(z[2]=K=>Je(f)?f.value=K:null),"line-to-reveal":m(g),class:"flex-1"},null,8,["modelValue","line-to-reveal"])])):(v(),y("div",{key:5,class:"spec-markdown p-6 text-sm font-mono text-retro-text max-w-4xl mx-auto",innerHTML:m(oe)},null,8,gR))])])])])}}}),vR={class:"w-full max-w-2xl rounded-xl border border-retro-border/80 bg-retro-black shadow-[0_24px_70px_rgba(0,0,0,0.55)] overflow-hidden"},bR={class:"flex items-center justify-between px-4 py-2 border-b border-retro-border/60 bg-retro-dark/70"},xR={class:"flex items-center gap-2 px-4 py-3 border-b border-retro-border/60"},yR={class:"flex items-center justify-between px-4 py-1.5 border-b border-retro-border/40 bg-retro-dark/30 text-[10px] font-mono text-retro-subtle"},kR={class:"flex items-center gap-3"},wR={class:"inline-flex items-center gap-1"},SR={key:0},$R={key:0,class:"truncate max-w-[42%]"},CR={class:"max-h-[58vh] overflow-y-auto"},QR={key:0,class:"px-4 py-3 text-xs font-mono text-retro-subtle animate-pulse"},PR={key:1,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},TR={key:2,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},MR={key:3,class:"px-4 py-3 text-xs font-mono text-retro-red"},AR={key:4,class:"py-2 px-2 space-y-2"},_R=["onMouseenter","onClick"],RR={class:"flex items-center justify-between gap-3 text-[10px] font-mono"},BR={class:"text-retro-cyan/90"},ZR={class:"text-retro-subtle truncate"},ER=["innerHTML"],DR={key:5,class:"px-4 py-3 text-xs font-mono text-retro-subtle"},LR={class:"flex items-center justify-between gap-3 px-4 py-2 border-t border-retro-border/60 bg-retro-dark/50 text-[11px] font-mono text-retro-subtle"},XR={key:0,class:"text-retro-yellow"},IR={key:0,class:"px-4 pb-3 text-xs font-mono text-retro-red flex items-center gap-2"},VR=400,zR=Ve({__name:"FeatureSearchModal",props:{availableFeatureIds:{}},emits:["close","select"],setup(r,{emit:e}){const t=r,n=e,{renderMarkdown:s}=Jm(),i=P(""),o=P(!1),a=P(!1),l=P(null),c=P(null),u=P(null),h=P(null),f=P([]),p=P(-1),g=P(null),O=P([]);let b=null,x=0;const k=J(()=>i.value.trim()),w=J(()=>{const W=k.value.toLowerCase().split(/\s+/).map(N=>N.trim()).filter(N=>N.length>=2);return Array.from(new Set(W)).slice(0,8)}),S=J(()=>l.value||c.value?"error":!k.value&&a.value?"empty-query":f.value.length>0?"results":a.value&&!o.value?"no-results":"idle");function Q(W){return{featureId:W.chunk.featureId,sourcePath:W.chunk.sourcePath,headingHierarchy:W.chunk.headingHierarchy,snippet:W.chunk.content,matchType:W.matchType,score:W.score,lineStart:W.chunk.lineStart,lineEnd:W.chunk.lineEnd}}async function L(){const W=k.value;if(c.value=null,!W){a.value=!0,u.value=null,h.value=null,l.value=null,f.value=[],p.value=-1;return}const N=++x;a.value=!0,l.value=null,o.value=!0;try{const I=await $fetch("/api/specs/search",{query:{q:W,mode:"keyword",limit:20}});if(N!==x)return;u.value=I.warning??null,h.value=I.searchTime,f.value=I.results.map(Q),p.value=f.value.length>0?0:-1}catch(I){if(N!==x)return;const z=I instanceof Error?I.message:"Failed to search specs";l.value=z,h.value=null,f.value=[],p.value=-1}finally{N===x&&(o.value=!1)}}ze(i,()=>{l.value=null,c.value=null,b&&clearTimeout(b),b=setTimeout(()=>{L()},VR)}),ze(f,()=>{O.value=[]}),ze(p,async W=>{W<0||(await It(),O.value[W]?.scrollIntoView({block:"nearest"}))});function E(){n("close")}function G(W){const N=f.value[W];if(N){if(!t.availableFeatureIds.includes(N.featureId)){c.value="Feature unavailable";return}n("select",N.featureId),n("close")}}function oe(W){if(f.value.length===0)return;if(p.value<0){p.value=0;return}const N=p.value+W;if(N<0){p.value=f.value.length-1;return}if(N>=f.value.length){p.value=0;return}p.value=N}function ie(W){if(W.key==="ArrowDown"){W.preventDefault(),oe(1);return}if(W.key==="ArrowUp"){W.preventDefault(),oe(-1);return}if(W.key==="Enter"){W.preventDefault(),p.value>=0&&G(p.value);return}W.key==="Escape"&&(W.preventDefault(),E())}function j(W){W.target===W.currentTarget&&E()}function V(W,N){if(!N){O.value[W]=null;return}if(N instanceof HTMLElement){O.value[W]=N;return}const I=N.$el;O.value[W]=I instanceof HTMLElement?I:null}function Z(){L()}function U(W){const N=W.trim();if(!N)return"";const I=N.length>700?`${N.slice(0,700)}...`:N,z=s(I);if(w.value.length===0)return z;const be=w.value.map(H=>H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),K=new RegExp(`(${be.join("|")})`,"gi");return z.split(/(<[^>]+>)/g).map(H=>H.startsWith("<")?H:H.replace(K,"<mark>$1</mark>")).join("")}return gt(()=>{It(()=>{g.value?.focus()})}),wt(()=>{b&&clearTimeout(b)}),(W,N)=>(v(),pe(Pr,{to:"body"},[ee(On,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ut(()=>[d("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-16 px-4 bg-black/75 backdrop-blur-[1px]",onClick:j},[ee(On,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0 translate-y-2 scale-[0.99]","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-1 scale-[0.995]"},{default:ut(()=>[d("div",vR,[d("div",bR,[N[1]||(N[1]=d("div",{class:"flex items-center gap-2"},[d("span",{class:"inline-flex items-center rounded px-2 py-0.5 text-[10px] font-mono border border-retro-cyan/50 text-retro-cyan bg-retro-cyan/10"}," Command Palette "),d("span",{class:"text-[10px] font-mono text-retro-subtle"},"Global spec search")],-1)),d("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (Escape)",onClick:E},[ee(m(St),{class:"h-4 w-4"})])]),d("div",xR,[ee(m(fs),{class:"h-4 w-4 text-retro-cyan"}),je(d("input",{ref_key:"inputRef",ref:g,"onUpdate:modelValue":N[0]||(N[0]=I=>Je(i)?i.value=I:null),type:"text",placeholder:"Search specs across all features...",class:"flex-1 bg-transparent text-sm font-mono text-retro-text placeholder:text-retro-subtle focus:outline-none",onKeydown:ie},null,544),[[Rt,m(i)]]),N[2]||(N[2]=d("span",{class:"text-[10px] font-mono text-retro-subtle border border-retro-border/60 rounded px-1.5 py-0.5"},"400ms",-1))]),d("div",yR,[d("div",kR,[d("span",wR,[ee(m(Os),{class:"h-3.5 w-3.5"}),Ie(" "+A(m(f).length)+" results ",1)]),m(h)!==null?(v(),y("span",SR,A(m(h))+"ms",1)):F("",!0)]),m(k)?(v(),y("span",$R,"“"+A(m(k))+"”",1)):F("",!0)]),d("div",CR,[m(o)?(v(),y("div",QR," Searching... ")):m(S)==="empty-query"?(v(),y("div",PR," Enter a search term to search across all feature specs. ")):m(S)==="no-results"?(v(),y("div",TR," No matching features found. ")):m(S)==="error"?(v(),y("div",MR,[d("p",null,A(m(c)||m(l)),1),m(l)?(v(),y("button",{key:0,type:"button",class:"mt-2 px-2 py-1 rounded border border-retro-border text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:Z}," Retry ")):F("",!0)])):m(f).length>0?(v(),y("ul",AR,[(v(!0),y(we,null,Ne(m(f),(I,z)=>(v(),y("li",{key:`${I.featureId}:${I.sourcePath}:${z}`},[d("button",{type:"button",ref_for:!0,ref:be=>V(z,be),class:_e(["w-full text-left px-4 py-3 min-h-[132px] rounded-lg border border-retro-border/40 border-l-2 transition-colors",z===m(p)?"border-retro-cyan bg-retro-panel/95 text-retro-text shadow-[0_0_0_1px_rgba(34,211,238,0.18)]":"text-retro-muted hover:text-retro-text hover:bg-retro-panel/90"]),onMouseenter:be=>p.value=z,onClick:be=>G(z)},[d("div",RR,[d("span",BR,A(I.featureId),1),d("span",ZR,A(I.sourcePath)+":"+A(I.lineStart)+"-"+A(I.lineEnd),1)]),d("div",{class:"snippet-markdown mt-2 max-h-20 overflow-hidden text-xs text-retro-text",innerHTML:U(I.snippet)},null,8,ER),N[3]||(N[3]=d("div",{class:"mt-2 text-[10px] font-mono text-retro-subtle"}," Select feature ",-1))],42,_R)]))),128))])):(v(),y("div",DR," Start typing to search. "))]),d("div",LR,[N[4]||(N[4]=d("div",{class:"flex items-center gap-2"},[d("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"↑↓ move"),d("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Enter select"),d("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Esc close")],-1)),m(u)?(v(),y("span",XR,A(m(u)),1)):F("",!0)]),m(c)?(v(),y("div",IR,[ee(m(En),{class:"h-3.5 w-3.5"}),d("span",null,A(m(c)),1)])):F("",!0)])]),_:1})])]),_:1})]))}}),NR=ws(zR,[["__scopeId","data-v-5199b408"]]);function WR(r){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(r)}function qR(r=Date.now,e=Math.random){return`req-${r()}-${e().toString(36).slice(2,8)}`}function zm(r=Date.now){return`session-${r()}`}function Ta(r,e=!1){const t={};return(!e||r?.hasWorktree)&&r?.worktreePath&&(t.cwd=r.worktreePath,t.worktreeBranch=r.worktreeBranch),r?.baseBranch&&(t.baseBranch=r.baseBranch),r?.featureId&&(t.featureId=r.featureId),Object.keys(t).length>0?t:void 0}function S1(r){if(r.file_path)return String(r.file_path);if(r.path)return String(r.path);if(r.command)return String(r.command).slice(0,50);if(r.pattern)return String(r.pattern);for(const e of Object.values(r))if(typeof e=="string"&&e.length<100)return e;return""}function jR(r){switch(r){case 1e3:return"Normal closure";case 1001:return"Endpoint is going away (server shutdown or page navigation)";case 1002:return"Protocol error";case 1003:return"Unsupported data";case 1005:return"No status code received from peer (close frame had no code)";case 1006:return"Abnormal closure (connection dropped without close frame)";case 1007:return"Invalid payload data";case 1008:return"Policy violation";case 1009:return"Message too big";case 1010:return"Missing required extension";case 1011:return"Internal server error";case 1012:return"Service restart";case 1013:return"Try again later (temporary overload)";case 1015:return"TLS handshake failure";default:return r>=4e3&&r<=4999?"Application-specific close code":"Unknown close code"}}function YR(r,e){const t=[];return r.reason?t.push(r.reason):t.push(jR(r.code)),e?.lastServerError?t.push(`Last server error: ${e.lastServerError}`):e?.lastSocketError&&t.push(`Last socket error: ${e.lastSocketError}`),t.push(`wasClean: ${r.wasClean?"yes":"no"}`),t.join(" | ")}function Nm(r,e="Permission"){const t=r||"",n=t.match(/write to (.+?)(?:[\s,?]|$)/i),s=t.match(/read (.+?)(?:[\s,?]|$)/i),i=t.match(/run (.+?)(?:[?,]|$)/i);return n?.[1]?{tool:"Write",description:t,filePath:n[1].trim()}:s?.[1]?{tool:"Read",description:t,filePath:s[1].trim()}:i?.[1]?{tool:"Bash",description:t,command:i[1].trim()}:{tool:e,description:t}}function FR(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function UR(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function yc(r,e){return`${r}:${e}`}function da(r,e){for(const t of r)if(t.type==="tool_use"){const n=t;(n.status==="running"||n.status==="pending")&&(n.status=e)}}function GR(){const r=new Map;function e(a,l,c){r.set(a,{featureId:l,queue:[...c]})}function t(a){a?r.delete(a):r.clear()}function n(a){return r.get(a)}function s(a){const l=r.get(a);if(!l||l.queue.length===0)return null;const c=l.queue.shift();return l.queue.length===0&&r.delete(a),{featureId:l.featureId,step:c}}function i(a){return r.has(a)}function o(){return r.size}return{enable:e,disable:t,get:n,popNextStep:s,has:i,size:o}}function $1(r,e=Ht){return{id:e(),type:"session_init",model:r.model,tools:r.tools,permissionMode:r.permissionMode,cwd:r.cwd}}function C1(r,e=Ht){return{id:r.blockId||e(),type:"text",text:r.text||""}}function Q1(r,e=Ht){return{id:r.blockId||e(),type:"thinking",thinking:r.thinking||""}}function P1(r,e=Ht){if(!r.toolUseId||!r.name)return null;const t=r.blockId||e();return{block:{id:t,type:"tool_use",toolUseId:r.toolUseId,name:r.name,input:{},inputSummary:"",status:"running"},tracking:{blockId:t,toolUseId:r.toolUseId,name:r.name,inputJson:""},index:r.index??0}}function T1(r,e=Ht){return{id:e(),type:"tool_result",toolUseId:r.toolUseId,content:r.content||"",isError:!!r.isError}}function M1(r,e=Ht){return r.subtype!=="success"||!r.usage?null:{id:e(),type:"result_summary",totalCostUsd:r.totalCostUsd??0,durationMs:r.durationMs??0,numTurns:r.numTurns??0,usage:r.usage}}function hl(r,e,t){if(e!==void 0){const n=r.get(e);if(n)return n}if(t){for(const[,n]of r)if(n.blockId===t)return n}}function HR(r,e=Ht){const t=[],n=new Map,s=[];let i="",o=null,a=null,l="streaming",c=!1;for(const u of r){if(u.type==="done"){u.denied?(da(t,"error"),l="stopped"):l==="error"||l==="stopped"?da(t,"error"):(da(t,"complete"),l="complete"),c=!0;continue}if(u.type==="error"){da(t,"error"),l="error";continue}if(u.type!=="ui_event"||!u.event)continue;const h=u.event;switch(h.sessionId&&s.push(h.sessionId),h.type){case"session_init":{t.push($1(h,e));break}case"block_start":{if(h.blockType==="text"){const f=C1(h,e);t.push(f),o=f.id,h.text&&(i+=h.text)}else if(h.blockType==="thinking"){const f=Q1(h,e);t.push(f),a=f.id}else if(h.blockType==="tool_use"){const f=P1(h,e);f&&(t.push(f.block),n.set(f.index,f.tracking))}break}case"block_delta":{if(h.text&&o){const f=t.find(p=>p.id===o);f&&f.type==="text"&&(f.text+=h.text,i+=h.text)}if(h.thinking&&a){const f=t.find(p=>p.id===a);f&&f.type==="thinking"&&(f.thinking+=h.thinking)}if(h.partialJson){const f=hl(n,h.index,h.blockId);f&&(f.inputJson+=h.partialJson)}break}case"block_end":{const f=hl(n,h.index,h.blockId);if(!f)o&&(o=null),a&&(a=null);else{let p={};try{p=JSON.parse(f.inputJson)}catch{}const g=t.find(O=>O.id===f.blockId);if(g&&g.type==="tool_use"){const O=g;O.input=p,O.inputSummary=S1(p),O.status="pending"}}break}case"tool_result":{const f=t.find(p=>p.type==="tool_use"&&p.toolUseId===h.toolUseId);f&&f.type==="tool_use"&&(f.status=h.isError?"error":"complete"),t.push(T1(h,e));break}case"turn_result":{h.subtype!=="success"&&(l="error");const f=M1(h,e);f&&t.push(f);break}case"error":{l="error";break}}}return{contentBlocks:t,flatText:i,currentTextBlockId:o,currentThinkingBlockId:a,activeTools:n,finalStatus:l,isDone:c,providerSessionIds:s}}function KR(r,e,t=Date.now){return{ws:r,currentMessageId:"",conversationId:e,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:t(),lastServerError:null,lastSocketError:null,isReplaying:!1,replayBuffer:[]}}function kc(r,e,t){const n=r.get(e);return!!n&&n.ws!==t}function JR(r,e){const t=r.get(e);return t?t.ws.readyState===WebSocket.OPEN?{kind:"open",conn:t}:{kind:"stale",conn:t}:{kind:"none"}}const mt=new Map;let fa=0;const As=GR(),ma=new Set,eB=3e4,A1=18e4,tB=Math.round(A1/1e3);function Ml(){const r=vr(),e=bo();fa++;function t(T){const D=r.conversations.find(B=>B.id===T)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${D} response completed.`,tag:`chat-complete-${T}`})}async function n(T){if(!(typeof window>"u"||typeof Notification>"u")&&!FR()){if(Notification.permission==="granted"){t(T);return}if(Notification.permission==="default")try{await Notification.requestPermission()==="granted"&&t(T)}catch(M){console.warn("[useChatStream] Failed to request browser notification permission:",M)}}}function s(T){T.healthCheckInterval&&(clearInterval(T.healthCheckInterval),T.healthCheckInterval=null)}function i(T){s(T),T.lastMessageTime=Date.now(),T.healthCheckInterval=Lu(()=>{const M=T.conversationId;if(T.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${M}`),s(T),r.isConversationStreaming(M)&&(c(T.currentMessageId,M,"error"),r.updateMessage(T.currentMessageId,{status:"error"},M),r.setSessionError("Connection lost during streaming",M),r.endSession(M),r.endConversationStreaming(M)),mt.delete(M);return}if(r.isConversationStreaming(M)){const D=Date.now()-T.lastMessageTime;D>A1&&(console.warn(`[useChatStream] Health check: streaming timeout for ${M} (${Math.round(D/1e3)}s)`),s(T),c(T.currentMessageId,M,"error"),r.updateMessage(T.currentMessageId,{status:"error"},M),r.setSessionError(`Streaming timed out — no response from server for ${tB} seconds`,M),r.endSession(M),r.endConversationStreaming(M),T.ws.close(),mt.delete(M))}},eB)}function o(T,M){return r.conversations.find(B=>B.id===T)?.messages.find(B=>B.id===M)?.status}function a(T,M=!0){const D=mt.get(T);D&&(s(D),M&&D.ws.readyState===WebSocket.OPEN&&D.ws.close(),mt.delete(T))}function l(T,M,D){!D||!T.currentTextBlockId||(r.updateBlockWithSave(T.currentMessageId,T.currentTextBlockId,B=>{B.type==="text"&&(B.text+=D)},M,{syncContent:!1}),r.appendToMessage(T.currentMessageId,D,M))}function c(T,M,D){const xe=r.conversations.find(Re=>Re.id===M)?.messages.find(Re=>Re.id===T);if(xe?.contentBlocks)for(const Re of xe.contentBlocks)Re.type==="tool_use"&&(Re.status==="running"||Re.status==="pending")&&r.updateBlockById(T,Re.id,Me=>{Me.type==="tool_use"&&(Me.status=D)},M)}async function u(T){try{(await h(T)).send(JSON.stringify({type:"reset_context"})),r.clearProviderSession(T),console.log("[useChatStream] Context reset requested for conversation:",T)}catch(M){throw console.error("[useChatStream] Failed to reset context:",M),M}}function h(T){return new Promise((M,D)=>{let B=!1;const xe=q=>{B||(B=!0,M(q))},Re=q=>{B||(B=!0,D(q))},Me=JR(mt,T);if(Me.kind==="open"){xe(Me.conn.ws);return}Me.kind==="stale"&&(Me.conn.ws.close(),mt.delete(T));const ue=UR(),ne=new WebSocket(ue),Ce=KR(ne,T);mt.set(T,Ce),ne.onopen=()=>{xe(ne)},ne.onerror=q=>{if(console.error(`[useChatStream] WebSocket error for conversation ${T}:`,q),kc(mt,T,ne))return;const ve=mt.get(T);ve&&(ve.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),r.isConversationStreaming(T)&&(ve?.currentMessageId&&(c(ve.currentMessageId,T,"error"),r.updateMessage(ve.currentMessageId,{status:"error"},T)),r.setSessionError("Connection error during streaming",T),r.endSession(T),r.endConversationStreaming(T)),mt.delete(T),Re(new Error("WebSocket connection failed. Server may be unavailable."))},ne.onclose=q=>{if(kc(mt,T,ne))return;const ve=mt.get(T);if(ve&&s(ve),mt.delete(T),As.disable(T),!B){Re(new Error(`WebSocket closed before connection was established (code: ${q.code})`));return}if(r.isConversationStreaming(T)){ve?.currentMessageId&&(c(ve.currentMessageId,T,"error"),r.updateMessage(ve.currentMessageId,{status:"error"},T));const Ze=YR(q,ve);r.setSessionError(`Connection closed: ${Ze} (code: ${q.code})`,T),r.endSession(T),r.endConversationStreaming(T)}},ne.onmessage=q=>{kc(mt,T,ne)||g(q.data,T)}})}async function f(T,M=3){for(let D=0;D<M;D++){const B=r.conversations.find(xe=>xe.id===T);if(B)return B;D<M-1&&await new Promise(xe=>setTimeout(xe,100))}console.error("[useChatStream] Conversation not found after retries:",T)}function p(T,M){const D=r.conversations.find(xe=>xe.id===T);if(!D)return null;const B=D.messages.findIndex(xe=>xe.id===M);if(B<=0)return null;for(let xe=B-1;xe>=0;xe--){const Re=D.messages[xe];if(Re.role==="user"&&Re.content.trim().length>0)return Re.content}return null}async function g(T,M){const D=mt.get(M);if(D){D.lastMessageTime=Date.now();try{r.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:T},M);const B=JSON.parse(T);if(r.pushDebugEvent({direction:"in",channel:"ws",eventType:B.type,payload:B},M),D.isReplaying&&((B.type==="ui_event"||B.type==="done"||B.type==="error")&&D.replayBuffer.push(B),B.type!=="replay_end"))return;if(B.type==="error")return await Q(B,D,M),void 0;if(B.type==="done"){await L(B,D,M);return}if(B.type==="pong")return;if(B.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${M}:`,B.reason),r.setProviderSessionId("",M),W(D.currentMessageId,`
|
|
40
|
+
|
|
41
|
+
> **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
|
|
42
|
+
|
|
43
|
+
`,M);return}if(B.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${M}`),W(D.currentMessageId,`
|
|
44
|
+
|
|
45
|
+
> **Worktree recovered**: The work directory was restored after a system restart.
|
|
46
|
+
|
|
47
|
+
`,M);return}if(B.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${M}`);return}if(B.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${M}`);return}if(B.type==="subscribed"){console.log(`[useChatStream] Subscribed to ${M}`,B.jobId?`(job: ${B.jobId}, status: ${B.jobStatus})`:"(no active job)"),B.jobId||(r.endSession(M),r.endConversationStreaming(M));return}if(B.type==="replay_start"){console.log(`[useChatStream] Replay start for ${M}: ${B.eventCount} events from job ${B.jobId}`),D.isReplaying=!0,D.replayBuffer=[];return}if(B.type==="replay_end"){console.log(`[useChatStream] Replay end for ${M}: nextCursor=${B.nextCursor}`),Z(D,M),D.isReplaying=!1,D.replayBuffer=[];return}if(B.type==="notification"){j(B);return}if(B.type==="permission_request"){x(B,D,M);return}if(B.type==="permission_prompt"&&B.text){k(B,D,M);return}B.type==="ui_event"&&B.event?V(B.event,M):B.type==="provider_json"&&B.data}catch(B){console.error(`[useChatStream] Failed to parse WebSocket message for ${M}:`,B,"Raw data:",T?.slice(0,200)),c(D.currentMessageId,M,"error"),r.updateMessage(D.currentMessageId,{status:"error"},M),r.setSessionError(`Failed to parse server response: ${B instanceof Error?B.message:"Invalid JSON"}`,M),r.endSession(M),r.endConversationStreaming(M),be(M),r.saveConversation(M,!0),a(M)}}}function O(T,M,D){if(T.text&&M.currentTextBlockId&&l(M,D,T.text),T.thinking&&M.currentThinkingBlockId&&r.updateBlockWithSave(M.currentMessageId,M.currentThinkingBlockId,B=>{B.type==="thinking"&&(B.thinking+=T.thinking)},D,{syncContent:!1}),T.partialJson){const B=hl(M.activeTools,T.index,T.blockId);B&&(B.inputJson+=T.partialJson)}}function b(T,M,D){const B=hl(M.activeTools,T.index,T.blockId);if(!B){M.currentTextBlockId&&(M.currentTextBlockId=null),M.currentThinkingBlockId&&(M.currentThinkingBlockId=null);return}let xe={};try{xe=JSON.parse(B.inputJson)}catch{}if(B.name==="ExitPlanMode"){const Re={allowedPrompts:xe.allowedPrompts};r.setPendingPlanApproval(Re,D)}r.updateBlockWithSave(M.currentMessageId,B.blockId,Re=>{if(Re.type==="tool_use"){const Me=Re;Me.input=xe,Me.inputSummary=S1(xe),Me.status="pending"}},D)}function x(T,M,D){s(M),r.endConversationStreaming(D);const B=Nm(T.description||"",T.tool||"Permission");r.setPendingPermission(B,D);let xe=`
|
|
48
|
+
|
|
49
|
+
**Permission Required**: ${B.tool}`;B.filePath&&(xe+=` - ${B.filePath}`),W(M.currentMessageId,xe+`
|
|
50
|
+
`,D)}function k(T,M,D){s(M),r.endConversationStreaming(D);const B=Nm(T.text||"","Permission");r.setPendingPermission(B,D);const xe=`
|
|
51
|
+
|
|
52
|
+
**${B.tool}**: ${B.filePath||B.command||B.description}
|
|
53
|
+
`;W(M.currentMessageId,xe,D)}const w=/codex cannot access session files|failed to clean up stale arg0 temp dirs: Permission denied|failed to initialize rollout recorder: Permission denied|failed to create session: Permission denied|\/\.codex\/.*permission denied/i,S=/state db missing rollout path for thread/i;async function Q(T,M,D){console.error(`[useChatStream] Server error for ${D}:`,T.error);const B=T.error||"Unknown server error";M.lastServerError=B;const xe=w.test(B);if(S.test(B)&&!xe){const Me=yc(D,M.currentMessageId);if(!ma.has(Me)){const ue=p(D,M.currentMessageId);if(ue){ma.add(Me),r.setProviderSessionId("",D),W(M.currentMessageId,`
|
|
54
|
+
|
|
55
|
+
> **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
|
|
56
|
+
|
|
57
|
+
`,D);try{const ne=r.conversations.find(q=>q.id===D),Ce=Ta(ne);return await N(ue,M.currentMessageId,D,Ce),!0}catch(ne){console.error(`[useChatStream] Rollout-path recovery retry failed for ${D}:`,ne)}}}}return s(M),c(M.currentMessageId,D,"error"),r.updateMessage(M.currentMessageId,{status:"error"},D),S.test(B)&&r.setProviderSessionId("",D),ma.delete(yc(D,M.currentMessageId)),r.setSessionError(B,D),r.endSession(D),r.endConversationStreaming(D),be(D),r.saveConversation(D,!0),a(D),!1}async function L(T,M,D){s(M);const B=o(D,M.currentMessageId);if(ma.delete(yc(D,M.currentMessageId)),T.denied){c(M.currentMessageId,D,"error"),r.updateMessage(M.currentMessageId,{status:"stopped"},D),E(M,D);return}if(B==="error"||B==="stopped"){c(M.currentMessageId,D,"error"),E(M,D);return}c(M.currentMessageId,D,"complete"),r.completeMessageWithSave(M.currentMessageId,D),r.endSession(D),r.endConversationStreaming(D),n(D);const xe=await f(D),Re=G(xe,D,M),Me=As.popNextStep(D);Me&&Re.then(()=>{setTimeout(()=>{K(D,Me.featureId,Me.step)},1500)}),r.clearPendingPermission(D),r.saveConversation(D,!0),M.activeTools.clear()}function E(T,M){r.endSession(M),r.endConversationStreaming(M),be(M),r.clearPendingPermission(M),T.activeTools.clear(),r.saveConversation(M,!0)}function G(T,M,D){return!T?.hasWorktree||!T.worktreePath?Promise.resolve():$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:T.worktreePath,conversationId:M,previousBranch:T.worktreeBranch}}).then(B=>T.previewBranch&&T.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:T.previewBranch,worktreePath:T.worktreePath}}).then(xe=>{if(!xe.success)throw new Error(xe.error||"Unknown preview sync failure");return B}):B).then(async B=>{if(B?.success&&B.currentBranch!==T.worktreeBranch){const xe=T.worktreeBranch||"unknown";r.updateWorktreeBranch(M,B.currentBranch);const Re=await r.syncConversationFeatureFromBranch(M),Me=B.deletedPreviousBranch?` and deleted \`${xe}\``:"",ue=Re?` and linked to feature \`${Re}\``:"";W(D.currentMessageId,`
|
|
58
|
+
|
|
59
|
+
> **Branch changed**: AI switched from \`${xe}\` to \`${B.currentBranch}\`${Me}${ue}
|
|
60
|
+
|
|
61
|
+
`,M)}else B?.success&&T.worktreeBranch&&r.updateWorktreeBranch(M,T.worktreeBranch);return r.saveConversation(M,!1),B}).catch(B=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",B)})}let oe=null;const ie=500;function j(T){const M=T.notificationEvent,D=T.source;console.log(`[useChatStream] Global notification: ${M}`,{jobId:T.jobId,conversationId:T.conversationId,source:D,status:T.status}),(M==="job_created"&&D!=="user"||M==="job_completed"||M==="job_persisted")&&(oe&&clearTimeout(oe),oe=setTimeout(()=>{oe=null,r.refreshServerConversations()},ie))}function V(T,M){const D=mt.get(M);if(D)switch(r.pushDebugEvent({direction:"in",channel:"ui",eventType:T.type,payload:T},M),T.sessionId&&r.setProviderSessionId(T.sessionId,M),T.type){case"session_init":{U(D.currentMessageId,M),r.appendContentBlockWithSave(D.currentMessageId,$1(T),M);break}case"block_start":{if(U(D.currentMessageId,M),T.blockType==="text"){const B=C1(T);r.appendContentBlockWithSave(D.currentMessageId,B,M),D.currentTextBlockId=B.id}else if(T.blockType==="thinking"){const B=Q1(T);r.appendContentBlockWithSave(D.currentMessageId,B,M),D.currentThinkingBlockId=B.id}else if(T.blockType==="tool_use"){const B=P1(T);B&&(r.appendContentBlockWithSave(D.currentMessageId,B.block,M),D.activeTools.set(B.index,B.tracking))}break}case"block_delta":{O(T,D,M);break}case"block_end":{b(T,D,M);break}case"tool_result":{U(D.currentMessageId,M);const B=r.findToolUseBlock(D.currentMessageId,T.toolUseId,M);B&&B.type==="tool_use"&&r.updateBlockById(D.currentMessageId,B.id,xe=>{xe.type==="tool_use"&&(xe.status=T.isError?"error":"complete")},M),r.appendContentBlockWithSave(D.currentMessageId,T1(T),M);break}case"permission_request":{s(D),r.endConversationStreaming(M);const B={tool:T.tool,description:T.description,input:T.input,tools:T.tools};r.setPendingPermission(B,M),W(D.currentMessageId,`
|
|
62
|
+
|
|
63
|
+
**Permission Required**: ${B.tool}
|
|
64
|
+
`,M);break}case"turn_result":{T.subtype!=="success"&&(r.updateMessage(D.currentMessageId,{status:"error"},M),be(M),T.subtype==="max_turns"?r.setSessionError("Maximum conversation turns reached. Please start a new conversation.",M):r.setSessionError("Provider reported an execution error.",M));const B=M1(T);B&&(U(D.currentMessageId,M),r.appendContentBlockWithSave(D.currentMessageId,B,M));break}case"error":{r.updateMessage(D.currentMessageId,{status:"error"},M),r.setSessionError(T.error,M);break}}}function Z(T,M){const D=T.replayBuffer;if(D.length===0)return;const B=HR(D);for(const xe of B.providerSessionIds)r.setProviderSessionId(xe,M);r.batchSetMessageBlocks(T.currentMessageId,B.contentBlocks,B.flatText,B.finalStatus,M),T.currentTextBlockId=B.currentTextBlockId,T.currentThinkingBlockId=B.currentThinkingBlockId,T.activeTools=B.activeTools,B.isDone&&(s(T),r.endSession(M),r.endConversationStreaming(M),n(M)),console.log(`[useChatStream] Replay batch processed: ${D.length} events → ${B.contentBlocks.length} blocks, status=${B.finalStatus}`)}function U(T,M){r.initContentBlocks(T,M)}function W(T,M,D){U(T,D);const B={id:Ht(),type:"text",text:M};r.appendContentBlockWithSave(T,B,D)}async function N(T,M,D,B){if(typeof window>"u")return;const xe=qR();try{const Re=await h(D),Me=mt.get(D);Me&&(Me.currentMessageId=M,Me.activeTools.clear(),Me.currentTextBlockId=null,Me.currentThinkingBlockId=null,i(Me)),WR(T)&&r.setProviderSessionId("",D);const ne=r.getProviderSessionId(D),Ce=r.conversations.find(it=>it.id===D),q=Ce?.providerId||e.providerSelection.providerId||tp,ve=Ce?.providerModelKey||e.providerSelection.modelKey||ep;Ce&&(!Ce.providerId||!Ce.providerModelKey)&&(r.setConversationProviderSelection(D,q,ve),r.saveConversation(D,!0));const Ze={type:"chat",message:T,attachments:B?.attachments,requestId:xe,sessionId:ne||void 0,permissionMode:r.permissionMode,conversationId:D,cwd:B?.cwd,worktreeBranch:B?.worktreeBranch,baseBranch:B?.baseBranch,featureId:B?.featureId,providerId:q,providerModelKey:ve};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:Ze},D),Re.send(JSON.stringify(Ze))}catch(Re){r.updateMessage(M,{status:"error"},D),r.setSessionError(Re.message||"Connection failed",D),r.endSession(D),r.endConversationStreaming(D),r.saveConversation(D,!0),a(D)}}function I(T,M){const D=M??r.activeConversationId;if(!D)return;const B=mt.get(D);if(!B||B.ws.readyState!==WebSocket.OPEN)return;const xe={type:"permission_response",allow:T};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:xe},D),B.ws.send(JSON.stringify(xe)),T&&(r.startConversationStreaming(D),i(B));const Re=T?"Allowed":"Denied";W(B.currentMessageId,`${Re}
|
|
65
|
+
`,D),r.clearPendingPermission(D)}function z(T,M,D){As.enable(M,T,D)}function be(T){As.disable(T)}async function K(T,M,D){r.activeConversationId!==T&&r.selectConversation(T);const B=r.conversations.find(ue=>ue.id===T);let xe;if(D.startsWith("skill:")){const ue=D.replace("skill:","");try{xe=(await $fetch(`/api/skills/${ue}/prompt`,{method:"POST",body:{featureId:M,cwd:B?.worktreePath}})).prompt}catch(ne){console.error(`[useChatStream] Failed to render skill prompt for ${ue}:`,ne);return}}else xe=`/speckit.${D} ${M}`;r.addUserMessage(xe,T),r.saveConversation(T,!0);const Re=r.addAssistantMessage(T);r.startSession(zm(),T),r.startConversationStreaming(T);const Me=Ta(B);await N(xe,Re.id,T,Me)}async function H(T,M,D=0){if(!(typeof window>"u"))try{const B=await h(T),xe=mt.get(T);xe&&(xe.currentMessageId=M,xe.activeTools.clear(),xe.currentTextBlockId=null,xe.currentThinkingBlockId=null,i(xe)),r.startConversationStreaming(T);const Re={type:"subscribe",conversationId:T,cursor:D};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"subscribe",payload:Re},T),B.send(JSON.stringify(Re))}catch(B){console.error(`[useChatStream] Failed to subscribe to ${T}:`,B),r.setSessionError(B.message||"Subscribe failed",T)}}function re(T){const M=T??r.activeConversationId;if(!M)return;const D=mt.get(M);if(D){if(D.ws.readyState===WebSocket.OPEN){const B={type:"abort"};r.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:B},M),D.ws.send(JSON.stringify(B)),D.ws.close()}D.currentMessageId&&(c(D.currentMessageId,M,"error"),r.updateMessage(D.currentMessageId,{status:"stopped"},M),r.endSession(M),r.saveConversation(M,!0)),mt.delete(M)}r.endConversationStreaming(M),r.clearPendingPermission(M),be(M)}function Oe(T){const M=mt.get(T);M&&(s(M),M.ws.close(),mt.delete(T)),As.disable(T)}function ge(){for(const[T,M]of mt)s(M),M.ws.close(),mt.delete(T);As.disable()}async function $e(T){const M=T??r.activeConversationId;if(!M)return;r.clearPendingPlanApproval(M),r.setPermissionMode("auto");const D="Approved. Proceed with the implementation.";r.addUserMessage(D,M),r.saveConversation(M,!0);const B=r.addAssistantMessage(M);r.startSession(zm(),M),r.startConversationStreaming(M);const xe=r.conversations.find(Me=>Me.id===M),Re=Ta(xe,!0);await N(D,B.id,M,Re)}function Pe(T){const M=T??r.activeConversationId;M&&r.clearPendingPlanApproval(M)}async function Fe(T){if(typeof window>"u")return!1;try{const M=await $fetch("/api/jobs",{params:{conversationId:T}}),B=M.find(Me=>Me.status==="running"||Me.status==="waiting_permission"||Me.status==="queued")||[...M].sort((Me,ue)=>ue.eventCount-Me.eventCount).find(Me=>Me.eventCount>0),xe=r.conversations.find(Me=>Me.id===T);if(!xe)return!1;const Re=[...xe.messages].reverse().find(Me=>Me.role==="assistant");return B?!Re||Re.status!=="streaming"?!1:(console.log("[useChatStream] Resuming streaming for",T,"job:",B.id,"status:",B.status,"events:",B.eventCount),r.resetMessageForReplay(Re.id,T),r.startSession(`resume-${Date.now()}`,T),await H(T,Re.id,0),!0):(Re&&Re.status==="streaming"&&(r.updateMessage(Re.id,{status:"error"},T),r.setSessionError("Streaming was interrupted (server job no longer active)",T)),!1)}catch(M){return console.error("[useChatStream] Failed to resume streaming:",M),!1}}return wt(()=>{fa--,fa<=0&&(fa=0,ge())}),{sendMessage:N,sendPermissionResponse:I,subscribe:H,tryResumeStreaming:Fe,approvePlan:$e,rejectPlan:Pe,abort:re,disconnect:ge,disconnectConversation:Oe,enableCascade:z,disableCascade:be,resetContext:u}}const rB=/^[0-9a-f]{7,40}$/i;function Bo(r){if(typeof r!="string")return!1;const e=r.trim();return e.length>0&&e!=="HEAD"&&!e.startsWith("sc/")&&!rB.test(e)}function Xh(r,e){const t=e.map(s=>s.trim()).filter(Boolean),n=r?.trim()||"";return n&&t.includes(n)&&Bo(n)?n:t.includes("main")?"main":t.includes("master")?"master":t[0]||null}function _1(r){return Bo(r)?r.trim():"Loading branches..."}function Ih(r){const e=[r.name,r.ref];for(const t of e){if(typeof t!="string")continue;const n=t.trim();if(!n)continue;const s=n.startsWith("refs/heads/")?n.slice(11):n;if(Bo(s))return s}return null}const nB={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},sB={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},iB=["disabled"],oB={class:"px-4 py-4 space-y-3"},aB={class:"relative"},lB=["disabled"],cB={key:0,value:""},uB=["value"],hB={key:0,class:"text-xs font-mono text-retro-red"},dB={key:1,class:"text-xs font-mono text-retro-muted"},fB={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},mB=["disabled"],pB=["disabled"],Tu=Ve({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean}},emits:["close","create"],setup(r,{emit:e}){const t=r,n=e,s=P([]),i=P(""),o=P(!1),a=P(""),l=J(()=>!o.value&&!t.creating&&i.value.length>0&&s.value.length>0);async function c(){o.value=!0,a.value="";try{const{cwd:h}=await $fetch("/api/cwd"),p=(await $fetch("/api/git/branches",{query:{excludeSc:!0,workingDirectory:h}})).branches.filter(O=>!O.isRemote).map(Ih).filter(O=>!!O),g=Array.from(new Set(p)).sort((O,b)=>{const x=w=>w==="main"?0:w==="master"?1:2,k=x(O)-x(b);return k!==0?k:O.localeCompare(b,void 0,{sensitivity:"base"})});if(s.value=g,!g.length){i.value="",a.value="No local branches available for chat creation.";return}i.value=Xh("main",g)||g[0]}catch(h){s.value=[],i.value="",a.value=h instanceof Error?h.message:"Failed to load branches"}finally{o.value=!1}}ze(()=>t.show,h=>{h&&c()});function u(){l.value&&n("create",i.value)}return(h,f)=>(v(),pe(Pr,{to:"body"},[ee(On,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ut(()=>[r.show?(v(),y("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:f[3]||(f[3]=kr(p=>n("close"),["self"]))},[d("div",nB,[d("div",sB,[f[4]||(f[4]=d("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"New Conversation",-1)),d("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:r.creating,onClick:f[0]||(f[0]=p=>n("close"))},[ee(m(St),{class:"w-4 h-4"})],8,iB)]),d("div",oB,[f[5]||(f[5]=d("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),d("div",aB,[je(d("select",{"onUpdate:modelValue":f[1]||(f[1]=p=>i.value=p),disabled:o.value||r.creating||s.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[o.value?(v(),y("option",cB,"Loading branches...")):F("",!0),(v(!0),y(we,null,Ne(s.value,p=>(v(),y("option",{key:p,value:p},A(p),9,uB))),128))],8,lB),[[ks,i.value]]),ee(m(Ru),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})]),a.value?(v(),y("p",hB,A(a.value),1)):(v(),y("p",dB," The conversation worktree will be created from the selected branch. "))]),d("div",fB,[d("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",disabled:r.creating,onClick:f[2]||(f[2]=p=>n("close"))}," Cancel ",8,mB),d("button",{type:"button",disabled:!l.value,class:"px-3 py-1.5 text-xs font-mono rounded border bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:u},A(r.creating?"Creating...":"Create"),9,pB)])])])):F("",!0)]),_:1})]))}}),gB={class:"h-full flex flex-col bg-retro-black"},OB={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},vB={class:"flex items-center gap-1"},bB={class:"flex-shrink-0 px-3 pt-3"},xB={class:"relative"},yB={class:"flex-1 overflow-y-auto p-3"},kB={class:"space-y-2"},wB={key:0,class:"flex items-center justify-center py-12"},SB={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},$B={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},Wm=Ve({__name:"FeaturesPanel",setup(r){const e=vr(),t=ml(),{sendMessage:n,enableCascade:s}=Ml(),i=vo(),o=P("features"),a=P(null),l=P(null),c=P([]),u=P([]),h=P(!1),f=P({}),p=P(!1),g=P(null),O=P(!1),b=P(!1),x=P(!1),k=P(null),w=P(""),S=P("");let Q=null;ze(w,ue=>{Q&&clearTimeout(Q),Q=setTimeout(()=>{S.value=ue},300)});const L=J(()=>{const ue=S.value.trim().toLowerCase();return ue?c.value.filter(ne=>ne.name.toLowerCase().includes(ue)||ne.id.toLowerCase().includes(ue)):c.value}),E=P({}),G=J(()=>{const ue=e.activeConversation;if(!ue)return null;if(ue.featureId)return ue.featureId;const ne=ue.worktreeBranch?.trim();return ne&&c.value.some(Ce=>Ce.id===ne)?ne:null}),oe=J(()=>G.value||a.value);ze(()=>e.activeConversationId,()=>{a.value=null;const ue=G.value;t.setSelectedFeatureId(ue),ue&&It(()=>{const ne=E.value[ue];ne&&ne.scrollIntoView({behavior:"auto",block:"nearest"})})}),ze(a,ue=>{ue&&It(()=>{const ne=E.value[ue];ne&&ne.scrollIntoView({behavior:"auto",block:"nearest"})})});async function ie(){h.value=!0;try{const ue=await $fetch("/api/specs/features");c.value=ue.features,j(ue.features)}catch{i.error("Failed to load features"),c.value=[],f.value={}}finally{h.value=!1}}async function j(ue){if(ue.length===0){f.value={};return}const ne=await Promise.allSettled(ue.map(async q=>{const ve=await $fetch(`/api/specs/traceability/${q.id}`),Ze=ve.alerts.filter(Nt=>Nt.severity==="critical").length,it=ve.alerts.filter(Nt=>Nt.severity==="major").length;return{featureId:q.id,critical:Ze,major:it}})),Ce={};for(const q of ne)q.status==="fulfilled"&&(Ce[q.value.featureId]={critical:q.value.critical,major:q.value.major});f.value=Ce}async function V(){try{const ue=await $fetch("/api/skills");u.value=ue.skills}catch{u.value=[]}}gt(()=>{ie(),V(),window.addEventListener("keydown",W)}),wt(()=>{window.removeEventListener("keydown",W)});function Z(ue,ne={}){if(a.value=ue,l.value=null,o.value="files",t.setSelectedFeatureId(ue),ne.openViewer!==!1){const Ce=c.value.find(q=>q.id===ue);Ce&&(g.value=Ce,p.value=!0)}}function U(){p.value=!1,g.value=null}function W(ue){(ue.ctrlKey||ue.metaKey)&&ue.key.toLowerCase()==="k"&&(ue.preventDefault(),O.value||(O.value=!0))}function N(){O.value=!1}function I(ue){Z(ue,{openViewer:!1}),O.value=!1}function z(){O.value=!0}const be=J(()=>c.value.map(ue=>ue.id));function K(ue){return f.value[ue]??{critical:0,major:0}}const H={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},re={analyze:["skill:better-spec"]};async function Oe(ue,ne,Ce){if(ue.startsWith("skill:")){const q=ue.replace("skill:",""),ve=Ce?e.conversations.find(it=>it.id===Ce):null;return(await $fetch(`/api/skills/${q}/prompt`,{method:"POST",body:{featureId:ne,cwd:ve?.worktreePath}})).prompt}return`/speckit.${ue} ${ne}`}function ge(ue,ne){if(ne)return null;const Ce=e.findConversationByFeature(ue);return Ce&&!e.isConversationStreaming(Ce.id)&&!Ce.finalized?(e.selectConversation(Ce.id),Ce.id):null}function $e(ue){const ne=e.findConversationByFeature(ue);return ne&&ne.finalized?(i.error(`This feature has a finalized conversation "${ne.title}". Please archive it first to start a new conversation.`),e.selectConversation(ne.id),!0):!1}async function Pe(ue,ne,Ce){const q=await e.createConversation({featureId:ue,baseBranch:Ce});if(!q)throw new Error("Failed to create conversation");return e.renameConversation(q,ne),e.selectConversation(q),q}async function Fe(ue,ne){e.addUserMessage(ne,ue),e.saveConversation(ue,!0);const Ce=e.conversations.find(Ze=>Ze.id===ue),q=e.addAssistantMessage(ue);e.startSession(`session-${Date.now()}`,ue),e.startConversationStreaming(ue);const ve={};Ce?.worktreePath&&(ve.cwd=Ce.worktreePath,ve.worktreeBranch=Ce.worktreeBranch),Ce?.featureId&&(ve.featureId=Ce.featureId),await n(ne,q.id,ue,Object.keys(ve).length>0?ve:void 0)}async function T(ue,ne,Ce){const q=re[ne];let ve;if(q&&q.length>0){const Ze=[...q.slice(1),ne,...H[ne]||[]];s(ue,Ce,Ze);const it=q[0];try{ve=await Oe(it,ue,Ce)}catch(Nt){i.error(Nt instanceof Error?Nt.message:"Failed to resolve prerequisite step");return}}else{const Ze=H[ne]||[];Ze.length>0&&s(ue,Ce,Ze),ve=`/speckit.${ne} ${ue}`}await Fe(Ce,ve)}async function M(ue,ne,Ce){const q=ue.shiftKey;if(!q&&$e(ne))return;const ve=ge(ne,q);if(ve){try{await T(ne,Ce,ve)}catch(Ze){i.error(Ze instanceof Error?Ze.message:"Failed to run cascade action")}return}k.value={type:"cascade",featureId:ne,command:Ce,title:`${Ce}: ${ne}`},b.value=!0}async function D(ue,ne){$e(ne)||(k.value={type:"open-chat",featureId:ne,title:`spec: ${ne}`},b.value=!0)}async function B(ue,ne,Ce){let q;try{const ve=e.conversations.find(Ze=>Ze.id===Ce);q=await $fetch(`/api/skills/${ne}/prompt`,{method:"POST",body:{featureId:ue,cwd:ve?.worktreePath}})}catch(ve){throw new Error(ve instanceof Error?ve.message:"Failed to render skill prompt")}await Fe(Ce,q.prompt)}async function xe(ue,ne,Ce){const q=ue.shiftKey;if(!q&&$e(ne))return;const ve=ge(ne,q);if(ve){try{await B(ne,Ce,ve)}catch(Ze){i.error(Ze instanceof Error?Ze.message:"Failed to run skill")}return}k.value={type:"skill",featureId:ne,skillId:Ce,title:`skill: ${Ce} — ${ne}`},b.value=!0}function Re(){b.value=!1,k.value=null}async function Me(ue){if(k.value){x.value=!0;try{const ne=k.value,Ce=await Pe(ne.featureId,ne.title,ue);ne.type==="cascade"?await T(ne.featureId,ne.command,Ce):ne.type==="skill"&&await B(ne.featureId,ne.skillId,Ce),b.value=!1,k.value=null}catch(ne){i.error(ne instanceof Error?ne.message:"Failed to create conversation")}finally{x.value=!1}}}return(ue,ne)=>{const Ce=B2,q=OR,ve=NR;return v(),y("div",gB,[d("div",OB,[ne[2]||(ne[2]=d("div",{class:"flex items-center gap-2 min-w-0"},null,-1)),d("div",vB,[d("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Search (Ctrl/Cmd+K)",onClick:z},[ee(m(fs),{class:"h-4 w-4"})]),d("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Refresh",onClick:ie},[ee(m(gs),{class:_e(["h-4 w-4",{"animate-spin":m(h)}])},null,8,["class"])])])]),d("div",bB,[d("div",xB,[ee(m(fs),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),je(d("input",{"onUpdate:modelValue":ne[0]||(ne[0]=Ze=>Je(w)?w.value=Ze:null),type:"text",placeholder:"Search features...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono rounded border border-retro-border bg-retro-panel text-retro-text placeholder:text-retro-subtle focus:outline-none focus:border-retro-cyan transition-colors"},null,512),[[Rt,m(w)]])])]),d("div",yB,[d("div",kB,[(v(!0),y(we,null,Ne(m(L),Ze=>(v(),y("div",{key:Ze.id,ref_for:!0,ref:it=>{m(E)[Ze.id]=it}},[ee(Ce,{feature:Ze,skills:m(u),"is-active":m(oe)===Ze.id,"critical-alerts":K(Ze.id).critical,"major-alerts":K(Ze.id).major,onSelect:ne[1]||(ne[1]=it=>Z(it,{openViewer:!0})),onCascade:M,onOpenChat:D,onSkill:xe},null,8,["feature","skills","is-active","critical-alerts","major-alerts"])]))),128))]),m(h)&&m(c).length===0?(v(),y("div",wB,[...ne[3]||(ne[3]=[d("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):F("",!0),!m(h)&&m(c).length>0&&m(L).length===0?(v(),y("div",SB,[ee(m(fs),{class:"h-10 w-10 text-retro-subtle mb-3"}),ne[4]||(ne[4]=d("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),ne[5]||(ne[5]=d("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):F("",!0),!m(h)&&m(c).length===0?(v(),y("div",$B,[ee(m(Tv),{class:"h-10 w-10 text-retro-subtle mb-3"}),ne[6]||(ne[6]=d("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),ne[7]||(ne[7]=d("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):F("",!0)]),m(p)&&m(g)?(v(),pe(q,{key:0,feature:m(g),onClose:U},null,8,["feature"])):F("",!0),m(O)?(v(),pe(ve,{key:1,"available-feature-ids":m(be),onClose:N,onSelect:I},null,8,["available-feature-ids"])):F("",!0),ee(Tu,{show:m(b),creating:m(x),onClose:Re,onCreate:Me},null,8,["show","creating"])])}}}),CB={class:"h-full flex flex-col bg-retro-black"},QB={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},PB={class:"flex items-center justify-between gap-2"},TB={class:"flex items-center gap-1"},MB={class:"relative"},AB=["placeholder"],_B={key:0,class:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-retro-yellow/10 border-b border-retro-yellow/30 text-xs"},RB={class:"text-retro-yellow font-mono"},BB={class:"flex-1 overflow-y-auto p-2"},ZB={key:0,class:"space-y-1"},EB={key:1,class:"text-center py-6 text-retro-muted"},DB={class:"font-mono text-xs"},LB={key:1,class:"text-center py-8 text-retro-muted"},XB={key:0,class:"space-y-2"},IB={class:"flex items-start justify-between gap-2"},VB={class:"min-w-0"},zB={class:"text-sm font-mono text-retro-text truncate"},NB={class:"text-xs text-retro-muted mt-1 truncate"},WB={class:"text-xs text-retro-muted/70 mt-1"},qB={class:"text-xs text-retro-muted/70"},jB={class:"flex items-center gap-1 flex-shrink-0"},YB=["onClick"],FB=["onClick"],UB={key:1,class:"text-center py-6 text-retro-muted"},GB={class:"font-mono text-xs"},HB={key:1,class:"text-center py-8 text-retro-muted"},qm=Ve({__name:"ConversationsPanel",setup(r){const e=vr(),t=vo(),n=P(""),s=P(""),i=P(!1),o=P(!1),a=P(!1),l=P(!1),c=P(null);let u=null;ze(n,N=>{u&&clearTimeout(u),u=setTimeout(()=>{s.value=N},180)},{immediate:!0}),wt(()=>{u&&(clearTimeout(u),u=null)});const h=new Map,f=new Map;ze(()=>e.sortedConversations.map(N=>N.id),N=>{const I=new Set(N);for(const z of h.keys())I.has(z)||h.delete(z)},{immediate:!0}),ze(()=>e.sortedArchivedConversations.map(N=>N.id),N=>{const I=new Set(N);for(const z of f.keys())I.has(z)||f.delete(z)},{immediate:!0});function p(N){const I=N.messages[N.messages.length-1];return[N.updatedAt,N.title,N.messages.length,I?.id||"",I?.content?.length||0].join("|")}function g(N){const I=N.messages[N.messages.length-1];return[N.updatedAt,N.archivedAt,N.title,N.messages.length,I?.id||"",I?.content?.length||0].join("|")}function O(N){const I=p(N),z=h.get(N.id);if(z&&z.signature===I)return z.text;const be=[N.title,...N.messages.map(K=>K.content||"")].join(`
|
|
66
|
+
`).toLowerCase();return h.set(N.id,{signature:I,text:be}),be}function b(N){const I=g(N),z=f.get(N.id);if(z&&z.signature===I)return z.text;const be=[N.title,...N.messages.map(K=>K.content||"")].join(`
|
|
67
|
+
`).toLowerCase();return f.set(N.id,{signature:I,text:be}),be}const x=J(()=>e.conversationViewMode==="archive"),k=J(()=>{const N=e.sortedConversations;if(!s.value.trim())return N;const I=s.value.toLowerCase().trim();return N.filter(z=>O(z).includes(I))}),w=J(()=>{const N=e.sortedArchivedConversations;if(!s.value.trim())return N;const I=s.value.toLowerCase().trim();return N.filter(z=>b(z).includes(I))}),S=J(()=>e.previewingConversationId);async function Q(){if(e.checkStorageLimits().atLimit){t.error("Delete or archive a conversation first (limit: 100).");return}i.value=!0}async function L(N){o.value=!0;try{if(!await e.createConversation({baseBranch:N})){t.error("Failed to create conversation");return}i.value=!1}catch(I){t.error(I instanceof Error?I.message:"Failed to create conversation")}finally{o.value=!1}}function E(N){e.selectConversation(N),e.setConversationViewMode("active")}async function G(N){const I=await e.archiveConversation(N);if(!I.success){t.error(I.error||"Failed to archive conversation");return}t.success("Conversation archived")}async function oe(N){c.value=N,a.value=!0}function ie(){a.value=!1,c.value=null}async function j(N){if(c.value){l.value=!0;try{const I=await e.restoreArchivedConversation(c.value,N);if(!I.success){t.error(I.error||"Failed to restore archived conversation");return}t.success("Archived conversation restored"),a.value=!1,c.value=null}finally{l.value=!1}}}async function V(N){const I=await e.deleteArchivedConversation(N);if(!I.success){t.error(I.error||"Failed to delete archived conversation");return}t.success("Archived conversation deleted")}function Z(N,I){e.renameConversation(N,I)}function U(N){return new Date(N).toLocaleString()}function W(N){if(!N.length)return"No messages";const z=(N[N.length-1].content||"").trim();return z?z.length>80?`${z.slice(0,80)}...`:z:"No messages"}return(N,I)=>(v(),y("div",CB,[d("div",QB,[d("div",PB,[d("button",{onClick:Q,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"New conversation","aria-label":"New conversation"},[ee(m(dl),{class:"w-4 h-4"})]),d("div",TB,[d("button",{onClick:I[0]||(I[0]=z=>m(e).setConversationViewMode("active")),class:_e(["p-1.5 rounded transition-colors",x.value?"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel":"text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations","aria-label":"Active conversations"},[ee(m(cp),{class:"w-4 h-4"})],2),d("button",{onClick:I[1]||(I[1]=z=>m(e).setConversationViewMode("archive")),class:_e(["p-1.5 rounded transition-colors",x.value?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel"]),title:"Archived conversations","aria-label":"Archived conversations"},[ee(m(qh),{class:"w-4 h-4"})],2)])]),d("div",MB,[ee(m(fs),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),je(d("input",{"onUpdate:modelValue":I[2]||(I[2]=z=>n.value=z),type:"text",placeholder:x.value?"Search archive...":"Search conversations...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono bg-retro-black border border-retro-border rounded focus:border-retro-cyan focus:outline-none focus:ring-1 focus:ring-retro-cyan text-retro-text placeholder-retro-muted"},null,8,AB),[[Rt,n.value]])])]),m(e).isNearStorageLimit?(v(),y("div",_B,[ee(m(En),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),d("p",RB,A(m(e).conversationCount)+" active conversations. Limit is 100. ",1)])):F("",!0),d("div",BB,[x.value?(v(),y(we,{key:1},[m(e).hasArchivedConversations?(v(),y("div",XB,[w.value.length>0?(v(!0),y(we,{key:0},Ne(w.value,(z,be,K,H)=>{const re=[z.id,z.title,z.updatedAt,z.archivedAt,z.messages.length];if(H&&H.key===z.id&&zh(H,re))return H;const Oe=(v(),y("div",{key:z.id,onClick:ge=>oe(z.id),onKeydown:[hs(kr(ge=>oe(z.id),["prevent"]),["enter"]),hs(kr(ge=>oe(z.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[d("div",IB,[d("div",VB,[d("h3",zB,A(z.title),1),d("p",NB,A(W(z.messages)),1),d("p",WB," Archived: "+A(U(z.archivedAt)),1),d("p",qB," Updated: "+A(U(z.updatedAt)),1)]),d("div",jB,[d("button",{onClick:kr(ge=>oe(z.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-retro-cyan/40 text-retro-cyan rounded hover:bg-retro-cyan/10 transition-colors",title:"Restore archived conversation"},[ee(m(qh),{class:"w-3.5 h-3.5"}),I[9]||(I[9]=Ie(" Restore ",-1))],8,YB),d("button",{onClick:kr(ge=>V(z.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete archived conversation"},[ee(m(vn),{class:"w-3.5 h-3.5"}),I[10]||(I[10]=Ie(" Delete ",-1))],8,FB)])])],40,["onClick","onKeydown"]));return Oe.memo=re,Oe},I,5),128)):(v(),y("div",UB,[d("p",GB,'No archived results for "'+A(n.value)+'"',1)]))])):(v(),y("div",HB,[...I[11]||(I[11]=[d("p",{class:"font-mono text-sm"},"No archived conversations",-1),d("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(v(),y(we,{key:0},[m(e).hasConversations?(v(),y("div",ZB,[k.value.length>0?(v(!0),y(we,{key:0},Ne(k.value,(z,be,K,H)=>{const re=[z.id,z.title,z.updatedAt,z.messages.length,z.finalized,z.id===m(e).activeConversationId,m(e).isConversationStreaming(z.id),S.value===z.id];if(H&&H.key===z.id&&zh(H,re))return H;const Oe=(v(),y("div",{key:z.id},[ee(rv,{conversation:z,"is-active":z.id===m(e).activeConversationId,"is-streaming":m(e).isConversationStreaming(z.id),"is-previewing":S.value===z.id,onSelect:ge=>E(z.id),onArchive:ge=>G(z.id),onRename:ge=>Z(z.id,ge)},null,8,["conversation","is-active","is-streaming","is-previewing","onSelect","onArchive","onRename"])]));return Oe.memo=re,Oe},I,3),128)):(v(),y("div",EB,[d("p",DB,'No results for "'+A(n.value)+'"',1)]))])):(v(),y("div",LB,[...I[8]||(I[8]=[d("p",{class:"font-mono text-sm"},"No conversations",-1),d("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),ee(Tu,{show:i.value,creating:o.value,onClose:I[7]||(I[7]=z=>i.value=!1),onCreate:L},null,8,["show","creating"]),ee(Tu,{show:a.value,creating:l.value,onClose:ie,onCreate:j},null,8,["show","creating"])]))}}),KB={mobile:768,tablet:1024};function JB(r,e){return r<e.mobile?"mobile":r<e.tablet?"tablet":"desktop"}const R1=Mu("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:r=>r.currentViewport==="mobile",isTablet:r=>r.currentViewport==="tablet",isDesktop:r=>r.currentViewport==="desktop",isChatFullscreen:r=>r.chatFullscreen},actions:{updateViewport(r){this.currentViewport=JB(r,KB)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(r){this.chatFullscreen=r}}});function e7(){const r=P(null),e=P(!0);let t=null,n="smooth";const s=50;function i(){const f=r.value;return f?f.scrollHeight-f.scrollTop-f.clientHeight<s:!0}function o(){e.value=i()}function a(f="smooth"){if(n=f,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):g=>setTimeout(()=>g(Date.now()),16))(()=>{t=null,It(()=>{const g=r.value;g&&g.scrollTo({top:g.scrollHeight,behavior:n})})})}function l(f="smooth"){a(f),e.value=!0}function c(f="smooth"){e.value&&a(f)}function u(){e.value=!0}function h(){e.value=!1}return{containerRef:r,shouldAutoScroll:Ae(e),onScroll:o,scrollToBottom:a,forceScrollToBottom:l,maybeScrollToBottom:c,enableAutoScroll:u,disableAutoScroll:h}}function t7(r){if(!r)return null;if(r instanceof HTMLElement)return r;if(typeof r=="object"&&"$el"in r){const e=r.$el;return e instanceof HTMLElement?e:null}return null}function r7(r){const{allMessages:e,containerRef:t,estimateItemHeight:n=120,overscan:s=6}=r,i=P(0),o=P(0),a=P(new Map),l=new Map;let c=null;function u(k,w){if(!Number.isFinite(w)||w<=0)return;const S=Math.ceil(w);if(a.value.get(k)===S)return;const Q=new Map(a.value);Q.set(k,S),a.value=Q}function h(k,w){u(k,w.getBoundingClientRect().height)}function f(k,w){const S=l.get(k);S&&c&&c.unobserve(S),S&&delete S.dataset.virtualMessageId,l.delete(k);const Q=t7(w);Q&&(Q.dataset.virtualMessageId=k,l.set(k,Q),h(k,Q),c&&c.observe(Q))}function p(){const k=t.value;k&&(i.value=k.scrollTop)}const g=J(()=>{const k=e.value,w=new Array(k.length);let S=0;for(let Q=0;Q<k.length;Q++)w[Q]=S,S+=a.value.get(k[Q].id)??n;return{offsets:w,totalHeight:S}});function O(k,w){let S=0,Q=k.length-1,L=k.length;for(;S<=Q;){const E=Math.floor((S+Q)/2);k[E]>=w?(L=E,Q=E-1):S=E+1}return L===k.length?Math.max(0,k.length-1):L}const b=J(()=>{const k=e.value;if(k.length===0)return[];const{offsets:w}=g.value,S=i.value,Q=S+Math.max(o.value,1),L=O(w,Math.max(0,S-n));let E=L;for(;E<k.length&&w[E]<Q;)E++;const G=Math.max(0,L-s),oe=Math.min(k.length,E+s),ie=[];for(let j=G;j<oe;j++)ie.push({message:k[j],index:j,top:w[j]});return ie}),x=J(()=>g.value.totalHeight);return gt(()=>{const k=t.value;k&&(o.value=k.clientHeight,i.value=k.scrollTop),c=new ResizeObserver(w=>{for(const S of w){const Q=S.target;if(t.value&&Q===t.value){o.value=S.contentRect.height;continue}const L=Q.dataset.virtualMessageId;L&&u(L,S.contentRect.height)}}),t.value&&c.observe(t.value);for(const[w,S]of l)S.dataset.virtualMessageId=w,c.observe(S),h(w,S)}),wt(()=>{c&&(c.disconnect(),c=null),l.clear()}),{visibleItems:b,totalHeight:x,onVirtualScroll:p,setItemRef:f}}const n7={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},s7={key:1,class:"relative"},i7={class:"sticky bottom-0"},o7={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},a7={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},l7={class:"flex items-start gap-2"},c7={class:"flex-1 min-w-0"},u7={class:"flex items-center justify-between gap-2 mb-0.5"},h7={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},d7={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},f7=Ve({__name:"ChatMessages",setup(r){const e=vr(),{containerRef:t,onScroll:n,maybeScrollToBottom:s,scrollToBottom:i,forceScrollToBottom:o}=e7(),{visibleItems:a,totalHeight:l,onVirtualScroll:c,setItemRef:u}=r7({allMessages:J(()=>e.messages),containerRef:t});function h(){n(),c()}const f=J(()=>e.isActiveConversationStreaming),p=J(()=>{const k=e.lastMessage;return!k||k.role!=="assistant"?null:k.status}),g=P(!1);function O(k){const w=k.contentBlocks;return!w||w.length===0?"":w.map(S=>{switch(S.type){case"tool_use":return`u:${S.id}:${S.status}:${S.inputSummary}`;case"tool_result":return`r:${S.id}:${S.toolUseId}:${S.isError?1:0}:${S.content.length}`;case"text":return`t:${S.id}:${S.text.length}`;case"thinking":return`k:${S.id}:${S.thinking.length}`;case"result_summary":return`s:${S.id}:${S.numTurns}:${S.durationMs}`;case"session_init":return`i:${S.id}:${S.model}:${S.tools.length}`;default:return""}}).join("|")}const b=P(null);function x(){if(b.value&&(b.value(),b.value=null),!t.value||typeof ResizeObserver>"u")return;const k=new ResizeObserver(()=>{s("instant")});k.observe(t.value),b.value=()=>{k.disconnect()}}return gt(()=>{i("instant"),x()}),wt(()=>{b.value&&b.value()}),ze(()=>e.activeConversationId,()=>{g.value=!1,i("instant")}),ze(t,()=>{x()}),ze(()=>[e.activeConversationId,e.messages.length],([k,w])=>{!k||w===0||g.value||(g.value=!0,o("instant"))},{immediate:!0}),ze(()=>e.messages.length,()=>{s("instant")}),ze(()=>e.lastMessage?.content,()=>{s("instant")}),ze([f,()=>e.lastError],()=>{s("instant")}),ze(l,()=>{s("instant")}),(k,w)=>(v(),y("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:h},[m(e).hasMessages?(v(),y("div",s7,[d("div",{class:"relative",style:tr({height:`${m(l)}px`})},[(v(!0),y(we,null,Ne(m(a),S=>(v(),y("div",{key:S.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:tr({transform:`translateY(${S.top}px)`})},[d("div",{ref_for:!0,ref:Q=>m(u)(S.message.id,Q)},[Gm([S.message.id,S.message.status,S.message.content,S.message.contentBlocks?.length||0,O(S.message),S.message.tools?.length||0],()=>ee(nv,{message:S.message},null,8,["message"]),w,0)],512)],4))),128))],4)])):(v(),y("div",n7,[...w[2]||(w[2]=[d("div",{class:"text-retro-muted text-sm font-mono mb-2"}," No messages yet ",-1),d("div",{class:"text-retro-muted text-xs font-mono"}," Send a message to start chatting ",-1)])])),d("div",i7,[m(f)&&!m(e).lastError?(v(),y("div",o7,[...w[3]||(w[3]=[Km('<div class="flex items-center gap-2"><div class="flex gap-1"><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:0ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:150ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:300ms;"></span></div><span class="text-xs font-mono text-retro-muted">Processing...</span></div>',1)])])):F("",!0),m(e).lastError?(v(),y("div",a7,[d("div",l7,[ee(m(Oo),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),d("div",c7,[d("div",u7,[w[4]||(w[4]=d("p",{class:"text-xs font-mono font-semibold text-retro-red"},"Error",-1)),d("button",{class:"text-xs font-mono text-retro-red/60 hover:text-retro-red underline",onClick:w[1]||(w[1]=S=>m(e).clearError())}," Dismiss ")]),d("p",h7,A(m(e).lastError),1),w[5]||(w[5]=d("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):m(p)==="stopped"?(v(),y("div",d7,[...w[6]||(w[6]=[d("div",{class:"flex items-center gap-2"},[d("span",{class:"w-2 h-2 rounded-full bg-retro-muted"}),d("span",{class:"text-xs font-mono text-retro-muted"},"Stopped")],-1)])])):F("",!0)])],544))}});function m7(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})])}function jm(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z","clip-rule":"evenodd"})])}function p7(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})])}function g7(r,e){return v(),y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[d("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd"})])}const O7=/^\/(reset|reset-context|new|clear)$/,v7=/^\/(context|ctx)$/;function b7(r){if(O7.test(r))return{kind:"reset"};if(v7.test(r))return{kind:"context"};const e=S7(r);return e?{kind:"spec-search",command:e}:{kind:"none"}}function x7(r,e){const t={permissionMode:e};return r?.hasWorktree&&r.worktreePath?t.cwd=r.worktreePath:r?.cwd&&(t.cwd=r.cwd),r?.featureId&&(t.featureId=r.featureId),r?.providerId&&(t.providerId=r.providerId),r?.providerModelKey&&(t.providerModelKey=r.providerModelKey),r?.providerSessionId&&(t.providerSessionId=r.providerSessionId),t}function y7(r,e={}){return{q:r.q,mode:r.mode??"hybrid",featureId:r.featureId??e.featureId,fileType:r.fileType,limit:String(r.limit??5)}}function k7(r){const e=r.instructionFiles.length>0?r.instructionFiles.map(n=>{const s=n.source==="cwd"?"cwd":"ancestor",i=n.mtime?` (mtime: ${n.mtime})`:"";return`- \`${n.path}\` [${s}] - ${n.hint}${i}`}):["- (none detected from current cwd ancestry)"],t=r.specContext.files.length>0?r.specContext.files.map(n=>`- \`${n}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${r.generatedAt}`,`- Session state: **${r.sessionState}**`,`- Provider session ID: \`${r.providerSessionId??"(empty)"}\``,`- Provider: \`${r.providerId}\` / \`${r.providerModelKey}\``,`- Permission mode: \`${r.permissionMode}\``,`- CWD (requested): \`${r.requestedCwd}\``,`- CWD (effective): \`${r.effectiveCwd}\``,`- Feature: \`${r.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${r.specContext.active?"yes":"no"}**`,`- Reason: ${r.specContext.reason}`,...t,"","### Detected Instruction Files",...e].join(`
|
|
68
|
+
`)}function w7(r){return(r.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(t=>t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t)}function S7(r){const e=r.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!e)return null;const t=w7(e[1]?.trim()??""),n=[],s={q:""};for(let i=0;i<t.length;i++){const o=t[i];if(o==="--mode"&&t[i+1]){const a=t[++i];(a==="keyword"||a==="semantic"||a==="hybrid")&&(s.mode=a);continue}if(o.startsWith("--mode=")){const a=o.slice(7);(a==="keyword"||a==="semantic"||a==="hybrid")&&(s.mode=a);continue}if(o==="--feature"&&t[i+1]){s.featureId=t[++i];continue}if(o.startsWith("--feature=")){s.featureId=o.slice(10);continue}if(o==="--file-type"&&t[i+1]){s.fileType=t[++i];continue}if(o.startsWith("--file-type=")){s.fileType=o.slice(12);continue}if(o==="--limit"&&t[i+1]){const a=Number.parseInt(t[++i],10);Number.isFinite(a)&&a>0&&(s.limit=a);continue}if(o.startsWith("--limit=")){const a=Number.parseInt(o.slice(8),10);Number.isFinite(a)&&a>0&&(s.limit=a);continue}n.push(o)}return s.q=n.join(" ").trim(),s}function $7(r,e=1400){const t=r.trim();return t.length<=e?t:`${t.slice(0,e)}
|
|
69
|
+
...`}function C7(r,e){const t=[];if(t.push("## Spec Search Results"),t.push(""),t.push(`- Query: \`${r.q}\``),t.push(`- Mode: \`${e.mode}\``),r.featureId&&t.push(`- Feature filter: \`${r.featureId}\``),r.fileType&&t.push(`- File type filter: \`${r.fileType}\``),t.push(`- Hits: **${e.totalCount}** (${e.searchTime}ms)`),e.warning&&t.push(`- Warning: ${e.warning}`),e.results.length===0)return t.push(""),t.push("No matching indexed chunks were found."),t.join(`
|
|
70
|
+
`);t.push("");for(const[n,s]of e.results.entries()){const i=s.chunk;t.push(`### ${n+1}. \`${i.sourcePath}:${i.lineStart}\``),t.push(`- Match: \`${s.matchType}\` (score: ${s.score.toFixed(3)})`),i.headingHierarchy.length>0&&t.push(`- Headings: ${i.headingHierarchy.join(" > ")}`),t.push(""),t.push($7(i.content)),t.push("")}return t.join(`
|
|
71
|
+
`)}function B1(r){return`${r.providerId}::${r.modelKey}`}function Q7(r,e){const t=new Map;for(const s of r)for(const i of s.models)t.set(i.label,(t.get(i.label)??0)+1);return r.flatMap(s=>s.models.map(i=>{const o=s.capabilities.streaming&&(!e||s.capabilities.permissions),a=(t.get(i.label)??0)>1;return{key:`${s.id}::${i.key}`,providerId:s.id,providerName:s.name,modelKey:i.key,modelLabel:i.label,label:a?`${i.label} · ${s.name}`:i.label,compatible:o}})).sort((s,i)=>s.modelLabel.localeCompare(i.modelLabel,void 0,{sensitivity:"base"})||s.providerName.localeCompare(i.providerName,void 0,{sensitivity:"base"}))}function P7(r){const e=new Map;for(const s of r){const i=e.get(s.providerId);if(i){i.options.push(s);continue}e.set(s.providerId,{providerId:s.providerId,providerName:s.providerName,options:[s]})}const t=new Map([["codex",0],["claude",1]]),n=Array.from(e.values());return n.sort((s,i)=>{const o=t.get(s.providerId)??99,a=t.get(i.providerId)??99;return o!==a?o-a:s.providerName.localeCompare(i.providerName,void 0,{sensitivity:"base"})}),n}function T7(r,e){const t=B1(e);return r.find(n=>n.key===t)??null}const Ym=4,M7=5*1024*1024;function A7(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function _7(r,e=M7){return r.type.startsWith("image/")?r.size>e?{ok:!1,reason:"too-large"}:{ok:!0}:{ok:!1,reason:"not-image"}}function R7(r){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{typeof n.result=="string"?e(n.result):t(new Error("Failed to read image"))},n.onerror=()=>t(n.error||new Error("Failed to read image")),n.readAsDataURL(r)})}function B7(r=Date.now,e=Math.random){return`att-${r()}-${e().toString(36).slice(2,8)}`}function Z7(r=Date.now,e=Math.random){return`q-${r()}-${e().toString(36).slice(2,8)}`}function E7(r,e=Z7){const t=r.text.trim();return t.length===0&&r.attachments.length===0?null:{id:e(),text:t,attachments:[...r.attachments]}}function D7(r,e){return r.filter(t=>t.id!==e)}const L7={class:"flex-shrink-0 flex-grow-0 border-t border-retro-border bg-retro-dark p-3"},X7={class:"flex flex-wrap items-center gap-2 mb-2"},I7={class:"relative min-w-0 flex-1 max-w-full sm:max-w-[154px] model-selector"},V7=["disabled"],z7={class:"truncate text-left"},N7={key:0,class:"absolute bottom-full left-0 mb-1 py-1 bg-retro-dark border border-retro-border rounded shadow-lg z-10 min-w-[220px] max-w-[280px]"},W7={key:0,class:"px-3 py-1.5 text-xs font-mono text-retro-muted"},q7={class:"px-3 py-1 text-[11px] font-mono uppercase tracking-wide text-retro-cyan/80 select-none"},j7=["disabled","onClick"],Y7={class:"truncate"},F7={class:"relative mode-selector"},U7={key:0,class:"absolute bottom-full left-0 mb-1 py-1 bg-retro-dark border border-retro-border rounded shadow-lg z-10 min-w-[140px]"},G7=["onClick"],H7={class:"hidden text-xs font-mono text-retro-muted sm:inline"},K7={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},J7={class:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"},e8={class:"flex-1 min-w-0"},t8={class:"text-xs font-mono text-retro-text truncate"},r8={class:"text-retro-cyan"},n8={key:0,class:"text-retro-muted"},s8={key:1,class:"text-retro-muted"},i8={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},o8={key:2,class:"mb-2 flex flex-wrap gap-2"},a8=["src","alt"],l8={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},c8={class:"truncate text-[10px] font-mono text-retro-muted/80"},u8=["onClick"],h8={key:3,class:"mb-2"},d8={class:"text-[10px] font-mono text-retro-muted mb-1 uppercase tracking-wide"},f8={class:"space-y-1"},m8={class:"text-[10px] font-mono text-retro-yellow flex-shrink-0"},p8={class:"flex-1 text-xs font-mono text-retro-text truncate"},g8={key:0,class:"text-[10px] font-mono text-retro-muted flex-shrink-0"},O8=["onClick"],v8={class:"flex gap-2 items-start"},b8=["disabled"],x8={class:"flex-1 relative min-h-[40px]"},y8=["disabled","placeholder"],k8=["disabled","title"],w8=Ve({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(r){const e=r,t=vr(),n=bo(),{sendMessage:s,sendPermissionResponse:i,approvePlan:o,rejectPlan:a,abort:l,resetContext:c}=Ml(),u=P(""),h=P(null),f=P(null),p=P(!1),g=P(!1),O=P(!1),b=P([]);let x=null;const k=P(null),w=P({}),S=J(()=>{const he=t.activeConversationId;return he?w.value[he]??[]:[]});function Q(he,ye){if(ye.length===0){const{[he]:Be,...Ye}=w.value;w.value=Ye}else w.value={...w.value,[he]:ye}}const{data:L,pending:E}=$c("chat-input-ai-providers",()=>$fetch("/api/ai/providers"),{server:!1,default:()=>({providers:[]})}),G=J(()=>L.value?.providers??[]),oe=J(()=>t.permissionMode==="ask"||t.permissionMode==="plan"),ie=J(()=>Q7(G.value,oe.value)),j=J(()=>P7(ie.value)),V=J(()=>{const he=t.activeConversation;return he?.providerId&&he.providerModelKey?{providerId:he.providerId,modelKey:he.providerModelKey}:k.value?k.value:n.providerSelection}),Z=J(()=>B1(V.value)),U=J(()=>T7(ie.value,V.value)),W=J(()=>U.value?.label||"Select model");function N(he,ye){t.setConversationProviderSelection(he,ye.providerId,ye.modelKey),t.clearProviderSession(he),t.saveConversation(he,!0)}function I(he){k.value&&(N(he,k.value),k.value=null)}function z(he){if(!he||!he.compatible)return;const ye={providerId:he.providerId,modelKey:he.modelKey},Be=t.activeConversationId;if(Be){N(Be,ye),k.value=null,O.value=!1;return}k.value=ye,O.value=!1}const be={plan:Bu,ask:Zu,auto:lp,bypass:Eu},K={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function H(he){t.setPermissionMode(he),g.value=!1}function re(he){const ye=he.target;ye.closest(".mode-selector")||(g.value=!1),ye.closest(".model-selector")||(O.value=!1)}gt(()=>{document.addEventListener("click",re),n.hydrate()}),wt(()=>{document.removeEventListener("click",re),x!==null&&typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&(window.cancelAnimationFrame(x),x=null)});const Oe=J(()=>(u.value.trim().length>0||b.value.length>0)&&!p.value&&!t.pendingPermission&&!Pe.value),ge=J(()=>t.isActiveConversationStreaming&&!t.pendingPermission),$e=J(()=>t.pendingPermission!==null),Pe=J(()=>t.pendingPlanApproval!==null);function Fe(){i(!0,t.activeConversationId)}function T(){i(!1,t.activeConversationId)}function M(){o(t.activeConversationId)}function D(){a(t.activeConversationId)}function B(){b.value=[],f.value&&(f.value.value="")}function xe(he){b.value=b.value.filter(ye=>ye.id!==he)}async function Re(he){const ye=he.target,Be=ye.files?Array.from(ye.files):[];if(Be.length===0)return;const{useToast:Ye}=await ds(async()=>{const{useToast:ot}=await import("./DDghssmX.js").then(Ft=>Ft.n);return{useToast:ot}},__vite__mapDeps([0,1,2]),import.meta.url),Ue=Ye();let Ct=Ym-b.value.length;if(Ct<=0){Ue.warning(`You can attach up to ${Ym} images per message.`),ye.value="";return}for(const ot of Be){if(Ct<=0)break;const Ft=_7(ot);if(!Ft.ok){Ft.reason==="not-image"?Ue.warning(`Skipped "${ot.name}": only image files are supported.`):Ue.warning(`Skipped "${ot.name}": max size is 5 MB.`);continue}try{const ir=await R7(ot);b.value.push({id:B7(),name:ot.name,mimeType:ot.type,size:ot.size,dataUrl:ir}),Ct--}catch{Ue.error(`Failed to attach "${ot.name}".`)}}ye.value=""}const Me=J(()=>{if(t.isActiveConversationStreaming||p.value)return!1;const he=t.lastMessage;return he?.role==="assistant"&&he?.status==="error"});async function ue(he){const ye=t.activeConversationId??await t.createConversation(),Be=t.addAssistantMessage(ye);if(!he.q){t.updateMessage(Be.id,{content:["Usage: `/spec-search <query> [--mode keyword|semantic|hybrid] [--feature <feature-id>] [--file-type <type>] [--limit <n>]`","","Examples:","- `/spec-search FR-001`",'- `/spec-search "indexing indicator" --mode hybrid --feature 008-spec-search --limit 5`'].join(`
|
|
72
|
+
`),status:"complete"},ye);return}const Ye=t.activeConversation,Ue=y7(he,{featureId:Ye?.featureId});try{const Ct=await $fetch("/api/specs/search",{query:Ue});t.updateMessage(Be.id,{content:C7({...he,mode:Ue.mode,featureId:Ue.featureId},Ct),status:"complete"},ye)}catch(Ct){const ot=Ct instanceof Error?Ct.message:"Failed to run spec search";t.updateMessage(Be.id,{content:`Spec search failed: ${ot}`,status:"error"},ye)}}async function ne(){const he=x7(t.activeConversation,t.permissionMode),ye=await $fetch("/api/chat/context",{query:he}),Be=t.activeConversationId??await t.createConversation(),Ye=t.addAssistantMessage(Be);t.updateMessage(Ye.id,{content:k7(ye),status:"complete"},Be)}function Ce(he=[]){const ye=Ta(t.activeConversation,!0)??{};return he.length>0?{...ye,attachments:he}:Object.keys(ye).length>0?ye:void 0}function q(he){const ye=t.addAssistantMessage(he);return t.startSession(`session-${Date.now()}`,he),t.startConversationStreaming(he),t.saveConversation(he,!0),ye}function ve(he,ye,Be,Ye){const Ue=Be instanceof Error?Be.message:Ye;t.setSessionError(Ue,he),t.updateMessage(ye,{status:"error"},he),t.endSession(he),t.endConversationStreaming(he)}async function Ze(he,ye){const Be=he!==void 0,Ye=(he??u.value).trim(),Ue=ye??[...b.value];if(Ye.length===0&&Ue.length===0||t.isActiveConversationStreaming||p.value||e.disabled)return;const Ct=!!t.activeConversationId;let ot=null,Ft=null;const ir=b7(Ye);if(ir.kind!=="none"){if(ir.kind==="reset"){await qn();return}ir.kind==="context"?await ne():ir.kind==="spec-search"&&await ue(ir.command),Be||(u.value="",B(),Et());return}p.value=!0,Be||(u.value="",B(),Et());try{if(await t.addUserMessageWithConversation(Ye,Ue),ot=t.activeConversationId,!ot)throw new Error("Failed to create or select a conversation");Ct||I(ot);const yr=q(ot);Ft=yr.id,await s(Ye,yr.id,ot,Ce(Ue))}catch(yr){if(ot&&Ft)ve(ot,Ft,yr,"Failed to send message");else{const Yn=yr instanceof Error?yr.message:"Failed to send message";t.setSessionError(Yn)}}finally{p.value=!1}}async function it(){try{l(t.activeConversationId)}catch{}}function Nt(){t.isActiveConversationStreaming?sr():Ze()}function sr(){const he=t.activeConversationId;if(!he)return;const ye=E7({text:u.value,attachments:b.value});ye&&(Q(he,[...S.value,ye]),u.value="",B(),Et(),Wt())}function on(he){const ye=t.activeConversationId;ye&&Q(ye,D7(S.value,he))}async function xr(){const he=t.activeConversationId;if(!he)return;const ye=w.value[he]??[];if(ye.length===0||t.isActiveConversationStreaming||p.value)return;const[Be,...Ye]=ye;Q(he,Ye),await Ze(Be.text,Be.attachments)}async function qn(){if(t.activeConversationId){u.value="",B(),Et(),p.value=!0;try{await c(t.activeConversationId);const he=t.addAssistantMessage(t.activeConversationId);t.updateMessage(he.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:ye}=await ds(async()=>{const{useToast:Ye}=await import("./DDghssmX.js").then(Ue=>Ue.n);return{useToast:Ye}},__vite__mapDeps([0,1,2]),import.meta.url);ye().success("AI context has been reset. The conversation will start fresh.")}catch(he){console.error("Failed to reset context:",he);const{useToast:ye}=await ds(async()=>{const{useToast:Ye}=await import("./DDghssmX.js").then(Ue=>Ue.n);return{useToast:Ye}},__vite__mapDeps([0,1,2]),import.meta.url);ye().error("Failed to reset context. Please try again.")}finally{p.value=!1}}}async function an(){const he=t.messages;let ye=null;for(let Ue=he.length-1;Ue>=0;Ue--)if(he[Ue].role==="user"){ye={content:he[Ue].content,attachments:he[Ue].attachments??[]};break}if(!ye||!t.activeConversationId)return;const Be=t.activeConversationId;t.clearError(),p.value=!0;let Ye=null;try{const Ue=q(Be);Ye=Ue.id,await s(ye.content,Ue.id,Be,Ce(ye.attachments))}catch(Ue){if(Ye)ve(Be,Ye,Ue,"Failed to retry message");else{const Ct=Ue instanceof Error?Ue.message:"Failed to retry message";t.setSessionError(Ct,Be)}}finally{p.value=!1}}function jn(he){he.key==="Enter"&&!he.shiftKey&&(he.preventDefault(),Nt())}function ln(){const he=h.value;if(he){if(!u.value.trim()){he.style.height="";return}he.style.height="auto",he.style.height=Math.min(he.scrollHeight,200)+"px"}}function Sn(){if(x!==null)return;x=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):ye=>setTimeout(()=>ye(Date.now()),16))(()=>{x=null,ln()})}function Et(){const he=h.value;he&&(he.style.height="")}function Wt(){It(()=>{h.value?.focus()})}return ze(u,Sn),ze(()=>t.isActiveConversationStreaming,(he,ye)=>{ye&&!he&&(S.value.length>0?It(()=>xr()):Wt())}),ze(()=>t.activeConversationId,()=>{t.activeConversationId&&(k.value=null),B(),Wt(),!t.isActiveConversationStreaming&&S.value.length>0&&It(()=>xr())}),(he,ye)=>(v(),y("div",L7,[d("div",X7,[d("div",I7,[d("button",{disabled:r.disabled||m(t).isActiveConversationStreaming||m($e)||m(Pe)||m(E)||m(ie).length===0,class:"flex items-center justify-between gap-1.5 w-full px-2 py-1 rounded border border-retro-border/50 hover:border-retro-border text-xs font-mono text-retro-muted transition-colors disabled:opacity-60 disabled:cursor-not-allowed",onClick:ye[0]||(ye[0]=Be=>O.value=!m(O))},[d("span",z7,A(m(W)),1),ee(m(jm),{class:"w-3 h-3 flex-shrink-0"})],8,V7),m(O)?(v(),y("div",N7,[m(ie).length===0?(v(),y("div",W7," Loading models... ")):F("",!0),(v(!0),y(we,null,Ne(m(j),Be=>(v(),y("div",{key:Be.providerId,class:"py-0.5"},[d("div",q7,A(Be.providerName),1),(v(!0),y(we,null,Ne(Be.options,Ye=>(v(),y("button",{key:Ye.key,disabled:!Ye.compatible,class:_e(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors disabled:opacity-50 disabled:cursor-not-allowed",m(Z)===Ye.key?"bg-retro-panel text-retro-text":"text-retro-muted"]),onClick:Ue=>z(Ye)},[d("span",Y7,A(Ye.modelLabel)+A(Ye.compatible?"":" (unsupported for current permission mode)"),1)],10,j7))),128))]))),128))])):F("",!0)]),d("div",F7,[d("button",{class:_e(["flex items-center gap-1.5 px-2 py-1 rounded border border-retro-border/50 hover:border-retro-border text-xs font-mono transition-colors",K[m(t).permissionMode]]),onClick:ye[1]||(ye[1]=Be=>g.value=!m(g))},[(v(),pe(ps(be[m(t).permissionMode]),{class:"w-4 h-4"})),d("span",null,A(m(Zs)[m(t).permissionMode]),1),ee(m(jm),{class:"w-3 h-3"})],2),m(g)?(v(),y("div",U7,[(v(),y(we,null,Ne(["plan","ask","auto","bypass"],Be=>d("button",{key:Be,class:_e(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[K[Be],m(t).permissionMode===Be?"bg-retro-panel":""]]),onClick:Ye=>H(Be)},[(v(),pe(ps(be[Be]),{class:"w-4 h-4"})),d("span",null,A(m(Zs)[Be]),1)],10,G7)),64))])):F("",!0)]),d("span",H7,A(m(t).permissionMode==="plan"?"Plan only":m(t).permissionMode==="ask"?"Ask before actions":m(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),m($e)?(v(),y("div",K7,[d("div",J7,[d("div",e8,[ye[4]||(ye[4]=d("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),d("div",t8,[d("span",r8,A(m(t).pendingPermission?.tool),1),m(t).pendingPermission?.filePath?(v(),y("span",n8," - "+A(m(t).pendingPermission.filePath),1)):m(t).pendingPermission?.command?(v(),y("span",s8," - "+A(m(t).pendingPermission.command),1)):F("",!0)])]),d("div",{class:"flex flex-shrink-0 gap-2"},[d("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:Fe}," Allow "),d("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:T}," Deny ")])])])):F("",!0),m(Pe)?(v(),y("div",i8,[d("div",{class:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"},[ye[5]||(ye[5]=d("div",{class:"flex-1 min-w-0"},[d("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),d("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),d("div",{class:"flex flex-shrink-0 gap-2"},[d("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:M}," Approve & Implement "),d("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:D}," Reject ")])])])):F("",!0),m(b).length>0?(v(),y("div",o8,[(v(!0),y(we,null,Ne(m(b),Be=>(v(),y("div",{key:Be.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[d("img",{src:Be.dataUrl,alt:Be.name,class:"h-16 w-full rounded object-cover"},null,8,a8),d("div",l8,A(Be.name),1),d("div",c8,A(m(A7)(Be.size)),1),d("button",{class:"absolute -right-2 -top-2 rounded-full border border-retro-border bg-retro-panel p-0.5 text-retro-red hover:bg-retro-red/20",type:"button",onClick:Ye=>xe(Be.id)},[ee(m(St),{class:"h-3 w-3"})],8,u8)]))),128))])):F("",!0),m(S).length>0?(v(),y("div",h8,[d("div",d8," Queued ("+A(m(S).length)+") ",1),d("div",f8,[(v(!0),y(we,null,Ne(m(S),(Be,Ye)=>(v(),y("div",{key:Be.id,class:"flex items-center gap-2 px-2.5 py-1.5 bg-retro-panel/50 border border-retro-border/30 rounded"},[d("span",m8,"#"+A(Ye+1),1),d("span",p8,A(Be.text),1),Be.attachments.length>0?(v(),y("span",g8," +"+A(Be.attachments.length)+" img ",1)):F("",!0),d("button",{class:"flex-shrink-0 p-0.5 text-retro-muted hover:text-retro-red transition-colors",title:"Cancel queued message",onClick:Ue=>on(Be.id)},[ee(m(St),{class:"w-3.5 h-3.5"})],8,O8)]))),128))])])):F("",!0),d("div",v8,[d("input",{ref_key:"fileInputRef",ref:f,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:Re},null,544),d("button",{class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-panel/70 text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-50 disabled:cursor-not-allowed transition-colors",type:"button",title:"Attach images",disabled:r.disabled||m($e)||m(Pe),onClick:ye[2]||(ye[2]=Be=>m(f)?.click())},[ee(m(Zv),{class:"w-5 h-5"})],8,b8),d("div",x8,[je(d("textarea",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":ye[3]||(ye[3]=Be=>Je(u)?u.value=Be:null),disabled:r.disabled||m($e)||m(Pe),placeholder:r.disabled?"This conversation is finalized (read-only)":m(t).isActiveConversationStreaming?"Type to queue a message...":"Type a message...",rows:"1",class:"w-full h-full min-h-[40px] px-3 py-2 bg-retro-black border border-retro-border rounded text-sm font-mono text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan disabled:opacity-50 disabled:cursor-not-allowed resize-none overflow-hidden",onKeydown:jn},null,40,y8),[[Rt,m(u)]])]),m(Me)?(v(),y("button",{key:0,class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30 transition-colors",title:"Retry last message",onClick:an},[ee(m(m7),{class:"w-5 h-5"})])):F("",!0),m($e)?F("",!0):(v(),y("button",{key:1,disabled:!m(Oe),title:m(t).isActiveConversationStreaming?"Queue message":"Send message",class:_e(["flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",m(t).isActiveConversationStreaming?"bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30":"bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30"]),onClick:Nt},[m(t).isActiveConversationStreaming?(v(),pe(m(fp),{key:0,class:"w-5 h-5"})):(v(),pe(m(p7),{key:1,class:"w-5 h-5"}))],10,k8)),m(ge)?(v(),y("button",{key:2,class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-red/20 text-retro-red hover:bg-retro-red/30 transition-colors",onClick:it},[ee(m(g7),{class:"w-5 h-5"})])):F("",!0)]),ye[6]||(ye[6]=d("div",{class:"mt-1 hidden text-xs font-mono text-retro-muted sm:block"}," Press Enter to send (or queue while AI is responding), Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/new`, `/clear`, `/spec-search`. ",-1))]))}}),S8={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},$8={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},C8={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},Q8={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},P8={class:"flex items-center gap-2 text-[10px] font-mono"},T8={class:"text-retro-muted"},M8={class:"text-retro-muted"},A8={class:"text-retro-green truncate"},_8={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},R8=Ve({__name:"ChatDebugPanel",setup(r){const e=vr(),{debugEvents:t}=W1(e);function n(i){return new Date(i).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function s(i){return i==="in"?"text-retro-cyan":i==="out"?"text-retro-yellow":"text-retro-muted"}return(i,o)=>(v(),y("div",S8,[d("div",$8,[o[1]||(o[1]=d("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),d("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:o[0]||(o[0]=a=>m(e).clearDebugEvents())},[ee(m(vn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),m(t).length===0?(v(),y("div",C8," No debug events yet ")):(v(),y("div",Q8,[(v(!0),y(we,null,Ne(m(t),a=>(v(),y("div",{key:a.id,class:"px-3 py-2 border-b border-retro-border/20"},[d("div",P8,[d("span",T8,A(n(a.timestamp)),1),d("span",{class:_e(s(a.direction))},A(a.direction.toUpperCase()),3),d("span",M8,A(a.channel),1),d("span",A8,A(a.eventType),1)]),d("pre",_8,A(a.payload),1)]))),128))]))]))}}),B8={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},Z8={class:"flex items-center justify-between"},E8={class:"space-y-1 text-xs font-mono"},D8={class:"flex items-center gap-2"},L8={class:"relative"},X8=["disabled"],I8=["value"],V8=["value"],z8={class:"flex items-center gap-2"},N8={class:"text-retro-text"},W8={class:"relative"},q8=["disabled"],j8=["disabled"],Y8={key:0,class:"flex items-center justify-between gap-3 rounded border border-retro-border bg-retro-black px-2 py-1.5 text-xs font-mono"},F8={class:"min-w-0"},U8={class:"flex items-center gap-2"},G8={class:"text-retro-text truncate"},H8={key:0,class:"mt-0.5 text-retro-red truncate"},K8={class:"flex items-center gap-2"},J8=["disabled"],eZ=["disabled"],tZ=Ve({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=P(""),i=P(null),o=P(!1),a=P(!1),l=P("idle"),c=P(""),u=P(null),h=P(Bo(t.baseBranch)?t.baseBranch:""),f=P([]),p=P(!1),g=P(null),O=J(()=>_1(h.value||t.baseBranch));async function b(){if(a.value)return;a.value=!0,l.value="running",c.value="";const w=new AbortController;u.value=w;try{const S=await $fetch("/api/chat/generate-commit-message",{method:"POST",signal:w.signal,body:{conversationId:t.worktreePath.split("/").pop()?.replace("sc-","")||"",worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,baseBranch:h.value||t.baseBranch}});S.success&&S.message?(s.value=S.message,l.value="done"):(l.value="error",c.value=S.error||"Failed to generate commit message")}catch(S){w.signal.aborted?l.value="aborted":(l.value="error",c.value=S instanceof Error?S.message:String(S))}finally{a.value=!1,u.value===w&&(u.value=null)}}function x(){u.value?.abort()}gt(async()=>{const w=(async()=>{try{const Q=t.worktreePath.split("/").pop()||"",L=await $fetch(`/api/commits/${encodeURIComponent(Q)}`,{params:{workingDirectory:t.worktreePath}});i.value=L.aheadCount}catch{i.value=null}})(),S=(async()=>{p.value=!0;try{const Q=t.worktreePath||(await $fetch("/api/cwd")).cwd,L=await $fetch("/api/git/branches",{query:{workingDirectory:Q}});f.value=L.branches.filter(G=>!G.isRemote&&!G.name.startsWith("sc/")).map(Ih).filter(G=>!!G);const E=Xh(h.value||t.baseBranch,f.value);E&&(h.value=E)}catch{f.value=[]}finally{p.value=!1}})();await Promise.all([w,S]),It(()=>g.value?.focus())});function k(){!s.value.trim()||!h.value||(o.value=!0,n("confirm",s.value.trim(),h.value))}return(w,S)=>(v(),y("div",B8,[d("div",Z8,[S[4]||(S[4]=d("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),d("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:S[0]||(S[0]=Q=>n("cancel"))},[ee(m(St),{class:"w-4 h-4"})])]),d("div",E8,[d("div",D8,[S[5]||(S[5]=d("span",{class:"text-retro-muted"},"target:",-1)),d("div",L8,[je(d("select",{"onUpdate:modelValue":S[1]||(S[1]=Q=>h.value=Q),disabled:o.value||p.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[p.value?(v(),y("option",{key:0,value:h.value},A(O.value),9,I8)):F("",!0),(v(!0),y(we,null,Ne(f.value,Q=>(v(),y("option",{key:Q,value:Q},A(Q),9,V8))),128))],8,X8),[[ks,h.value]]),ee(m(Ru),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),d("div",z8,[S[6]||(S[6]=d("span",{class:"text-retro-muted"},"commits:",-1)),d("span",N8,A(i.value!==null?i.value:"..."),1)])]),d("div",W8,[je(d("textarea",{ref_key:"textareaRef",ref:g,"onUpdate:modelValue":S[2]||(S[2]=Q=>s.value=Q),placeholder:"Squash commit message...",rows:"2",class:"w-full px-2 py-1.5 pr-8 text-xs font-mono bg-retro-black border border-retro-border rounded text-retro-text placeholder-retro-subtle focus:outline-none focus:border-retro-cyan resize-none",disabled:o.value||a.value},null,8,q8),[[Rt,s.value]]),d("button",{type:"button",disabled:o.value||a.value||p.value||!h.value,class:"absolute right-1.5 top-1.5 p-0.5 rounded text-retro-muted hover:text-retro-cyan transition-colors disabled:opacity-40",title:"Generate commit message",onClick:b},[ee(m(ji),{class:_e(["w-4 h-4",{"animate-spin":a.value}])},null,8,["class"])],8,j8)]),l.value!=="idle"?(v(),y("div",Y8,[d("div",F8,[d("div",U8,[ee(m(ji),{class:_e(["w-3.5 h-3.5 text-retro-cyan shrink-0",{"animate-spin":l.value==="running"}])},null,8,["class"]),d("span",G8,A(l.value==="running"?`Generating from ${h.value}...`:l.value==="done"?"Commit message generated":l.value==="aborted"?"Generation stopped":"Generation failed"),1)]),c.value?(v(),y("div",H8,A(c.value),1)):F("",!0)]),l.value==="running"?(v(),y("button",{key:0,type:"button",class:"shrink-0 p-0.5 rounded text-retro-muted hover:text-retro-red transition-colors",title:"Stop generation",onClick:x},[ee(m(pp),{class:"w-4 h-4"})])):F("",!0)])):F("",!0),d("div",K8,[d("button",{type:"button",disabled:!s.value.trim()||!h.value||o.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:k},[ee(m(_u),{class:"w-3.5 h-3.5"}),Ie(" "+A(o.value?"Finalizing...":"Confirm"),1)],8,J8),d("button",{type:"button",disabled:o.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:S[3]||(S[3]=Q=>n("cancel"))}," Cancel ",8,eZ)])]))}}),rZ={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},nZ={class:"flex items-center justify-between"},sZ={class:"space-y-1 text-xs font-mono"},iZ={class:"flex items-center gap-2"},oZ={class:"text-retro-cyan"},aZ={class:"flex items-center gap-2"},lZ={class:"relative"},cZ=["disabled"],uZ=["value"],hZ=["value"],dZ={class:"flex items-center gap-2"},fZ={class:"text-retro-text"},mZ={class:"flex items-center gap-2"},pZ=["disabled"],gZ=["disabled"],OZ=Ve({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=r,n=e,s=P(null),i=P(!1),o=P(Bo(t.baseBranch)?t.baseBranch:""),a=P([]),l=P(!1),c=J(()=>_1(o.value||t.baseBranch));async function u(f){if(!f){s.value=null;return}try{const p=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:f}});s.value=p.ahead}catch{s.value=null}}gt(async()=>{const f=u(o.value),p=(async()=>{l.value=!0;try{const g=t.worktreePath||(await $fetch("/api/cwd")).cwd,O=await $fetch("/api/git/branches",{query:{workingDirectory:g}});a.value=O.branches.filter(x=>!x.isRemote&&!x.name.startsWith("sc/")).map(Ih).filter(x=>!!x);const b=Xh(o.value||t.baseBranch,a.value);b&&(o.value=b)}catch{a.value=[]}finally{l.value=!1}})();await Promise.all([f,p])}),ze(o,f=>{u(f)});function h(){o.value&&(i.value=!0,n("confirm",o.value))}return(f,p)=>(v(),y("div",rZ,[d("div",nZ,[p[3]||(p[3]=d("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),d("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:p[0]||(p[0]=g=>n("cancel"))},[ee(m(St),{class:"w-4 h-4"})])]),d("div",sZ,[d("div",iZ,[p[4]||(p[4]=d("span",{class:"text-retro-muted"},"worktree:",-1)),d("span",oZ,A(r.worktreeBranch),1)]),d("div",aZ,[p[5]||(p[5]=d("span",{class:"text-retro-muted"},"target:",-1)),d("div",lZ,[je(d("select",{"onUpdate:modelValue":p[1]||(p[1]=g=>o.value=g),disabled:i.value||l.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[l.value?(v(),y("option",{key:0,value:o.value},A(c.value),9,uZ)):F("",!0),(v(!0),y(we,null,Ne(a.value,g=>(v(),y("option",{key:g,value:g},A(g),9,hZ))),128))],8,cZ),[[ks,o.value]]),ee(m(Ru),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),d("div",dZ,[p[6]||(p[6]=d("span",{class:"text-retro-muted"},"commits ahead:",-1)),d("span",fZ,A(s.value!==null?s.value:"..."),1)])]),d("div",mZ,[d("button",{type:"button",disabled:i.value||!o.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:h},[ee(m(_u),{class:"w-3.5 h-3.5"}),Ie(" "+A(i.value?"Rebasing...":"Confirm"),1)],8,pZ),d("button",{type:"button",disabled:i.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:p[2]||(p[2]=g=>n("cancel"))}," Cancel ",8,gZ)])]))}}),vZ={class:"flex-1 flex flex-col overflow-hidden"},bZ={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},xZ={class:"text-xs font-mono text-retro-text truncate"},yZ={class:"flex items-center gap-2 flex-shrink-0"},kZ={key:0,class:"text-xs font-mono text-retro-green"},wZ={key:1,class:"text-[11px] font-mono text-retro-muted"},SZ={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},$Z=["innerHTML"],CZ={key:0,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},QZ=Ve({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},isAiResolving:{type:Boolean},strategy:{}},emits:["resolve","aiResolve","retry"],setup(r,{emit:e}){const t=r;P(t.file.content);const n=P(""),s=P(!1);ze(()=>t.file.path,()=>{a()}),ze(()=>t.file.content,()=>{a()});const i=J(()=>{const c=/^<{7}\s/gm;return(t.file.content.match(c)||[]).length});function o(c){const u=c.split(".").pop()?.toLowerCase()||"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",vue:"vue",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",sh:"bash",zsh:"bash",sql:"sql",graphql:"graphql",xml:"xml",svg:"xml",toml:"toml",ini:"ini",dockerfile:"dockerfile"}[u]||"text"}async function a(){s.value=!0;try{const{codeToHtml:c}=await ds(async()=>{const{codeToHtml:x}=await import("./x26pmbJN.js");return{codeToHtml:x}},__vite__mapDeps([3,1,2]),import.meta.url),u=o(t.file.path),f=t.file.content.split(`
|
|
73
|
+
`);let p="",g=!1,O=!1,b=0;for(const x of f){b++;const k=/^<{7}\s/.test(x),w=/^={7}$/.test(x),S=/^>{7}\s/.test(x);if(k){g=!0,O=!1,p+=`<div class="conflict-line conflict-marker-line" data-line="${b}"><span class="line-number">${b}</span><span class="line-content conflict-marker">${l(x)}</span></div>
|
|
74
|
+
`;continue}if(w&&g){g=!1,O=!0,p+=`<div class="conflict-line conflict-marker-line" data-line="${b}"><span class="line-number">${b}</span><span class="line-content conflict-marker">${l(x)}</span></div>
|
|
75
|
+
`;continue}if(S){O=!1,p+=`<div class="conflict-line conflict-marker-line" data-line="${b}"><span class="line-number">${b}</span><span class="line-content conflict-marker">${l(x)}</span></div>
|
|
76
|
+
`;continue}let Q=l(x);try{const G=(await c(x||" ",{lang:u,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);G&&(Q=G[1])}catch{}let L="";g?L="conflict-ours":O&&(L="conflict-theirs"),p+=`<div class="conflict-line ${L}" data-line="${b}"><span class="line-number">${b}</span><span class="line-content">${Q}</span></div>
|
|
77
|
+
`}n.value=p}catch{const c=t.file.content.split(`
|
|
78
|
+
`);n.value=c.map((u,h)=>{const f=h+1;return`<div class="conflict-line" data-line="${f}"><span class="line-number">${f}</span><span class="line-content">${l(u)}</span></div>`}).join(`
|
|
79
|
+
`)}finally{s.value=!1}}function l(c){return c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}return gt(()=>{a()}),(c,u)=>(v(),y("div",vZ,[d("div",bZ,[d("span",xZ,A(r.file.path),1),d("div",yZ,[r.resolved?(v(),y("span",kZ," Resolved ")):i.value>0?(v(),y("span",wZ,A(i.value)+" conflict "+A(i.value===1?"block":"blocks"),1)):F("",!0)])]),d("div",{class:_e(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":r.resolved}])},[s.value?(v(),y("div",SZ," Highlighting... ")):(v(),y("div",{key:1,class:"conflict-code",innerHTML:n.value},null,8,$Z))],2),i.value>0&&!r.resolved?(v(),y("div",CZ," File contains "+A(i.value)+" conflict "+A(i.value===1?"block":"blocks")+". Use AI resolution to resolve. ",1)):F("",!0)]))}}),PZ={class:"flex flex-col h-full border-l border-retro-border bg-retro-dark"},TZ={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border"},MZ={class:"flex items-center gap-2"},AZ={class:"text-[10px] font-mono text-retro-muted mt-1"},_Z={key:0,class:"text-xs font-mono text-retro-muted text-center py-8"},RZ={key:0,class:"bg-retro-panel/50 rounded px-2 py-1.5 border border-retro-border"},BZ={class:"mt-0.5"},ZZ={class:"inline-block w-3 text-center opacity-70"},EZ={key:1,class:"flex items-center gap-2 text-xs font-mono text-retro-cyan"},DZ={class:"flex-shrink-0 border-t border-retro-border p-3 space-y-2"},LZ=["disabled"],XZ=["disabled"],IZ={key:0},VZ={key:1},zZ=Ve({__name:"ConflictChatPanel",setup(r){const e=vr(),t=bo(),n=P(""),s=P(null),i=J(()=>e.conflictState?.chatMessages??[]),o=J(()=>e.conflictState?.lifecycleState==="resolving"),a=J(()=>{if(!e.conflictState)return!1;const g=e.conflictState.files.length,O=e.conflictState.resolvedFiles.size;return g>0&&O>=g}),l=J(()=>e.conflictState?e.conflictState.files.length-e.conflictState.resolvedFiles.size:0),c=J(()=>`${t.providerId}/${t.providerModelKey}`);ze(()=>i.value.length,async()=>{await It(),s.value&&(s.value.scrollTop=s.value.scrollHeight)});function u(){!e.conflictState||o.value||(e.setConflictUserGuidance(n.value.trim()),e.aiResolveAllConflicts())}function h(){e.cancelConflictResolution()}function f(g){switch(g.type){case"success":return"text-retro-green";case"error":return"text-retro-red";case"progress":return"text-retro-cyan";case"summary":return"text-retro-yellow";default:return"text-retro-muted"}}function p(g){switch(g.type){case"success":return"✓";case"error":return"✗";case"progress":return"▶";case"summary":return"─";default:return"●"}}return(g,O)=>(v(),y("div",PZ,[d("div",TZ,[d("div",MZ,[ee(m(ji),{class:"w-4 h-4 text-retro-orange"}),O[1]||(O[1]=d("span",{class:"text-xs font-mono text-retro-text font-semibold"},"AI Conflict Resolution",-1))]),d("div",AZ," Model: "+A(c.value),1)]),d("div",{ref_key:"messagesContainer",ref:s,class:"flex-1 overflow-y-auto px-3 py-2 space-y-2"},[i.value.length===0?(v(),y("div",_Z," Enter optional guidance below and click resolve to start AI conflict resolution. ")):F("",!0),(v(!0),y(we,null,Ne(i.value,b=>(v(),y("div",{key:b.id,class:_e(["text-xs font-mono leading-relaxed",b.role==="user"?"text-retro-text":f(b)])},[b.role==="user"?(v(),y("div",RZ,[O[2]||(O[2]=d("span",{class:"text-retro-muted text-[10px]"},"Guidance:",-1)),d("div",BZ,A(b.content),1)])):(v(),y(we,{key:1},[d("span",ZZ,A(p(b)),1),Ie(" "+A(b.content),1)],64))],2))),128)),o.value?(v(),y("div",EZ,[...O[3]||(O[3]=[d("span",{class:"animate-pulse"},"●",-1),Ie(" Processing... ",-1)])])):F("",!0)],512),d("div",DZ,[je(d("textarea",{"onUpdate:modelValue":O[0]||(O[0]=b=>n.value=b),disabled:o.value,placeholder:'Optional: Add guidance for AI resolution (e.g., "prefer feature branch API changes", "keep both import sets")...',class:"w-full h-16 px-2 py-1.5 text-xs font-mono bg-retro-black text-retro-text border border-retro-border rounded resize-none focus:outline-none focus:border-retro-cyan/50 placeholder:text-retro-muted/50 disabled:opacity-50",spellcheck:"false"},null,8,LZ),[[Rt,n.value]]),o.value?(v(),y("button",{key:1,type:"button",class:"w-full flex items-center justify-center gap-2 px-3 py-2 text-xs font-mono rounded border transition-colors bg-retro-red/10 border-retro-red/50 text-retro-red hover:bg-retro-red/20",onClick:h},[ee(m(pp),{class:"w-4 h-4"}),O[4]||(O[4]=Ie(" Stop Resolution ",-1))])):(v(),y("button",{key:0,type:"button",disabled:a.value||l.value===0,class:"w-full flex items-center justify-center gap-2 px-3 py-2 text-xs font-mono rounded border transition-colors bg-retro-orange/10 border-retro-orange/50 text-retro-orange hover:bg-retro-orange/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:u},[ee(m(ji),{class:"w-4 h-4"}),a.value?(v(),y("span",IZ,"All Conflicts Resolved")):(v(),y("span",VZ,"Resolve Conflicts Automatically ("+A(l.value)+")",1))],8,XZ))])]))}}),NZ={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},WZ={class:"w-full max-w-7xl mx-4 my-8 h-[85vh] bg-retro-dark border border-retro-border rounded-lg shadow-xl flex flex-col overflow-hidden"},qZ={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},jZ={class:"flex items-center gap-3"},YZ={class:"text-xs font-mono text-retro-muted"},FZ={class:"flex items-center gap-2"},UZ=["disabled"],GZ=["disabled"],HZ={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},KZ={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},JZ={key:2,class:"flex-1 flex overflow-hidden"},e6={class:"w-56 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},t6={class:"py-1"},r6=["onClick"],n6={class:"flex-1 flex flex-col overflow-hidden min-w-0"},s6={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},i6={class:"w-80 flex-shrink-0"},o6=Ve({__name:"ConflictResolutionModal",emits:["close"],setup(r,{emit:e}){const t=e,n=vr(),s=P(null),i=P(!1),o=P(!1),a=J(()=>n.conflictState?.files??[]),l=J(()=>n.conflictState?.resolvedFiles??new Set),c=J(()=>a.value.length),u=J(()=>l.value.size),h=J(()=>c.value>0&&u.value>=c.value),f=J(()=>s.value?a.value.find(x=>x.path===s.value)??null:null);function p(x){return l.value.has(x)}function g(x){s.value=x}async function O(){i.value=!0;const x=await n.continueRebase();i.value=!1,x.success&&t("close")}async function b(){o.value=!0,await n.cancelConflictResolution(),o.value=!1,t("close")}return(x,k)=>(v(),pe(Pr,{to:"body"},[ee(On,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ut(()=>[m(n).conflictState?(v(),y("div",NZ,[d("div",WZ,[d("div",qZ,[d("div",jZ,[ee(m(En),{class:"w-5 h-5 text-retro-yellow"}),k[0]||(k[0]=d("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Resolve Conflicts",-1)),d("span",YZ,A(u.value)+"/"+A(c.value)+" resolved ",1)]),d("div",FZ,[d("button",{type:"button",disabled:!h.value||i.value||o.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:O},A(i.value?"Continuing...":"Continue Rebase"),9,UZ),d("button",{type:"button",disabled:i.value||o.value,class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-red/50 text-retro-red hover:bg-retro-red/10 transition-colors disabled:opacity-40",onClick:b},A(o.value?"Aborting...":"Abort"),9,GZ)])]),m(n).conflictState?.loading?(v(),y("div",HZ," Loading conflict files... ")):m(n).conflictState?.error?(v(),y("div",KZ,A(m(n).conflictState.error),1)):(v(),y("div",JZ,[d("div",e6,[d("div",t6,[(v(!0),y(we,null,Ne(a.value,w=>(v(),y("button",{key:w.path,type:"button",class:_e(["w-full text-left px-3 py-2 text-xs font-mono flex items-center gap-2 transition-colors hover:bg-retro-panel",{"bg-retro-panel":s.value===w.path}]),onClick:S=>g(w.path)},[p(w.path)?(v(),pe(m(Au),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(v(),pe(m(Oo),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),d("span",{class:_e(["truncate",p(w.path)?"text-retro-green":"text-retro-yellow"])},A(w.path),3)],10,r6))),128))])]),d("div",n6,[f.value?(v(),pe(QZ,{key:0,file:f.value,resolved:p(f.value.path)},null,8,["file","resolved"])):(v(),y("div",s6," Select a file to view "))]),d("div",i6,[ee(zZ)])]))])])):F("",!0)]),_:1})]))}}),a6={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},l6={class:"flex items-center justify-between p-4 border-b border-retro-border"},c6={class:"flex items-center gap-2"},u6={class:"p-4"},h6={class:"mt-2 text-sm text-retro-text font-mono truncate"},d6={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},f6=Ve({__name:"DeleteConfirmModal",props:{show:{type:Boolean},title:{}},emits:["confirm","cancel"],setup(r,{emit:e}){const t=e;function n(s){s.target===s.currentTarget&&t("cancel")}return(s,i)=>(v(),pe(Pr,{to:"body"},[ee(On,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:ut(()=>[r.show?(v(),y("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n},[ee(On,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:ut(()=>[r.show?(v(),y("div",a6,[d("div",l6,[d("div",c6,[ee(m(En),{class:"w-5 h-5 text-retro-red"}),i[3]||(i[3]=d("h3",{class:"text-lg font-mono text-retro-text"},"Delete Conversation",-1))]),d("button",{onClick:i[0]||(i[0]=o=>t("cancel")),class:"p-1 hover:bg-retro-panel rounded transition-colors"},[ee(m(St),{class:"w-5 h-5 text-retro-muted"})])]),d("div",u6,[i[4]||(i[4]=d("p",{class:"text-sm text-retro-muted font-mono"}," Are you sure you want to delete this conversation? ",-1)),d("p",h6,' "'+A(r.title)+'" ',1),i[5]||(i[5]=d("p",{class:"mt-3 text-xs text-retro-muted"}," This action cannot be undone. ",-1))]),d("div",d6,[d("button",{onClick:i[1]||(i[1]=o=>t("cancel")),class:"px-4 py-2 text-sm font-mono text-retro-muted border border-retro-border rounded hover:bg-retro-panel transition-colors"}," Cancel "),d("button",{onClick:i[2]||(i[2]=o=>t("confirm")),class:"px-4 py-2 text-sm font-mono text-white bg-retro-red/80 border border-retro-red rounded hover:bg-retro-red transition-colors"}," Delete ")])])):F("",!0)]),_:1})])):F("",!0)]),_:1})]))}}),m6={class:"h-full flex flex-col bg-retro-black"},p6={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},g6={class:"flex items-center gap-2 min-w-0"},O6={class:"text-xs font-mono text-retro-text truncate"},v6={class:"flex items-center gap-1"},b6=["disabled","title"],x6=["title"],y6=["title"],k6=["disabled"],w6={key:4,class:"flex-shrink-0 px-4 py-2 border-b border-retro-border bg-retro-green/10 text-retro-green text-xs font-mono text-center"},S6={class:"flex-1 min-h-0 flex flex-col"},Fm=Ve({__name:"ChatPanel",setup(r){const e=vr(),t=R1(),{disconnectConversation:n}=Ml();gt(async()=>{try{const I=await $fetch("/api/cwd");e.setCwd(I.cwd)}catch{}});const s=J(()=>e.activeConversation?.title||"New Chat"),i=P(!1),o=J(()=>t.isChatFullscreen),a=P(!1);ze(a,I=>{e.setDebugStreamEnabled(I)}),wt(()=>{e.setDebugStreamEnabled(!1)});function l(){t.toggleChatFullscreen()}async function c(){i.value=!1;const I=e.activeConversationId;I&&(n(I),await e.deleteConversation(I)),e.clearMessages()}function u(){e.hasMessages&&(i.value=!0)}function h(){i.value=!1}const f=P(!1),p=P(null),g=J(()=>e.activeConversation?.finalized===!0),O=J(()=>g.value),b=P(null),x=P(!1);async function k(){const I=e.activeConversation;if(!I?.worktreePath||!I?.baseBranch){b.value=null;return}x.value=!0;try{const z=await $fetch("/api/chat/compare",{params:{worktreePath:I.worktreePath,baseBranch:I.baseBranch}});b.value=z}catch{b.value=null}finally{x.value=!1}}ze(()=>[e.activeConversationId,e.activeConversation?.worktreePath,e.activeConversation?.baseBranch,e.activeConversation?.lastCommitTime,e.activeConversation?.updatedAt,e.isActiveConversationStreaming],()=>{k()},{immediate:!0}),ze(()=>e.activeConversationId,()=>{f.value=!1,Z.value=!1,p.value=null});const w=J(()=>b.value?b.value.ahead===0&&b.value.behind===0:!1),S=J(()=>{const I=e.activeConversation;return I?.hasWorktree&&!I?.finalized}),Q=J(()=>{const I=e.activeConversation;return!!I?.hasWorktree&&!I?.finalized&&!e.isActiveConversationStreaming&&!w.value});function L(){f.value=!0,p.value=null}async function E(I,z){const be=e.activeConversationId;if(!be)return;const K=await e.finalizeConversation(be,I,z);if(f.value=!1,K.success)p.value={type:"success",message:`Merged to ${z}`},setTimeout(()=>{p.value=null},5e3);else if(K.rebaseInProgress)p.value=null;else{const H=K.conflictFiles?.length?`Conflict in: ${K.conflictFiles.join(", ")}`:K.error||"Finalize failed";p.value={type:"error",message:H}}}function G(){f.value=!1}function oe(){if(!e.conflictState&&e.activeConversation?.hasWorktree){const I=e.activeConversation?.baseBranch||"main";p.value={type:"success",message:`Rebased onto ${I}`},setTimeout(()=>{p.value=null},5e3)}else p.value=null}const ie=P(!1),j=J(()=>!!e.activeConversation?.previewBranch);async function V(){const I=e.activeConversationId;if(!I)return;ie.value=!0,p.value=null;const z=j.value,be=await e.togglePreview(I);if(be.success){const K=z?`Switched back to ${e.activeConversation?.baseBranch}`:"Preview active — main worktree updated";p.value={type:"success",message:K},setTimeout(()=>{p.value=null},3e3)}else p.value={type:"error",message:be.error||"Preview toggle failed"};ie.value=!1}const Z=P(!1);function U(){Z.value=!0,p.value=null}async function W(I){const z=e.activeConversationId;if(!z)return;const be=await e.rebaseConversation(z,I);Z.value=!1,be.success?(p.value={type:"success",message:`Rebased onto ${I}`},setTimeout(()=>{p.value=null},5e3)):be.rebaseInProgress?p.value=null:p.value={type:"error",message:be.error||"Rebase failed"}}function N(){Z.value=!1}return(I,z)=>(v(),y("div",m6,[d("div",p6,[d("div",g6,[d("span",O6,A(m(s)),1)]),d("div",v6,[m(S)?(v(),y("button",{key:0,disabled:m(ie),class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:m(j)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:V},[m(j)?(v(),pe(m(Qv),{key:0,class:"w-4 h-4 text-retro-cyan"})):(v(),pe(m(Pv),{key:1,class:"w-4 h-4"}))],8,b6)):F("",!0),m(Q)?(v(),y("button",{key:1,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Rebase: sync worktree onto target base branch",onClick:U},[...z[2]||(z[2]=[Km('<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="7" cy="4.5" r="1.5" fill="currentColor"></circle><circle cx="18" cy="20" r="1.5" fill="currentColor"></circle><circle cx="12" cy="7" r="1.4" fill="currentColor" opacity="0.9"></circle><path d="M7 6V16M7 16L4.5 13.5M7 16L9.5 13.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.4 7H12.5C15.5376 7 18 9.46243 18 12.5V18.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15.5 16L18 18.5L20.5 16" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)])])):F("",!0),m(Q)?(v(),y("button",{key:2,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Finalize: squash & merge to base branch",onClick:L},[ee(m(Au),{class:"w-4 h-4"})])):F("",!0),d("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:m(o)?"Exit fullscreen chat":"Fullscreen chat",onClick:l},[m(o)?(v(),pe(m(ip),{key:0,class:"w-4 h-4"})):(v(),pe(m(op),{key:1,class:"w-4 h-4"}))],8,x6),d("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:m(a)?"Hide debug stream":"Show debug stream",onClick:z[0]||(z[0]=be=>a.value=!m(a))},[ee(m(Ov),{class:_e(["w-4 h-4",m(a)?"text-retro-cyan":""])},null,8,["class"])],8,y6),d("button",{disabled:!m(e).hasMessages,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"New conversation",onClick:u},[ee(m(vn),{class:"w-4 h-4"})],8,k6)])]),ee(f6,{show:m(i),title:m(s),onConfirm:c,onCancel:h},null,8,["show","title"]),m(f)&&m(e).activeConversation?.hasWorktree?(v(),pe(tZ,{key:0,"base-branch":m(e).activeConversation.baseBranch||"main","worktree-branch":m(e).activeConversation.worktreeBranch||"","worktree-path":m(e).activeConversation.worktreePath||"",onConfirm:E,onCancel:G},null,8,["base-branch","worktree-branch","worktree-path"])):F("",!0),m(Z)&&m(e).activeConversation?.hasWorktree?(v(),pe(OZ,{key:1,"base-branch":m(e).activeConversation.baseBranch||"main","worktree-branch":m(e).activeConversation.worktreeBranch||"","worktree-path":m(e).activeConversation.worktreePath||"",onConfirm:W,onCancel:N},null,8,["base-branch","worktree-branch","worktree-path"])):F("",!0),m(e).conflictState?(v(),pe(o6,{key:2,onClose:oe})):F("",!0),m(p)?(v(),y("div",{key:3,class:_e(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",m(p).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[Ie(A(m(p).message)+" ",1),m(p).type==="error"?(v(),y("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:z[1]||(z[1]=be=>p.value=null)}," dismiss ")):F("",!0)],2)):F("",!0),m(g)?(v(),y("div",w6," This conversation has been finalized and is read-only. ")):F("",!0),d("div",S6,[ee(f7,{class:"flex-1 overflow-hidden"}),m(a)?(v(),pe(R8,{key:0})):F("",!0)]),ee(w8,{disabled:m(O)},null,8,["disabled"])]))}}),$6={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},C6={class:"flex items-center gap-2 min-w-0"},Q6=["title"],P6={class:"text-retro-text font-mono text-sm truncate"},T6={class:"text-retro-muted"},M6={class:"text-retro-text"},A6={class:"text-retro-muted font-mono text-xs flex-shrink-0"},_6={class:"flex-1 overflow-auto"},R6={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},B6={key:1,class:"flex items-center justify-center text-retro-muted text-sm py-8"},Z6={key:2,class:"flex items-center justify-center text-retro-muted text-sm py-8"},E6={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},D6={key:0,class:"diff-warning"},L6={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},X6={class:"diff-line-num select-none text-right px-2 w-12"},I6={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},V6={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},z6={key:0,class:"diff-sign"},N6={key:1,class:"diff-sign"},W6={key:2,class:"diff-sign"},q6={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},j6=Ve({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(r,{emit:e}){const t=r,n=e,s=P(null),i=J(()=>t.commitHash.substring(0,7)),o=J(()=>Fs[t.file.status]||{label:t.file.status,colorClass:"text-retro-muted"}),a=J(()=>t.file.status==="R"&&t.file.oldPath);function l(c){c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),n("close"))}return gt(()=>{s.value?.focus()}),(c,u)=>(v(),y("div",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:l,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[d("div",$6,[d("div",C6,[d("span",{class:_e(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",o.value.colorClass]),title:o.value.label},A(r.file.status),11,Q6),d("span",P6,[a.value&&r.file.oldPath?(v(),y(we,{key:0},[d("span",T6,A(r.file.oldPath),1),u[1]||(u[1]=d("span",{class:"text-retro-yellow mx-1"},"→",-1)),d("span",M6,A(r.file.path),1)],64)):(v(),y(we,{key:1},[Ie(A(r.file.path),1)],64))]),d("span",A6," @ "+A(i.value),1)]),d("button",{onClick:u[0]||(u[0]=h=>n("close")),class:"p-1 hover:bg-retro-dark rounded transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close diff viewer",title:"Close (Esc)"},[ee(m(St),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),d("div",_6,[r.loading?(v(),y("div",R6,[...u[2]||(u[2]=[d("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ie(" Loading diff... ",-1)])])):r.content&&r.content.binary?(v(),y("div",B6,[...u[3]||(u[3]=[d("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," Binary file — cannot display diff ",-1)])])):r.content&&r.content.lines.length===0?(v(),y("div",Z6,[...u[4]||(u[4]=[d("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," No changes in this file ",-1)])])):r.content?(v(),y("table",E6,[d("tbody",null,[r.content.truncated?(v(),y("tr",D6,[...u[5]||(u[5]=[d("td",{colspan:"3",class:"px-4 py-2 text-retro-yellow bg-retro-panel text-center"}," Diff truncated — file has more than 10,000 lines ",-1)])])):F("",!0),(v(!0),y(we,null,Ne(r.content.lines,(h,f)=>(v(),y("tr",{key:f,class:_e({"diff-add":h.type==="add","diff-delete":h.type==="delete","diff-context":h.type==="context","diff-header":h.type==="header"})},[h.type==="header"?(v(),y("td",L6,A(h.content),1)):(v(),y(we,{key:1},[d("td",X6,A(h.oldLineNumber??""),1),d("td",I6,A(h.newLineNumber??""),1),d("td",V6,[h.type==="add"?(v(),y("span",z6,"+")):h.type==="delete"?(v(),y("span",N6,"-")):(v(),y("span",W6," ")),Ie(" "+A(h.content),1)])],64))],2))),128))])])):(v(),y("div",q6," Failed to load diff content. "))])],544))}}),Um=ws(j6,[["__scopeId","data-v-74bf9bf3"]]),Y6={class:"fixed inset-0 z-50 flex items-center justify-center"},F6={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},U6={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},G6={class:"flex items-center gap-2"},H6={class:"text-sm font-mono text-retro-text"},K6={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},J6={key:0},eE={class:"space-y-6"},tE={class:"space-y-1.5"},rE=["value","checked","onChange"],nE={class:"flex-1"},sE={class:"text-sm font-mono text-retro-text"},iE={class:"text-xs text-retro-muted leading-tight"},oE={class:"text-xs font-mono text-retro-muted"},aE={class:"text-xs text-retro-muted mb-3"},lE=["disabled"],cE={class:"space-y-1.5"},uE=["value","checked","onChange"],hE={class:"flex-1"},dE={class:"text-sm font-mono text-retro-text"},fE={class:"text-xs text-retro-muted leading-tight"},mE={key:1,class:"space-y-4"},pE={class:"space-y-1.5"},gE=["checked"],OE=["checked"],vE={class:"flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel"},bE={class:"text-xs font-mono text-retro-cyan"},xE=Ve({__name:"SettingsModal",emits:["close"],setup(r,{emit:e}){const t=e,n=bo(),s=q1(),i=vo(),o=P("main"),a=P(!1),l=J(()=>s.public.appVersion||"unknown"),c=[{value:"dark",label:"Dark",description:"Retro terminal theme with dark backgrounds"},{value:"light",label:"Light",description:"Bright theme for well-lit environments"}],u=[{value:"plan",label:Zs.plan,description:Do.plan,icon:Bu,color:"text-retro-cyan"},{value:"ask",label:Zs.ask,description:Do.ask,icon:Zu,color:"text-retro-green"},{value:"auto",label:Zs.auto,description:Do.auto,icon:lp,color:"text-retro-yellow"},{value:"bypass",label:Zs.bypass,description:Do.bypass,icon:Eu,color:"text-retro-red"}],{data:h,pending:f,error:p}=$c("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),g=J(()=>h.value?.providers??[]),O=J(()=>{const Z=p.value;return Z?Z instanceof Error?Z.message:String(Z):null}),{data:b,refresh:x}=$c("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),k=J(()=>{const Z=b.value;return Z?Z.isIndexing?`Indexing (${Z.currentJob||"running"})`:Z.schedulerActive?`Indexed ${Z.fileCount} files / ${Z.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});gt(()=>{n.hydrate()});const w=Z=>{n.setProviderSelection(Z),i.success("Settings saved")},S=()=>{o.value="provider"},Q=()=>{o.value="main"},L=Z=>{n.setTheme(Z),i.success("Settings saved")},E=Z=>{n.setPermissionMode(Z),i.success("Settings saved")},G=Z=>{n.setAutoGenerateCommitMessages(Z),i.success("Settings saved")},oe=()=>{t("close")},ie=async()=>{if(!a.value){a.value=!0;try{const Z=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!Z.success&&Z.status==="already-indexing"?i.info("Spec index is already running"):i.success("Spec reindex started"),await x()}catch(Z){i.error(Z instanceof Error?Z.message:"Failed to start spec reindex")}finally{a.value=!1}}},j=Z=>{Z.key==="Escape"&&t("close")};gt(()=>{window.addEventListener("keydown",j)}),wt(()=>{window.removeEventListener("keydown",j)});let V=null;return gt(()=>{V=Lu(()=>{x()},5e3)}),wt(()=>{V&&clearInterval(V)}),(Z,U)=>(v(),pe(Pr,{to:"body"},[d("div",Y6,[d("div",{class:"absolute inset-0 bg-black/70",onClick:oe}),d("div",F6,[d("div",U6,[d("div",G6,[o.value==="provider"?(v(),y("button",{key:0,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Back",onClick:Q},[ee(m(pv),{class:"h-4 w-4"})])):F("",!0),d("h2",H6,A(o.value==="provider"?"AI Provider Settings":"Settings"),1)]),d("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:U[0]||(U[0]=W=>t("close"))},[ee(m(St),{class:"h-4 w-4"})])]),d("div",K6,[o.value==="main"?(v(),y("section",J6,[d("div",eE,[d("section",null,[U[3]||(U[3]=d("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),U[4]||(U[4]=d("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),d("div",tE,[(v(),y(we,null,Ne(c,W=>d("label",{key:W.value,class:_e(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[m(n).theme===W.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[d("input",{type:"radio",name:"theme",value:W.value,checked:m(n).theme===W.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:N=>L(W.value)},null,40,rE),d("div",nE,[d("div",sE,A(W.label),1),d("div",iE,A(W.description),1)])],2)),64))])]),U[11]||(U[11]=d("div",{class:"border-t border-retro-border"},null,-1)),d("section",null,[U[6]||(U[6]=d("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),U[7]||(U[7]=d("p",{class:"text-xs text-retro-muted mb-3"}," Configure provider and model settings for new conversations. ",-1)),d("button",{type:"button",class:"w-full flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel hover:border-retro-muted transition-colors",onClick:S},[U[5]||(U[5]=d("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),d("span",oE,A(m(n).providerSelection.providerId)+" / "+A(m(n).providerSelection.modelKey),1)])]),U[12]||(U[12]=d("div",{class:"border-t border-retro-border"},null,-1)),d("section",null,[U[8]||(U[8]=d("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),d("p",aE,A(k.value),1),d("button",{type:"button",class:"w-full flex items-center justify-center px-3 py-2 rounded border border-retro-border bg-retro-panel text-retro-text hover:border-retro-muted transition-colors disabled:opacity-60",disabled:a.value||m(b)?.isIndexing,onClick:ie},A(a.value?"Starting reindex...":"Reindex Specs"),9,lE)]),U[13]||(U[13]=d("div",{class:"border-t border-retro-border"},null,-1)),d("section",null,[U[9]||(U[9]=d("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),U[10]||(U[10]=d("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),d("div",cE,[(v(),y(we,null,Ne(u,W=>d("label",{key:W.value,class:_e(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[m(n).permissionMode===W.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[d("input",{type:"radio",name:"permission-mode",value:W.value,checked:m(n).permissionMode===W.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:N=>E(W.value)},null,40,uE),(v(),pe(ps(W.icon),{class:_e(["w-4 h-4 flex-shrink-0",W.color])},null,8,["class"])),d("div",hE,[d("div",dE,A(W.label),1),d("div",fE,A(W.description),1)])],2)),64))])]),U[14]||(U[14]=d("div",{class:"border-t border-retro-border"},null,-1))])])):(v(),y("section",mE,[U[15]||(U[15]=d("div",null,[d("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider"),d("p",{class:"text-xs text-retro-muted mb-3"}," Choose which registered provider and model powers new conversations. ")],-1)),ee(uv,{providers:g.value,selected:m(n).providerSelection,permissionMode:m(n).permissionMode,pending:m(f),errorMessage:O.value,onSelect:w},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),U[23]||(U[23]=d("div",{class:"border-t border-retro-border"},null,-1)),d("section",null,[U[18]||(U[18]=d("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Commit Messages",-1)),U[19]||(U[19]=d("p",{class:"text-xs text-retro-muted mb-3"}," Choose whether to use AI to generate commit messages automatically. ",-1)),d("div",pE,[d("label",{class:_e(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[m(n).autoGenerateCommitMessages?"border-retro-border bg-retro-panel hover:border-retro-muted":"border-retro-cyan bg-retro-cyan/10"]])},[d("input",{type:"radio",name:"commit-messages",value:!1,checked:!m(n).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:U[1]||(U[1]=W=>G(!1))},null,40,gE),U[16]||(U[16]=d("div",{class:"flex-1"},[d("div",{class:"text-sm font-mono text-retro-text"},"Template (Recommended)"),d("div",{class:"text-xs text-retro-muted leading-tight"},"Simple template-based messages. No token usage.")],-1))],2),d("label",{class:_e(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[m(n).autoGenerateCommitMessages?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[d("input",{type:"radio",name:"commit-messages",value:!0,checked:m(n).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:U[2]||(U[2]=W=>G(!0))},null,40,OE),U[17]||(U[17]=d("div",{class:"flex-1"},[d("div",{class:"text-sm font-mono text-retro-text"},"AI-Generated"),d("div",{class:"text-xs text-retro-muted leading-tight"},"Uses Claude Haiku to create meaningful commit messages. ~300-500 tokens per commit.")],-1))],2)])]),U[24]||(U[24]=d("div",{class:"border-t border-retro-border"},null,-1)),d("section",null,[U[21]||(U[21]=d("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec-Cat",-1)),U[22]||(U[22]=d("p",{class:"text-xs text-retro-muted mb-3"}," Application version. ",-1)),d("div",vE,[U[20]||(U[20]=d("span",{class:"text-sm font-mono text-retro-text"},"Version",-1)),d("span",bE,A(l.value),1)])])])])])]))}}),yE={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},kE={class:"flex-1 text-sm font-mono text-retro-text"},wE=["onClick"],SE=Ve({__name:"ToastContainer",setup(r){const{toasts:e,remove:t}=vo(),n={success:{bg:"bg-retro-green/20",icon:"text-retro-green",border:"border-retro-green/50"},error:{bg:"bg-retro-red/20",icon:"text-retro-red",border:"border-retro-red/50"},info:{bg:"bg-retro-cyan/20",icon:"text-retro-cyan",border:"border-retro-cyan/50"},warning:{bg:"bg-retro-yellow/20",icon:"text-retro-yellow",border:"border-retro-yellow/50"}},s=i=>{switch(i){case"success":return Au;case"error":return Oo;case"warning":return En;default:return _v}};return(i,o)=>(v(),pe(Pr,{to:"body"},[d("div",yE,[ee(j1,{"enter-active-class":"transition-all duration-300 ease-out","leave-active-class":"transition-all duration-200 ease-in","enter-from-class":"opacity-0 translate-x-4","enter-to-class":"opacity-100 translate-x-0","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-4"},{default:ut(()=>[(v(!0),y(we,null,Ne(m(e),a=>(v(),y("div",{key:a.id,class:_e(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[n[a.type].bg,n[a.type].border]])},[(v(),pe(ps(s(a.type)),{class:_e(["h-5 w-5 flex-shrink-0 mt-0.5",n[a.type].icon])},null,8,["class"])),d("p",kE,A(a.message),1),d("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:l=>m(t)(a.id)},[ee(m(St),{class:"h-4 w-4"})],8,wE)],2))),128))]),_:1})])]))}}),$E=Ve({__name:"SplashScreen",setup(r){const e=P(!0),t=P(!1);return gt(()=>{setTimeout(()=>{t.value=!0,setTimeout(()=>{e.value=!1},600)},1800)}),(n,s)=>(v(),pe(Pr,{to:"body"},[e.value?(v(),y("div",{key:0,class:_e(["fixed inset-0 z-[9999] flex items-center justify-center bg-retro-black transition-opacity duration-500",{"opacity-0":t.value}])},[...s[0]||(s[0]=[d("div",{class:"flex flex-col items-center gap-6"},[d("pre",{class:"text-retro-cyan font-mono text-xs leading-tight select-none splash-glow"},` ____ ____ _
|
|
80
|
+
/ ___| _ __ ___ ___ / ___|__ _| |_
|
|
81
|
+
\\___ \\| '_ \\ / _ \\/ __|| | / _\` | __|
|
|
82
|
+
___) | |_) | __/ (__ | |__| (_| | |_
|
|
83
|
+
|____/| .__/ \\___|\\___| \\____\\__,_|\\__|
|
|
84
|
+
|_|
|
|
85
|
+
`),d("div",{class:"flex items-center gap-2"},[d("span",{class:"inline-block w-2 h-2 rounded-full bg-retro-cyan animate-pulse"}),d("span",{class:"text-retro-muted font-mono text-xs tracking-widest uppercase"},"initializing")])],-1)])],2)):F("",!0)]))}}),CE=ws($E,[["__scopeId","data-v-7fddb179"]]);let Lt=null,_s=null,es=null;const QE=5e3,PE=500,TE=1e3,wc=5;let dr=null;const ts=new Map,rs=new Map,pa=new Map;function ME(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function AE(){const r=vr();async function e(){console.log("[GlobalNotifications] Executing debounced refresh");const g=await r.refreshServerConversations();console.log("[GlobalNotifications] Refresh result:",g);const O=[];for(const[b,x]of ts)ts.delete(b),n(b,x)||O.push([b,x]);for(const[b,x]of O){const k=(rs.get(b)??0)+1;if(k<=wc){rs.set(b,k),console.log(`[GlobalNotifications] Scheduling retry ${k}/${wc} for ${b}`);const w=setTimeout(()=>{pa.delete(b),ts.set(b,x),t()},TE*k);pa.set(b,w)}else console.warn(`[GlobalNotifications] Gave up streaming setup for ${b} after ${wc} retries`),rs.delete(b)}}function t(){es&&clearTimeout(es),es=setTimeout(()=>{es=null,e()},PE)}function n(g,O){if(!Lt||Lt.readyState!==WebSocket.OPEN)return!1;if(r.isConversationStreaming(g))return rs.delete(g),!0;const b=r.conversations.find(w=>w.id===g);if(!b)return console.warn("[GlobalNotifications] Conversation not found for streaming:",g),!1;rs.delete(g),b.messages.length===0&&O&&r.addUserMessage(O,g);const x=[...b.messages].reverse().find(w=>w.role==="assistant");if(x)return r.resetMessageForReplay(x.id,g),r.startConversationStreaming(g),dr={conversationId:g,messageId:x.id,currentTextBlockId:null,currentToolBlockId:null,currentToolInputJson:"",isReplaying:!1,replayBuffer:[]},Lt.send(JSON.stringify({type:"subscribe",conversationId:g,cursor:0})),console.log("[GlobalNotifications] Resumed server job streaming (existing msg):",g),!0;const k=r.addAssistantMessage(g);return r.initContentBlocks(k.id,g),r.startConversationStreaming(g),dr={conversationId:g,messageId:k.id,currentTextBlockId:null,currentToolBlockId:null,currentToolInputJson:"",isReplaying:!1,replayBuffer:[]},Lt.send(JSON.stringify({type:"subscribe",conversationId:g,cursor:0})),console.log("[GlobalNotifications] Subscribed to server job streaming:",g),!0}function s(g){try{const O=JSON.parse(g.data);if(O.type==="notification"){i(O);return}dr&&o(O)}catch{}}function i(g){if(console.log("[GlobalNotifications] Received:",g.notificationEvent,g.conversationId),g.notificationEvent==="job_created"){ts.set(g.conversationId,g.message||""),t();return}if(g.notificationEvent==="job_persisted"){dr?.conversationId===g.conversationId&&(r.endConversationStreaming(g.conversationId),dr=null),ts.delete(g.conversationId),rs.delete(g.conversationId),t();return}if(g.notificationEvent!=="job_completed"&&g.notificationEvent==="conversation_archived"){t();return}}function o(g){const O=dr,b=O.conversationId;if(g.type==="replay_start"){O.isReplaying=!0,O.replayBuffer=[];return}if(g.type==="replay_end"){a(O),O.isReplaying=!1,O.replayBuffer=[];return}if(O.isReplaying){(g.type==="ui_event"||g.type==="done"||g.type==="error")&&O.replayBuffer.push(g);return}if(g.type==="ui_event"&&g.event){c(O,g.event,b);return}if(g.type!=="done"&&g.type==="error"){r.updateMessage(O.messageId,{status:"error"},b),r.setSessionError(g.error||"Server job error",b),r.endConversationStreaming(b),dr=null;return}}function a(g){const O=[];let b="",x=null,k=null,w="";for(const S of g.replayBuffer){if(S.type!=="ui_event"||!S.event)continue;const Q=S.event;switch(Q.type){case"block_start":if(Q.blockType==="text"){const L=Q.blockId||Ht();O.push({id:L,type:"text",text:Q.text||""}),x=L,k=null,Q.text&&(b+=Q.text)}else if(Q.blockType==="tool_use"&&Q.toolUseId&&Q.name){const L=Q.blockId||Ht();O.push({id:L,type:"tool_use",toolUseId:Q.toolUseId,name:Q.name,input:{},inputSummary:"",status:"running"}),x=null,k=Q.index??0,w=""}break;case"block_delta":if(Q.text&&x){const L=O.find(E=>E.id===x);L&&L.type==="text"&&(L.text+=Q.text,b+=Q.text)}Q.partialJson&&k!==null&&(w+=Q.partialJson);break;case"block_end":if(x&&(x=null),k!==null){const L=[...O].reverse().find(E=>E.type==="tool_use");if(L){let E={};try{E=JSON.parse(w)}catch{}L.input=E,L.inputSummary=l(E),L.status="pending"}k=null,w=""}break;case"tool_result":{const L=[...O].reverse().find(E=>E.type==="tool_use"&&E.toolUseId===Q.toolUseId);L&&(L.status=Q.isError?"error":"complete"),O.push({id:Ht(),type:"tool_result",toolUseId:Q.toolUseId,content:Q.content||"",isError:!!Q.isError});break}}}O.length>0&&r.batchSetMessageBlocks(g.messageId,O,b,"streaming",g.conversationId),g.currentTextBlockId=x,g.currentToolBlockId=null,g.currentToolInputJson="",console.log(`[GlobalNotifications] Replay batch: ${g.replayBuffer.length} events → ${O.length} blocks`)}function l(g){return g.file_path?String(g.file_path):g.path?String(g.path):g.command?String(g.command).slice(0,50):""}function c(g,O,b){switch(O.type){case"block_start":{if(O.blockType==="text"){const x=O.blockId||Ht(),k={id:x,type:"text",text:O.text||""};r.appendContentBlock(g.messageId,k,b),g.currentTextBlockId=x,g.currentToolBlockId=null,O.text&&r.appendToMessage(g.messageId,O.text,b)}else if(O.blockType==="tool_use"&&O.toolUseId&&O.name){const x=O.blockId||Ht(),k={id:x,type:"tool_use",toolUseId:O.toolUseId,name:O.name,input:{},inputSummary:"",status:"running"};r.appendContentBlock(g.messageId,k,b),g.currentToolBlockId=x,g.currentToolInputJson="",g.currentTextBlockId=null}break}case"block_delta":{O.text&&g.currentTextBlockId&&(r.updateBlockById(g.messageId,g.currentTextBlockId,x=>{x.type==="text"&&(x.text+=O.text)},b),r.appendToMessage(g.messageId,O.text,b)),O.partialJson&&g.currentToolBlockId&&(g.currentToolInputJson+=O.partialJson);break}case"block_end":{if(g.currentTextBlockId&&(g.currentTextBlockId=null),g.currentToolBlockId){const x=g.currentToolBlockId,k=g.currentToolInputJson;r.updateBlockById(g.messageId,x,w=>{if(w.type==="tool_use"){const S=w;let Q={};try{Q=JSON.parse(k)}catch{}S.input=Q,S.inputSummary=l(Q),S.status="pending"}},b),g.currentToolBlockId=null,g.currentToolInputJson=""}break}case"tool_result":{if(O.toolUseId){const x=r.findToolUseBlock(g.messageId,O.toolUseId,b);x&&r.updateBlockById(g.messageId,x.id,w=>{w.type==="tool_use"&&(w.status=O.isError?"error":"complete")},b);const k={id:Ht(),type:"tool_result",toolUseId:O.toolUseId,content:O.content||"",isError:!!O.isError};r.appendContentBlock(g.messageId,k,b)}break}}}function u(){if(typeof window>"u"||Lt&&(Lt.readyState===WebSocket.OPEN||Lt.readyState===WebSocket.CONNECTING))return;const g=ME();Lt=new WebSocket(g),Lt.onopen=()=>{console.log("[GlobalNotifications] WebSocket connected")},Lt.onmessage=s,Lt.onclose=O=>{console.log("[GlobalNotifications] WebSocket closed",{code:O.code,reason:O.reason}),Lt=null,dr&&(r.endConversationStreaming(dr.conversationId),dr=null),h()},Lt.onerror=O=>{console.warn("[GlobalNotifications] WebSocket error",O)}}function h(){_s||(_s=setTimeout(()=>{_s=null,u()},QE))}function f(){_s&&(clearTimeout(_s),_s=null),es&&(clearTimeout(es),es=null);for(const g of pa.values())clearTimeout(g);pa.clear(),rs.clear(),ts.clear(),dr&&(r.endConversationStreaming(dr.conversationId),dr=null),Lt&&(Lt.close(),Lt=null)}async function p(){try{const O=(await $fetch("/api/jobs")).filter(b=>b.source!=="user"&&(b.status==="running"||b.status==="waiting_permission"||b.status==="queued"||b.status==="done"&&b.eventCount>0));if(O.length===0)return;await r.refreshServerConversations();for(const b of O){if(r.isConversationStreaming(b.conversationId))continue;const x=r.conversations.find(S=>S.id===b.conversationId);if(!x)continue;const k=[...x.messages].reverse().find(S=>S.role==="assistant");if(k&&(k.status==="complete"||k.status==="error"||k.status==="stopped"))continue;console.log("[GlobalNotifications] Resuming active server job:",b.id,"for conversation:",b.conversationId),n(b.conversationId,"")||(console.log("[GlobalNotifications] WS not ready for resume, queuing for retry:",b.conversationId),ts.set(b.conversationId,""),t())}}catch(g){console.warn("[GlobalNotifications] Failed to check for active server jobs:",g)}}return gt(()=>{u()}),wt(()=>{f()}),{connect:u,disconnect:f,resumeActiveServerJobs:p}}const _E={class:"h-screen min-w-[320px] overflow-hidden bg-retro-black text-retro-text"},RE={key:0,class:"flex h-full flex-col overflow-hidden"},BE={class:"flex-shrink-0 border-b border-retro-border bg-retro-panel"},ZE={class:"flex h-14 items-center justify-between gap-3 px-3"},EE={class:"flex items-center gap-2 min-w-0"},DE={class:"min-w-0"},LE={class:"text-[11px] text-retro-muted font-mono truncate"},XE={class:"flex items-center gap-1"},IE=["title"],VE={class:"relative flex-1 min-h-0 overflow-hidden"},zE={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Git"},NE={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Specs"},WE={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Conversations"},qE={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Chat"},jE={key:0,class:"absolute inset-0 z-30 flex flex-col overflow-hidden bg-retro-black"},YE={class:"flex-shrink-0 border-t border-retro-border bg-retro-panel","aria-label":"Mobile primary navigation"},FE={class:"grid h-16 grid-cols-4"},UE=["aria-current","onClick"],GE={class:"truncate"},HE={key:1,class:"flex h-full overflow-x-auto"},KE={class:"flex flex-col overflow-hidden",style:{flex:"3"}},JE={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},eD={class:"flex items-center gap-2 min-w-0"},tD={key:0,class:"text-xs text-retro-muted font-mono truncate"},rD={class:"flex items-center gap-1"},nD=["title"],sD={class:"flex-1 min-h-0 overflow-y-auto"},iD={class:"relative flex min-w-0",style:{flex:"7"}},oD={key:0,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},aD={key:1,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},lD={key:2,class:"absolute inset-0 z-30 flex flex-col overflow-hidden border-l border-retro-border bg-retro-black"},yD=Ve({__name:"default",setup(r){const e=R1(),t=bo(),n=vr(),s=ml(),{isDark:i,toggleTheme:o}=sv(),{tryResumeStreaming:a}=Ml(),{resumeActiveServerJobs:l}=AE(),c=J(()=>s.diffViewerFile!==null),u=J(()=>e.isMobile),h=J(()=>e.isChatFullscreen),f=J(()=>h.value),p=J(()=>h.value?7:3),g=P(!1),O=P(""),b=P("chat"),x=[{id:"git",label:"Git",icon:kv},{id:"features",label:"Specs",icon:Os},{id:"conversations",label:"Threads",icon:fp},{id:"chat",label:"Chat",icon:cp}],k=J(()=>x.find(E=>E.id===b.value)?.label??"Chat"),w=J(()=>{if(!O.value)return"";const E=O.value.replace(/\/+$/,"").split("/");return E[E.length-1]||""}),S=J(()=>w.value?`spec cat :: ${w.value}`:"spec cat");function Q(){return n.conversations.filter(E=>[...E.messages].reverse().find(oe=>oe.role==="assistant")?.status==="streaming").map(E=>E.id)}Y1(()=>({title:S.value}));const L=()=>{typeof window<"u"&&e.updateViewport(window.innerWidth)};return ze(u,E=>{E&&h.value&&e.setChatFullscreen(!1)}),ze(()=>n.activeConversationId,(E,G)=>{u.value&&b.value==="conversations"&&E&&E!==G&&(b.value="chat")}),gt(async()=>{typeof window<"u"&&(e.updateViewport(window.innerWidth),window.addEventListener("resize",L)),await t.hydrate(),await n.initialize(),await n.loadConversations();const E=Q();await Promise.allSettled(E.map(G=>a(G))),await l();try{const G=await $fetch("/api/cwd");O.value=G.cwd}catch{O.value=""}}),wt(()=>{typeof window<"u"&&window.removeEventListener("resize",L)}),(E,G)=>{const oe=v2;return v(),y("div",_E,[u.value?(v(),y("div",RE,[d("header",BE,[d("div",ZE,[d("div",EE,[G[8]||(G[8]=d("img",{alt:"SpecCat",src:od,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),d("div",DE,[G[7]||(G[7]=d("div",{class:"text-xs font-bold text-retro-cyan font-mono uppercase tracking-wider"},"SPECCAT",-1)),d("div",LE,A(w.value?`${w.value} / ${k.value}`:k.value),1)])]),d("div",XE,[d("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-black",title:m(i)?"Switch to light theme":"Switch to dark theme",onClick:G[0]||(G[0]=(...ie)=>m(o)&&m(o)(...ie))},[m(i)?(v(),pe(m(jh),{key:0,class:"w-5 h-5"})):(v(),pe(m(Yh),{key:1,class:"w-5 h-5"}))],8,IE),d("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-black",title:"Settings",onClick:G[1]||(G[1]=ie=>g.value=!0)},[ee(m(Cc),{class:"w-5 h-5"})])])])]),d("main",VE,[je(d("section",zE,[ee(oe,{"working-directory":O.value,"is-active":b.value==="git"},null,8,["working-directory","is-active"])],512),[[Eo,b.value==="git"]]),je(d("section",NE,[ee(Wm)],512),[[Eo,b.value==="features"]]),je(d("section",WE,[ee(qm)],512),[[Eo,b.value==="conversations"]]),je(d("section",qE,[ee(Fm)],512),[[Eo,b.value==="chat"]]),c.value?(v(),y("div",jE,[ee(Um,{file:m(s).diffViewerFile,"commit-hash":m(s).diffViewerCommitHash,content:m(s).diffViewerContent,loading:m(s).diffViewerLoading,onClose:G[2]||(G[2]=ie=>m(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):F("",!0)]),d("nav",YE,[d("div",FE,[(v(),y(we,null,Ne(x,ie=>d("button",{key:ie.id,type:"button",class:_e(["flex min-w-0 flex-col items-center justify-center gap-1 px-1 text-[11px] font-mono transition-colors",b.value===ie.id?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-text hover:bg-retro-black"]),"aria-current":b.value===ie.id?"page":void 0,onClick:j=>b.value=ie.id},[(v(),pe(ps(ie.icon),{class:"h-5 w-5 flex-shrink-0"})),d("span",GE,A(ie.label),1)],10,UE)),64))])])])):(v(),y("div",HE,[d("div",KE,[d("div",JE,[d("div",eD,[G[9]||(G[9]=d("img",{alt:"SpecCat",src:od,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),G[10]||(G[10]=d("span",{class:"text-sm font-bold text-retro-cyan font-mono uppercase tracking-wider flex-shrink-0"},"SPECCAT",-1)),w.value?(v(),y("span",tD,"/ "+A(w.value),1)):F("",!0)]),d("div",rD,[d("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:m(i)?"Switch to light theme":"Switch to dark theme",onClick:G[3]||(G[3]=(...ie)=>m(o)&&m(o)(...ie))},[m(i)?(v(),pe(m(jh),{key:0,class:"w-5 h-5"})):(v(),pe(m(Yh),{key:1,class:"w-5 h-5"}))],8,nD),d("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:"Settings",onClick:G[4]||(G[4]=ie=>g.value=!0)},[ee(m(Cc),{class:"w-5 h-5"})])])]),d("div",sD,[ee(oe,{"working-directory":O.value},null,8,["working-directory"])])]),d("div",iD,[f.value?F("",!0):(v(),y("div",oD,[ee(Wm)])),f.value?F("",!0):(v(),y("div",aD,[ee(qm)])),d("div",{class:"flex flex-col overflow-hidden border-l border-retro-border",style:tr({flex:p.value})},[ee(Fm)],4),c.value?(v(),y("div",lD,[ee(Um,{file:m(s).diffViewerFile,"commit-hash":m(s).diffViewerCommitHash,content:m(s).diffViewerContent,loading:m(s).diffViewerLoading,onClose:G[5]||(G[5]=ie=>m(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):F("",!0)])])),g.value?(v(),pe(xE,{key:2,onClose:G[6]||(G[6]=ie=>g.value=!1)})):F("",!0),ee(SE),ee(CE),Hm(E.$slots,"default")])}}});export{yD as default};
|