studiograph 1.3.9 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/web/_app/immutable/chunks/{Bi-t3yHN.js → AWihU6Ne.js} +1 -1
  2. package/dist/web/_app/immutable/chunks/B1Cz8BMn.js +1 -0
  3. package/dist/web/_app/immutable/chunks/{BmPhvzn5.js → BqzGUHtY.js} +1 -1
  4. package/dist/web/_app/immutable/chunks/{BXuvR8Ks.js → C7VoTosa.js} +1 -1
  5. package/dist/web/_app/immutable/chunks/{BBLgaWN8.js → CTRxNfZk.js} +1 -1
  6. package/dist/web/_app/immutable/chunks/CWQRQXxy.js +1 -0
  7. package/dist/web/_app/immutable/chunks/{Cs5oz2oJ.js → CX_61fY8.js} +1 -1
  8. package/dist/web/_app/immutable/chunks/{BiuVYCkU.js → CfTe44NH.js} +1 -1
  9. package/dist/web/_app/immutable/chunks/{0oxpWEgM.js → CrdV0ttd.js} +1 -1
  10. package/dist/web/_app/immutable/chunks/{B1y7Wy5O.js → CscoF-YL.js} +1 -1
  11. package/dist/web/_app/immutable/chunks/{D2aTbzFm.js → D7ZqAKi9.js} +1 -1
  12. package/dist/web/_app/immutable/chunks/{7pRCkuF5.js → D9er1L5a.js} +1 -1
  13. package/dist/web/_app/immutable/chunks/DKQjBKyp.js +1 -0
  14. package/dist/web/_app/immutable/chunks/{CMFOFkXK.js → Dkz6p8Jo.js} +1 -1
  15. package/dist/web/_app/immutable/chunks/{BVBRzmeQ.js → DnL9f0lc.js} +2 -2
  16. package/dist/web/_app/immutable/chunks/{BCB5cYCz.js → i9c_RUF6.js} +2 -2
  17. package/dist/web/_app/immutable/entry/{app.CFW5bplI.js → app.mJ5Araew.js} +2 -2
  18. package/dist/web/_app/immutable/entry/start.DF_0_BfK.js +1 -0
  19. package/dist/web/_app/immutable/nodes/{0.DzgYLVo-.js → 0.BvuYB1gx.js} +3 -3
  20. package/dist/web/_app/immutable/nodes/{1.DGm1MhwK.js → 1.DJ_l-bGr.js} +1 -1
  21. package/dist/web/_app/immutable/nodes/{2.CzXC4v8x.js → 2.BGwKASX5.js} +1 -1
  22. package/dist/web/_app/immutable/nodes/3.xRAvlc2o.js +11 -0
  23. package/dist/web/_app/immutable/nodes/{4.BSv65LtF.js → 4.B0ynwCv_.js} +1 -1
  24. package/dist/web/_app/immutable/nodes/{5.DcKJMtC8.js → 5.BfU_Rt3A.js} +1 -1
  25. package/dist/web/_app/immutable/nodes/{6.koFgxtvt.js → 6.9tzx4cb2.js} +1 -1
  26. package/dist/web/_app/immutable/nodes/{7.Baev0HTo.js → 7.DExKUmUV.js} +2 -2
  27. package/dist/web/_app/immutable/nodes/{8.wJRie-EF.js → 8.BfIZOncu.js} +1 -1
  28. package/dist/web/_app/version.json +1 -1
  29. package/dist/web/index.html +6 -6
  30. package/package.json +1 -1
  31. package/dist/web/_app/immutable/chunks/B-2G7IOL.js +0 -1
  32. package/dist/web/_app/immutable/chunks/BPUy9_sS.js +0 -1
  33. package/dist/web/_app/immutable/entry/start.7s9ZYPwM.js +0 -1
  34. package/dist/web/_app/immutable/nodes/3.DuaI9dSH.js +0 -11
@@ -1 +1 @@
1
- import{c,a as p}from"./Cs_ROD7H.js";import"./CQCkXCml.js";import{f as i}from"./BeBar3OL.js";import{I as l,s as m}from"./BmPhvzn5.js";import{l as d,s as f}from"./xBRYfpah.js";function k(t,o){const e=d(o,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M20 6 9 17l-5-5"}]];l(t,f({name:"check"},()=>e,{get iconNode(){return r},children:(a,$)=>{var s=c(),n=i(s);m(n,o,"default",{}),p(a,s)},$$slots:{default:!0}}))}export{k as C};
1
+ import{c,a as p}from"./Cs_ROD7H.js";import"./CQCkXCml.js";import{f as i}from"./BeBar3OL.js";import{I as l,s as m}from"./BqzGUHtY.js";import{l as d,s as f}from"./xBRYfpah.js";function k(t,o){const e=d(o,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M20 6 9 17l-5-5"}]];l(t,f({name:"check"},()=>e,{get iconNode(){return r},children:(a,$)=>{var s=c(),n=i(s);m(n,o,"default",{}),p(a,s)},$$slots:{default:!0}}))}export{k as C};
@@ -0,0 +1 @@
1
+ import{aF as _e,bx as yt,R as ze,L as A,m as U,K as P,S as re,by as bt}from"./BeBar3OL.js";const V=[];function Ue(e,t=_e){let n=null;const r=new Set;function a(o){if(yt(e,o)&&(e=o,n)){const l=!V.length;for(const c of r)c[1](),V.push(c,e);if(l){for(let c=0;c<V.length;c+=2)V[c][0](V[c+1]);V.length=0}}}function i(o){a(o(e))}function s(o,l=_e){const c=[o,l];return r.add(c),r.size===1&&(n=t(a,i)||_e),o(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:a,update:i,subscribe:s}}class Pe{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Te{constructor(t,n){this.status=t,this.location=n}}class Ie extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function kt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function St(e){return e.split("%25").map(decodeURI).join("%25")}function Et(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function ve({href:e}){return e.split("#")[0]}function Rt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(s,o){if(o==="get"||o==="getAll"||o==="has")return(c,...d)=>(n(c),s[o](c,...d));t();const l=Reflect.get(s,o);return typeof l=="function"?l.bind(s):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const s of i)Object.defineProperty(a,s,{get(){return t(),e[s]},enumerable:!0,configurable:!0});return a}function xt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function Lt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const At=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&M.delete(Oe(e)),At(e,t));const M=new Map;function Ut(e,t){const n=Oe(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&M.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=Lt(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Pt(e,t,n){if(M.size>0){const r=Oe(e,n),a=M.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);M.delete(r)}}return window.fetch(t,n)}function Oe(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${xt(...a)}"]`}return r}const Tt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function It(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${$t(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return we(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return we(String.fromCharCode(...l.slice(2).split("-").map(v=>parseInt(v,16))));const d=Tt.exec(l),[,p,f,u,h]=d;return t.push({name:u,matcher:h,optional:!!p,rest:!!f,chained:f?c===1&&s[0]==="":!1}),f?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return we(l)}).join("")}).join("")}/?$`),params:t}}function Ot(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function $t(e){return e.slice(1).split("/").filter(Ot)}function Ct(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(d=>d).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&l.chained&&(s=0),!d&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function we(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function jt({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,d]])=>{const{pattern:p,params:f}=It(o),u={id:o,exec:h=>{const v=p.exec(h);if(v)return Ct(v,f,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...c||[]].map(s),leaf:i(l)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function Ze(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function He(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const x=globalThis.__sveltekit_10v1voa?.base??"",Nt=globalThis.__sveltekit_10v1voa?.assets??x??"",qt="1774287622111",et="sveltekit:snapshot",tt="sveltekit:scroll",nt="sveltekit:states",Dt="sveltekit:pageurl",B="sveltekit:history",H="sveltekit:navigation",N={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},pe=location.origin;function $e(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function q(){return{x:pageXOffset,y:pageYOffset}}function K(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const We={...N,"":N.hover};function rt(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function at(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=rt(e)}}function Se(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||ge(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===pe&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function ae(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=K(o,"preload-code")),a===null&&(a=K(o,"preload-data")),t===null&&(t=K(o,"keepfocus")),n===null&&(n=K(o,"noscroll")),i===null&&(i=K(o,"reload")),s===null&&(s=K(o,"replacestate")),o=rt(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:We[r??"off"],preload_data:We[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function Je(e){const t=Ue(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const ot={v:()=>{}};function Vt(){const{set:e,subscribe:t}=Ue(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Nt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==qt;return s&&(e(!0),ot.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function ge(e,t,n){return e.origin!==pe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function dn(e){}const st=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...st];const Kt=new Set([...st]);[...Kt];function Bt(e){return e.filter(t=>t!=null)}function Ce(e){return e instanceof Pe||e instanceof Ie?e.status:500}function Ft(e){return e instanceof Ie?e.text:"Internal Error"}let b,W,ye;const Gt=ze.toString().includes("$$")||/function \w+\(\) \{\}/.test(ze.toString());Gt?(b={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},W={current:null},ye={current:!1}):(b=new class{#e=A({});get data(){return U(this.#e)}set data(t){P(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){P(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){P(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){P(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){P(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){P(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){P(this.#s,t)}#i=A(new URL("https://example.com"));get url(){return U(this.#i)}set url(t){P(this.#i,t)}},W=new class{#e=A(null);get current(){return U(this.#e)}set current(t){P(this.#e,t)}},ye=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){P(this.#e,t)}},ot.v=()=>ye.current=!0);function it(e){Object.assign(b,e)}const Ye={spanContext(){return Mt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},Mt={traceId:"",spanId:"",traceFlags:0},zt=new Set(["icon","shortcut icon","apple-touch-icon"]),j=Ze(tt)??{},J=Ze(et)??{},C={url:Je({}),page:Je({}),navigating:Ue(null),updated:Vt()};function je(e){j[e]=q()}function Ht(e,t){let n=e+1;for(;j[n];)delete j[n],n+=1;for(n=t+1;J[n];)delete J[n],n+=1}function Y(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function lt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Ee(){}let Ne,Re,oe,T,xe,w;const se=[],ie=[];let L=null;function le(){L?.fork?.then(e=>e?.discard()),L=null}const ne=new Map,ct=new Set,Wt=new Set,z=new Set;let _={branch:[],error:null,url:null},ut=!1,ce=!1,Xe=!0,X=!1,G=!1,ft=!1,Z=!1,qe,y,R,I;const ue=new Set;let be;const fe=new Map;async function mn(e,t,n){globalThis.__sveltekit_10v1voa?.data&&globalThis.__sveltekit_10v1voa.data,document.URL!==location.href&&(location.href=location.href),w=e,await e.hooks.init?.(),Ne=jt(e),T=document.documentElement,xe=t,Re=e.nodes[0],oe=e.nodes[1],Re(),oe(),y=history.state?.[B],R=history.state?.[H],y||(y=R=Date.now(),history.replaceState({...history.state,[B]:y,[H]:R},""));const r=j[y];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await sn(xe,n)):(await F({type:"enter",url:$e(w.hash?un(new URL(location.href)):location.href),replace_state:!0}),a()),on()}async function Jt(e=!0,t=!0){if(await(be||=Promise.resolve()),!be)return;be=null;const n=I={},r=await ee(_.url,!0);if(le(),Z&&fe.forEach(({resource:a})=>{a.refresh?.()}),e){const a=b.state,i=r&&await Be(r);if(!i||n!==I)return;if(i.type==="redirect")return De(new URL(i.location,_.url).href,{replaceState:!0},1,n);t||(i.props.page.state=a),it(i.props.page),_=i.state,Le(),qe.$set(i.props)}else Le();await Promise.all([...fe.values()].map(({resource:a})=>a)).catch(Ee)}function Le(){se.length=0,Z=!1}function dt(e){ie.some(t=>t?.snapshot)&&(J[e]=ie.map(t=>t?.snapshot?.capture()))}function ht(e){J[e]?.forEach((t,n)=>{ie[n]?.snapshot?.restore(t)})}function Qe(){je(y),He(tt,j),dt(R),He(et,J)}async function De(e,t,n,r){let a;t.invalidateAll&&le(),await F({type:"goto",url:$e(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Z=!0,a=[...fe.keys()]),t.invalidate&&t.invalidate.forEach(an)}}),t.invalidateAll&&re().then(re).then(()=>{fe.forEach(({resource:i},s)=>{a?.includes(s)&&i.refresh?.()})})}async function Yt(e){if(e.id!==L?.id){le();const t={};ue.add(t),L={id:e.id,token:t,promise:Be({...e,preload:t}).then(n=>(ue.delete(t),n.type==="loaded"&&n.state.error&&le(),n)),fork:null}}return L.promise}async function ke(e){const t=(await ee(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function pt(e,t,n){_=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(b,e.props.page),qe=new w.root({target:t,props:{...e.props,stores:C,components:ie},hydrate:n,sync:!1}),await Promise.resolve(),ht(R),n){const a={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href),scroll:j[y]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};z.forEach(i=>i(a))}ce=!0}function de({url:e,params:t,branch:n,status:r,error:a,route:i,form:s}){let o="never";if(x&&(e.pathname===x||e.pathname===x+"/"))o="always";else for(const u of n)u?.slash!==void 0&&(o=u.slash);e.pathname=kt(e.pathname,o),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:i},props:{constructors:Bt(n).map(u=>u.node.component),page:Me(b)}};s!==void 0&&(l.props.form=s);let c={},d=!b,p=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const h=n[u],v=_.branch[u];h?.data!==v?.data&&(d=!0),h&&(c={...c,...h.data},d&&(l.props[`data_${p}`]=c),p+=1)}return(!_.url||e.href!==_.url.href||_.error!==a||s!==void 0&&s!==b.form||d)&&(l.props.page={error:a,params:t,route:{id:i?.id??null},state:{},status:r,url:new URL(e),form:s??null,data:d?c:b.data}),l}async function Ve({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null,o=!0;const l={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},c=await e();if(c.universal?.load){let d=function(...f){for(const u of f){const{href:h}=new URL(u,n);l.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Ye,current:Ye},route:new Proxy(a,{get:(f,u)=>(o&&(l.route=!0),f[u])}),params:new Proxy(r,{get:(f,u)=>(o&&l.params.add(u),f[u])}),data:i?.data??null,url:Rt(n,()=>{o&&(l.url=!0)},f=>{o&&l.search_params.add(f)},w.hash),async fetch(f,u){f instanceof Request&&(u={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:[...f.headers].length>0?f?.headers:void 0,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,...u});const{resolved:h,promise:v}=gt(f,u,n);return o&&d(h.href),v},setHeaders:()=>{},depends:d,parent(){return o&&(l.parent=!0),t()},untrack(f){o=!1;try{return f()}finally{o=!0}}};s=await c.universal.load.call(null,p)??null}return{node:c,loader:e,server:i,universal:c.universal?.load?{type:"data",data:s,uses:l}:null,data:s??i?.data??null,slash:c.universal?.trailingSlash??i?.slash}}function gt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=ce?Pt(r,a.href,t):Ut(r,t);return{resolved:a,promise:i}}function Xt(e,t,n,r,a,i){if(Z)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==_.params[s])return!0;for(const s of a.dependencies)if(se.some(o=>o(new URL(s))))return!0;return!1}function Ke(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Qt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Zt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:Me(b),constructors:[]}}}async function Be({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(L?.id===e)return ue.delete(L.token),L.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(m=>m?.().catch(()=>{})),c.forEach(m=>m?.[1]().catch(()=>{}));const d=_.url?e!==he(_.url):!1,p=_.route?a.id!==_.route.id:!1,f=Qt(_.url,n);let u=!1;const h=c.map(async(m,g)=>{if(!m)return;const S=_.branch[g];return m[1]===S?.loader&&!Xt(u,p,d,f,S.universal?.uses,r)?S:(u=!0,Ve({loader:m[1],url:n,params:r,route:a,parent:async()=>{const O={};for(let $=0;$<g;$+=1)Object.assign(O,(await h[$])?.data);return O},server_data_node:Ke(m[0]?{type:"skip"}:null,m[0]?S?.server:void 0)}))});for(const m of h)m.catch(()=>{});const v=[];for(let m=0;m<c.length;m+=1)if(c[m])try{v.push(await h[m])}catch(g){if(g instanceof Te)return{type:"redirect",location:g.location};if(ue.has(i))return Zt({error:await Q(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let S=Ce(g),E;if(g instanceof Pe)E=g.body;else{if(await C.updated.check())return await lt(),await Y(n);E=await Q(g,{params:r,url:n,route:{id:a.id}})}const O=await en(m,v,s);return O?de({url:n,params:r,branch:v.slice(0,O.idx).concat(O.node),status:S,error:E,route:a}):await _t(n,{id:a.id},E,S)}else v.push(void 0);return de({url:n,params:r,branch:v,status:200,error:null,route:a,form:t?void 0:null})}async function en(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Fe({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await Ve({loader:Re,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Ke(i)}),o={node:await oe(),loader:oe,universal:null,server:null,data:null};return de({url:n,params:a,branch:[s,o],status:e,error:t,route:null})}catch(s){if(s instanceof Te)return De(new URL(s.location,location.href),{},0);throw s}}async function tn(e){const t=e.href;if(ne.has(t))return ne.get(t);let n;try{const r=(async()=>{let a=await w.hooks.reroute({url:new URL(e),fetch:async(i,s)=>gt(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);w.hash?i.hash=a:i.pathname=a,a=i}return a})();ne.set(t,r),n=await r}catch{ne.delete(t);return}return n}async function ee(e,t){if(e&&!ge(e,x,w.hash)){const n=await tn(e);if(!n)return;const r=nn(n);for(const a of Ne){const i=a.exec(r);if(i)return{id:he(e),invalidating:t,route:a,params:Et(i),url:e}}}}function nn(e){return St(w.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function he(e){return(w.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function mt({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=Ge(_,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return X||ct.forEach(c=>c(l)),s?null:o}async function F({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Ee,block:d=Ee,event:p}){const f=I;I=l;const u=await ee(t,!1),h=e==="enter"?Ge(_,u,t,e):mt({url:t,type:e,delta:n?.delta,intent:u,scroll:n?.scroll,event:p});if(!h){d(),I===l&&(I=f);return}const v=y,m=R;c(),X=!0,ce&&h.navigation.type!=="enter"&&C.navigating.set(W.current=h.navigation);let g=u&&await Be(u);if(!g){if(ge(t,x,w.hash))return await Y(t,i);g=await _t(t,{id:null},await Q(new Ie(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,I!==l)return h.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(o<20){await F({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),h.fulfil(void 0);return}g=await Fe({status:500,error:await Q(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await C.updated.check()&&(await lt(),await Y(t,i));if(Le(),je(v),dt(m),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const k=i?0:1,te={[B]:y+=k,[H]:R+=k,[nt]:s};(i?history.replaceState:history.pushState).call(history,te,"",t),i||Ht(y,R)}const S=u&&L?.id===u.id?L.fork:null;L=null,g.props.page.state=s;let E;if(ce){const k=(await Promise.all(Array.from(Wt,D=>D(h.navigation)))).filter(D=>typeof D=="function");if(k.length>0){let D=function(){k.forEach(me=>{z.delete(me)})};k.push(D),k.forEach(me=>{z.add(me)})}_=g.state,g.props.page&&(g.props.page.url=t);const te=S&&await S;te?E=te.commit():(qe.$set(g.props),it(g.props.page),E=bt?.()),ft=!0}else await pt(g,xe,!1);const{activeElement:O}=document;await E,await re(),await re();let $=null;if(Xe){const k=n?n.scroll:a?q():null;k?scrollTo(k.x,k.y):($=t.hash&&document.getElementById(vt(t)))?$.scrollIntoView():scrollTo(0,0)}const wt=document.activeElement!==O&&document.activeElement!==document.body;!r&&!wt&&cn(t,!$),Xe=!0,g.props.page&&Object.assign(b,g.props.page),X=!1,e==="popstate"&&ht(R),h.fulfil(void 0),h.navigation.to&&(h.navigation.to.scroll=q()),z.forEach(k=>k(h.navigation)),C.navigating.set(W.current=null)}async function _t(e,t,n,r,a){return e.origin===pe&&e.pathname===location.pathname&&!ut?await Fe({status:r,error:n,url:e,route:t}):await Y(e,a)}function rn(){let e,t={element:void 0,href:void 0},n;T.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,N.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],N.tap)}T.addEventListener("mousedown",r),T.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(ke(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=at(o,T),d=c===t.element&&c?.href===t.href&&l>=n;if(!c||d)return;const{url:p,external:f,download:u}=Se(c,x,w.hash);if(f||u)return;const h=ae(c),v=p&&he(_.url)===he(p);if(!(h.reload||v))if(l<=h.preload_data){t={element:c,href:c.href},n=N.tap;const m=await ee(p,!1);if(!m)return;Yt(m)}else l<=h.preload_code&&(t={element:c,href:c.href},n=l,ke(p))}function s(){a.disconnect();for(const o of T.querySelectorAll("a")){const{url:l,external:c,download:d}=Se(o,x,w.hash);if(c||d)continue;const p=ae(o);p.reload||(p.preload_code===N.viewport&&a.observe(o),p.preload_code===N.eager&&ke(l))}}z.add(s),s()}function Q(e,t){if(e instanceof Pe)return e.body;const n=Ce(e),r=Ft(e);return w.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function _n(e,t={}){return e=new URL($e(e)),e.origin!==pe?Promise.reject(new Error("goto: invalid URL")):De(e,t,0)}function an(e){if(typeof e=="function")se.push(e);else{const{href:t}=new URL(e,location.href);se.push(n=>n.href===t)}}function vn(){return Z=!0,Jt()}function on(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Qe(),!X){const r=Ge(_,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};ct.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Qe()}),navigator.connection?.saveData||rn(),T.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=at(t.composedPath()[0],T);if(!n)return;const{url:r,external:a,target:i,download:s}=Se(n,x,w.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=ae(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,d]=(w.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===ve(location);if(a||o.reload&&(!p||!d)){mt({url:r,type:"link",event:t})?X=!0:t.preventDefault();return}if(d!==void 0&&p){const[,f]=_.url.href.split("#");if(f===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(d));u&&(u.scrollIntoView(),u.focus())}return}if(G=!0,je(y),e(r),!o.replace_state)return;G=!1}t.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await F({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),T.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(ge(s,x,!1))return;const o=t.target,l=ae(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),F({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Ae){if(t.state?.[B]){const n=t.state[B];if(I={},n===y)return;const r=j[n],a=t.state[nt]??{},i=new URL(t.state[Dt]??location.href),s=t.state[H],o=_.url?ve(location)===ve(_.url):!1;if(s===R&&(ft||o)){a!==b.state&&(b.state=a),e(i),j[y]=q(),r&&scrollTo(r.x,r.y),y=n;return}const c=n-y;await F({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{y=n,R=s},block:()=>{history.go(-c)},nav_token:I,event:t})}else if(!G){const n=new URL(location.href);e(n),w.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[B]:++y,[H]:R},"",location.href))});for(const t of document.querySelectorAll("link"))zt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&C.navigating.set(W.current=null)});function e(t){_.url=b.url=t,C.page.set(Me(b)),C.page.notify()}}async function sn(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){ut=!0;const c=new URL(location.href);let d;({params:a={},route:i={id:null}}=await ee(c,!1)||{}),d=Ne.find(({id:u})=>u===i.id);let p,f=!0;try{const u=r.map(async(v,m)=>{const g=o[m];return g?.uses&&(g.uses=ln(g.uses)),Ve({loader:w.nodes[v],url:c,params:a,route:i,parent:async()=>{const S={};for(let E=0;E<m;E+=1)Object.assign(S,(await u[E]).data);return S},server_data_node:Ke(g)})}),h=await Promise.all(u);if(d){const v=d.layouts;for(let m=0;m<v.length;m++)v[m]||h.splice(m,0,void 0)}p=de({url:c,params:a,branch:h,status:t,error:n,form:l,route:d??null})}catch(u){if(u instanceof Te){await Y(new URL(u.location,location.href));return}p=await Fe({status:Ce(u),error:await Q(u,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",f=!1}p.props.page&&(p.props.page.state={}),await pt(p,e,f)}function ln(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let Ae=!1;function cn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=vt(e);if(r&&document.getElementById(r)){const{x:i,y:s}=q();setTimeout(()=>{const o=history.state;Ae=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),Ae=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ge(e,t,n,r,a=null){let i,s;const o=new Promise((c,d)=>{i=c,s=d});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function Me(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function un(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function vt(e){let t;if(w.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{mn as a,_n as g,vn as i,dn as l,b as p,C as s};
@@ -1,4 +1,4 @@
1
- import{c as C,a as h,q as Ca,o as li,p as it,r as Ot,f as E,m as Aa,u as Oa,t as ln,s as Ce,j as Ea,e as Mn,g as Ta}from"./Cs_ROD7H.js";import{bd as ka,h as ci,a as ui,bu as Ma,b as Ia,L as z,bv as Ms,ai as Fa,m as s,K as x,aH as er,y as j,n as Ln,k as ar,B as F,f as b,D as R,G as I,A as q,T as w,bp as Ra,a7 as Jt,bq as Na,z as Is,br as Da,u as za,j as st,S as La,aF as he,bw as Ba,bs as di,R as Po,F as ot,I as ge,aj as mr,bn as fi}from"./BeBar3OL.js";import{B as $a,l as $e,p as _,s as Z,i as D,r as we,b as Co}from"./xBRYfpah.js";import{d as Ge,c as ao,e as H,k as St,j as hi,s as gi,i as _n,w as L,a as ht,q as Fs,t as Wa,g as lo}from"./DP09rP34.js";import{e as Mt,b as Ka,i as $t,r as It,n as rt}from"./CMFOFkXK.js";import{c as $}from"./DCGSm8Hl.js";import{g as an}from"./B-2G7IOL.js";import{c as Pt,a as Ir,B as gt,I as kr}from"./BuOTIbJu.js";import"./CQCkXCml.js";import{i as Va}from"./DiP47fAp.js";function Ua(){return Symbol(ka)}const Ha=Symbol("NaN");function ja(t,e,n){ci&&ui();var r=new $a(t),o=!Ma();Ia(()=>{var a=e();a!==a&&(a=Ha),o&&a!==null&&typeof a=="object"&&(a={}),r.ensure(a,n)})}function Ke(t,e,n,r,o){ci&&ui();var a=e.$$slots?.[n],i=!1;a===!0&&(a=e.children,i=!0),a===void 0||a(t,i?()=>r:r)}class go extends Map{#e=new Map;#t=z(0);#n=z(0);#r=Ms||-1;constructor(e){if(super(),e){for(var[n,r]of e)super.set(n,r);this.#n.v=super.size}}#o(e){return Ms===this.#r?z(e):Fa(e)}has(e){var n=this.#e,r=n.get(e);if(r===void 0)if(super.has(e))r=this.#o(0),n.set(e,r);else return s(this.#t),!1;return s(r),!0}forEach(e,n){this.#s(),super.forEach(e,n)}get(e){var n=this.#e,r=n.get(e);if(r===void 0)if(super.has(e))r=this.#o(0),n.set(e,r);else{s(this.#t);return}return s(r),super.get(e)}set(e,n){var r=this.#e,o=r.get(e),a=super.get(e),i=super.set(e,n),l=this.#t;if(o===void 0)o=this.#o(0),r.set(e,o),x(this.#n,super.size),er(l);else if(a!==n){er(o);var c=l.reactions===null?null:new Set(l.reactions),f=c===null||!o.reactions?.every(m=>c.has(m));f&&er(l)}return i}delete(e){var n=this.#e,r=n.get(e),o=super.delete(e);return r!==void 0&&(n.delete(e),x(r,-1)),o&&(x(this.#n,super.size),er(this.#t)),o}clear(){if(super.size!==0){super.clear();var e=this.#e;x(this.#n,0);for(var n of e.values())x(n,-1);er(this.#t),e.clear()}}#s(){s(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var n of super.keys())if(!e.has(n)){var r=this.#o(0);e.set(n,r)}}for([,r]of this.#e)s(r)}keys(){return s(this.#t),super.keys()}values(){return this.#s(),super.values()}entries(){return this.#s(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return s(this.#n),super.size}}var Rs=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,qa=/\n/g,Ya=/^\s*/,Ga=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Xa=/^:\s*/,Za=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Qa=/^[;\s]*/,Ja=/^\s+|\s+$/g,el=`
1
+ import{c as C,a as h,q as Ca,o as li,p as it,r as Ot,f as E,m as Aa,u as Oa,t as ln,s as Ce,j as Ea,e as Mn,g as Ta}from"./Cs_ROD7H.js";import{bd as ka,h as ci,a as ui,bu as Ma,b as Ia,L as z,bv as Ms,ai as Fa,m as s,K as x,aH as er,y as j,n as Ln,k as ar,B as F,f as b,D as R,G as I,A as q,T as w,bp as Ra,a7 as Jt,bq as Na,z as Is,br as Da,u as za,j as st,S as La,aF as he,bw as Ba,bs as di,R as Po,F as ot,I as ge,aj as mr,bn as fi}from"./BeBar3OL.js";import{B as $a,l as $e,p as _,s as Z,i as D,r as we,b as Co}from"./xBRYfpah.js";import{d as Ge,c as ao,e as H,k as St,j as hi,s as gi,i as _n,w as L,a as ht,q as Fs,t as Wa,g as lo}from"./DP09rP34.js";import{e as Mt,b as Ka,i as $t,r as It,n as rt}from"./Dkz6p8Jo.js";import{c as $}from"./DCGSm8Hl.js";import{g as an}from"./B1Cz8BMn.js";import{c as Pt,a as Ir,B as gt,I as kr}from"./BuOTIbJu.js";import"./CQCkXCml.js";import{i as Va}from"./DiP47fAp.js";function Ua(){return Symbol(ka)}const Ha=Symbol("NaN");function ja(t,e,n){ci&&ui();var r=new $a(t),o=!Ma();Ia(()=>{var a=e();a!==a&&(a=Ha),o&&a!==null&&typeof a=="object"&&(a={}),r.ensure(a,n)})}function Ke(t,e,n,r,o){ci&&ui();var a=e.$$slots?.[n],i=!1;a===!0&&(a=e.children,i=!0),a===void 0||a(t,i?()=>r:r)}class go extends Map{#e=new Map;#t=z(0);#n=z(0);#r=Ms||-1;constructor(e){if(super(),e){for(var[n,r]of e)super.set(n,r);this.#n.v=super.size}}#o(e){return Ms===this.#r?z(e):Fa(e)}has(e){var n=this.#e,r=n.get(e);if(r===void 0)if(super.has(e))r=this.#o(0),n.set(e,r);else return s(this.#t),!1;return s(r),!0}forEach(e,n){this.#s(),super.forEach(e,n)}get(e){var n=this.#e,r=n.get(e);if(r===void 0)if(super.has(e))r=this.#o(0),n.set(e,r);else{s(this.#t);return}return s(r),super.get(e)}set(e,n){var r=this.#e,o=r.get(e),a=super.get(e),i=super.set(e,n),l=this.#t;if(o===void 0)o=this.#o(0),r.set(e,o),x(this.#n,super.size),er(l);else if(a!==n){er(o);var c=l.reactions===null?null:new Set(l.reactions),f=c===null||!o.reactions?.every(m=>c.has(m));f&&er(l)}return i}delete(e){var n=this.#e,r=n.get(e),o=super.delete(e);return r!==void 0&&(n.delete(e),x(r,-1)),o&&(x(this.#n,super.size),er(this.#t)),o}clear(){if(super.size!==0){super.clear();var e=this.#e;x(this.#n,0);for(var n of e.values())x(n,-1);er(this.#t),e.clear()}}#s(){s(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var n of super.keys())if(!e.has(n)){var r=this.#o(0);e.set(n,r)}}for([,r]of this.#e)s(r)}keys(){return s(this.#t),super.keys()}values(){return this.#s(),super.values()}entries(){return this.#s(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return s(this.#n),super.size}}var Rs=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,qa=/\n/g,Ya=/^\s*/,Ga=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Xa=/^:\s*/,Za=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Qa=/^[;\s]*/,Ja=/^\s+|\s+$/g,el=`
2
2
  `,Ns="/",Ds="*",In="",tl="comment",nl="declaration";function rl(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function o(d){var g=d.match(qa);g&&(n+=g.length);var P=d.lastIndexOf(el);r=~P?d.length-P:r+d.length}function a(){var d={line:n,column:r};return function(g){return g.position=new i(d),f(),g}}function i(d){this.start=d,this.end={line:n,column:r},this.source=e.source}i.prototype.content=t;function l(d){var g=new Error(e.source+":"+n+":"+r+": "+d);if(g.reason=d,g.filename=e.source,g.line=n,g.column=r,g.source=t,!e.silent)throw g}function c(d){var g=d.exec(t);if(g){var P=g[0];return o(P),t=t.slice(P.length),g}}function f(){c(Ya)}function m(d){var g;for(d=d||[];g=y();)g!==!1&&d.push(g);return d}function y(){var d=a();if(!(Ns!=t.charAt(0)||Ds!=t.charAt(1))){for(var g=2;In!=t.charAt(g)&&(Ds!=t.charAt(g)||Ns!=t.charAt(g+1));)++g;if(g+=2,In===t.charAt(g-1))return l("End of comment missing");var P=t.slice(2,g-2);return r+=2,o(P),t=t.slice(g),r+=2,d({type:tl,comment:P})}}function v(){var d=a(),g=c(Ga);if(g){if(y(),!c(Xa))return l("property missing ':'");var P=c(Za),O=d({type:nl,property:zs(g[0].replace(Rs,In)),value:P?zs(P[0].replace(Rs,In)):In});return c(Qa),O}}function u(){var d=[];m(d);for(var g;g=v();)g!==!1&&(d.push(g),m(d));return d}return f(),u()}function zs(t){return t?t.replace(Ja,In):In}function ol(t,e){let n=null;if(!t||typeof t!="string")return n;const r=rl(t),o=typeof e=="function";return r.forEach(a=>{if(a.type!=="declaration")return;const{property:i,value:l}=a;o?e(i,l,a):l&&(n=n||{},n[i]=l)}),n}const sl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const il=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const Ls=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();var al=Ca("<svg><!><!></svg>");function Ue(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]),r=$e(n,["name","color","size","strokeWidth","absoluteStrokeWidth","iconNode"]);j(e,!1);let o=_(e,"name",8,void 0),a=_(e,"color",8,"currentColor"),i=_(e,"size",8,24),l=_(e,"strokeWidth",8,2),c=_(e,"absoluteStrokeWidth",8,!1),f=_(e,"iconNode",24,()=>[]);Va();var m=al();Ge(m,(u,d,g)=>({...sl,...u,...r,width:i(),height:i(),stroke:a(),"stroke-width":d,class:g}),[()=>il(r)?void 0:{"aria-hidden":"true"},()=>(Ln(c()),Ln(l()),Ln(i()),ar(()=>c()?Number(l())*24/Number(i()):l())),()=>(Ln(Ls),Ln(o()),Ln(n),ar(()=>Ls("lucide-icon","lucide",o()?`lucide-${o()}`:"",n.class)))]);var y=F(m);Mt(y,1,f,$t,(u,d)=>{var g=w(()=>Ra(s(d),2));let P=()=>s(g)[0],O=()=>s(g)[1];var T=C(),N=b(T);Ka(N,P,!0,(k,V)=>{Ge(k,()=>({...O()}))}),h(u,T)});var v=R(y);Ke(v,e,"default",{}),I(m),h(t,m),q()}function vi(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];Ue(t,Z({name:"search"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function vo(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];Ue(t,Z({name:"x"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function yr(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"m9 18 6-6-6-6"}]];Ue(t,Z({name:"chevron-right"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function br(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"m6 9 6 6 6-6"}]];Ue(t,Z({name:"chevron-down"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function ll(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"m16 17 5-5-5-5"}],["path",{d:"M21 12H9"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}]];Ue(t,Z({name:"log-out"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}const cl={project:"#6e6ee8",organization:"#00c2b2",person:"#f0c246",meeting:"#ff7a00",deal:"#3ecf8e",deliverable:"#ff3864",decision:"#00a8ff",dataset:"#be00ff",process:"#f5c800",deck:"#6e6ee8",doc:"#00a8ff",document:"#a855f7",note:"#94a3b8",publication:"#ec4899",reference:"#14b8a6",task:"#f97316",role:"#ff7a00","practice-area":"#8b5cf6","case-study":"#06b6d4",standard:"#ff2aa8"};function $n(t){return t?cl[t]??"#5c5c66":"#5c5c66"}const ul={person:"people","practice-area":"practice-areas","case-study":"case-studies",process:"processes"};function dl(t){return ul[t]??t+"s"}function Bs(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];Ue(t,Z({name:"plus"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function fl(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];Ue(t,Z({name:"eye"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function co(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];Ue(t,Z({name:"eye-off"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function wr(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];Ue(t,Z({name:"trash-2"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function hl(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];Ue(t,Z({name:"settings"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function $s(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];Ue(t,Z({name:"refresh-cw"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function _r(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];Ue(t,Z({name:"ellipsis"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function gl(t,e){const n=$e(e,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];Ue(t,Z({name:"pencil"},()=>n,{get iconNode(){return r},children:(o,a)=>{var i=C(),l=b(i);Ke(l,e,"default",{}),h(o,i)},$$slots:{default:!0}}))}function vl(t){return typeof t=="function"}function ur(t){return t!==null&&typeof t=="object"}const pl=["string","number","bigint","boolean"];function po(t){return t==null||pl.includes(typeof t)?!0:Array.isArray(t)?t.every(e=>po(e)):typeof t=="object"?Object.getPrototypeOf(t)===Object.prototype:!1}const Vn=Symbol("box"),qr=Symbol("is-writable");function A(t,e){const n=w(t);return e?{[Vn]:!0,[qr]:!0,get current(){return s(n)},set current(r){e(r)}}:{[Vn]:!0,get current(){return t()}}}function dr(t){return ur(t)&&Vn in t}function Ao(t){return dr(t)&&qr in t}function pi(t){return dr(t)?t:vl(t)?A(t):Zt(t)}function ml(t){return Object.entries(t).reduce((e,[n,r])=>dr(r)?(Ao(r)?Object.defineProperty(e,n,{get(){return r.current},set(o){r.current=o}}):Object.defineProperty(e,n,{get(){return r.current}}),e):Object.assign(e,{[n]:r}),{})}function yl(t){return Ao(t)?{[Vn]:!0,get current(){return t.current}}:t}function Zt(t){let e=z(Jt(t));return{[Vn]:!0,[qr]:!0,get current(){return s(e)},set current(n){x(e,n,!0)}}}function Dn(t){let e=z(Jt(t));return{[Vn]:!0,[qr]:!0,get current(){return s(e)},set current(n){x(e,n,!0)}}}Dn.from=pi;Dn.with=A;Dn.flatten=ml;Dn.readonly=yl;Dn.isBox=dr;Dn.isWritableBox=Ao;function mi(...t){return function(e){for(const n of t)if(n){if(e.defaultPrevented)return;typeof n=="function"?n.call(this,e):n.current?.call(this,e)}}}const bl=/\d/,wl=["-","_","/","."];function _l(t=""){if(!bl.test(t))return t!==t.toLowerCase()}function xl(t){const e=[];let n="",r,o;for(const a of t){const i=wl.includes(a);if(i===!0){e.push(n),n="",r=void 0;continue}const l=_l(a);if(o===!1){if(r===!1&&l===!0){e.push(n),n=a,r=l;continue}if(r===!0&&l===!1&&n.length>1){const c=n.at(-1);e.push(n.slice(0,Math.max(0,n.length-1))),n=c+a,r=l;continue}}n+=a,r=l,o=i}return e.push(n),e}function yi(t){return t?xl(t).map(e=>Pl(e)).join(""):""}function Sl(t){return Cl(yi(t||""))}function Pl(t){return t?t[0].toUpperCase()+t.slice(1):""}function Cl(t){return t?t[0].toLowerCase()+t.slice(1):""}function sr(t){if(!t)return{};const e={};function n(r,o){if(r.startsWith("-moz-")||r.startsWith("-webkit-")||r.startsWith("-ms-")||r.startsWith("-o-")){e[yi(r)]=o;return}if(r.startsWith("--")){e[r]=o;return}e[Sl(r)]=o}return ol(t,n),e}function Fn(...t){return(...e)=>{for(const n of t)typeof n=="function"&&n(...e)}}function Al(t,e){const n=RegExp(t,"g");return r=>{if(typeof r!="string")throw new TypeError(`expected an argument of type string, but got ${typeof r}`);return r.match(n)?r.replace(n,e):r}}const Ol=Al(/[A-Z]/,t=>`-${t.toLowerCase()}`);function El(t){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected an argument of type object, but got ${typeof t}`);return Object.keys(t).map(e=>`${Ol(e)}: ${t[e]};`).join(`
3
3
  `)}function bi(t={}){return El(t).replace(`
4
4
  `," ")}const Tl=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],kl=new Set(Tl);function Ml(t){return kl.has(t)}function De(...t){const e={...t[0]};for(let n=1;n<t.length;n++){const r=t[n];if(r){for(const o of Object.keys(r)){const a=e[o],i=r[o],l=typeof a=="function",c=typeof i=="function";if(l&&Ml(o)){const f=a,m=i;e[o]=mi(f,m)}else if(l&&c)e[o]=Fn(a,i);else if(o==="class"){const f=po(a),m=po(i);f&&m?e[o]=ao(a,i):f?e[o]=ao(a):m&&(e[o]=ao(i))}else if(o==="style"){const f=typeof a=="object",m=typeof i=="object",y=typeof a=="string",v=typeof i=="string";if(f&&m)e[o]={...a,...i};else if(f&&v){const u=sr(i);e[o]={...a,...u}}else if(y&&m){const u=sr(a);e[o]={...u,...i}}else if(y&&v){const u=sr(a),d=sr(i);e[o]={...u,...d}}else f?e[o]=a:m?e[o]=i:y?e[o]=a:v&&(e[o]=i)}else e[o]=i!==void 0?i:a}for(const o of Object.getOwnPropertySymbols(r)){const a=e[o],i=r[o];e[o]=i!==void 0?i:a}}}return typeof e.style=="object"&&(e.style=bi(e.style).replaceAll(`
@@ -1,2 +1,2 @@
1
1
  const ct=1024;let Je=0;class H{constructor(e,t){this.from=e,this.to=t}}class A{constructor(e={}){this.id=Je++,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=L.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}A.closedBy=new A({deserialize:l=>l.split(" ")});A.openedBy=new A({deserialize:l=>l.split(" ")});A.group=new A({deserialize:l=>l.split(" ")});A.isolate=new A({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}});A.contextHash=new A({perNode:!0});A.lookAhead=new A({perNode:!0});A.mounted=new A({perNode:!0});class re{constructor(e,t,r,i=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[A.mounted.id]}}const Ke=Object.create(null);class L{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):Ke,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new L(e.name||"",t,e.id,r);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return i}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(A.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(A.group),n=-1;n<(i?i.length:0);n++){let s=t[n<0?r.name:i[n]];if(s)return s}}}}L.none=new L("",Object.create(null),0,8);class je{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 r of this.types){let i=null;for(let n of e){let s=n(r);if(s){i||(i=Object.assign({},r.props));let o=s[1],a=s[0];a.combine&&a.id in i&&(o=a.combine(i[a.id],o)),i[a.id]=o}}t.push(i?new L(r.name,i,r.id,r.flags):r)}return new je(t)}}const he=new WeakMap,Ne=new WeakMap;var v;(function(l){l[l.ExcludeBuffers=1]="ExcludeBuffers",l[l.IncludeAnonymous=2]="IncludeAnonymous",l[l.IgnoreMounts=4]="IgnoreMounts",l[l.IgnoreOverlays=8]="IgnoreOverlays",l[l.EnterBracketed=16]="EnterBracketed"})(v||(v={}));class R{constructor(e,t,r,i,n){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,n&&n.length){this.props=Object.create(null);for(let[s,o]of n)this.props[typeof s=="number"?s:s.id]=o}}toString(){let e=re.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}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 ge(this.topNode,e)}cursorAt(e,t=0,r=0){let i=he.get(this)||this.topNode,n=new ge(i);return n.moveTo(e,t),he.set(this,n._tree),n}get topNode(){return new T(this,0,0,null)}resolve(e,t=0){let r=se(he.get(this)||this.topNode,e,t,!1);return he.set(this,r),r}resolveInner(e,t=0){let r=se(Ne.get(this)||this.topNode,e,t,!0);return Ne.set(this,r),r}resolveStack(e,t=0){return Ge(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:n=this.length}=e,s=e.mode||0,o=(s&v.IncludeAnonymous)>0;for(let a=this.cursor(s|v.IncludeAnonymous);;){let h=!1;if(a.from<=n&&a.to>=i&&(!o&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&r&&(o||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;h=!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:Ae(L.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new R(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new R(L.none,t,r,i)))}static build(e){return Qe(e)}}R.empty=new R(L.none,[],[],0);class ke{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 ke(this.buffer,this.index)}}class X{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return L.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],r=this.buffer[e+3],i=this.set.types[t],n=i.name;if(/\W/.test(n)&&!i.isError&&(n=JSON.stringify(n)),e+=4,r==e)return n;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return n+"("+s.join(",")+")"}findChild(e,t,r,i,n){let{buffer:s}=this,o=-1;for(let a=e;a!=t&&!(Fe(n,i,s[a+1],s[a+2])&&(o=a,r>0));a=s[a+3]);return o}slice(e,t,r){let i=this.buffer,n=new Uint16Array(t-e),s=0;for(let o=e,a=0;o<t;){n[a++]=i[o++],n[a++]=i[o++]-r;let h=n[a++]=i[o++]-r;n[a++]=i[o++]-e,s=Math.max(s,h)}return new X(n,s,this.set)}}function Fe(l,e,t,r){switch(l){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function se(l,e,t,r){for(var i;l.from==l.to||(t<1?l.from>=e:l.from>e)||(t>-1?l.to<=e:l.to<e);){let s=!r&&l instanceof T&&l.index<0?null:l.parent;if(!s)return l;l=s}let n=r?0:v.IgnoreOverlays;if(r)for(let s=l,o=s.parent;o;s=o,o=s.parent)s instanceof T&&s.index<0&&((i=o.enter(e,t,n))===null||i===void 0?void 0:i.from)!=s.from&&(l=o);for(;;){let s=l.enter(e,t,n);if(!s)return l;l=s}}class De{cursor(e=0){return new ge(this,e)}getChild(e,t=null,r=null){let i=_e(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return _e(this,e,t,r)}resolve(e,t=0){return se(this,e,t,!1)}resolveInner(e,t=0){return se(this,e,t,!0)}matchContext(e){return be(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class T extends De{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,n=0){for(let s=this;;){for(let{children:o,positions:a}=s._tree,h=t>0?o.length:-1;e!=h;e+=t){let u=o[e],p=a[e]+s.from,c;if(!(!(n&v.EnterBracketed&&u instanceof R&&(c=re.get(u))&&!c.overlay&&c.bracketed&&r>=p&&r<=p+u.length)&&!Fe(i,r,p,p+u.length))){if(u instanceof X){if(n&v.ExcludeBuffers)continue;let m=u.findChild(0,u.buffer.length,t,r-p,i);if(m>-1)return new K(new Ve(s,u,e,p),null,m)}else if(n&v.IncludeAnonymous||!u.type.isAnonymous||ve(u)){let m;if(!(n&v.IgnoreMounts)&&(m=re.get(u))&&!m.overlay)return new T(m.tree,p,e,s);let w=new T(u,p,e,s);return n&v.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?u.children.length-1:0,t,r,i,n)}}}if(n&v.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+t:e=t<0?-1:s._parent._tree.children.length,s=s._parent,!s))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,r=0){let i;if(!(r&v.IgnoreOverlays)&&(i=re.get(this._tree))&&i.overlay){let n=e-this.from,s=r&v.EnterBracketed&&i.bracketed;for(let{from:o,to:a}of i.overlay)if((t>0||s?o<=n:o<n)&&(t<0||s?a>=n:a>n))return new T(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}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 _e(l,e,t,r){let i=l.cursor(),n=[];if(!i.firstChild())return n;if(t!=null){for(let s=!1;!s;)if(s=i.type.is(t),!i.nextSibling())return n}for(;;){if(r!=null&&i.type.is(r))return n;if(i.type.is(e)&&n.push(i.node),!i.nextSibling())return r==null?n:[]}}function be(l,e,t=e.length-1){for(let r=l;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class Ve{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class K extends De{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,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return n<0?null:new K(this.context,this,n)}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,r=0){if(r&v.ExcludeBuffers)return null;let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return n<0?null:new K(this.context,this,n)}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 K(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 K(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,n=r.buffer[this.index+3];if(n>i){let s=r.buffer[this.index+1];e.push(r.slice(i,n,s)),t.push(0)}return new R(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function He(l){if(!l.length)return null;let e=0,t=l[0];for(let n=1;n<l.length;n++){let s=l[n];(s.from>t.from||s.to<t.to)&&(t=s,e=n)}let r=t instanceof T&&t.index<0?null:t.parent,i=l.slice();return r?i[e]=r:i.splice(e,1),new $e(i,t)}class $e{constructor(e,t){this.heads=e,this.node=t}get next(){return He(this.heads)}}function Ge(l,e,t){let r=l.resolveInner(e,t),i=null;for(let n=r instanceof T?r:r.context.parent;n;n=n.parent)if(n.index<0){let s=n.parent;(i||(i=[r])).push(s.resolve(e,t)),n=s}else{let s=re.get(n.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let o=new T(s.tree,s.overlay[0].from+n.from,-1,n);(i||(i=[r])).push(se(o,e,t,!1))}}return i?He(i):r}class ge{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&~v.EnterBracketed,e instanceof T)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.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:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof T?(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,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,n=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}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,r=this.mode){return this.buffer?r&v.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&v.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&v.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,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<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,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(i.buffer.buffer[n+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let n=t+e,s=e<0?-1:r._tree.children.length;n!=s;n+=e){let o=r._tree.children[n];if(this.mode&v.IncludeAnonymous||o instanceof X||!o.type.isAnonymous||ve(o))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,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,n=this.stack.length;n>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,r=n+1;break e}i=this.stack[--n]}for(let i=r;i<this.stack.length;i++)t=new K(this.buffer,t,this.stack[i]);return this.bufferNode=new K(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return be(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,n=this.stack.length-1;i>=0;n--){if(n<0)return be(this._tree,e,i);let s=r[t.buffer[this.stack[n]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function ve(l){return l.children.some(e=>e instanceof X||!e.type.isAnonymous||ve(e))}function Qe(l){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=1024,reused:n=[],minRepeatType:s=r.types.length}=l,o=Array.isArray(t)?new ke(t,t.length):t,a=r.types,h=0,u=0;function p(x,N,d,B,k,I){let{id:b,start:g,end:S,size:_}=o,O=u,$=h;if(_<0)if(o.next(),_==-1){let V=n[b];d.push(V),B.push(g-x);return}else if(_==-3){h=b;return}else if(_==-4){u=b;return}else throw new RangeError(`Unrecognized record size: ${_}`);let ie=a[b],ae,Y,Ce=g-x;if(S-g<=i&&(Y=M(o.pos-N,k))){let V=new Uint16Array(Y.size-Y.skip),D=o.pos-Y.size,W=V.length;for(;o.pos>D;)W=E(Y.start,V,W);ae=new X(V,S-Y.start,r),Ce=Y.start-x}else{let V=o.pos-_;o.next();let D=[],W=[],Z=b>=s?b:-1,te=0,fe=S;for(;o.pos>V;)Z>=0&&o.id==Z&&o.size>=0?(o.end<=fe-i&&(w(D,W,g,te,o.end,fe,Z,O,$),te=D.length,fe=o.end),o.next()):I>2500?c(g,V,D,W):p(g,V,D,W,Z,I+1);if(Z>=0&&te>0&&te<D.length&&w(D,W,g,te,g,fe,Z,O,$),D.reverse(),W.reverse(),Z>-1&&te>0){let Se=m(ie,$);ae=Ae(ie,D,W,0,D.length,0,S-g,Se,Se)}else ae=P(ie,D,W,S-g,O-S,$)}d.push(ae),B.push(Ce)}function c(x,N,d,B){let k=[],I=0,b=-1;for(;o.pos>N;){let{id:g,start:S,end:_,size:O}=o;if(O>4)o.next();else{if(b>-1&&S<b)break;b<0&&(b=_-i),k.push(g,S,_),I++,o.next()}}if(I){let g=new Uint16Array(I*4),S=k[k.length-2];for(let _=k.length-3,O=0;_>=0;_-=3)g[O++]=k[_],g[O++]=k[_+1]-S,g[O++]=k[_+2]-S,g[O++]=O;d.push(new X(g,k[2]-S,r)),B.push(S-x)}}function m(x,N){return(d,B,k)=>{let I=0,b=d.length-1,g,S;if(b>=0&&(g=d[b])instanceof R){if(!b&&g.type==x&&g.length==k)return g;(S=g.prop(A.lookAhead))&&(I=B[b]+g.length+S)}return P(x,d,B,k,I,N)}}function w(x,N,d,B,k,I,b,g,S){let _=[],O=[];for(;x.length>B;)_.push(x.pop()),O.push(N.pop()+d-k);x.push(P(r.types[b],_,O,I-k,g-I,S)),N.push(k-d)}function P(x,N,d,B,k,I,b){if(I){let g=[A.contextHash,I];b=b?[g].concat(b):[g]}if(k>25){let g=[A.lookAhead,k];b=b?[g].concat(b):[g]}return new R(x,N,d,B,b)}function M(x,N){let d=o.fork(),B=0,k=0,I=0,b=d.end-i,g={size:0,start:0,skip:0};e:for(let S=d.pos-x;d.pos>S;){let _=d.size;if(d.id==N&&_>=0){g.size=B,g.start=k,g.skip=I,I+=4,B+=4,d.next();continue}let O=d.pos-_;if(_<0||O<S||d.start<b)break;let $=d.id>=s?4:0,ie=d.start;for(d.next();d.pos>O;){if(d.size<0)if(d.size==-3||d.size==-4)$+=4;else break e;else d.id>=s&&($+=4);d.next()}k=ie,B+=_,I+=$}return(N<0||B==x)&&(g.size=B,g.start=k,g.skip=I),g.size>4?g:void 0}function E(x,N,d){let{id:B,start:k,end:I,size:b}=o;if(o.next(),b>=0&&B<s){let g=d;if(b>4){let S=o.pos-(b-4);for(;o.pos>S;)d=E(x,N,d)}N[--d]=g,N[--d]=I-x,N[--d]=k-x,N[--d]=B}else b==-3?h=B:b==-4&&(u=B);return d}let z=[],C=[];for(;o.pos>0;)p(l.start||0,l.bufferStart||0,z,C,-1,0);let F=(e=l.length)!==null&&e!==void 0?e:z.length?C[0]+z[0].length:0;return new R(a[l.topID],z.reverse(),C.reverse(),F)}const Be=new WeakMap;function de(l,e){if(!l.isAnonymous||e instanceof X||e.type!=l)return 1;let t=Be.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=l||!(r instanceof R)){t=1;break}t+=de(l,r)}Be.set(e,t)}return t}function Ae(l,e,t,r,i,n,s,o,a){let h=0;for(let w=r;w<i;w++)h+=de(l,e[w]);let u=Math.ceil(h*1.5/8),p=[],c=[];function m(w,P,M,E,z){for(let C=M;C<E;){let F=C,x=P[C],N=de(l,w[C]);for(C++;C<E;C++){let d=de(l,w[C]);if(N+d>=u)break;N+=d}if(C==F+1){if(N>u){let d=w[F];m(d.children,d.positions,0,d.children.length,P[F]+z);continue}p.push(w[F])}else{let d=P[C-1]+w[C-1].length-x;p.push(Ae(l,w,P,F,C,x,d,null,a))}c.push(x+z-n)}}return m(e,t,r,i,0),(o||a)(p,c,s)}class dt{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof K?this.setBuffer(e.context.buffer,e.index,t):e instanceof T&&this.map.set(e.tree,t)}get(e){return e instanceof K?this.getBuffer(e.context.buffer,e.index):e instanceof T?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 le{constructor(e,t,r,i,n=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(n?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new le(0,e.length,e,0,!1,r)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],n=1,s=e.length?e[0]:null;for(let o=0,a=0,h=0;;o++){let u=o<t.length?t[o]:null,p=u?u.fromA:1e9;if(p-a>=r)for(;s&&s.from<p;){let c=s;if(a>=c.from||p<=c.to||h){let m=Math.max(c.from,a)-h,w=Math.min(c.to,p)-h;c=m>=w?null:new le(m,w,c.tree,c.offset+h,o>0,!!u)}if(c&&i.push(c),s.to>p)break;s=n<e.length?e[n++]:null}if(!u)break;a=u.toA,h=u.toA-u.toB}return i}}class gt{startParse(e,t,r){return typeof e=="string"&&(e=new Xe(e)),r=r?r.length?r.map(i=>new H(i.from,i.to)):[new H(0,0)]:[new H(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let n=i.advance();if(n)return n}}}class Xe{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 mt(l){return(e,t,r,i)=>new Ze(e,l,t,r,i)}class Ie{constructor(e,t,r,i,n,s){this.parser=e,this.parse=t,this.overlay=r,this.bracketed=i,this.target=n,this.from=s}}function Pe(l){if(!l.length||l.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(l))}class Ye{constructor(e,t,r,i,n,s,o,a){this.parser=e,this.predicate=t,this.mounts=r,this.index=i,this.start=n,this.bracketed=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const xe=new A({perNode:!0});class Ze{constructor(e,t,r,i,n){this.nest=t,this.input=r,this.fragments=i,this.ranges=n,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new R(r.type,r.children,r.positions,r.length,r.propValues.concat([[xe,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[A.mounted.id]=new re(t,e.overlay,e.parser,e.bracketed),e.target.props=r}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 rt(this.fragments),t=null,r=null,i=new ge(new T(this.baseTree,this.ranges[0].from,0,null),v.IncludeAnonymous|v.IgnoreMounts);e:for(let n,s;;){let o=!0,a;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)o=!1;else if(e.hasNode(i)){if(t){let h=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(h)for(let u of h.mount.overlay){let p=u.from+h.pos,c=u.to+h.pos;p>=i.from&&c<=i.to&&!t.ranges.some(m=>m.from<c&&m.to>p)&&t.ranges.push({from:p,to:c})}}o=!1}else if(r&&(s=et(r.ranges,i.from,i.to)))o=s!=2;else if(!i.type.isAnonymous&&(n=this.nest(i,this.input))&&(i.from<i.to||!n.overlay)){i.tree||(tt(i),t&&t.depth++,r&&r.depth++);let h=e.findMounts(i.from,n.parser);if(typeof n.overlay=="function")t=new Ye(n.parser,n.overlay,h,this.inner.length,i.from,!!n.bracketed,i.tree,t);else{let u=Ee(this.ranges,n.overlay||(i.from<i.to?[new H(i.from,i.to)]:[]));u.length&&Pe(u),(u.length||!n.overlay)&&this.inner.push(new Ie(n.parser,u.length?n.parser.startParse(this.input,Oe(h,u),u):n.parser.startParse(""),n.overlay?n.overlay.map(p=>new H(p.from-i.from,p.to-i.from)):null,!!n.bracketed,i.tree,u.length?u[0].from:i.from)),n.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):o=!1}}else if(t&&(a=t.predicate(i))&&(a===!0&&(a=new H(i.from,i.to)),a.from<a.to)){let h=t.ranges.length-1;h>=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(o&&i.firstChild())t&&t.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let h=Ee(this.ranges,t.ranges);h.length&&(Pe(h),this.inner.splice(t.index,0,new Ie(t.parser,t.parser.startParse(this.input,Oe(t.mounts,h),h),t.ranges.map(u=>new H(u.from-t.start,u.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function et(l,e,t){for(let r of l){if(r.from>=t)break;if(r.to>e)return r.from<=e&&r.to>=t?2:1}return 0}function Me(l,e,t,r,i,n){if(e<t){let s=l.buffer[e+1];r.push(l.slice(e,t,s)),i.push(s-n)}}function tt(l){let{node:e}=l,t=[],r=e.context.buffer;do t.push(l.index),l.parent();while(!l.tree);let i=l.tree,n=i.children.indexOf(r),s=i.children[n],o=s.buffer,a=[n];function h(u,p,c,m,w,P){let M=t[P],E=[],z=[];Me(s,u,M,E,z,m);let C=o[M+1],F=o[M+2];a.push(E.length);let x=P?h(M+4,o[M+3],s.set.types[o[M]],C,F-C,P-1):e.toTree();return E.push(x),z.push(C-m),Me(s,o[M+3],p,E,z,m),new R(c,E,z,w)}i.children[n]=h(0,o.length,L.none,0,s.length,t.length-1);for(let u of a){let p=l.tree.children[u],c=l.tree.positions[u];l.yield(new T(p,c+l.from,u,l._tree))}}class ze{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(v.IncludeAnonymous|v.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)t.to>=e&&t.enter(r,1,v.IgnoreOverlays|v.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 R)t=t.children[0];else break}return!1}}class rt{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(t=r.tree.prop(xe))!==null&&t!==void 0?t:r.to,this.inner=new ze(r.tree,-r.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(xe))!==null&&e!==void 0?e:t.to,this.inner=new ze(t.tree,-t.offset)}}findMounts(e,t){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let n=this.inner.cursor.node;n;n=n.parent){let s=(r=n.tree)===null||r===void 0?void 0:r.prop(A.mounted);if(s&&s.parser==t)for(let o=this.fragI;o<this.fragments.length;o++){let a=this.fragments[o];if(a.from>=n.to)break;a.tree==this.curFrag.tree&&i.push({frag:a,pos:n.from-a.offset,mount:s})}}}return i}}function Ee(l,e){let t=null,r=e;for(let i=1,n=0;i<l.length;i++){let s=l[i-1].to,o=l[i].from;for(;n<r.length;n++){let a=r[n];if(a.from>=o)break;a.to<=s||(t||(r=t=e.slice()),a.from<s?(t[n]=new H(a.from,s),a.to>o&&t.splice(n+1,0,new H(o,a.to))):a.to>o?t[n--]=new H(o,a.to):t.splice(n--,1))}}return r}function it(l,e,t,r){let i=0,n=0,s=!1,o=!1,a=-1e9,h=[];for(;;){let u=i==l.length?1e9:s?l[i].to:l[i].from,p=n==e.length?1e9:o?e[n].to:e[n].from;if(s!=o){let c=Math.max(a,t),m=Math.min(u,p,r);c<m&&h.push(new H(c,m))}if(a=Math.min(u,p),a==1e9)break;u==a&&(s?(s=!1,i++):s=!0),p==a&&(o?(o=!1,n++):o=!0)}return h}function Oe(l,e){let t=[];for(let{pos:r,mount:i,frag:n}of l){let s=r+(i.overlay?i.overlay[0].from:0),o=s+i.tree.length,a=Math.max(n.from,s),h=Math.min(n.to,o);if(i.overlay){let u=i.overlay.map(c=>new H(c.from+r,c.to+r)),p=it(e,u,a,h);for(let c=0,m=a;;c++){let w=c==p.length,P=w?h:p[c].from;if(P>m&&t.push(new le(m,P,i.tree,-s,n.from>=m||n.openStart,n.to<=P||n.openEnd)),w)break;m=p[c].to}}else t.push(new le(a,h,i.tree,-s,n.from>=s||n.openStart,n.to<=o||n.openEnd))}return t}let nt=0;class j{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=nt++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof j&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let i=new j(r,[],null,[]);if(i.set.push(i),t)for(let n of t.set)i.set.push(n);return i}static defineModifier(e){let t=new me(e);return r=>r.modified.indexOf(t)>-1?r:me.get(r.base||r,r.modified.concat(t).sort((i,n)=>i.id-n.id))}}let st=0;class me{constructor(e){this.name=e,this.instances=[],this.id=st++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(o=>o.base==e&&lt(t,o.modified));if(r)return r;let i=[],n=new j(e.name,i,e,t);for(let o of t)o.instances.push(n);let s=ot(t);for(let o of e.set)if(!o.modified.length)for(let a of s)i.push(me.get(o,a));return n}}function lt(l,e){return l.length==e.length&&l.every((t,r)=>t==e[r])}function ot(l){let e=[[]];for(let t=0;t<l.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(l[t]));return e.sort((t,r)=>r.length-t.length)}function at(l){let e=Object.create(null);for(let t in l){let r=l[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let n=[],s=2,o=i;for(let p=0;;){if(o=="..."&&p>0&&p+3==i.length){s=1;break}let c=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!c)throw new RangeError("Invalid path: "+i);if(n.push(c[0]=="*"?"":c[0][0]=='"'?JSON.parse(c[0]):c[0]),p+=c[0].length,p==i.length)break;let m=i[p++];if(p==i.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+i);o=i.slice(p)}let a=n.length-1,h=n[a];if(!h)throw new RangeError("Invalid path: "+i);let u=new oe(r,s,a>0?n.slice(0,a):null);e[h]=u.sort(e[h])}}return Le.add(e)}const Le=new A({combine(l,e){let t,r,i;for(;l||e;){if(!l||e&&l.depth>=e.depth?(i=e,e=e.next):(i=l,l=l.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let n=new oe(i.tags,i.mode,i.context);t?t.next=n:r=n,t=n}return r}});class oe{constructor(e,t,r,i){this.tags=e,this.mode=t,this.context=r,this.next=i}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}}oe.empty=new oe([],2,null);function We(l,e){let t=Object.create(null);for(let n of l)if(!Array.isArray(n.tag))t[n.tag.id]=n.class;else for(let s of n.tag)t[s.id]=n.class;let{scope:r,all:i=null}=e||{};return{style:n=>{let s=i;for(let o of n)for(let a of o.set){let h=t[a.id];if(h){s=s?s+" "+h:h;break}}return s},scope:r}}function ft(l,e){let t=null;for(let r of l){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function Ue(l,e,t,r=0,i=l.length){let n=new ut(r,Array.isArray(e)?e:[e],t);n.highlightRange(l.cursor(),r,i,"",n.highlighters),n.flush(i)}function ht(l,e,t,r,i,n=0,s=l.length){let o=n;function a(h,u){if(!(h<=o)){for(let p=l.slice(o,h),c=0;;){let m=p.indexOf(`
2
- `,c),w=m<0?p.length:m;if(w>c&&r(p.slice(c,w),u),m<0)break;i(),c=m+1}o=h}}Ue(e,t,(h,u,p)=>{a(h,""),a(u,p)},n,s),a(s,"")}class ut{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,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,r,i,n){let{type:s,from:o,to:a}=e;if(o>=r||a<=t)return;s.isTop&&(n=this.highlighters.filter(m=>!m.scope||m.scope(s)));let h=i,u=qe(e)||oe.empty,p=ft(n,u.tags);if(p&&(h&&(h+=" "),h+=p,u.mode==1&&(i+=(i?" ":"")+p)),this.startSpan(Math.max(t,o),h),u.opaque)return;let c=e.tree&&e.tree.prop(A.mounted);if(c&&c.overlay){let m=e.node.enter(c.overlay[0].from+o,1),w=this.highlighters.filter(M=>!M.scope||M.scope(c.tree.type)),P=e.firstChild();for(let M=0,E=o;;M++){let z=M<c.overlay.length?c.overlay[M]:null,C=z?z.from+o:a,F=Math.max(t,E),x=Math.min(r,C);if(F<x&&P)for(;e.from<x&&(this.highlightRange(e,F,x,i,n),this.startSpan(Math.min(x,e.to),h),!(e.to>=C||!e.nextSibling())););if(!z||C>r)break;E=z.to+o,E>t&&(this.highlightRange(m.cursor(),Math.max(t,z.from+o),Math.min(r,E),"",w),this.startSpan(Math.min(r,E),h))}P&&e.parent()}else if(e.firstChild()){c&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,n),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function qe(l){let e=l.type.prop(Le);for(;e&&e.context&&!l.matchContext(e.context);)e=e.next;return e||null}const f=j.define,ue=f(),G=f(),Te=f(G),Re=f(G),Q=f(),pe=f(Q),ye=f(Q),J=f(),ee=f(J),U=f(),q=f(),we=f(),ne=f(we),ce=f(),y={comment:ue,lineComment:f(ue),blockComment:f(ue),docComment:f(ue),name:G,variableName:f(G),typeName:Te,tagName:f(Te),propertyName:Re,attributeName:f(Re),className:f(G),labelName:f(G),namespace:f(G),macroName:f(G),literal:Q,string:pe,docString:f(pe),character:f(pe),attributeValue:f(pe),number:ye,integer:f(ye),float:f(ye),bool:f(Q),regexp:f(Q),escape:f(Q),color:f(Q),url:f(Q),keyword:U,self:f(U),null:f(U),atom:f(U),unit:f(U),modifier:f(U),operatorKeyword:f(U),controlKeyword:f(U),definitionKeyword:f(U),moduleKeyword:f(U),operator:q,derefOperator:f(q),arithmeticOperator:f(q),logicOperator:f(q),bitwiseOperator:f(q),compareOperator:f(q),updateOperator:f(q),definitionOperator:f(q),typeOperator:f(q),controlOperator:f(q),punctuation:we,separator:f(we),bracket:ne,angleBracket:f(ne),squareBracket:f(ne),paren:f(ne),brace:f(ne),content:J,heading:ee,heading1:f(ee),heading2:f(ee),heading3:f(ee),heading4:f(ee),heading5:f(ee),heading6:f(ee),contentSeparator:f(J),list:f(J),quote:f(J),emphasis:f(J),strong:f(J),link:f(J),monospace:f(J),strikethrough:f(J),inserted:f(),deleted:f(),changed:f(),invalid:f(),meta:ce,documentMeta:f(ce),annotation:f(ce),processingInstruction:f(ce),definition:j.defineModifier("definition"),constant:j.defineModifier("constant"),function:j.defineModifier("function"),standard:j.defineModifier("standard"),local:j.defineModifier("local"),special:j.defineModifier("special")};for(let l in y){let e=y[l];e instanceof j&&(e.name=l)}const pt=We([{tag:y.link,class:"tok-link"},{tag:y.heading,class:"tok-heading"},{tag:y.emphasis,class:"tok-emphasis"},{tag:y.strong,class:"tok-strong"},{tag:y.keyword,class:"tok-keyword"},{tag:y.atom,class:"tok-atom"},{tag:y.bool,class:"tok-bool"},{tag:y.url,class:"tok-url"},{tag:y.labelName,class:"tok-labelName"},{tag:y.inserted,class:"tok-inserted"},{tag:y.deleted,class:"tok-deleted"},{tag:y.literal,class:"tok-literal"},{tag:y.string,class:"tok-string"},{tag:y.number,class:"tok-number"},{tag:[y.regexp,y.escape,y.special(y.string)],class:"tok-string2"},{tag:y.variableName,class:"tok-variableName"},{tag:y.local(y.variableName),class:"tok-variableName tok-local"},{tag:y.definition(y.variableName),class:"tok-variableName tok-definition"},{tag:y.special(y.variableName),class:"tok-variableName2"},{tag:y.definition(y.propertyName),class:"tok-propertyName tok-definition"},{tag:y.typeName,class:"tok-typeName"},{tag:y.namespace,class:"tok-namespace"},{tag:y.className,class:"tok-className"},{tag:y.macroName,class:"tok-macroName"},{tag:y.propertyName,class:"tok-propertyName"},{tag:y.operator,class:"tok-operator"},{tag:y.comment,class:"tok-comment"},{tag:y.meta,class:"tok-meta"},{tag:y.invalid,class:"tok-invalid"},{tag:y.punctuation,class:"tok-punctuation"}]),yt=Object.freeze(Object.defineProperty({__proto__:null,Tag:j,classHighlighter:pt,getStyleTags:qe,highlightCode:ht,highlightTree:Ue,styleTags:at,tagHighlighter:We,tags:y},Symbol.toStringTag,{value:"Module"}));export{ct as D,v as I,je as N,gt as P,R as T,L as a,A as b,le as c,y as d,j as e,dt as f,Ue as h,yt as i,mt as p,at as s,We as t};
2
+ `,c),w=m<0?p.length:m;if(w>c&&r(p.slice(c,w),u),m<0)break;i(),c=m+1}o=h}}Ue(e,t,(h,u,p)=>{a(h,""),a(u,p)},n,s),a(s,"")}class ut{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,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,r,i,n){let{type:s,from:o,to:a}=e;if(o>=r||a<=t)return;s.isTop&&(n=this.highlighters.filter(m=>!m.scope||m.scope(s)));let h=i,u=qe(e)||oe.empty,p=ft(n,u.tags);if(p&&(h&&(h+=" "),h+=p,u.mode==1&&(i+=(i?" ":"")+p)),this.startSpan(Math.max(t,o),h),u.opaque)return;let c=e.tree&&e.tree.prop(A.mounted);if(c&&c.overlay){let m=e.node.enter(c.overlay[0].from+o,1),w=this.highlighters.filter(M=>!M.scope||M.scope(c.tree.type)),P=e.firstChild();for(let M=0,E=o;;M++){let z=M<c.overlay.length?c.overlay[M]:null,C=z?z.from+o:a,F=Math.max(t,E),x=Math.min(r,C);if(F<x&&P)for(;e.from<x&&(this.highlightRange(e,F,x,i,n),this.startSpan(Math.min(x,e.to),h),!(e.to>=C||!e.nextSibling())););if(!z||C>r)break;E=z.to+o,E>t&&(this.highlightRange(m.cursor(),Math.max(t,z.from+o),Math.min(r,E),"",w),this.startSpan(Math.min(r,E),h))}P&&e.parent()}else if(e.firstChild()){c&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,n),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function qe(l){let e=l.type.prop(Le);for(;e&&e.context&&!l.matchContext(e.context);)e=e.next;return e||null}const f=j.define,ue=f(),G=f(),Te=f(G),Re=f(G),Q=f(),pe=f(Q),ye=f(Q),J=f(),ee=f(J),U=f(),q=f(),we=f(),ne=f(we),ce=f(),y={comment:ue,lineComment:f(ue),blockComment:f(ue),docComment:f(ue),name:G,variableName:f(G),typeName:Te,tagName:f(Te),propertyName:Re,attributeName:f(Re),className:f(G),labelName:f(G),namespace:f(G),macroName:f(G),literal:Q,string:pe,docString:f(pe),character:f(pe),attributeValue:f(pe),number:ye,integer:f(ye),float:f(ye),bool:f(Q),regexp:f(Q),escape:f(Q),color:f(Q),url:f(Q),keyword:U,self:f(U),null:f(U),atom:f(U),unit:f(U),modifier:f(U),operatorKeyword:f(U),controlKeyword:f(U),definitionKeyword:f(U),moduleKeyword:f(U),operator:q,derefOperator:f(q),arithmeticOperator:f(q),logicOperator:f(q),bitwiseOperator:f(q),compareOperator:f(q),updateOperator:f(q),definitionOperator:f(q),typeOperator:f(q),controlOperator:f(q),punctuation:we,separator:f(we),bracket:ne,angleBracket:f(ne),squareBracket:f(ne),paren:f(ne),brace:f(ne),content:J,heading:ee,heading1:f(ee),heading2:f(ee),heading3:f(ee),heading4:f(ee),heading5:f(ee),heading6:f(ee),contentSeparator:f(J),list:f(J),quote:f(J),emphasis:f(J),strong:f(J),link:f(J),monospace:f(J),strikethrough:f(J),inserted:f(),deleted:f(),changed:f(),invalid:f(),meta:ce,documentMeta:f(ce),annotation:f(ce),processingInstruction:f(ce),definition:j.defineModifier("definition"),constant:j.defineModifier("constant"),function:j.defineModifier("function"),standard:j.defineModifier("standard"),local:j.defineModifier("local"),special:j.defineModifier("special")};for(let l in y){let e=y[l];e instanceof j&&(e.name=l)}const pt=We([{tag:y.link,class:"tok-link"},{tag:y.heading,class:"tok-heading"},{tag:y.emphasis,class:"tok-emphasis"},{tag:y.strong,class:"tok-strong"},{tag:y.keyword,class:"tok-keyword"},{tag:y.atom,class:"tok-atom"},{tag:y.bool,class:"tok-bool"},{tag:y.url,class:"tok-url"},{tag:y.labelName,class:"tok-labelName"},{tag:y.inserted,class:"tok-inserted"},{tag:y.deleted,class:"tok-deleted"},{tag:y.literal,class:"tok-literal"},{tag:y.string,class:"tok-string"},{tag:y.number,class:"tok-number"},{tag:[y.regexp,y.escape,y.special(y.string)],class:"tok-string2"},{tag:y.variableName,class:"tok-variableName"},{tag:y.local(y.variableName),class:"tok-variableName tok-local"},{tag:y.definition(y.variableName),class:"tok-variableName tok-definition"},{tag:y.special(y.variableName),class:"tok-variableName2"},{tag:y.definition(y.propertyName),class:"tok-propertyName tok-definition"},{tag:y.typeName,class:"tok-typeName"},{tag:y.namespace,class:"tok-namespace"},{tag:y.className,class:"tok-className"},{tag:y.macroName,class:"tok-macroName"},{tag:y.propertyName,class:"tok-propertyName"},{tag:y.operator,class:"tok-operator"},{tag:y.comment,class:"tok-comment"},{tag:y.meta,class:"tok-meta"},{tag:y.invalid,class:"tok-invalid"},{tag:y.punctuation,class:"tok-punctuation"}]),yt=Object.freeze(Object.defineProperty({__proto__:null,Tag:j,classHighlighter:pt,getStyleTags:qe,highlightCode:ht,highlightTree:Ue,styleTags:at,tagHighlighter:We,tags:y},Symbol.toStringTag,{value:"Module"}));export{ct as D,v as I,A as N,gt as P,R as T,je as a,L as b,le as c,y as d,j as e,dt as f,Ue as h,yt as i,mt as p,at as s,We as t};
@@ -1 +1 @@
1
- import{L as r}from"./0oxpWEgM.js";import{s as P,d as O}from"./BXuvR8Ks.js";import{LanguageSupport as a,LRLanguage as Q,indentNodeProp as o,continuedIndent as e,foldNodeProp as t,foldInside as s}from"./D2aTbzFm.js";const n=P({String:O.string,Number:O.number,"True False":O.bool,PropertyName:O.propertyName,Null:O.null,", :":O.separator,"[ ]":O.squareBracket,"{ }":O.brace}),i=r.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[n],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),c=Q.define({name:"json",parser:i.configure({props:[o.add({Object:e({except:/^\s*\}/}),Array:e({except:/^\s*\]/})}),t.add({"Object Array":s})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function d(){return new a(c)}export{d as json,c as jsonLanguage};
1
+ import{L as r}from"./CrdV0ttd.js";import{s as P,d as O}from"./C7VoTosa.js";import{LanguageSupport as a,LRLanguage as Q,indentNodeProp as o,continuedIndent as e,foldNodeProp as t,foldInside as s}from"./D7ZqAKi9.js";const n=P({String:O.string,Number:O.number,"True False":O.bool,PropertyName:O.propertyName,Null:O.null,", :":O.separator,"[ ]":O.squareBracket,"{ }":O.brace}),i=r.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[n],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),c=Q.define({name:"json",parser:i.configure({props:[o.add({Object:e({except:/^\s*\}/}),Array:e({except:/^\s*\]/})}),t.add({"Object Array":s})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function d(){return new a(c)}export{d as json,c as jsonLanguage};
@@ -0,0 +1 @@
1
+ import{StateField as ze,Transaction as P,Facet as oe,combineConfig as He,EditorSelection as h,StateEffect as le,ChangeSet as qe,ChangeDesc as Ke,Annotation as ce,countColumn as $,Text as se,findClusterBreak as E}from"./CX_61fY8.js";import{E as x,D as $e}from"./DnL9f0lc.js";import{IndentContext as ie,getIndentation as ue,indentString as v,syntaxTree as W,matchBrackets as D,getIndentUnit as G,indentUnit as We}from"./D7ZqAKi9.js";import{N as F}from"./C7VoTosa.js";const Qe=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=X(e.state,r.from);return n.line?Xe(e):n.block?Ze(e):!1};function Q(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let l=e(t,r);return l?(n(r.update(l)),!0):!1}}const Xe=Q(we,0),Ye=Q(fe,0),Ze=Q((e,t)=>fe(e,t,_e(t)),0);function X(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}const M=50;function je(e,{open:t,close:r},n,l){let o=e.sliceDoc(n-M,n),c=e.sliceDoc(l,l+M),s=/\s*$/.exec(o)[0].length,i=/^\s*/.exec(c)[0].length,f=o.length-s;if(o.slice(f-t.length,f)==t&&c.slice(i,i+r.length)==r)return{open:{pos:n-s,margin:s&&1},close:{pos:l+i,margin:i&&1}};let u,a;l-n<=2*M?u=a=e.sliceDoc(n,l):(u=e.sliceDoc(n,n+M),a=e.sliceDoc(l-M,l));let p=/^\s*/.exec(u)[0].length,T=/\s*$/.exec(a)[0].length,L=a.length-T-r.length;return u.slice(p,p+t.length)==t&&a.slice(L,L+r.length)==r?{open:{pos:n+p+t.length,margin:/\s/.test(u.charAt(p+t.length))?1:0},close:{pos:l-T-r.length,margin:/\s/.test(a.charAt(L-1))?1:0}}:null}function _e(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),l=r.to<=n.to?n:e.doc.lineAt(r.to);l.from>n.from&&l.from==r.to&&(l=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let o=t.length-1;o>=0&&t[o].to>n.from?t[o].to=l.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:l.to})}return t}function fe(e,t,r=t.selection.ranges){let n=r.map(o=>X(t,o.from).block);if(!n.every(o=>o))return null;let l=r.map((o,c)=>je(t,n[c],o.from,o.to));if(e!=2&&!l.every(o=>o))return{changes:t.changes(r.map((o,c)=>l[c]?[]:[{from:o.from,insert:n[c].open+" "},{from:o.to,insert:" "+n[c].close}]))};if(e!=1&&l.some(o=>o)){let o=[];for(let c=0,s;c<l.length;c++)if(s=l[c]){let i=n[c],{open:f,close:u}=s;o.push({from:f.pos-i.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+i.close.length})}return{changes:o}}return null}function we(e,t,r=t.selection.ranges){let n=[],l=-1;e:for(let{from:o,to:c}of r){let s=n.length,i=1e9,f;for(let u=o;u<=c;){let a=t.doc.lineAt(u);if(f==null&&(f=X(t,a.from).line,!f))continue e;if(a.from>l&&(o==c||c>a.from)){l=a.from;let p=/^\s*/.exec(a.text)[0].length,T=p==a.length,L=a.text.slice(p,p+f.length)==f?p:-1;p<a.text.length&&p<i&&(i=p),n.push({line:a,comment:L,token:f,indent:p,empty:T,single:!1})}u=a.to+1}if(i<1e9)for(let u=s;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=i);n.length==s+1&&(n[s].single=!0)}if(e!=2&&n.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:s,token:i,indent:f,empty:u,single:a}of n)(a||!u)&&o.push({from:s.from+f,insert:i+" "});let c=t.changes(o);return{changes:c,selection:t.selection.map(c,1)}}else if(e!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:c,comment:s,token:i}of n)if(s>=0){let f=c.from+s,u=f+i.length;c.text[u-c.from]==" "&&u++,o.push({from:f,to:u})}return{changes:o}}return null}const z=ce.define(),et=ce.define(),tt=oe.define(),ae=oe.define({combine(e){return He(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,r)=>(n,l)=>t(n,l)||r(n,l)})}}),he=ze.define({create(){return B.empty},update(e,t){let r=t.state.facet(ae),n=t.annotation(z);if(n){let i=m.fromTransaction(t,n.selection),f=n.side,u=f==0?e.undone:e.done;return i?u=R(u,u.length,r.minDepth,i):u=pe(u,t.startState.selection),new B(f==0?n.rest:u,f==0?u:n.rest)}let l=t.annotation(et);if((l=="full"||l=="before")&&(e=e.isolate()),t.annotation(P.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=m.fromTransaction(t),c=t.annotation(P.time),s=t.annotation(P.userEvent);return o?e=e.addChanges(o,c,s,r,t):t.selection&&(e=e.addSelection(t.startState.selection,c,s,r.newGroupDelay)),(l=="full"||l=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new B(e.done.map(m.fromJSON),e.undone.map(m.fromJSON))}});function un(e={}){return[he,ae.of(e),x.domEventHandlers({beforeinput(t,r){let n=t.inputType=="historyUndo"?de:t.inputType=="historyRedo"?H:null;return n?(t.preventDefault(),n(r)):!1}})]}function I(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let l=r.field(he,!1);if(!l)return!1;let o=l.pop(e,r,t);return o?(n(o),!0):!1}}const de=I(0,!1),H=I(1,!1),nt=I(0,!0),rt=I(1,!0);class m{constructor(t,r,n,l,o){this.changes=t,this.effects=r,this.mapped=n,this.startSelection=l,this.selectionsAfter=o}setSelAfter(t){return new m(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(t){return new m(t.changes&&qe.fromJSON(t.changes),[],t.mapped&&Ke.fromJSON(t.mapped),t.startSelection&&h.fromJSON(t.startSelection),t.selectionsAfter.map(h.fromJSON))}static fromTransaction(t,r){let n=g;for(let l of t.startState.facet(tt)){let o=l(t);o.length&&(n=n.concat(o))}return!n.length&&t.changes.empty?null:new m(t.changes.invert(t.startState.doc),n,void 0,r||t.startState.selection,g)}static selection(t){return new m(void 0,g,void 0,void 0,t)}}function R(e,t,r,n){let l=t+1>r+20?t-r-1:0,o=e.slice(l,t);return o.push(n),o}function ot(e,t){let r=[],n=!1;return e.iterChangedRanges((l,o)=>r.push(l,o)),t.iterChangedRanges((l,o,c,s)=>{for(let i=0;i<r.length;){let f=r[i++],u=r[i++];s>=f&&c<=u&&(n=!0)}}),n}function lt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((r,n)=>r.empty!=t.ranges[n].empty).length===0}function me(e,t){return e.length?t.length?e.concat(t):e:t}const g=[],ct=200;function pe(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-ct));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),R(e,e.length-1,1e9,r.setSelAfter(n)))}else return[m.selection([t])]}function st(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function J(e,t){if(!e.length)return e;let r=e.length,n=g;for(;r;){let l=it(e[r-1],t,n);if(l.changes&&!l.changes.empty||l.effects.length){let o=e.slice(0,r);return o[r-1]=l,o}else t=l.mapped,r--,n=l.selectionsAfter}return n.length?[m.selection(n)]:g}function it(e,t,r){let n=me(e.selectionsAfter.length?e.selectionsAfter.map(s=>s.map(t)):g,r);if(!e.changes)return m.selection(n);let l=e.changes.map(t),o=t.mapDesc(e.changes,!0),c=e.mapped?e.mapped.composeDesc(o):o;return new m(l,le.mapEffects(e.effects,t),c,e.startSelection.map(o),n)}const ut=/^(input\.type|delete)($|\.)/;class B{constructor(t,r,n=0,l=void 0){this.done=t,this.undone=r,this.prevTime=n,this.prevUserEvent=l}isolate(){return this.prevTime?new B(this.done,this.undone):this}addChanges(t,r,n,l,o){let c=this.done,s=c[c.length-1];return s&&s.changes&&!s.changes.empty&&t.changes&&(!n||ut.test(n))&&(!s.selectionsAfter.length&&r-this.prevTime<l.newGroupDelay&&l.joinToEvent(o,ot(s.changes,t.changes))||n=="input.type.compose")?c=R(c,c.length-1,l.minDepth,new m(t.changes.compose(s.changes),me(le.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,g)):c=R(c,c.length,l.minDepth,t),new B(c,g,r,n)}addSelection(t,r,n,l){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:g;return o.length>0&&r-this.prevTime<l&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&lt(o[o.length-1],t)?this:new B(pe(this.done,t),this.undone,r,n)}addMapping(t){return new B(J(this.done,t),J(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,n){let l=t==0?this.done:this.undone;if(l.length==0)return null;let o=l[l.length-1],c=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):r.selection);if(n&&o.selectionsAfter.length)return r.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:z.of({side:t,rest:st(l),selection:c}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let s=l.length==1?g:l.slice(0,l.length-1);return o.mapped&&(s=J(s,o.mapped)),r.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:z.of({side:t,rest:s,selection:c}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}B.empty=new B(g,g);const fn=[{key:"Mod-z",run:de,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:H,preventDefault:!0},{linux:"Ctrl-Shift-z",run:H,preventDefault:!0},{key:"Mod-u",run:nt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:rt,preventDefault:!0}];function C(e,t){return h.create(e.ranges.map(t),e.mainIndex)}function k(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function A({state:e,dispatch:t},r){let n=C(e.selection,r);return n.eq(e.selection,!0)?!1:(t(k(e,n)),!0)}function N(e,t){return h.cursor(t?e.to:e.from)}function ge(e,t){return A(e,r=>r.empty?e.moveByChar(r,t):N(r,t))}function d(e){return e.textDirectionAt(e.state.selection.main.head)==$e.LTR}const ye=e=>ge(e,!d(e)),ke=e=>ge(e,d(e));function Ae(e,t){return A(e,r=>r.empty?e.moveByGroup(r,t):N(r,t))}const ft=e=>Ae(e,!d(e)),at=e=>Ae(e,d(e));function ht(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function U(e,t,r){let n=W(e).resolveInner(t.head),l=r?F.closedBy:F.openedBy;for(let i=t.head;;){let f=r?n.childAfter(i):n.childBefore(i);if(!f)break;ht(e,f,l)?n=f:i=r?f.to:f.from}let o=n.type.prop(l),c,s;return o&&(c=r?D(e,n.from,1):D(e,n.to,-1))&&c.matched?s=r?c.end.to:c.end.from:s=r?n.to:n.from,h.cursor(s,r?-1:1)}const dt=e=>A(e,t=>U(e.state,t,!d(e))),mt=e=>A(e,t=>U(e.state,t,d(e)));function Be(e,t){return A(e,r=>{if(!r.empty)return N(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}const Se=e=>Be(e,!1),De=e=>Be(e,!0);function xe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,l;if(t){for(let o of e.state.facet(x.scrollMargins)){let c=o(e);c?.top&&(r=Math.max(c?.top,r)),c?.bottom&&(n=Math.max(c?.bottom,n))}l=e.scrollDOM.clientHeight-r-n}else l=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,l-5)}}function Ce(e,t){let r=xe(e),{state:n}=e,l=C(n.selection,c=>c.empty?e.moveVertically(c,t,r.height):N(c,t));if(l.eq(n.selection))return!1;let o;if(r.selfScroll){let c=e.coordsAtPos(n.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),i=s.top+r.marginTop,f=s.bottom-r.marginBottom;c&&c.top>i&&c.bottom<f&&(o=x.scrollIntoView(l.main.head,{y:"start",yMargin:c.top-i}))}return e.dispatch(k(n,l),{effects:o}),!0}const Z=e=>Ce(e,!1),q=e=>Ce(e,!0);function S(e,t,r){let n=e.lineBlockAt(t.head),l=e.moveToLineBoundary(t,r);if(l.head==t.head&&l.head!=(r?n.to:n.from)&&(l=e.moveToLineBoundary(t,r,!1)),!r&&l.head==n.from&&n.length){let o=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&t.head!=n.from+o&&(l=h.cursor(n.from+o))}return l}const pt=e=>A(e,t=>S(e,t,!0)),gt=e=>A(e,t=>S(e,t,!1)),yt=e=>A(e,t=>S(e,t,!d(e))),kt=e=>A(e,t=>S(e,t,d(e))),At=e=>A(e,t=>h.cursor(e.lineBlockAt(t.head).from,1)),Bt=e=>A(e,t=>h.cursor(e.lineBlockAt(t.head).to,-1));function St(e,t,r){let n=!1,l=C(e.selection,o=>{let c=D(e,o.head,-1)||D(e,o.head,1)||o.head>0&&D(e,o.head-1,1)||o.head<e.doc.length&&D(e,o.head+1,-1);if(!c||!c.end)return o;n=!0;let s=c.start.from==o.head?c.end.to:c.end.from;return h.cursor(s)});return n?(t(k(e,l)),!0):!1}const Dt=({state:e,dispatch:t})=>St(e,t);function y(e,t){let r=C(e.state.selection,n=>{let l=t(n);return h.range(n.anchor,l.head,l.goalColumn,l.bidiLevel||void 0,l.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(k(e.state,r)),!0)}function Le(e,t){return y(e,r=>e.moveByChar(r,t))}const Me=e=>Le(e,!d(e)),Ee=e=>Le(e,d(e));function Oe(e,t){return y(e,r=>e.moveByGroup(r,t))}const xt=e=>Oe(e,!d(e)),Ct=e=>Oe(e,d(e)),Lt=e=>y(e,t=>U(e.state,t,!d(e))),Mt=e=>y(e,t=>U(e.state,t,d(e)));function Te(e,t){return y(e,r=>e.moveVertically(r,t))}const be=e=>Te(e,!1),ve=e=>Te(e,!0);function Re(e,t){return y(e,r=>e.moveVertically(r,t,xe(e).height))}const j=e=>Re(e,!1),_=e=>Re(e,!0),Et=e=>y(e,t=>S(e,t,!0)),Ot=e=>y(e,t=>S(e,t,!1)),Tt=e=>y(e,t=>S(e,t,!d(e))),bt=e=>y(e,t=>S(e,t,d(e))),vt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).from)),Rt=e=>y(e,t=>h.cursor(e.lineBlockAt(t.head).to)),w=({state:e,dispatch:t})=>(t(k(e,{anchor:0})),!0),ee=({state:e,dispatch:t})=>(t(k(e,{anchor:e.doc.length})),!0),te=({state:e,dispatch:t})=>(t(k(e,{anchor:e.selection.main.anchor,head:0})),!0),ne=({state:e,dispatch:t})=>(t(k(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),It=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Nt=({state:e,dispatch:t})=>{let r=V(e).map(({from:n,to:l})=>h.range(n,Math.min(l+1,e.doc.length)));return t(e.update({selection:h.create(r),userEvent:"select"})),!0},Ut=({state:e,dispatch:t})=>{let r=C(e.selection,n=>{let l=W(e),o=l.resolveStack(n.from,1);if(n.empty){let c=l.resolveStack(n.from,-1);c.node.from>=o.node.from&&c.node.to<=o.node.to&&(o=c)}for(let c=o;c;c=c.next){let{node:s}=c;if((s.from<n.from&&s.to>=n.to||s.to>n.to&&s.from<=n.from)&&c.next)return h.range(s.to,s.from)}return n});return r.eq(e.selection)?!1:(t(k(e,r)),!0)};function Ie(e,t){let{state:r}=e,n=r.selection,l=r.selection.ranges.slice();for(let o of r.selection.ranges){let c=r.doc.lineAt(o.head);if(t?c.to<e.state.doc.length:c.from>0)for(let s=o;;){let i=e.moveVertically(s,t);if(i.head<c.from||i.head>c.to){l.some(f=>f.head==i.head)||l.push(i);break}else{if(i.head==s.head)break;s=i}}}return l.length==n.ranges.length?!1:(e.dispatch(k(r,h.create(l,l.length-1))),!0)}const Vt=e=>Ie(e,!1),Pt=e=>Ie(e,!0),Jt=({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=h.create([r.main]):r.main.empty||(n=h.create([h.cursor(r.main.head)])),n?(t(k(e,n)),!0):!1};function O(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,l=n.changeByRange(o=>{let{from:c,to:s}=o;if(c==s){let i=t(o);i<c?(r="delete.backward",i=b(e,i,!1)):i>c&&(r="delete.forward",i=b(e,i,!0)),c=Math.min(c,i),s=Math.max(s,i)}else c=b(e,c,!1),s=b(e,s,!0);return c==s?{range:o}:{changes:{from:c,to:s},range:h.cursor(c,c<o.head?-1:1)}});return l.changes.empty?!1:(e.dispatch(n.update(l,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?x.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function b(e,t,r){if(e instanceof x)for(let n of e.state.facet(x.atomicRanges).map(l=>l(e)))n.between(t,t,(l,o)=>{l<t&&o>t&&(t=r?o:l)});return t}const Ne=(e,t,r)=>O(e,n=>{let l=n.from,{state:o}=e,c=o.doc.lineAt(l),s,i;if(r&&!t&&l>c.from&&l<c.from+200&&!/[^ \t]/.test(s=c.text.slice(0,l-c.from))){if(s[s.length-1]==" ")return l-1;let f=$(s,o.tabSize),u=f%G(o)||G(o);for(let a=0;a<u&&s[s.length-1-a]==" ";a++)l--;i=l}else i=E(c.text,l-c.from,t,t)+c.from,i==l&&c.number!=(t?o.doc.lines:1)?i+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(i-c.from,l-c.from))&&(i=E(c.text,i-c.from,!1,!1)+c.from);return i}),K=e=>Ne(e,!1,!0),Ue=e=>Ne(e,!0,!1),Ve=(e,t)=>O(e,r=>{let n=r.head,{state:l}=e,o=l.doc.lineAt(n),c=l.charCategorizer(n);for(let s=null;;){if(n==(t?o.to:o.from)){n==r.head&&o.number!=(t?l.doc.lines:1)&&(n+=t?1:-1);break}let i=E(o.text,n-o.from,t)+o.from,f=o.text.slice(Math.min(n,i)-o.from,Math.max(n,i)-o.from),u=c(f);if(s!=null&&u!=s)break;(f!=" "||n!=r.head)&&(s=u),n=i}return n}),Pe=e=>Ve(e,!1),Gt=e=>Ve(e,!0),Ft=e=>O(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),zt=e=>O(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)}),Ht=e=>O(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),qt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:se.of(["",""])},range:h.cursor(n.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},Kt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let l=n.from,o=e.doc.lineAt(l),c=l==o.from?l-1:E(o.text,l-o.from,!1)+o.from,s=l==o.to?l+1:E(o.text,l-o.from,!0)+o.from;return{changes:{from:c,to:s,insert:e.doc.slice(l,s).append(e.doc.slice(c,l))},range:h.cursor(s)}});return r.changes.empty?!1:(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function V(e){let t=[],r=-1;for(let n of e.selection.ranges){let l=e.doc.lineAt(n.from),o=e.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=e.doc.lineAt(n.to-1)),r>=l.number){let c=t[t.length-1];c.to=o.to,c.ranges.push(n)}else t.push({from:l.from,to:o.to,ranges:[n]});r=o.number+1}return t}function Je(e,t,r){if(e.readOnly)return!1;let n=[],l=[];for(let o of V(e)){if(r?o.to==e.doc.length:o.from==0)continue;let c=e.doc.lineAt(r?o.to+1:o.from-1),s=c.length+1;if(r){n.push({from:o.to,to:c.to},{from:o.from,insert:c.text+e.lineBreak});for(let i of o.ranges)l.push(h.range(Math.min(e.doc.length,i.anchor+s),Math.min(e.doc.length,i.head+s)))}else{n.push({from:c.from,to:o.from},{from:o.to,insert:e.lineBreak+c.text});for(let i of o.ranges)l.push(h.range(i.anchor-s,i.head-s))}}return n.length?(t(e.update({changes:n,scrollIntoView:!0,selection:h.create(l,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const $t=({state:e,dispatch:t})=>Je(e,t,!1),Wt=({state:e,dispatch:t})=>Je(e,t,!0);function Ge(e,t,r){if(e.readOnly)return!1;let n=[];for(let o of V(e))r?n.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak}):n.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let l=e.changes(n);return t(e.update({changes:l,selection:e.selection.map(l,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Qt=({state:e,dispatch:t})=>Ge(e,t,!1),Xt=({state:e,dispatch:t})=>Ge(e,t,!0),Yt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(V(t).map(({from:l,to:o})=>(l>0?l--:o<t.doc.length&&o++,{from:l,to:o}))),n=C(t.selection,l=>{let o;if(e.lineWrapping){let c=e.lineBlockAt(l.head),s=e.coordsAtPos(l.head,l.assoc||1);s&&(o=c.bottom+e.documentTop-s.bottom+e.defaultLineHeight/2)}return e.moveVertically(l,!0,o)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Zt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=W(e).resolveInner(t),n=r.childBefore(t),l=r.childAfter(t),o;return n&&l&&n.to<=t&&l.from>=t&&(o=n.type.prop(F.closedBy))&&o.indexOf(l.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(n.to,l.from))?{from:n.to,to:l.from}:null}const re=Fe(!1),jt=Fe(!0);function Fe(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(l=>{let{from:o,to:c}=l,s=t.doc.lineAt(o),i=!e&&o==c&&Zt(t,o);e&&(o=c=(c<=s.to?s:t.doc.lineAt(c)).to);let f=new ie(t,{simulateBreak:o,simulateDoubleBreak:!!i}),u=ue(f,o);for(u==null&&(u=$(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));c<s.to&&/\s/.test(s.text[c-s.from]);)c++;i?{from:o,to:c}=i:o>s.from&&o<s.from+100&&!/\S/.test(s.text.slice(0,o))&&(o=s.from);let a=["",v(t,u)];return i&&a.push(v(t,f.lineIndent(s.from,-1))),{changes:{from:o,to:c,insert:se.of(a)},range:h.cursor(o+1+a[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Y(e,t){let r=-1;return e.changeByRange(n=>{let l=[];for(let c=n.from;c<=n.to;){let s=e.doc.lineAt(c);s.number>r&&(n.empty||n.to>s.from)&&(t(s,l,n),r=s.number),c=s.to+1}let o=e.changes(l);return{changes:l,range:h.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}const _t=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new ie(e,{overrideIndentation:o=>{let c=r[o];return c??-1}}),l=Y(e,(o,c,s)=>{let i=ue(n,o.from);if(i==null)return;/\S/.test(o.text)||(i=0);let f=/^\s*/.exec(o.text)[0],u=v(e,i);(f!=u||s.from<o.from+f.length)&&(r[o.from]=i,c.push({from:o.from,to:o.from+f.length,insert:u}))});return l.changes.empty||t(e.update(l,{userEvent:"indent"})),!0},wt=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Y(e,(r,n)=>{n.push({from:r.from,insert:e.facet(We)})}),{userEvent:"input.indent"})),!0),en=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Y(e,(r,n)=>{let l=/^\s*/.exec(r.text)[0];if(!l)return;let o=$(l,e.tabSize),c=0,s=v(e,Math.max(0,o-G(e)));for(;c<l.length&&c<s.length&&l.charCodeAt(c)==s.charCodeAt(c);)c++;n.push({from:r.from+c,to:r.from+l.length,insert:s.slice(c)})}),{userEvent:"delete.dedent"})),!0),tn=e=>(e.setTabFocusMode(),!0),nn=[{key:"Ctrl-b",run:ye,shift:Me,preventDefault:!0},{key:"Ctrl-f",run:ke,shift:Ee},{key:"Ctrl-p",run:Se,shift:be},{key:"Ctrl-n",run:De,shift:ve},{key:"Ctrl-a",run:At,shift:vt},{key:"Ctrl-e",run:Bt,shift:Rt},{key:"Ctrl-d",run:Ue},{key:"Ctrl-h",run:K},{key:"Ctrl-k",run:Ft},{key:"Ctrl-Alt-h",run:Pe},{key:"Ctrl-o",run:qt},{key:"Ctrl-t",run:Kt},{key:"Ctrl-v",run:q}],rn=[{key:"ArrowLeft",run:ye,shift:Me,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ft,shift:xt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:yt,shift:Tt,preventDefault:!0},{key:"ArrowRight",run:ke,shift:Ee,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:at,shift:Ct,preventDefault:!0},{mac:"Cmd-ArrowRight",run:kt,shift:bt,preventDefault:!0},{key:"ArrowUp",run:Se,shift:be,preventDefault:!0},{mac:"Cmd-ArrowUp",run:w,shift:te},{mac:"Ctrl-ArrowUp",run:Z,shift:j},{key:"ArrowDown",run:De,shift:ve,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ee,shift:ne},{mac:"Ctrl-ArrowDown",run:q,shift:_},{key:"PageUp",run:Z,shift:j},{key:"PageDown",run:q,shift:_},{key:"Home",run:gt,shift:Ot,preventDefault:!0},{key:"Mod-Home",run:w,shift:te},{key:"End",run:pt,shift:Et,preventDefault:!0},{key:"Mod-End",run:ee,shift:ne},{key:"Enter",run:re,shift:re},{key:"Mod-a",run:It},{key:"Backspace",run:K,shift:K,preventDefault:!0},{key:"Delete",run:Ue,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Pe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Gt,preventDefault:!0},{mac:"Mod-Backspace",run:zt,preventDefault:!0},{mac:"Mod-Delete",run:Ht,preventDefault:!0}].concat(nn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),an=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:dt,shift:Lt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:mt,shift:Mt},{key:"Alt-ArrowUp",run:$t},{key:"Shift-Alt-ArrowUp",run:Qt},{key:"Alt-ArrowDown",run:Wt},{key:"Shift-Alt-ArrowDown",run:Xt},{key:"Mod-Alt-ArrowUp",run:Vt},{key:"Mod-Alt-ArrowDown",run:Pt},{key:"Escape",run:Jt},{key:"Mod-Enter",run:jt},{key:"Alt-l",mac:"Ctrl-l",run:Nt},{key:"Mod-i",run:Ut,preventDefault:!0},{key:"Mod-[",run:en},{key:"Mod-]",run:wt},{key:"Mod-Alt-\\",run:_t},{key:"Shift-Mod-k",run:Yt},{key:"Shift-Mod-\\",run:Dt},{key:"Mod-/",run:Qe},{key:"Alt-A",run:Ye},{key:"Ctrl-m",mac:"Shift-Alt-m",run:tn}].concat(rn);export{Vt as addCursorAbove,Pt as addCursorBelow,Xt as copyLineDown,Qt as copyLineUp,ye as cursorCharLeft,ke as cursorCharRight,ee as cursorDocEnd,w as cursorDocStart,ft as cursorGroupLeft,at as cursorGroupRight,gt as cursorLineBoundaryBackward,pt as cursorLineBoundaryForward,yt as cursorLineBoundaryLeft,kt as cursorLineBoundaryRight,De as cursorLineDown,Bt as cursorLineEnd,At as cursorLineStart,Se as cursorLineUp,Dt as cursorMatchingBracket,q as cursorPageDown,Z as cursorPageUp,dt as cursorSyntaxLeft,mt as cursorSyntaxRight,an as defaultKeymap,K as deleteCharBackward,Ue as deleteCharForward,Pe as deleteGroupBackward,Gt as deleteGroupForward,Yt as deleteLine,zt as deleteLineBoundaryBackward,Ht as deleteLineBoundaryForward,Ft as deleteToLineEnd,nn as emacsStyleKeymap,un as history,fn as historyKeymap,en as indentLess,wt as indentMore,_t as indentSelection,jt as insertBlankLine,re as insertNewlineAndIndent,tt as invertedEffects,et as isolateHistory,Wt as moveLineDown,$t as moveLineUp,H as redo,rt as redoSelection,It as selectAll,Me as selectCharLeft,Ee as selectCharRight,ne as selectDocEnd,te as selectDocStart,xt as selectGroupLeft,Ct as selectGroupRight,Nt as selectLine,Ot as selectLineBoundaryBackward,Et as selectLineBoundaryForward,Tt as selectLineBoundaryLeft,bt as selectLineBoundaryRight,ve as selectLineDown,Rt as selectLineEnd,vt as selectLineStart,be as selectLineUp,_ as selectPageDown,j as selectPageUp,Ut as selectParentSyntax,Lt as selectSyntaxLeft,Mt as selectSyntaxRight,Jt as simplifySelection,qt as splitLine,rn as standardKeymap,Ye as toggleBlockComment,Ze as toggleBlockCommentByLine,Qe as toggleComment,Xe as toggleLineComment,tn as toggleTabFocusMode,Kt as transposeChars,de as undo,nt as undoSelection};
@@ -1,5 +1,5 @@
1
1
  let re=[],Ee=[];(()=>{let l="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,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<l.length;e++)(e%2?Ee:re).push(t=t+l[e])})();function Ge(l){if(l<768)return!1;for(let e=0,t=re.length;;){let n=e+t>>1;if(l<re[n])t=n;else if(l>=Ee[n])e=n+1;else return!0;if(e==t)return!1}}function ke(l){return l>=127462&&l<=127487}const ye=8205;function je(l,e,t=!0,n=!0){return(t?Oe:Ze)(l,e,n)}function Oe(l,e,t){if(e==l.length)return e;e&&Me(l.charCodeAt(e))&&Re(l.charCodeAt(e-1))&&e--;let n=ie(l,e);for(e+=Se(n);e<l.length;){let i=ie(l,e);if(n==ye||i==ye||t&&Ge(i))e+=Se(i),n=i;else if(ke(i)){let s=0,r=e-2;for(;r>=0&&ke(ie(l,r));)s++,r-=2;if(s%2==0)break;e+=2}else break}return e}function Ze(l,e,t){for(;e>0;){let n=Oe(l,e-2,t);if(n<e)return n;e--}return 0}function ie(l,e){let t=l.charCodeAt(e);if(!Re(t)||e+1==l.length)return t;let n=l.charCodeAt(e+1);return Me(n)?(t-55296<<10)+(n-56320)+65536:t}function Me(l){return l>=56320&&l<57344}function Re(l){return l>=55296&&l<56320}function Se(l){return l<65536?1:2}class x{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]=J(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),C.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=J(this,e,t);let n=[];return this.decompose(e,t,n,0),C.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),i=new N(this),s=new N(e);for(let r=t,h=t;;){if(i.next(r),s.next(r),r=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(h+=i.value.length,i.done||h>=n)return!0}}iter(e=1){return new N(this,e)}iterRange(e,t=this.length){return new Te(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Be(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]?x.empty:e.length<=32?new m(e):C.from(m.split(e,[]))}}class m extends x{constructor(e,t=Ke(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let s=0;;s++){let r=this.text[s],h=i+r.length;if((t?n:h)>=e)return new Qe(i,h,n,r);i=h+1,n++}}decompose(e,t,n,i){let s=e<=0&&t>=this.length?this:new m(Ie(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let r=n.pop(),h=Z(s.text,r.text.slice(),0,s.length);if(h.length<=32)n.push(new m(h,r.length+s.length));else{let o=h.length>>1;n.push(new m(h.slice(0,o)),new m(h.slice(o)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof m))return super.replace(e,t,n);[e,t]=J(this,e,t);let i=Z(this.text,Z(n.text,Ie(this.text,0,e)),t),s=this.length+n.length-(t-e);return i.length<=32?new m(i,s):C.from(m.split(i,[]),s)}sliceString(e,t=this.length,n=`
2
2
  `){[e,t]=J(this,e,t);let i="";for(let s=0,r=0;s<=t&&r<this.text.length;r++){let h=this.text[r],o=s+h.length;s>e&&r&&(i+=n),e<o&&t>s&&(i+=h.slice(Math.max(0,e-s),t-s)),s=o+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let s of e)n.push(s),i+=s.length+1,n.length==32&&(t.push(new m(n,i)),n=[],i=-1);return i>-1&&t.push(new m(n,i)),t}}class C extends x{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,i){for(let s=0;;s++){let r=this.children[s],h=i+r.length,o=n+r.lines-1;if((t?o:h)>=e)return r.lineInner(e,t,n,i);i=h+1,n=o+1}}decompose(e,t,n,i){for(let s=0,r=0;r<=t&&s<this.children.length;s++){let h=this.children[s],o=r+h.length;if(e<=o&&t>=r){let a=i&((r<=e?1:0)|(o>=t?2:0));r>=e&&o<=t&&!a?n.push(h):h.decompose(e-r,t-r,n,a)}r=o+1}}replace(e,t,n){if([e,t]=J(this,e,t),n.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let r=this.children[i],h=s+r.length;if(e>=s&&t<=h){let o=r.replace(e-s,t-s,n),a=this.lines-r.lines+o.lines;if(o.lines<a>>4&&o.lines>a>>6){let u=this.children.slice();return u[i]=o,new C(u,this.length-(t-e)+n.length)}return super.replace(s,h,o)}s=h+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
3
3
  `){[e,t]=J(this,e,t);let i="";for(let s=0,r=0;s<this.children.length&&r<=t;s++){let h=this.children[s],o=r+h.length;r>e&&s&&(i+=n),e<o&&t>r&&(i+=h.sliceString(e-r,t-r,n)),r=o+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof C))return 0;let n=0,[i,s,r,h]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==r||s==h)return n;let o=this.children[i],a=e.children[s];if(o!=a)return n+o.scanIdentical(a,t);n+=o.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let c of e)n+=c.lines;if(n<32){let c=[];for(let g of e)g.flatten(c);return new m(c,t)}let i=Math.max(32,n>>5),s=i<<1,r=i>>1,h=[],o=0,a=-1,u=[];function f(c){let g;if(c.lines>s&&c instanceof C)for(let b of c.children)f(b);else c.lines>r&&(o>r||!o)?(d(),h.push(c)):c instanceof m&&o&&(g=u[u.length-1])instanceof m&&c.lines+g.lines<=32?(o+=c.lines,a+=c.length+1,u[u.length-1]=new m(g.text.concat(c.text),g.length+1+c.length)):(o+c.lines>i&&d(),o+=c.lines,a+=c.length+1,u.push(c))}function d(){o!=0&&(h.push(u.length==1?u[0]:C.from(u,a)),a=-1,o=u.length=0)}for(let c of e)f(c);return d(),h.length==1?h[0]:new C(h,t)}}x.empty=new m([""],0);function Ke(l){let e=-1;for(let t of l)e+=t.length+1;return e}function Z(l,e,t=0,n=1e9){for(let i=0,s=0,r=!0;s<l.length&&i<=n;s++){let h=l[s],o=i+h.length;o>=t&&(o>n&&(h=h.slice(0,n-i)),i<t&&(h=h.slice(t-i)),r?(e[e.length-1]+=h,r=!1):e.push(h)),i=o+1}return e}function Ie(l,e,t){return Z(l,[""],e,t)}class N{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 m?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],s=this.offsets[n],r=s>>1,h=i instanceof m?i.text.length:i.children.length;if(r==(t>0?h: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((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
4
- `,this;e--}else if(i instanceof m){let o=i.text[r+(t<0?-1:0)];if(this.offsets[n]+=t,o.length>Math.max(0,e))return this.value=e==0?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=i.children[r+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof m?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Te{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new N(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:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.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 Be{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=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=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(x.prototype[Symbol.iterator]=function(){return this.iter()},N.prototype[Symbol.iterator]=Te.prototype[Symbol.iterator]=Be.prototype[Symbol.iterator]=function(){return this});class Qe{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function J(l,e,t){return e=Math.max(0,Math.min(l.length,e)),[e,Math.max(e,Math.min(l.length,t))]}function Q(l,e,t=!0,n=!0){return je(l,e,t,n)}function Xe(l){return l>=56320&&l<57344}function Ye(l){return l>=55296&&l<56320}function ft(l,e){let t=l.charCodeAt(e);if(!Ye(t)||e+1==l.length)return t;let n=l.charCodeAt(e+1);return Xe(n)?(t-55296<<10)+(n-56320)+65536:t}function ct(l){return l<=65535?String.fromCharCode(l):(l-=65536,String.fromCharCode((l>>10)+55296,(l&1023)+56320))}function dt(l){return l<65536?1:2}const le=/\r\n?|\n/;var O=(function(l){return l[l.Simple=0]="Simple",l[l.TrackDel=1]="TrackDel",l[l.TrackBefore=2]="TrackBefore",l[l.TrackAfter=3]="TrackAfter",l})(O||(O={}));class E{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,i=0;t<this.sections.length;){let s=this.sections[t++],r=this.sections[t++];r<0?(e(n,i,s),i+=s):i+=r,n+=s}}iterChangedRanges(e,t=!1){he(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new E(e)}composeDesc(e){return this.empty?e:e.empty?this:Fe(this,e)}mapDesc(e,t=!1){return e.empty?this:oe(this,e,t)}mapPos(e,t=-1,n=O.Simple){let i=0,s=0;for(let r=0;r<this.sections.length;){let h=this.sections[r++],o=this.sections[r++],a=i+h;if(o<0){if(a>e)return s+(e-i);s+=h}else{if(n!=O.Simple&&a>=e&&(n==O.TrackDel&&i<e&&a>e||n==O.TrackBefore&&i<e||n==O.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!h)return e==i||t<0?s:s+o;s+=o}i=a}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let s=this.sections[n++],r=this.sections[n++],h=i+s;if(r>=0&&i<=t&&h>=e)return i<e&&h>t?"cover":!0;i=h}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}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 E(e)}static create(e){return new E(e)}}class k extends E{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 he(this,(t,n,i,s,r)=>e=e.replace(i,i+(n-t),r),!1),e}mapDesc(e,t=!1){return oe(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i<t.length;i+=2){let r=t[i],h=t[i+1];if(h>=0){t[i]=h,t[i+1]=r;let o=i>>1;for(;n.length<o;)n.push(x.empty);n.push(r?e.slice(s,s+r):x.empty)}s+=r}return new k(t,n)}compose(e){return this.empty?e:e.empty?this:Fe(this,e,!0)}map(e,t=!1){return e.empty?this:oe(this,e,t,!0)}iterChanges(e,t=!1){he(this,e,t)}get desc(){return E.create(this.sections)}filter(e){let t=[],n=[],i=[],s=new q(this);e:for(let r=0,h=0;;){let o=r==e.length?1e9:e[r++];for(;h<o||h==o&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,o-h);y(i,u,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;y(t,u,f),f>0&&M(n,t,s.text),s.forward(u),h+=u}let a=e[r++];for(;h<a;){if(s.done)break e;let u=Math.min(s.len,a-h);y(t,u,-1),y(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),h+=u}}return{changes:new k(t,n),filtered:E.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],s=[],r=0,h=null;function o(u=!1){if(!u&&!i.length)return;r<t&&y(i,t-r,-1);let f=new k(i,s);h=h?h.compose(f.map(h)):f,i=[],s=[],r=0}function a(u){if(Array.isArray(u))for(let f of u)a(f);else if(u instanceof k){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);o(),h=h?h.compose(u.map(h)):u}else{let{from:f,to:d=f,insert:c}=u;if(f>d||f<0||d>t)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${t})`);let g=c?typeof c=="string"?x.of(c.split(n||le)):c:x.empty,b=g.length;if(f==d&&b==0)return;f<r&&o(),f>r&&y(i,f-r,-1),y(i,d-f,b),M(s,i,g),r=d}}return a(e),o(!h),h}static empty(e){return new k(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((r,h)=>h&&typeof r!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length<i;)n.push(x.empty);n[i]=x.of(s.slice(1)),t.push(s[0],n[i].length)}}}return new k(t,n)}static createSet(e,t){return new k(e,t)}}function y(l,e,t,n=!1){if(e==0&&t<=0)return;let i=l.length-2;i>=0&&t<=0&&t==l[i+1]?l[i]+=e:i>=0&&e==0&&l[i]==0?l[i+1]+=t:n?(l[i]+=e,l[i+1]+=t):l.push(e,t)}function M(l,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<l.length)l[l.length-1]=l[l.length-1].append(t);else{for(;l.length<n;)l.push(x.empty);l.push(t)}}function he(l,e,t){let n=l.inserted;for(let i=0,s=0,r=0;r<l.sections.length;){let h=l.sections[r++],o=l.sections[r++];if(o<0)i+=h,s+=h;else{let a=i,u=s,f=x.empty;for(;a+=h,u+=o,o&&n&&(f=f.append(n[r-2>>1])),!(t||r==l.sections.length||l.sections[r+1]<0);)h=l.sections[r++],o=l.sections[r++];e(i,a,s,u,f),i=a,s=u}}}function oe(l,e,t,n=!1){let i=[],s=n?[]:null,r=new q(l),h=new q(e);for(let o=-1;;){if(r.done&&h.len||h.done&&r.len)throw new Error("Mismatched change set lengths");if(r.ins==-1&&h.ins==-1){let a=Math.min(r.len,h.len);y(i,a,-1),r.forward(a),h.forward(a)}else if(h.ins>=0&&(r.ins<0||o==r.i||r.off==0&&(h.len<r.len||h.len==r.len&&!t))){let a=h.len;for(y(i,h.ins,-1);a;){let u=Math.min(r.len,a);r.ins>=0&&o<r.i&&r.len<=u&&(y(i,0,r.ins),s&&M(s,i,r.text),o=r.i),r.forward(u),a-=u}h.next()}else if(r.ins>=0){let a=0,u=r.len;for(;u;)if(h.ins==-1){let f=Math.min(u,h.len);a+=f,u-=f,h.forward(f)}else if(h.ins==0&&h.len<u)u-=h.len,h.next();else break;y(i,a,o<r.i?r.ins:0),s&&o<r.i&&M(s,i,r.text),o=r.i,r.forward(r.len-u)}else{if(r.done&&h.done)return s?k.createSet(i,s):E.create(i);throw new Error("Mismatched change set lengths")}}}function Fe(l,e,t=!1){let n=[],i=t?[]:null,s=new q(l),r=new q(e);for(let h=!1;;){if(s.done&&r.done)return i?k.createSet(n,i):E.create(n);if(s.ins==0)y(n,s.len,0,h),s.next();else if(r.len==0&&!r.done)y(n,0,r.ins,h),i&&M(i,n,r.text),r.next();else{if(s.done||r.done)throw new Error("Mismatched change set lengths");{let o=Math.min(s.len2,r.len),a=n.length;if(s.ins==-1){let u=r.ins==-1?-1:r.off?0:r.ins;y(n,o,u,h),i&&u&&M(i,n,r.text)}else r.ins==-1?(y(n,s.off?0:s.len,o,h),i&&M(i,n,s.textBit(o))):(y(n,s.off?0:s.len,r.off?0:r.ins,h),i&&!r.off&&M(i,n,r.text));h=(s.ins>o||r.ins>=0&&r.len>o)&&(h||n.length>a),s.forward2(o),r.forward(o)}}}}class q{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?x.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?x.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 B{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,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new B(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return p.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return p.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 p.range(e.anchor,e.head)}static create(e,t,n){return new B(e,t,n)}}class p{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:p.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 p([this.main],0)}addRange(e,t=!0){return p.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,p.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 p(e.ranges.map(t=>B.fromJSON(t)),e.main)}static single(e,t=e){return new p([p.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,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=n:s.from<n)return p.normalized(e.slice(),t);n=s.to}return new p(e,t)}static cursor(e,t=0,n,i){return B.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,t,n,i){let s=(n??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?B.create(t,e,48|s):B.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let n=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let s=e[i],r=e[i-1];if(s.empty?s.from<=r.to:s.from<r.to){let h=r.from,o=Math.max(s.to,r.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?p.range(o,h):p.range(h,o))}}return new p(e,t)}}function Je(l,e){for(let t of l.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let me=0;class A{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=me++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new A(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:we),!!e.static,e.enables)}of(e){return new K([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new K(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new K(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function we(l,e){return l==e||l.length==e.length&&l.every((t,n)=>t===e[n])}class K{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=me++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,r=e[s]>>1,h=this.type==2,o=!1,a=!1,u=[];for(let f of this.dependencies)f=="doc"?o=!0:f=="selection"?a=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[f.id]);return{create(f){return f.values[r]=n(f),1},update(f,d){if(o&&d.docChanged||a&&(d.docChanged||d.selection)||ae(f,u)){let c=n(f);if(h?!Pe(c,f.values[r],i):!i(c,f.values[r]))return f.values[r]=c,1}return 0},reconfigure:(f,d)=>{let c,g=d.config.address[s];if(g!=null){let b=Y(d,g);if(this.dependencies.every(v=>v instanceof A?d.facet(v)===f.facet(v):v instanceof L?d.field(v,!1)==f.field(v,!1):!0)||(h?Pe(c=n(f),b,i):i(c=n(f),b)))return f.values[r]=b,0}else c=n(f);return f.values[r]=c,1}}}}function Pe(l,e,t){if(l.length!=e.length)return!1;for(let n=0;n<l.length;n++)if(!t(l[n],e[n]))return!1;return!0}function ae(l,e){let t=!1;for(let n of e)$(l,n)&1&&(t=!0);return t}function _e(l,e,t){let n=t.map(o=>l[o.id]),i=t.map(o=>o.type),s=n.filter(o=>!(o&1)),r=l[e.id]>>1;function h(o){let a=[];for(let u=0;u<n.length;u++){let f=Y(o,n[u]);if(i[u]==2)for(let d of f)a.push(d);else a.push(f)}return e.combine(a)}return{create(o){for(let a of n)$(o,a);return o.values[r]=h(o),1},update(o,a){if(!ae(o,s))return 0;let u=h(o);return e.compare(u,o.values[r])?0:(o.values[r]=u,1)},reconfigure(o,a){let u=ae(o,n),f=a.config.facets[e.id],d=a.facet(e);if(f&&!u&&we(t,f))return o.values[r]=d,0;let c=h(o);return e.compare(c,d)?(o.values[r]=d,0):(o.values[r]=c,1)}}}const U=A.define({static:!0});class L{constructor(e,t,n,i,s){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new L(me++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(U).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,i)=>{let s=n.values[t],r=this.updateF(s,i);return this.compareF(s,r)?0:(n.values[t]=r,1)},reconfigure:(n,i)=>{let s=n.facet(U),r=i.facet(U),h;return(h=s.find(o=>o.field==this))&&h!=r.find(o=>o.field==this)?(n.values[t]=h.create(n),1):i.config.address[this.id]!=null?(n.values[t]=i.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,U.of({field:this,create:e})]}get extension(){return this}}const T={lowest:4,low:3,default:2,high:1,highest:0};function D(l){return e=>new Le(e,l)}const gt={highest:D(T.highest),high:D(T.high),default:D(T.default),low:D(T.low),lowest:D(T.lowest)};class Le{constructor(e,t){this.inner=e,this.prec=t}}class te{of(e){return new ue(this,e)}reconfigure(e){return te.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ue{constructor(e,t){this.compartment=e,this.inner=t}}class X{constructor(e,t,n,i,s,r){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=r,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 i=[],s=Object.create(null),r=new Map;for(let d of et(e,t,r))d instanceof L?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let h=Object.create(null),o=[],a=[];for(let d of i)h[d.id]=a.length<<1,a.push(c=>d.slot(c));let u=n?.config.facets;for(let d in s){let c=s[d],g=c[0].facet,b=u&&u[d]||[];if(c.every(v=>v.type==0))if(h[g.id]=o.length<<1|1,we(b,c))o.push(n.facet(g));else{let v=g.combine(c.map(ne=>ne.value));o.push(n&&g.compare(v,n.facet(g))?n.facet(g):v)}else{for(let v of c)v.type==0?(h[v.id]=o.length<<1|1,o.push(v.value)):(h[v.id]=a.length<<1,a.push(ne=>v.dynamicSlot(ne)));h[g.id]=a.length<<1,a.push(v=>_e(v,g,c))}}let f=a.map(d=>d(h));return new X(e,r,f,h,o,s)}}function et(l,e,t){let n=[[],[],[],[],[]],i=new Map;function s(r,h){let o=i.get(r);if(o!=null){if(o<=h)return;let a=n[o].indexOf(r);a>-1&&n[o].splice(a,1),r instanceof ue&&t.delete(r.compartment)}if(i.set(r,h),Array.isArray(r))for(let a of r)s(a,h);else if(r instanceof ue){if(t.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let a=e.get(r.compartment)||r.inner;t.set(r.compartment,a),s(a,h)}else if(r instanceof Le)s(r.inner,r.prec);else if(r instanceof L)n[h].push(r),r.provides&&s(r.provides,h);else if(r instanceof K)n[h].push(r),r.facet.extensions&&s(r.facet.extensions,T.default);else{let a=r.extension;if(!a)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(a,h)}}return s(l,T.default),n.reduce((r,h)=>r.concat(h))}function $(l,e){if(e&1)return 2;let t=e>>1,n=l.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;l.status[t]=4;let i=l.computeSlot(l,l.config.dynamicSlots[t]);return l.status[t]=2|i}function Y(l,e){return e&1?l.config.staticValues[e>>1]:l.values[e>>1]}const De=A.define(),fe=A.define({combine:l=>l.some(e=>e),static:!0}),Ve=A.define({combine:l=>l.length?l[0]:void 0,static:!0}),Ne=A.define(),$e=A.define(),qe=A.define(),ze=A.define({combine:l=>l.length?l[0]:!1});class H{constructor(e,t){this.type=e,this.value=t}static define(){return new tt}}class tt{of(e){return new H(this,e)}}class nt{constructor(e){this.map=e}of(e){return new I(this,e)}}class I{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 I(this.type,t)}is(e){return this.type==e}static define(e={}){return new nt(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let s=i.map(t);s&&n.push(s)}return n}}I.reconfigure=I.define();I.appendConfig=I.define();class P{constructor(e,t,n,i,s,r){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,n&&Je(n,t.newLength),s.some(h=>h.type==P.time)||(this.annotations=s.concat(P.time.of(Date.now())))}static create(e,t,n,i,s,r){return new P(e,t,n,i,s,r)}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(P.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}P.time=H.define();P.userEvent=H.define();P.addToHistory=H.define();P.remote=H.define();function it(l,e){let t=[];for(let n=0,i=0;;){let s,r;if(n<l.length&&(i==e.length||e[i]>=l[n]))s=l[n++],r=l[n++];else if(i<e.length)s=e[i++],r=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,r):t[t.length-1]<r&&(t[t.length-1]=r)}}function We(l,e,t){var n;let i,s,r;return t?(i=e.changes,s=k.empty(e.changes.length),r=l.changes.compose(e.changes)):(i=e.changes.map(l.changes),s=l.changes.mapDesc(e.changes,!0),r=l.changes.compose(i)),{changes:r,selection:e.selection?e.selection.map(s):(n=l.selection)===null||n===void 0?void 0:n.map(i),effects:I.mapEffects(l.effects,i).concat(I.mapEffects(e.effects,s)),annotations:l.annotations.length?l.annotations.concat(e.annotations):e.annotations,scrollIntoView:l.scrollIntoView||e.scrollIntoView}}function ce(l,e,t){let n=e.selection,i=F(e.annotations);return e.userEvent&&(i=i.concat(P.userEvent.of(e.userEvent))),{changes:e.changes instanceof k?e.changes:k.of(e.changes||[],t,l.facet(Ve)),selection:n&&(n instanceof p?n:p.single(n.anchor,n.head)),effects:F(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function He(l,e,t){let n=ce(l,e.length?e[0]:{},l.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let r=!!e[s].sequential;n=We(n,ce(l,e[s],r?n.changes.newLength:l.doc.length),r)}let i=P.create(l,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return rt(t?st(i):i)}function st(l){let e=l.startState,t=!0;for(let i of e.facet(Ne)){let s=i(l);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:it(t,s))}if(t!==!0){let i,s;if(t===!1)s=l.changes.invertedDesc,i=k.empty(e.doc.length);else{let r=l.changes.filter(t);i=r.changes,s=r.filtered.mapDesc(r.changes).invertedDesc}l=P.create(e,i,l.selection&&l.selection.map(s),I.mapEffects(l.effects,s),l.annotations,l.scrollIntoView)}let n=e.facet($e);for(let i=n.length-1;i>=0;i--){let s=n[i](l);s instanceof P?l=s:Array.isArray(s)&&s.length==1&&s[0]instanceof P?l=s[0]:l=He(e,F(s),!1)}return l}function rt(l){let e=l.startState,t=e.facet(qe),n=l;for(let i=t.length-1;i>=0;i--){let s=t[i](l);s&&Object.keys(s).length&&(n=We(n,ce(e,s,l.changes.newLength),!0))}return n==l?l:P.create(e,l.changes,l.selection,n.effects,n.annotations,n.scrollIntoView)}const lt=[];function F(l){return l==null?lt:Array.isArray(l)?l:[l]}var R=(function(l){return l[l.Word=0]="Word",l[l.Space=1]="Space",l[l.Other=2]="Other",l})(R||(R={}));const ht=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let de;try{de=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ot(l){if(de)return de.test(l);for(let e=0;e<l.length;e++){let t=l[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||ht.test(t)))return!0}return!1}function at(l){return e=>{if(!/\S/.test(e))return R.Space;if(ot(e))return R.Word;for(let t=0;t<l.length;t++)if(e.indexOf(l[t])>-1)return R.Word;return R.Other}}class w{constructor(e,t,n,i,s,r){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let h=0;h<this.config.dynamicSlots.length;h++)$(this,h<<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 $(this,n),Y(this,n)}update(...e){return He(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let h of e.effects)h.is(te.reconfigure)?(t&&(i=new Map,t.compartments.forEach((o,a)=>i.set(a,o)),t=null),i.set(h.value.compartment,h.value.extension)):h.is(I.reconfigure)?(t=null,n=h.value):h.is(I.appendConfig)&&(t=null,n=F(n).concat(h.value));let s;t?s=e.startState.values.slice():(t=X.resolve(n,i,this),s=new w(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(o,a)=>a.reconfigure(o,this),null).values);let r=e.startState.facet(fe)?e.newSelection:e.newSelection.asSingle();new w(t,e.newDoc,r,s,(h,o)=>o.update(h,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:p.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),s=[n.range],r=F(n.effects);for(let h=1;h<t.ranges.length;h++){let o=e(t.ranges[h]),a=this.changes(o.changes),u=a.map(i);for(let d=0;d<h;d++)s[d]=s[d].map(u);let f=i.mapDesc(a,!0);s.push(o.range.map(f)),i=i.compose(u),r=I.mapEffects(r,u).concat(I.mapEffects(F(o.effects),f))}return{changes:i,selection:p.create(s,t.mainIndex),effects:r}}changes(e=[]){return e instanceof k?e:k.of(e,this.doc.length,this.facet(w.lineSeparator))}toText(e){return x.of(e.split(this.facet(w.lineSeparator)||le))}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:($(this,t),Y(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof L&&this.config.address[i.id]!=null&&(t[n]=i.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 i=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let r=n[s],h=e[s];i.push(r.init(o=>r.spec.fromJSON(h,o)))}}return w.create({doc:e.doc,selection:p.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=X.resolve(e.extensions||[],new Map),n=e.doc instanceof x?e.doc:x.of((e.doc||"").split(t.staticFacet(w.lineSeparator)||le)),i=e.selection?e.selection instanceof p?e.selection:p.single(e.selection.anchor,e.selection.head):p.single(0);return Je(i,n.length),t.staticFacet(fe)||(i=i.asSingle()),new w(t,n,i,t.dynamicSlots.map(()=>null),(s,r)=>r.create(s),null)}get tabSize(){return this.facet(w.tabSize)}get lineBreak(){return this.facet(w.lineSeparator)||`
4
+ `,this;e--}else if(i instanceof m){let o=i.text[r+(t<0?-1:0)];if(this.offsets[n]+=t,o.length>Math.max(0,e))return this.value=e==0?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=i.children[r+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof m?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Te{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new N(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:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.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 Be{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=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=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(x.prototype[Symbol.iterator]=function(){return this.iter()},N.prototype[Symbol.iterator]=Te.prototype[Symbol.iterator]=Be.prototype[Symbol.iterator]=function(){return this});class Qe{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function J(l,e,t){return e=Math.max(0,Math.min(l.length,e)),[e,Math.max(e,Math.min(l.length,t))]}function Q(l,e,t=!0,n=!0){return je(l,e,t,n)}function Xe(l){return l>=56320&&l<57344}function Ye(l){return l>=55296&&l<56320}function ft(l,e){let t=l.charCodeAt(e);if(!Ye(t)||e+1==l.length)return t;let n=l.charCodeAt(e+1);return Xe(n)?(t-55296<<10)+(n-56320)+65536:t}function ct(l){return l<=65535?String.fromCharCode(l):(l-=65536,String.fromCharCode((l>>10)+55296,(l&1023)+56320))}function dt(l){return l<65536?1:2}const le=/\r\n?|\n/;var O=(function(l){return l[l.Simple=0]="Simple",l[l.TrackDel=1]="TrackDel",l[l.TrackBefore=2]="TrackBefore",l[l.TrackAfter=3]="TrackAfter",l})(O||(O={}));class E{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,i=0;t<this.sections.length;){let s=this.sections[t++],r=this.sections[t++];r<0?(e(n,i,s),i+=s):i+=r,n+=s}}iterChangedRanges(e,t=!1){he(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new E(e)}composeDesc(e){return this.empty?e:e.empty?this:Fe(this,e)}mapDesc(e,t=!1){return e.empty?this:oe(this,e,t)}mapPos(e,t=-1,n=O.Simple){let i=0,s=0;for(let r=0;r<this.sections.length;){let h=this.sections[r++],o=this.sections[r++],a=i+h;if(o<0){if(a>e)return s+(e-i);s+=h}else{if(n!=O.Simple&&a>=e&&(n==O.TrackDel&&i<e&&a>e||n==O.TrackBefore&&i<e||n==O.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!h)return e==i||t<0?s:s+o;s+=o}i=a}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let s=this.sections[n++],r=this.sections[n++],h=i+s;if(r>=0&&i<=t&&h>=e)return i<e&&h>t?"cover":!0;i=h}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}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 E(e)}static create(e){return new E(e)}}class k extends E{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 he(this,(t,n,i,s,r)=>e=e.replace(i,i+(n-t),r),!1),e}mapDesc(e,t=!1){return oe(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i<t.length;i+=2){let r=t[i],h=t[i+1];if(h>=0){t[i]=h,t[i+1]=r;let o=i>>1;for(;n.length<o;)n.push(x.empty);n.push(r?e.slice(s,s+r):x.empty)}s+=r}return new k(t,n)}compose(e){return this.empty?e:e.empty?this:Fe(this,e,!0)}map(e,t=!1){return e.empty?this:oe(this,e,t,!0)}iterChanges(e,t=!1){he(this,e,t)}get desc(){return E.create(this.sections)}filter(e){let t=[],n=[],i=[],s=new q(this);e:for(let r=0,h=0;;){let o=r==e.length?1e9:e[r++];for(;h<o||h==o&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,o-h);y(i,u,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;y(t,u,f),f>0&&M(n,t,s.text),s.forward(u),h+=u}let a=e[r++];for(;h<a;){if(s.done)break e;let u=Math.min(s.len,a-h);y(t,u,-1),y(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),h+=u}}return{changes:new k(t,n),filtered:E.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],s=[],r=0,h=null;function o(u=!1){if(!u&&!i.length)return;r<t&&y(i,t-r,-1);let f=new k(i,s);h=h?h.compose(f.map(h)):f,i=[],s=[],r=0}function a(u){if(Array.isArray(u))for(let f of u)a(f);else if(u instanceof k){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);o(),h=h?h.compose(u.map(h)):u}else{let{from:f,to:d=f,insert:c}=u;if(f>d||f<0||d>t)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${t})`);let g=c?typeof c=="string"?x.of(c.split(n||le)):c:x.empty,b=g.length;if(f==d&&b==0)return;f<r&&o(),f>r&&y(i,f-r,-1),y(i,d-f,b),M(s,i,g),r=d}}return a(e),o(!h),h}static empty(e){return new k(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((r,h)=>h&&typeof r!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length<i;)n.push(x.empty);n[i]=x.of(s.slice(1)),t.push(s[0],n[i].length)}}}return new k(t,n)}static createSet(e,t){return new k(e,t)}}function y(l,e,t,n=!1){if(e==0&&t<=0)return;let i=l.length-2;i>=0&&t<=0&&t==l[i+1]?l[i]+=e:i>=0&&e==0&&l[i]==0?l[i+1]+=t:n?(l[i]+=e,l[i+1]+=t):l.push(e,t)}function M(l,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<l.length)l[l.length-1]=l[l.length-1].append(t);else{for(;l.length<n;)l.push(x.empty);l.push(t)}}function he(l,e,t){let n=l.inserted;for(let i=0,s=0,r=0;r<l.sections.length;){let h=l.sections[r++],o=l.sections[r++];if(o<0)i+=h,s+=h;else{let a=i,u=s,f=x.empty;for(;a+=h,u+=o,o&&n&&(f=f.append(n[r-2>>1])),!(t||r==l.sections.length||l.sections[r+1]<0);)h=l.sections[r++],o=l.sections[r++];e(i,a,s,u,f),i=a,s=u}}}function oe(l,e,t,n=!1){let i=[],s=n?[]:null,r=new q(l),h=new q(e);for(let o=-1;;){if(r.done&&h.len||h.done&&r.len)throw new Error("Mismatched change set lengths");if(r.ins==-1&&h.ins==-1){let a=Math.min(r.len,h.len);y(i,a,-1),r.forward(a),h.forward(a)}else if(h.ins>=0&&(r.ins<0||o==r.i||r.off==0&&(h.len<r.len||h.len==r.len&&!t))){let a=h.len;for(y(i,h.ins,-1);a;){let u=Math.min(r.len,a);r.ins>=0&&o<r.i&&r.len<=u&&(y(i,0,r.ins),s&&M(s,i,r.text),o=r.i),r.forward(u),a-=u}h.next()}else if(r.ins>=0){let a=0,u=r.len;for(;u;)if(h.ins==-1){let f=Math.min(u,h.len);a+=f,u-=f,h.forward(f)}else if(h.ins==0&&h.len<u)u-=h.len,h.next();else break;y(i,a,o<r.i?r.ins:0),s&&o<r.i&&M(s,i,r.text),o=r.i,r.forward(r.len-u)}else{if(r.done&&h.done)return s?k.createSet(i,s):E.create(i);throw new Error("Mismatched change set lengths")}}}function Fe(l,e,t=!1){let n=[],i=t?[]:null,s=new q(l),r=new q(e);for(let h=!1;;){if(s.done&&r.done)return i?k.createSet(n,i):E.create(n);if(s.ins==0)y(n,s.len,0,h),s.next();else if(r.len==0&&!r.done)y(n,0,r.ins,h),i&&M(i,n,r.text),r.next();else{if(s.done||r.done)throw new Error("Mismatched change set lengths");{let o=Math.min(s.len2,r.len),a=n.length;if(s.ins==-1){let u=r.ins==-1?-1:r.off?0:r.ins;y(n,o,u,h),i&&u&&M(i,n,r.text)}else r.ins==-1?(y(n,s.off?0:s.len,o,h),i&&M(i,n,s.textBit(o))):(y(n,s.off?0:s.len,r.off?0:r.ins,h),i&&!r.off&&M(i,n,r.text));h=(s.ins>o||r.ins>=0&&r.len>o)&&(h||n.length>a),s.forward2(o),r.forward(o)}}}}class q{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?x.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?x.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 B{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,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new B(n,i,this.flags)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return p.range(e,t,void 0,void 0,n);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return p.range(this.anchor,i,void 0,void 0,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 p.range(e.anchor,e.head)}static create(e,t,n){return new B(e,t,n)}}class p{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:p.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 p([this.main],0)}addRange(e,t=!0){return p.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,p.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 p(e.ranges.map(t=>B.fromJSON(t)),e.main)}static single(e,t=e){return new p([p.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,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=n:s.from<n)return p.normalized(e.slice(),t);n=s.to}return new p(e,t)}static cursor(e,t=0,n,i){return B.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,t,n,i,s){let r=(n??16777215)<<6|(i==null?7:Math.min(6,i));return!s&&e!=t&&(s=t<e?1:-1),t<e?B.create(t,e,48|r):B.create(e,t,(s?s<0?8:16:0)|r)}static normalized(e,t=0){let n=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let s=e[i],r=e[i-1];if(s.empty?s.from<=r.to:s.from<r.to){let h=r.from,o=Math.max(s.to,r.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?p.range(o,h):p.range(h,o))}}return new p(e,t)}}function Je(l,e){for(let t of l.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let me=0;class A{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=me++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new A(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:we),!!e.static,e.enables)}of(e){return new K([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new K(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new K(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function we(l,e){return l==e||l.length==e.length&&l.every((t,n)=>t===e[n])}class K{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=me++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,r=e[s]>>1,h=this.type==2,o=!1,a=!1,u=[];for(let f of this.dependencies)f=="doc"?o=!0:f=="selection"?a=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[f.id]);return{create(f){return f.values[r]=n(f),1},update(f,d){if(o&&d.docChanged||a&&(d.docChanged||d.selection)||ae(f,u)){let c=n(f);if(h?!Pe(c,f.values[r],i):!i(c,f.values[r]))return f.values[r]=c,1}return 0},reconfigure:(f,d)=>{let c,g=d.config.address[s];if(g!=null){let b=Y(d,g);if(this.dependencies.every(v=>v instanceof A?d.facet(v)===f.facet(v):v instanceof L?d.field(v,!1)==f.field(v,!1):!0)||(h?Pe(c=n(f),b,i):i(c=n(f),b)))return f.values[r]=b,0}else c=n(f);return f.values[r]=c,1}}}}function Pe(l,e,t){if(l.length!=e.length)return!1;for(let n=0;n<l.length;n++)if(!t(l[n],e[n]))return!1;return!0}function ae(l,e){let t=!1;for(let n of e)$(l,n)&1&&(t=!0);return t}function _e(l,e,t){let n=t.map(o=>l[o.id]),i=t.map(o=>o.type),s=n.filter(o=>!(o&1)),r=l[e.id]>>1;function h(o){let a=[];for(let u=0;u<n.length;u++){let f=Y(o,n[u]);if(i[u]==2)for(let d of f)a.push(d);else a.push(f)}return e.combine(a)}return{create(o){for(let a of n)$(o,a);return o.values[r]=h(o),1},update(o,a){if(!ae(o,s))return 0;let u=h(o);return e.compare(u,o.values[r])?0:(o.values[r]=u,1)},reconfigure(o,a){let u=ae(o,n),f=a.config.facets[e.id],d=a.facet(e);if(f&&!u&&we(t,f))return o.values[r]=d,0;let c=h(o);return e.compare(c,d)?(o.values[r]=d,0):(o.values[r]=c,1)}}}const U=A.define({static:!0});class L{constructor(e,t,n,i,s){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new L(me++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(U).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,i)=>{let s=n.values[t],r=this.updateF(s,i);return this.compareF(s,r)?0:(n.values[t]=r,1)},reconfigure:(n,i)=>{let s=n.facet(U),r=i.facet(U),h;return(h=s.find(o=>o.field==this))&&h!=r.find(o=>o.field==this)?(n.values[t]=h.create(n),1):i.config.address[this.id]!=null?(n.values[t]=i.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,U.of({field:this,create:e})]}get extension(){return this}}const T={lowest:4,low:3,default:2,high:1,highest:0};function D(l){return e=>new Le(e,l)}const gt={highest:D(T.highest),high:D(T.high),default:D(T.default),low:D(T.low),lowest:D(T.lowest)};class Le{constructor(e,t){this.inner=e,this.prec=t}}class te{of(e){return new ue(this,e)}reconfigure(e){return te.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ue{constructor(e,t){this.compartment=e,this.inner=t}}class X{constructor(e,t,n,i,s,r){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=r,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 i=[],s=Object.create(null),r=new Map;for(let d of et(e,t,r))d instanceof L?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let h=Object.create(null),o=[],a=[];for(let d of i)h[d.id]=a.length<<1,a.push(c=>d.slot(c));let u=n?.config.facets;for(let d in s){let c=s[d],g=c[0].facet,b=u&&u[d]||[];if(c.every(v=>v.type==0))if(h[g.id]=o.length<<1|1,we(b,c))o.push(n.facet(g));else{let v=g.combine(c.map(ne=>ne.value));o.push(n&&g.compare(v,n.facet(g))?n.facet(g):v)}else{for(let v of c)v.type==0?(h[v.id]=o.length<<1|1,o.push(v.value)):(h[v.id]=a.length<<1,a.push(ne=>v.dynamicSlot(ne)));h[g.id]=a.length<<1,a.push(v=>_e(v,g,c))}}let f=a.map(d=>d(h));return new X(e,r,f,h,o,s)}}function et(l,e,t){let n=[[],[],[],[],[]],i=new Map;function s(r,h){let o=i.get(r);if(o!=null){if(o<=h)return;let a=n[o].indexOf(r);a>-1&&n[o].splice(a,1),r instanceof ue&&t.delete(r.compartment)}if(i.set(r,h),Array.isArray(r))for(let a of r)s(a,h);else if(r instanceof ue){if(t.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let a=e.get(r.compartment)||r.inner;t.set(r.compartment,a),s(a,h)}else if(r instanceof Le)s(r.inner,r.prec);else if(r instanceof L)n[h].push(r),r.provides&&s(r.provides,h);else if(r instanceof K)n[h].push(r),r.facet.extensions&&s(r.facet.extensions,T.default);else{let a=r.extension;if(!a)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(a,h)}}return s(l,T.default),n.reduce((r,h)=>r.concat(h))}function $(l,e){if(e&1)return 2;let t=e>>1,n=l.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;l.status[t]=4;let i=l.computeSlot(l,l.config.dynamicSlots[t]);return l.status[t]=2|i}function Y(l,e){return e&1?l.config.staticValues[e>>1]:l.values[e>>1]}const De=A.define(),fe=A.define({combine:l=>l.some(e=>e),static:!0}),Ve=A.define({combine:l=>l.length?l[0]:void 0,static:!0}),Ne=A.define(),$e=A.define(),qe=A.define(),ze=A.define({combine:l=>l.length?l[0]:!1});class H{constructor(e,t){this.type=e,this.value=t}static define(){return new tt}}class tt{of(e){return new H(this,e)}}class nt{constructor(e){this.map=e}of(e){return new I(this,e)}}class I{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 I(this.type,t)}is(e){return this.type==e}static define(e={}){return new nt(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let s=i.map(t);s&&n.push(s)}return n}}I.reconfigure=I.define();I.appendConfig=I.define();class P{constructor(e,t,n,i,s,r){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,n&&Je(n,t.newLength),s.some(h=>h.type==P.time)||(this.annotations=s.concat(P.time.of(Date.now())))}static create(e,t,n,i,s,r){return new P(e,t,n,i,s,r)}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(P.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}P.time=H.define();P.userEvent=H.define();P.addToHistory=H.define();P.remote=H.define();function it(l,e){let t=[];for(let n=0,i=0;;){let s,r;if(n<l.length&&(i==e.length||e[i]>=l[n]))s=l[n++],r=l[n++];else if(i<e.length)s=e[i++],r=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,r):t[t.length-1]<r&&(t[t.length-1]=r)}}function We(l,e,t){var n;let i,s,r;return t?(i=e.changes,s=k.empty(e.changes.length),r=l.changes.compose(e.changes)):(i=e.changes.map(l.changes),s=l.changes.mapDesc(e.changes,!0),r=l.changes.compose(i)),{changes:r,selection:e.selection?e.selection.map(s):(n=l.selection)===null||n===void 0?void 0:n.map(i),effects:I.mapEffects(l.effects,i).concat(I.mapEffects(e.effects,s)),annotations:l.annotations.length?l.annotations.concat(e.annotations):e.annotations,scrollIntoView:l.scrollIntoView||e.scrollIntoView}}function ce(l,e,t){let n=e.selection,i=F(e.annotations);return e.userEvent&&(i=i.concat(P.userEvent.of(e.userEvent))),{changes:e.changes instanceof k?e.changes:k.of(e.changes||[],t,l.facet(Ve)),selection:n&&(n instanceof p?n:p.single(n.anchor,n.head)),effects:F(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function He(l,e,t){let n=ce(l,e.length?e[0]:{},l.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let r=!!e[s].sequential;n=We(n,ce(l,e[s],r?n.changes.newLength:l.doc.length),r)}let i=P.create(l,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return rt(t?st(i):i)}function st(l){let e=l.startState,t=!0;for(let i of e.facet(Ne)){let s=i(l);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:it(t,s))}if(t!==!0){let i,s;if(t===!1)s=l.changes.invertedDesc,i=k.empty(e.doc.length);else{let r=l.changes.filter(t);i=r.changes,s=r.filtered.mapDesc(r.changes).invertedDesc}l=P.create(e,i,l.selection&&l.selection.map(s),I.mapEffects(l.effects,s),l.annotations,l.scrollIntoView)}let n=e.facet($e);for(let i=n.length-1;i>=0;i--){let s=n[i](l);s instanceof P?l=s:Array.isArray(s)&&s.length==1&&s[0]instanceof P?l=s[0]:l=He(e,F(s),!1)}return l}function rt(l){let e=l.startState,t=e.facet(qe),n=l;for(let i=t.length-1;i>=0;i--){let s=t[i](l);s&&Object.keys(s).length&&(n=We(n,ce(e,s,l.changes.newLength),!0))}return n==l?l:P.create(e,l.changes,l.selection,n.effects,n.annotations,n.scrollIntoView)}const lt=[];function F(l){return l==null?lt:Array.isArray(l)?l:[l]}var R=(function(l){return l[l.Word=0]="Word",l[l.Space=1]="Space",l[l.Other=2]="Other",l})(R||(R={}));const ht=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let de;try{de=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ot(l){if(de)return de.test(l);for(let e=0;e<l.length;e++){let t=l[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||ht.test(t)))return!0}return!1}function at(l){return e=>{if(!/\S/.test(e))return R.Space;if(ot(e))return R.Word;for(let t=0;t<l.length;t++)if(e.indexOf(l[t])>-1)return R.Word;return R.Other}}class w{constructor(e,t,n,i,s,r){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let h=0;h<this.config.dynamicSlots.length;h++)$(this,h<<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 $(this,n),Y(this,n)}update(...e){return He(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let h of e.effects)h.is(te.reconfigure)?(t&&(i=new Map,t.compartments.forEach((o,a)=>i.set(a,o)),t=null),i.set(h.value.compartment,h.value.extension)):h.is(I.reconfigure)?(t=null,n=h.value):h.is(I.appendConfig)&&(t=null,n=F(n).concat(h.value));let s;t?s=e.startState.values.slice():(t=X.resolve(n,i,this),s=new w(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(o,a)=>a.reconfigure(o,this),null).values);let r=e.startState.facet(fe)?e.newSelection:e.newSelection.asSingle();new w(t,e.newDoc,r,s,(h,o)=>o.update(h,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:p.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),s=[n.range],r=F(n.effects);for(let h=1;h<t.ranges.length;h++){let o=e(t.ranges[h]),a=this.changes(o.changes),u=a.map(i);for(let d=0;d<h;d++)s[d]=s[d].map(u);let f=i.mapDesc(a,!0);s.push(o.range.map(f)),i=i.compose(u),r=I.mapEffects(r,u).concat(I.mapEffects(F(o.effects),f))}return{changes:i,selection:p.create(s,t.mainIndex),effects:r}}changes(e=[]){return e instanceof k?e:k.of(e,this.doc.length,this.facet(w.lineSeparator))}toText(e){return x.of(e.split(this.facet(w.lineSeparator)||le))}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:($(this,t),Y(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof L&&this.config.address[i.id]!=null&&(t[n]=i.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 i=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let r=n[s],h=e[s];i.push(r.init(o=>r.spec.fromJSON(h,o)))}}return w.create({doc:e.doc,selection:p.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=X.resolve(e.extensions||[],new Map),n=e.doc instanceof x?e.doc:x.of((e.doc||"").split(t.staticFacet(w.lineSeparator)||le)),i=e.selection?e.selection instanceof p?e.selection:p.single(e.selection.anchor,e.selection.head):p.single(0);return Je(i,n.length),t.staticFacet(fe)||(i=i.asSingle()),new w(t,n,i,t.dynamicSlots.map(()=>null),(s,r)=>r.create(s),null)}get tabSize(){return this.facet(w.tabSize)}get lineBreak(){return this.facet(w.lineSeparator)||`
5
5
  `}get readOnly(){return this.facet(ze)}phrase(e,...t){for(let n of this.facet(w.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(De))for(let r of s(this,t,n))Object.prototype.hasOwnProperty.call(r,e)&&i.push(r[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return at(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),r=e-n,h=e-n;for(;r>0;){let o=Q(t,r,!1);if(s(t.slice(o,r))!=R.Word)break;r=o}for(;h<i;){let o=Q(t,h);if(s(t.slice(h,o))!=R.Word)break;h=o}return r==h?null:p.range(r+n,h+n)}}w.allowMultipleSelections=fe;w.tabSize=A.define({combine:l=>l.length?l[0]:4});w.lineSeparator=Ve;w.readOnly=ze;w.phrases=A.define({compare(l,e){let t=Object.keys(l),n=Object.keys(e);return t.length==n.length&&t.every(i=>l[i]==e[i])}});w.languageData=De;w.changeFilter=Ne;w.transactionFilter=$e;w.transactionExtender=qe;te.reconfigure=I.define();function pt(l,e,t={}){let n={};for(let i of l)for(let s of Object.keys(i)){let r=i[s],h=n[s];if(h===void 0)n[s]=r;else if(!(h===r||r===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](h,r);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class _{eq(e){return this==e}range(e,t=e){return z.create(e,t,this)}}_.prototype.startSide=_.prototype.endSide=0;_.prototype.point=!1;_.prototype.mapMode=O.TrackDel;function ve(l,e){return l==e||l.constructor==e.constructor&&l.eq(e)}class z{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new z(e,t,n)}}function ge(l,e){return l.from-e.from||l.value.startSide-e.value.startSide}class xe{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let r=i,h=s.length;;){if(r==h)return r;let o=r+h>>1,a=s[o]-e||(n?this.value[o].endSide:this.value[o].startSide)-t;if(o==r)return a>=0?r:h;a>=0?h=o:r=o+1}}between(e,t,n,i){for(let s=this.findIndex(t,-1e9,!0),r=this.findIndex(n,1e9,!1,s);s<r;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],i=[],s=[],r=-1,h=-1;for(let o=0;o<this.value.length;o++){let a=this.value[o],u=this.from[o]+e,f=this.to[o]+e,d,c;if(u==f){let g=t.mapPos(u,a.startSide,a.mapMode);if(g==null||(d=c=g,a.startSide!=a.endSide&&(c=t.mapPos(u,a.endSide),c<d)))continue}else if(d=t.mapPos(u,a.startSide),c=t.mapPos(f,a.endSide),d>c||d==c&&a.startSide>0&&a.endSide<=0)continue;(c-d||a.endSide-a.startSide)<0||(r<0&&(r=d),a.point&&(h=Math.max(h,c-d)),n.push(a),i.push(d-r),s.push(c-r))}return{mapped:n.length?new xe(i,s,n,h):null,pos:r}}}class S{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new S(e,t,n,i)}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:i=0,filterTo:s=this.length}=e,r=e.filter;if(t.length==0&&!r)return this;if(n&&(t=t.slice().sort(ge)),this.isEmpty)return t.length?S.of(t):this;let h=new Ue(this,null,-1).goto(0),o=0,a=[],u=new ee;for(;h.value||o<t.length;)if(o<t.length&&(h.from-t[o].from||h.startSide-t[o].value.startSide)>=0){let f=t[o++];u.addInner(f.from,f.to,f.value)||a.push(f)}else h.rangeIndex==1&&h.chunkIndex<this.chunk.length&&(o==t.length||this.chunkEnd(h.chunkIndex)<t[o].from)&&(!r||i>this.chunkEnd(h.chunkIndex)||s<this.chunkPos[h.chunkIndex])&&u.addChunk(this.chunkPos[h.chunkIndex],this.chunk[h.chunkIndex])?h.nextChunk():((!r||i>h.to||s<h.from||r(h.from,h.to,h.value))&&(u.addInner(h.from,h.to,h.value)||a.push(z.create(h.from,h.to,h.value))),h.next());return u.finishInner(this.nextLayer.isEmpty&&!a.length?S.empty:this.nextLayer.update({add:a,filter:r,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let h=this.chunkPos[r],o=this.chunk[r],a=e.touchesRange(h,h+o.length);if(a===!1)i=Math.max(i,o.maxPoint),t.push(o),n.push(e.mapPos(h));else if(a===!0){let{mapped:u,pos:f}=o.map(h,e);u&&(i=Math.max(i,u.maxPoint),t.push(u),n.push(f))}}let s=this.nextLayer.map(e);return t.length==0?s:new S(n,t,s||S.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],r=this.chunk[i];if(t>=s&&e<=s+r.length&&r.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return W.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return W.from(e).goto(t)}static compare(e,t,n,i,s=-1){let r=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),h=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),o=Ae(r,h,n),a=new V(r,o,s),u=new V(h,o,s);n.iterGaps((f,d,c)=>be(a,f,u,d,c,i)),n.empty&&n.length==0&&be(a,0,u,0,0,i)}static eq(e,t,n=0,i){i==null&&(i=999999999);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),r=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=r.length)return!1;if(!s.length)return!0;let h=Ae(s,r),o=new V(s,h,0).goto(n),a=new V(r,h,0).goto(n);for(;;){if(o.to!=a.to||!pe(o.active,a.active)||o.point&&(!a.point||!ve(o.point,a.point)))return!1;if(o.to>i)return!0;o.next(),a.next()}}static spans(e,t,n,i,s=-1){let r=new V(e,null,s).goto(t),h=t,o=r.openStart;for(;;){let a=Math.min(r.to,n);if(r.point){let u=r.activeForPoint(r.to),f=r.pointFrom<t?u.length+1:r.point.startSide<0?u.length:Math.min(u.length,o);i.point(h,a,r.point,u,f,r.pointRank),o=Math.min(r.openEnd(a),u.length)}else a>h&&(i.span(h,a,r.active,o),o=r.openEnd(a));if(r.to>n)return o+(r.point&&r.to>n?1:0);h=r.to,r.next()}}static of(e,t=!1){let n=new ee;for(let i of e instanceof z?[e]:t?ut(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return S.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=S.empty;i=i.nextLayer)t=new S(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}S.empty=new S([],[],null,-1);function ut(l){if(l.length>1)for(let e=l[0],t=1;t<l.length;t++){let n=l[t];if(ge(e,n)>0)return l.slice().sort(ge);e=n}return l}S.empty.nextLayer=S.empty;class ee{finishChunk(e){this.chunks.push(new xe(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 ee)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<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(S.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=S.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Ae(l,e,t){let n=new Map;for(let s of l)for(let r=0;r<s.chunk.length;r++)s.chunk[r].maxPoint<=0&&n.set(s.chunk[r],s.chunkPos[r]);let i=new Set;for(let s of e)for(let r=0;r<s.chunk.length;r++){let h=n.get(s.chunk[r]);h!=null&&(t?t.mapPos(h):h)==s.chunkPos[r]&&!t?.touchesRange(h,h+s.chunk[r].length)&&i.add(s.chunk[r])}return i}class Ue{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}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 i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}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 W{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let s=0;s<e.length;s++)for(let r=e[s];!r.isEmpty;r=r.nextLayer)r.maxPoint>=n&&i.push(new Ue(r,t,n,s));return i.length==1?i[0]:new W(i)}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--)se(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--)se(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(),se(this.heap,0)}}}function se(l,e){for(let t=l[e];;){let n=(e<<1)+1;if(n>=l.length)break;let i=l[n];if(n+1<l.length&&i.compare(l[n+1])>=0&&(i=l[n+1],n++),t.compare(i)<0)break;l[n]=t,l[e]=i,e=n}}class V{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=W.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){G(this.active,e),G(this.activeTo,e),G(this.activeRank,e),this.minActive=Ce(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;j(this.active,t,n),j(this.activeTo,t,i),j(this.activeRank,t,s),e&&j(e,t,this.cursor.from),this.minActive=Ce(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&G(n,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.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=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.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 i=n.length-1;i>=0&&n[i]<e;i--)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 be(l,e,t,n,i,s){l.goto(e),t.goto(n);let r=n+i,h=n,o=n-e,a=!!s.boundChange;for(let u=!1;;){let f=l.to+o-t.to,d=f||l.endSide-t.endSide,c=d<0?l.to+o:t.to,g=Math.min(c,r);if(l.point||t.point?(l.point&&t.point&&ve(l.point,t.point)&&pe(l.activeForPoint(l.to),t.activeForPoint(t.to))||s.comparePoint(h,g,l.point,t.point),u=!1):(u&&s.boundChange(h),g>h&&!pe(l.active,t.active)&&s.compareRange(h,g,l.active,t.active),a&&g<r&&(f||l.openEnd(c)!=t.openEnd(c))&&(u=!0)),c>r)break;h=c,d<=0&&l.next(),d>=0&&t.next()}}function pe(l,e){if(l.length!=e.length)return!1;for(let t=0;t<l.length;t++)if(l[t]!=e[t]&&!ve(l[t],e[t]))return!1;return!0}function G(l,e){for(let t=e,n=l.length-1;t<n;t++)l[t]=l[t+1];l.pop()}function j(l,e,t){for(let n=l.length-1;n>=e;n--)l[n+1]=l[n];l[e]=t}function Ce(l,e){let t=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||l[i].endSide-l[t].endSide)<0&&(t=i,n=e[i]);return t}function mt(l,e,t=l.length){let n=0;for(let i=0;i<t&&i<l.length;)l.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=Q(l,i));return n}function wt(l,e,t,n){for(let i=0,s=0;;){if(s>=e)return i;if(i==l.length)break;s+=l.charCodeAt(i)==9?t-s%t:1,i=Q(l,i)}return n===!0?-1:l.length}export{H as Annotation,tt as AnnotationType,E as ChangeDesc,k as ChangeSet,R as CharCategory,te as Compartment,p as EditorSelection,w as EditorState,A as Facet,Qe as Line,O as MapMode,gt as Prec,z as Range,S as RangeSet,ee as RangeSetBuilder,_ as RangeValue,B as SelectionRange,I as StateEffect,nt as StateEffectType,L as StateField,x as Text,P as Transaction,ft as codePointAt,dt as codePointSize,pt as combineConfig,mt as countColumn,Q as findClusterBreak,wt as findColumn,ct as fromCodePoint};
@@ -1 +1 @@
1
- import{O as B,f as F,g as A,e as V,w as S,a as J,t as v,c as D,r as L,b as _,d as N,h as E,i as P,j as G,k as O,l as q,D as R,m as z}from"./CLFba8FK.js";import{r as M}from"./CMFOFkXK.js";const b=3e4;class K extends B{constructor(n){super(),this.doc=n,this.clientID=n.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const e=A();this.getLocalState()!==null&&b/2<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const s=[];this.meta.forEach((a,c)=>{c!==this.clientID&&b<=e-a.lastUpdated&&this.states.has(c)&&s.push(c)}),s.length>0&&x(this,s,"timeout")},F(b/10)),n.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(n){const e=this.clientID,s=this.meta.get(e),a=s===void 0?0:s.clock+1,c=this.states.get(e);n===null?this.states.delete(e):this.states.set(e,n),this.meta.set(e,{clock:a,lastUpdated:A()});const l=[],u=[],r=[],p=[];n===null?p.push(e):c==null?n!=null&&l.push(e):(u.push(e),V(c,n)||r.push(e)),(l.length>0||r.length>0||p.length>0)&&this.emit("change",[{added:l,updated:r,removed:p},"local"]),this.emit("update",[{added:l,updated:u,removed:p},"local"])}setLocalStateField(n,e){const s=this.getLocalState();s!==null&&this.setLocalState({...s,[n]:e})}getStates(){return this.states}}const x=(t,n,e)=>{const s=[];for(let a=0;a<n.length;a++){const c=n[a];if(t.states.has(c)){if(t.states.delete(c),c===t.clientID){const l=t.meta.get(c);t.meta.set(c,{clock:l.clock+1,lastUpdated:A()})}s.push(c)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},e]),t.emit("update",[{added:[],updated:[],removed:s},e]))},Q=(t,n,e=t.states)=>{const s=n.length,a=D();S(a,s);for(let c=0;c<s;c++){const l=n[c],u=e.get(l)||null,r=t.meta.get(l).clock;S(a,l),S(a,r),J(a,JSON.stringify(u))}return v(a)},X=(t,n,e)=>{const s=N(n),a=A(),c=[],l=[],u=[],r=[],p=L(s);for(let m=0;m<p;m++){const d=L(s);let g=L(s);const h=JSON.parse(_(s)),y=t.meta.get(d),k=t.states.get(d),o=y===void 0?0:y.clock;(o<g||o===g&&h===null&&t.states.has(d))&&(h===null?d===t.clientID&&t.getLocalState()!=null?g++:t.states.delete(d):t.states.set(d,h),t.meta.set(d,{clock:g,lastUpdated:a}),y===void 0&&h!==null?c.push(d):y!==void 0&&h===null?r.push(d):h!==null&&(V(h,k)||u.push(d),l.push(d)))}(c.length>0||u.length>0||r.length>0)&&t.emit("change",[{added:c,updated:u,removed:r},e]),(c.length>0||l.length>0||r.length>0)&&t.emit("update",[{added:c,updated:l,removed:r},e])},W=0,j=1,C=2,Z=(t,n)=>{S(t,W);const e=P(n);E(t,e)},$=(t,n,e)=>{S(t,j),E(t,q(n,e))},H=(t,n,e)=>$(n,e,O(t)),Y=(t,n,e,s)=>{try{G(n,O(t),e)}catch(a){s?.(a),console.error("Caught error while handling a Yjs update",a)}},tt=(t,n)=>{S(t,C),E(t,n)},et=Y,nt=(t,n,e,s,a)=>{const c=L(t);switch(c){case W:H(t,n,e);break;case j:Y(t,e,s,a);break;case C:et(t,e,s,a);break;default:throw new Error("Unknown message type")}return c},U=0,T=1;function st(t,n,e){const s=new TextEncoder().encode(t),a=new ArrayBuffer(2+s.length+1+e.length);return new DataView(a).setUint16(0,s.length),new Uint8Array(a,2,s.length).set(s),new Uint8Array(a)[2+s.length]=n,new Uint8Array(a,2+s.length+1).set(e),a}function at(t){if(t.byteLength<3)return null;const e=new DataView(t).getUint16(0);if(t.byteLength<2+e+1)return null;const s=new TextDecoder().decode(new Uint8Array(t,2,e)),a=new Uint8Array(t)[2+e],c=new Uint8Array(t,2+e+1);return{docName:s,msgType:a,payload:c}}function lt(t,n){const e=new R,s=e.getText("content"),a=new K(e);a.setLocalStateField("user",{name:n.name,color:n.color,colorLight:n.colorLight??n.color+"33"});let c=null,l=!1;function u(){return M.ws??null}function r(o,f){const i=u();!i||i.readyState!==WebSocket.OPEN||i.send(st(t,o,f))}function p(){const o=D();Z(o,e),r(U,v(o))}function m(o){const f=o??[e.clientID],i=Q(a,f);r(T,i)}function d(o){if(l||typeof o.data=="string")return;const f=o.data instanceof ArrayBuffer?o.data:null;if(!f)return;const i=at(f);if(!(!i||i.docName!==t))if(i.msgType===U){const I=N(i.payload),w=D();nt(I,w,e,"ws-server"),z(w)>0&&r(U,v(w))}else i.msgType===T&&X(a,i.payload,"ws-server")}function g(o,f){if(l||f==="ws-server")return;const i=D();tt(i,o),r(U,v(i))}function h({added:o,updated:f,removed:i},I){if(l||I==="ws-server")return;const w=o.concat(f,i);m(w)}function y(){if(l)return;const o=u();!o||o.readyState!==WebSocket.OPEN||(o.send(JSON.stringify({type:"collab:join",docName:t})),c&&o.removeEventListener("message",c),c=d,o.addEventListener("message",c),p(),m())}e.on("update",g),a.on("update",h),y(),M.addConnectHandler(y);function k(){if(l)return;l=!0,x(a,[e.clientID],"local"),m([e.clientID]);const o=u();o&&o.readyState===WebSocket.OPEN&&o.send(JSON.stringify({type:"collab:leave",docName:t})),c&&o&&(o.removeEventListener("message",c),c=null),e.off("update",g),a.off("update",h),a.destroy(),e.destroy()}return{ydoc:e,ytext:s,awareness:a,destroy:k}}export{lt as createCollabSession};
1
+ import{O as B,f as F,g as A,e as V,w as S,a as J,t as v,c as D,r as L,b as _,d as N,h as E,i as P,j as G,k as O,l as q,D as R,m as z}from"./CLFba8FK.js";import{r as M}from"./Dkz6p8Jo.js";const b=3e4;class K extends B{constructor(n){super(),this.doc=n,this.clientID=n.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const e=A();this.getLocalState()!==null&&b/2<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const s=[];this.meta.forEach((a,c)=>{c!==this.clientID&&b<=e-a.lastUpdated&&this.states.has(c)&&s.push(c)}),s.length>0&&x(this,s,"timeout")},F(b/10)),n.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(n){const e=this.clientID,s=this.meta.get(e),a=s===void 0?0:s.clock+1,c=this.states.get(e);n===null?this.states.delete(e):this.states.set(e,n),this.meta.set(e,{clock:a,lastUpdated:A()});const l=[],u=[],r=[],p=[];n===null?p.push(e):c==null?n!=null&&l.push(e):(u.push(e),V(c,n)||r.push(e)),(l.length>0||r.length>0||p.length>0)&&this.emit("change",[{added:l,updated:r,removed:p},"local"]),this.emit("update",[{added:l,updated:u,removed:p},"local"])}setLocalStateField(n,e){const s=this.getLocalState();s!==null&&this.setLocalState({...s,[n]:e})}getStates(){return this.states}}const x=(t,n,e)=>{const s=[];for(let a=0;a<n.length;a++){const c=n[a];if(t.states.has(c)){if(t.states.delete(c),c===t.clientID){const l=t.meta.get(c);t.meta.set(c,{clock:l.clock+1,lastUpdated:A()})}s.push(c)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},e]),t.emit("update",[{added:[],updated:[],removed:s},e]))},Q=(t,n,e=t.states)=>{const s=n.length,a=D();S(a,s);for(let c=0;c<s;c++){const l=n[c],u=e.get(l)||null,r=t.meta.get(l).clock;S(a,l),S(a,r),J(a,JSON.stringify(u))}return v(a)},X=(t,n,e)=>{const s=N(n),a=A(),c=[],l=[],u=[],r=[],p=L(s);for(let m=0;m<p;m++){const d=L(s);let g=L(s);const h=JSON.parse(_(s)),y=t.meta.get(d),k=t.states.get(d),o=y===void 0?0:y.clock;(o<g||o===g&&h===null&&t.states.has(d))&&(h===null?d===t.clientID&&t.getLocalState()!=null?g++:t.states.delete(d):t.states.set(d,h),t.meta.set(d,{clock:g,lastUpdated:a}),y===void 0&&h!==null?c.push(d):y!==void 0&&h===null?r.push(d):h!==null&&(V(h,k)||u.push(d),l.push(d)))}(c.length>0||u.length>0||r.length>0)&&t.emit("change",[{added:c,updated:u,removed:r},e]),(c.length>0||l.length>0||r.length>0)&&t.emit("update",[{added:c,updated:l,removed:r},e])},W=0,j=1,C=2,Z=(t,n)=>{S(t,W);const e=P(n);E(t,e)},$=(t,n,e)=>{S(t,j),E(t,q(n,e))},H=(t,n,e)=>$(n,e,O(t)),Y=(t,n,e,s)=>{try{G(n,O(t),e)}catch(a){s?.(a),console.error("Caught error while handling a Yjs update",a)}},tt=(t,n)=>{S(t,C),E(t,n)},et=Y,nt=(t,n,e,s,a)=>{const c=L(t);switch(c){case W:H(t,n,e);break;case j:Y(t,e,s,a);break;case C:et(t,e,s,a);break;default:throw new Error("Unknown message type")}return c},U=0,T=1;function st(t,n,e){const s=new TextEncoder().encode(t),a=new ArrayBuffer(2+s.length+1+e.length);return new DataView(a).setUint16(0,s.length),new Uint8Array(a,2,s.length).set(s),new Uint8Array(a)[2+s.length]=n,new Uint8Array(a,2+s.length+1).set(e),a}function at(t){if(t.byteLength<3)return null;const e=new DataView(t).getUint16(0);if(t.byteLength<2+e+1)return null;const s=new TextDecoder().decode(new Uint8Array(t,2,e)),a=new Uint8Array(t)[2+e],c=new Uint8Array(t,2+e+1);return{docName:s,msgType:a,payload:c}}function lt(t,n){const e=new R,s=e.getText("content"),a=new K(e);a.setLocalStateField("user",{name:n.name,color:n.color,colorLight:n.colorLight??n.color+"33"});let c=null,l=!1;function u(){return M.ws??null}function r(o,f){const i=u();!i||i.readyState!==WebSocket.OPEN||i.send(st(t,o,f))}function p(){const o=D();Z(o,e),r(U,v(o))}function m(o){const f=o??[e.clientID],i=Q(a,f);r(T,i)}function d(o){if(l||typeof o.data=="string")return;const f=o.data instanceof ArrayBuffer?o.data:null;if(!f)return;const i=at(f);if(!(!i||i.docName!==t))if(i.msgType===U){const I=N(i.payload),w=D();nt(I,w,e,"ws-server"),z(w)>0&&r(U,v(w))}else i.msgType===T&&X(a,i.payload,"ws-server")}function g(o,f){if(l||f==="ws-server")return;const i=D();tt(i,o),r(U,v(i))}function h({added:o,updated:f,removed:i},I){if(l||I==="ws-server")return;const w=o.concat(f,i);m(w)}function y(){if(l)return;const o=u();!o||o.readyState!==WebSocket.OPEN||(o.send(JSON.stringify({type:"collab:join",docName:t})),c&&o.removeEventListener("message",c),c=d,o.addEventListener("message",c),p(),m())}e.on("update",g),a.on("update",h),y(),M.addConnectHandler(y);function k(){if(l)return;l=!0,x(a,[e.clientID],"local"),m([e.clientID]);const o=u();o&&o.readyState===WebSocket.OPEN&&o.send(JSON.stringify({type:"collab:leave",docName:t})),c&&o&&(o.removeEventListener("message",c),c=null),e.off("update",g),a.off("update",h),a.destroy(),e.destroy()}return{ydoc:e,ytext:s,awareness:a,destroy:k}}export{lt as createCollabSession};