studiograph 1.3.9 → 1.3.11

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 (36) hide show
  1. package/dist/mcp/connector-manager.d.ts +1 -2
  2. package/dist/mcp/connector-manager.js +11 -4
  3. package/dist/mcp/connector-manager.js.map +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/{Bi-t3yHN.js → CcTF9GKp.js} +1 -1
  9. package/dist/web/_app/immutable/chunks/{CMFOFkXK.js → CmiAUmdM.js} +1 -1
  10. package/dist/web/_app/immutable/chunks/{0oxpWEgM.js → CrdV0ttd.js} +1 -1
  11. package/dist/web/_app/immutable/chunks/{B1y7Wy5O.js → CscoF-YL.js} +1 -1
  12. package/dist/web/_app/immutable/chunks/{D2aTbzFm.js → D7ZqAKi9.js} +1 -1
  13. package/dist/web/_app/immutable/chunks/DKQjBKyp.js +1 -0
  14. package/dist/web/_app/immutable/chunks/{BiuVYCkU.js → DWaUc78f.js} +1 -1
  15. package/dist/web/_app/immutable/chunks/{B-2G7IOL.js → DanDOJ5u.js} +1 -1
  16. package/dist/web/_app/immutable/chunks/{BVBRzmeQ.js → DnL9f0lc.js} +2 -2
  17. package/dist/web/_app/immutable/chunks/{7pRCkuF5.js → HrtBFUbT.js} +1 -1
  18. package/dist/web/_app/immutable/chunks/{BCB5cYCz.js → i9c_RUF6.js} +2 -2
  19. package/dist/web/_app/immutable/chunks/{BmPhvzn5.js → sVYS7TyA.js} +1 -1
  20. package/dist/web/_app/immutable/entry/{app.CFW5bplI.js → app.Bng-YqKW.js} +2 -2
  21. package/dist/web/_app/immutable/entry/start.Dm8mDZfG.js +1 -0
  22. package/dist/web/_app/immutable/nodes/{0.DzgYLVo-.js → 0.ByUMuKDE.js} +3 -3
  23. package/dist/web/_app/immutable/nodes/{1.DGm1MhwK.js → 1.BxO8jAo9.js} +1 -1
  24. package/dist/web/_app/immutable/nodes/{2.CzXC4v8x.js → 2.Bhe8UMNg.js} +1 -1
  25. package/dist/web/_app/immutable/nodes/3.Cbr9aUat.js +11 -0
  26. package/dist/web/_app/immutable/nodes/{4.BSv65LtF.js → 4.zaAkGRXZ.js} +1 -1
  27. package/dist/web/_app/immutable/nodes/{5.DcKJMtC8.js → 5.CxUBFA1w.js} +1 -1
  28. package/dist/web/_app/immutable/nodes/{6.koFgxtvt.js → 6.BowojMxW.js} +1 -1
  29. package/dist/web/_app/immutable/nodes/{7.Baev0HTo.js → 7.D0l0MHPJ.js} +2 -2
  30. package/dist/web/_app/immutable/nodes/{8.wJRie-EF.js → 8.Ds2ZxH84.js} +1 -1
  31. package/dist/web/_app/version.json +1 -1
  32. package/dist/web/index.html +6 -6
  33. package/package.json +1 -1
  34. package/dist/web/_app/immutable/chunks/BPUy9_sS.js +0 -1
  35. package/dist/web/_app/immutable/entry/start.7s9ZYPwM.js +0 -1
  36. package/dist/web/_app/immutable/nodes/3.DuaI9dSH.js +0 -11
@@ -35,8 +35,7 @@ export interface ConnectorConfig {
35
35
  /** Auth mode: 'oauth' uses per-user OAuth tokens, 'headers' uses manual headers, 'none' for local connectors */
36
36
  auth?: 'headers' | 'oauth' | 'none';
37
37
  }
38
- /** Pre-listed connectors derived from integration registry. */
39
- export { KNOWN_CONNECTORS } from '../integrations/registry.js';
38
+ export declare const KNOWN_CONNECTORS: Record<string, import("../integrations/types.js").ConnectorSpec>;
40
39
  export declare class ConnectorManager {
41
40
  /**
42
41
  * Load all connector configs, merging workspace + homedir layers.
@@ -29,7 +29,8 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
29
29
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
30
30
  export const CONNECTORS_DIR = join(homedir(), '.studiograph', 'connectors');
31
31
  /** Pre-listed connectors — derived from integration registry. */
32
- export { KNOWN_CONNECTORS } from '../integrations/registry.js';
32
+ import { KNOWN_CONNECTORS as _KNOWN } from '../integrations/registry.js';
33
+ export const KNOWN_CONNECTORS = _KNOWN;
33
34
  // ── ConnectorManager ──────────────────────────────────────────────────────────
34
35
  export class ConnectorManager {
35
36
  // ── config persistence ────────────────────────────────────────────────────
@@ -43,10 +44,16 @@ export class ConnectorManager {
43
44
  ? ConnectorManager._readDir(join(workspacePath, '.studiograph', 'connectors'))
44
45
  : [];
45
46
  const homedirConfigs = ConnectorManager._readDir(CONNECTORS_DIR);
46
- // Merge: workspace as base, homedir overrides
47
+ // Start with KNOWN_CONNECTORS as a base layer so known integrations
48
+ // are always available even without on-disk config files.
47
49
  const merged = new Map();
48
- for (const c of workspaceConfigs)
49
- merged.set(c.name, c);
50
+ for (const [name, known] of Object.entries(KNOWN_CONNECTORS)) {
51
+ merged.set(name, { name, url: known.url, description: known.description, auth: known.auth });
52
+ }
53
+ for (const c of workspaceConfigs) {
54
+ const base = merged.get(c.name);
55
+ merged.set(c.name, base ? ConnectorManager._merge(base, c) : c);
56
+ }
50
57
  for (const c of homedirConfigs) {
51
58
  const base = merged.get(c.name);
52
59
  merged.set(c.name, base ? ConnectorManager._merge(base, c) : c);
@@ -1 +1 @@
1
- {"version":3,"file":"connector-manager.js","sourceRoot":"","sources":["../../src/mcp/connector-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,MAAM,E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M,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;yBACrC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;yBACvB,IAAI,CAAC,IAAI,CAAC,CAAC;oBACd,OAAO;wBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;wBACnF,OAAO,EAAE,MAAM;qBAChB,CAAC;gBACJ,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAC7D,OAAO;wBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;wBAChG,OAAO,EAAE,IAAI;qBACd,CAAC;gBACJ,CAAC;YACH,CAAC;SACF,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
@@ -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{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"./sVYS7TyA.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 +1 @@
1
- import{q as G,b as fe,m as p,al as te,Y as we,X as K,am as be,_ as Ie,af as $e,an as Ae,ai as ne,ao as xe,ap as Ce,Q as Ne,h as w,c as F,x as de,a as Q,aq as Oe,ar as ee,r as ke,a0 as He,s as se,d as z,e as R,C as Re,as as De,at as N,U as he,W as pe,au as X,av as Me,aw as Pe,V as Be,a2 as Fe,w as Ue,ax as ge,ay as Le,az as Ve,E as ze,aA as We,aB as qe,a9 as Ge,aC as Ye,K as d,L as b,a7 as re,k as ie,T as Je}from"./BeBar3OL.js";import{b as Xe,i as Ke}from"./Cs_ROD7H.js";import{B as Qe}from"./xBRYfpah.js";import{i as Ze}from"./B-2G7IOL.js";import{b as oe,u as ae,w as C,a as je}from"./DP09rP34.js";function Ct(e,t){return t}function et(e,t,n){for(var s=[],i=t.length,a,o=t.length,c=0;c<i;c++){let T=t[c];pe(T,()=>{if(a){if(a.pending.delete(T),a.done.add(T),a.pending.size===0){var h=e.outrogroups;Z(ee(a.done)),h.delete(a),h.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var u=s.length===0&&n!==null;if(u){var E=n,l=E.parentNode;Pe(l),l.append(E),e.items.clear()}Z(t,!u)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Z(e,t=!0){for(var n=0;n<e.length;n++)Be(e[n],t)}var le;function Nt(e,t,n,s,i,a=null){var o=e,c=new Map,u=(t&ge)!==0;if(u){var E=e;o=w?F(de(E)):E.appendChild(G())}w&&Q();var l=null,T=$e(()=>{var f=n();return Oe(f)?f:f==null?[]:ee(f)}),h,g=!0;function m(){r.fallback=l,tt(r,h,o,t,s),l!==null&&(h.length===0?(l.f&N)===0?he(l):(l.f^=N,V(l,null,o)):pe(l,()=>{l=null}))}var y=fe(()=>{h=p(T);var f=h.length;let x=!1;if(w){var M=ke(o)===He;M!==(f===0)&&(o=se(),F(o),z(!1),x=!0)}for(var $=new Set,k=we,P=Ie(),I=0;I<f;I+=1){w&&R.nodeType===Re&&R.data===De&&(o=R,x=!0,z(!1));var H=h[I],B=s(H,I),v=g?null:c.get(B);v?(v.v&&te(v.v,H),v.i&&te(v.i,I),P&&k.unskip_effect(v.e)):(v=nt(c,g?o:le??=G(),H,B,I,i,t,n),g||(v.e.f|=N),c.set(B,v)),$.add(B)}if(f===0&&a&&!l&&(g?l=K(()=>a(o)):(l=K(()=>a(le??=G())),l.f|=N)),f>$.size&&be(),w&&f>0&&F(se()),!g)if(P){for(const[Se,ve]of c)$.has(Se)||k.skip_effect(ve.e);k.oncommit(m),k.ondiscard(()=>{})}else m();x&&z(!0),p(T)}),r={effect:y,items:c,outrogroups:null,fallback:l};g=!1,w&&(o=R)}function U(e){for(;e!==null&&(e.f&Me)===0;)e=e.next;return e}function tt(e,t,n,s,i){var a=(s&Le)!==0,o=t.length,c=e.items,u=U(e.effect.first),E,l=null,T,h=[],g=[],m,y,r,f;if(a)for(f=0;f<o;f+=1)m=t[f],y=i(m,f),r=c.get(y).e,(r.f&N)===0&&(r.nodes?.a?.measure(),(T??=new Set).add(r));for(f=0;f<o;f+=1){if(m=t[f],y=i(m,f),r=c.get(y).e,e.outrogroups!==null)for(const v of e.outrogroups)v.pending.delete(r),v.done.delete(r);if((r.f&N)!==0)if(r.f^=N,r===u)V(r,null,n);else{var x=l?l.next:u;r===e.effect.last&&(e.effect.last=r.prev),r.prev&&(r.prev.next=r.next),r.next&&(r.next.prev=r.prev),O(e,l,r),O(e,r,x),V(r,x,n),l=r,h=[],g=[],u=U(l.next);continue}if((r.f&X)!==0&&(he(r),a&&(r.nodes?.a?.unfix(),(T??=new Set).delete(r))),r!==u){if(E!==void 0&&E.has(r)){if(h.length<g.length){var M=g[0],$;l=M.prev;var k=h[0],P=h[h.length-1];for($=0;$<h.length;$+=1)V(h[$],M,n);for($=0;$<g.length;$+=1)E.delete(g[$]);O(e,k.prev,P.next),O(e,l,k),O(e,P,M),u=M,l=P,f-=1,h=[],g=[]}else E.delete(r),V(r,u,n),O(e,r.prev,r.next),O(e,r,l===null?e.effect.first:l.next),O(e,l,r),l=r;continue}for(h=[],g=[];u!==null&&u!==r;)(E??=new Set).add(u),g.push(u),u=U(u.next);if(u===null)continue}(r.f&N)===0&&h.push(r),l=r,u=U(r.next)}if(e.outrogroups!==null){for(const v of e.outrogroups)v.pending.size===0&&(Z(ee(v.done)),e.outrogroups?.delete(v));e.outrogroups.size===0&&(e.outrogroups=null)}if(u!==null||E!==void 0){var I=[];if(E!==void 0)for(r of E)(r.f&X)===0&&I.push(r);for(;u!==null;)(u.f&X)===0&&u!==e.fallback&&I.push(u),u=U(u.next);var H=I.length;if(H>0){var B=(s&ge)!==0&&o===0?n:null;if(a){for(f=0;f<H;f+=1)I[f].nodes?.a?.measure();for(f=0;f<H;f+=1)I[f].nodes?.a?.fix()}et(e,I,B)}}a&&Fe(()=>{if(T!==void 0)for(r of T)r.nodes?.a?.apply()})}function nt(e,t,n,s,i,a,o,c){var u=(o&xe)!==0?(o&Ce)===0?Ne(n,!1,!1):ne(n):null,E=(o&Ae)!==0?ne(i):null;return{v:u,i:E,e:K(()=>(a(t,u??n,E??i,c),()=>{e.delete(s)}))}}function V(e,t,n){if(e.nodes)for(var s=e.nodes.start,i=e.nodes.end,a=t&&(t.f&N)===0?t.nodes.start:n;s!==null;){var o=Ue(s);if(a.before(s),s===i)return;s=o}}function O(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Ot(e,t,n,s,i,a){let o=w;w&&Q();var c=null;w&&R.nodeType===Ve&&(c=R,Q());var u=w?R:e,E=new Qe(u,!1);fe(()=>{const l=t()||null;var T=n||l==="svg"?qe:void 0;if(l===null){E.ensure(null,null);return}return E.ensure(l,h=>{if(l){if(c=w?c:We(l,T),Xe(c,c),s){w&&Ke(l)&&c.append(document.createComment(""));var g=w?de(c):c.appendChild(G());w&&(g===null?z(!1):F(g)),s(c,g)}Ge.nodes.end=c,h.before(c)}w&&F(h)}),()=>{}},ze),Ye(()=>{}),o&&(z(!0),F(u))}function st(){let e=b(null),t=b(null),n=b(null),s=b(null),i=b("entity"),a=b(null),o=b("general");function c(m,y){p(e)&&(p(e)!==m||p(n)!==y)&&oe(p(e)).catch(()=>{})}function u(m,y,r,f){c(m,r),d(e,m,!0),d(t,y,!0),d(n,r,!0),d(s,f??null,!0)}function E(){d(i,"entity")}function l(){d(i,"graph")}function T(){d(i,"settings")}function h(m,y,r){p(n)===r&&p(e)===m?(d(e,null),d(t,null),d(n,null)):(d(e,m,!0),d(t,y,!0),d(n,r,!0)),d(s,null)}function g(){p(e)&&oe(p(e)).catch(()=>{}),d(e,null),d(t,null),d(n,null),d(s,null)}return{get selectedRepo(){return p(e)},get selectedType(){return p(t)},get selectedId(){return p(n)},get selectedSubPath(){return p(s)},get activeView(){return p(i)},get entityPath(){return p(e)&&p(t)&&p(n)?`/${p(e)}/${p(t)}/${p(n)}`:null},get hoveredEntityId(){return p(a)},set hoveredEntityId(m){d(a,m,!0)},get settingsTab(){return p(o)},set settingsTab(m){d(o,m,!0)},select:u,deselect:g,selectOnGraph:h,showEntity:E,showGraph:l,showSettings:T}}const L=st();function kt(...e){return e.filter(Boolean).join(" ")}const rt=typeof document<"u";let ue=0;class it{#e=b(re([]));get toasts(){return p(this.#e)}set toasts(t){d(this.#e,t,!0)}#t=b(re([]));get heights(){return p(this.#t)}set heights(t){d(this.#t,t,!0)}#n=t=>{const n=this.toasts.findIndex(s=>s.id===t);return n===-1?null:n};addToast=t=>{rt&&this.toasts.unshift(t)};updateToast=({id:t,data:n,type:s,message:i})=>{const a=this.toasts.findIndex(c=>c.id===t),o=this.toasts[a];this.toasts[a]={...o,...n,id:t,title:i,type:s,updated:!0}};create=t=>{const{message:n,...s}=t,i=typeof t?.id=="number"||t.id&&t.id?.length>0?t.id:ue++,a=t.dismissible!==void 0?t.dismissible:t.dismissable!==void 0?t.dismissable:!0,o=t.type===void 0?"default":t.type;return ie(()=>{this.toasts.find(u=>u.id===i)?this.updateToast({id:i,data:t,type:o,message:n,dismissible:a}):this.addToast({...s,id:i,title:n,dismissible:a,type:o})}),i};dismiss=t=>(ie(()=>{if(t===void 0){this.toasts=this.toasts.map(s=>({...s,dismiss:!0}));return}const n=this.toasts.findIndex(s=>s.id===t);this.toasts[n]&&(this.toasts[n]={...this.toasts[n],dismiss:!0})}),t);remove=t=>{if(t===void 0){this.toasts=[];return}const n=this.#n(t);if(n!==null)return this.toasts.splice(n,1),t};message=(t,n)=>this.create({...n,type:"default",message:t});error=(t,n)=>this.create({...n,type:"error",message:t});success=(t,n)=>this.create({...n,type:"success",message:t});info=(t,n)=>this.create({...n,type:"info",message:t});warning=(t,n)=>this.create({...n,type:"warning",message:t});loading=(t,n)=>this.create({...n,type:"loading",message:t});promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:typeof n.loading=="string"?n.loading:n.loading()}));const i=t instanceof Promise?t:t();let a=s!==void 0;return i.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){a=!1;const c=ot(o);this.create({id:s,type:"error",message:c})}else if(n.success!==void 0){a=!1;const c=typeof n.success=="function"?n.success(o):n.success;this.create({id:s,type:"success",message:c})}}).catch(o=>{if(n.error!==void 0){a=!1;const c=typeof n.error=="function"?n.error(o):n.error;this.create({id:s,type:"error",message:c})}}).finally(()=>{a&&(this.dismiss(s),s=void 0),n.finally?.()}),s};custom=(t,n)=>{const s=n?.id||ue++;return this.create({component:t,id:s,...n}),s};removeHeight=t=>{this.heights=this.heights.filter(n=>n.toastId!==t)};setHeight=t=>{const n=this.#n(t.toastId);if(n===null){this.heights.push(t);return}this.heights[n]=t};reset=()=>{this.toasts=[],this.heights=[]}}function ot(e){return e&&typeof e=="object"&&"status"in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}const A=new it;function at(e,t){return A.create({message:e,...t})}class Ht{#e=Je(()=>A.toasts.filter(t=>!t.dismiss));get toasts(){return p(this.#e)}}const lt=at,S=Object.assign(lt,{success:A.success,info:A.info,warning:A.warning,error:A.error,custom:A.custom,message:A.message,promise:A.promise,dismiss:A.dismiss,loading:A.loading,getActiveToasts:()=>A.toasts.filter(e=>!e.dismiss)}),ut=800;function ct(){let e=b(!1),t=b(null),n=b(null),s=null,i=null,a=!1;function o(h,g,m,y){s&&s.repo===h&&s.type===g&&s.id===m?(y.data!==void 0&&(s.payload.data=y.data),y.content!==void 0&&(s.payload.content=y.content)):s={repo:h,type:g,id:m,payload:{...y}},c()}function c(){i&&clearTimeout(i),i=setTimeout(u,ut)}async function u(){if(i=null,!a&&s){const{repo:h,type:g,id:m,payload:y}=s;s=null,a=!0,d(e,!0),d(n,null);try{if(await ae(h,g,m,y),d(t,new Date,!0),y.data?.name){const f=C.repos.find(x=>x.name===h)?.entities.find(x=>x.id===m);f&&(f.title=y.data.name)}}catch(r){d(n,r.message??"Save failed",!0);const f=r.status??r.statusCode;(!f||f>=500)&&(s={repo:h,type:g,id:m,payload:y})}finally{d(e,!1),a=!1,s&&u()}}}function E(){i&&(clearTimeout(i),i=null),s&&u()}async function l(h,g,m,y){d(e,!0),d(n,null);try{const r=await ae(h,g,m,y);return d(t,new Date,!0),r}catch(r){return d(n,r.message??"Save failed",!0),null}finally{d(e,!1)}}function T(){d(n,null),d(t,null),s=null,i&&(clearTimeout(i),i=null)}return{get saving(){return p(e)},get lastSaved(){return p(t)},get error(){return p(n)},get hasPending(){return!!(s||a)},scheduleAutoSave:o,flush:E,saveEntity:l,reset:T}}const ft=ct();let _=null,me=null,ye=null,Ee=[],Y=null,q=1e3,J=b(!1),Te=b(null);const D=new Map,W={},j={};function ce(e,t){D.delete(e);const n=t.entities.length,s=n===1?`${e} updated ${t.entities[0]}`:`${e} updated ${n} entities`;S(s)}function dt(e){for(const[t,n]of D)n.repo===e&&(clearTimeout(n.timer),D.delete(t))}function ht(e){const t=je.user?.displayName;if(e.type==="sync_progress"){const n=W[e.repo];if(n){const s=e.message.trim(),i=s.match(/^Syncing from source:\s*(.+)$/i);i&&(j[e.repo]=`Syncing ${i[1].trim()}…`);const a=j[e.repo]??`Syncing ${e.repo}…`;S.loading(a,{id:n,description:s,duration:36e5})}return}if(e.type==="entity_change"){if(t&&e.actor===t&&e.source==="api"){C.refreshEntities(e.repo);return}if(C.refreshEntities(e.repo),L.selectedRepo===e.repo&&L.selectedType===e.entityType&&L.selectedId===e.entityId){ft.hasPending?S(`${e.actor} also saved changes to this entity`):Ze();return}const s=D.get(e.actor);if(s)clearTimeout(s.timer),s.entities.includes(e.entityId)||s.entities.push(e.entityId),s.timer=setTimeout(()=>ce(e.actor,s),1e4);else{const i={entities:[e.entityId],repo:e.repo,timer:setTimeout(()=>ce(e.actor,i),1e4)};D.set(e.actor,i)}return}if(e.type==="session_commit"){if(t&&e.actor===t){d(Te,e.timestamp,!0);return}const n=e.entities.length,s=n===1?`${e.actor} saved changes to ${e.entities[0]}`:`${e.actor} saved ${n} changes in ${e.repo}`;S(s),C.refreshEntities(e.repo);return}if(e.type==="sync_complete"){if(dt(e.repo),!W[e.repo]){const n=e.created+e.updated+e.deleted,s=n===0?`Sync complete · no changes in ${e.repo}`:`Sync complete · ${n} ${n===1?"entity":"entities"} from ${e.source}`;S.success(s)}C.refreshEntities(e.repo);return}if(e.type==="collection_created"){S(`${e.actor} created collection ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="collection_deleted"){S(`${e.actor} deleted collection ${e.repo}`);return}if(e.type==="repo_sync"){S(`${e.actor} pushed to ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="presence"){me?.(e);return}if(e.type==="online"){ye?.(e);return}if(e.type==="access_granted"||e.type==="access_revoked"){e.type==="access_revoked"&&L.selectedRepo===e.repo&&L.deselect(),C.load();return}}function _e(){if(typeof window>"u"||_&&(_.readyState===WebSocket.OPEN||_.readyState===WebSocket.CONNECTING))return;const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;_=new WebSocket(t),_.binaryType="arraybuffer",_.onopen=()=>{d(J,!0),q=1e3,C.refreshAll();for(const n of Ee)n()},_.onmessage=n=>{if(!(n.data instanceof ArrayBuffer))try{const s=JSON.parse(n.data);if(s?.type==="ping"){_?.send(JSON.stringify({type:"pong"}));return}const i=s;i.type&&i.type!=="toast"&&ht(i)}catch{}},_.onclose=()=>{d(J,!1),_=null,Y=setTimeout(()=>{q=Math.min(q*2,1e4),_e()},q)},_.onerror=()=>{}}function pt(){Y&&(clearTimeout(Y),Y=null),_&&(_.close(),_=null),d(J,!1);for(const[,e]of D)clearTimeout(e.timer);D.clear()}function gt(e,t=4e3){S(e,{duration:t})}function mt(e,t){const n=crypto.randomUUID();return t?.loading?S.loading(e,{id:n,duration:36e5}):S(e,{id:n}),n}function yt(e,t,n){if(n?.loading){S.loading(t,{id:e});return}/failed|error/i.test(t)?S.error(t,{id:e,duration:n?.duration??6e3}):S.success(t,{id:e,duration:n?.duration??4e3})}function Et(e){const t=crypto.randomUUID();W[e]=t,S.loading(`Syncing ${e}…`,{id:t,duration:36e5})}function Tt(e,t,n){const s=W[e];s&&(delete W[e],delete j[e],n?S.error(t,{id:s,duration:6e3}):S.success(t,{id:s,duration:4e3}))}function _t(e){me=e}function St(e){ye=e}function vt(e){Ee.push(e)}function wt(e){_?.readyState===WebSocket.OPEN&&_.send(JSON.stringify(e))}const Rt={get connected(){return p(J)},get lastAutoSaved(){return p(Te)},get ws(){return _},connect:_e,disconnect:pt,showToast:gt,showPersistentToast:mt,updateToast:yt,startSyncToast:Et,finishSyncToast:Tt,send:wt,setPresenceHandler:_t,setOnlineHandler:St,addConnectHandler:vt};export{Ht as S,ft as a,Ot as b,kt as c,Nt as e,Ct as i,L as n,Rt as r,A as t};
1
+ import{q as G,b as fe,m as p,al as te,Y as we,X as K,am as be,_ as Ie,af as $e,an as Ae,ai as ne,ao as xe,ap as Ce,Q as Ne,h as w,c as F,x as de,a as Q,aq as Oe,ar as ee,r as ke,a0 as He,s as se,d as z,e as R,C as Re,as as De,at as N,U as he,W as pe,au as X,av as Me,aw as Pe,V as Be,a2 as Fe,w as Ue,ax as ge,ay as Le,az as Ve,E as ze,aA as We,aB as qe,a9 as Ge,aC as Ye,K as d,L as b,a7 as re,k as ie,T as Je}from"./BeBar3OL.js";import{b as Xe,i as Ke}from"./Cs_ROD7H.js";import{B as Qe}from"./xBRYfpah.js";import{i as Ze}from"./DanDOJ5u.js";import{b as oe,u as ae,w as C,a as je}from"./DP09rP34.js";function Ct(e,t){return t}function et(e,t,n){for(var s=[],i=t.length,a,o=t.length,c=0;c<i;c++){let T=t[c];pe(T,()=>{if(a){if(a.pending.delete(T),a.done.add(T),a.pending.size===0){var h=e.outrogroups;Z(ee(a.done)),h.delete(a),h.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var u=s.length===0&&n!==null;if(u){var E=n,l=E.parentNode;Pe(l),l.append(E),e.items.clear()}Z(t,!u)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Z(e,t=!0){for(var n=0;n<e.length;n++)Be(e[n],t)}var le;function Nt(e,t,n,s,i,a=null){var o=e,c=new Map,u=(t&ge)!==0;if(u){var E=e;o=w?F(de(E)):E.appendChild(G())}w&&Q();var l=null,T=$e(()=>{var f=n();return Oe(f)?f:f==null?[]:ee(f)}),h,g=!0;function m(){r.fallback=l,tt(r,h,o,t,s),l!==null&&(h.length===0?(l.f&N)===0?he(l):(l.f^=N,V(l,null,o)):pe(l,()=>{l=null}))}var y=fe(()=>{h=p(T);var f=h.length;let x=!1;if(w){var M=ke(o)===He;M!==(f===0)&&(o=se(),F(o),z(!1),x=!0)}for(var $=new Set,k=we,P=Ie(),I=0;I<f;I+=1){w&&R.nodeType===Re&&R.data===De&&(o=R,x=!0,z(!1));var H=h[I],B=s(H,I),v=g?null:c.get(B);v?(v.v&&te(v.v,H),v.i&&te(v.i,I),P&&k.unskip_effect(v.e)):(v=nt(c,g?o:le??=G(),H,B,I,i,t,n),g||(v.e.f|=N),c.set(B,v)),$.add(B)}if(f===0&&a&&!l&&(g?l=K(()=>a(o)):(l=K(()=>a(le??=G())),l.f|=N)),f>$.size&&be(),w&&f>0&&F(se()),!g)if(P){for(const[Se,ve]of c)$.has(Se)||k.skip_effect(ve.e);k.oncommit(m),k.ondiscard(()=>{})}else m();x&&z(!0),p(T)}),r={effect:y,items:c,outrogroups:null,fallback:l};g=!1,w&&(o=R)}function U(e){for(;e!==null&&(e.f&Me)===0;)e=e.next;return e}function tt(e,t,n,s,i){var a=(s&Le)!==0,o=t.length,c=e.items,u=U(e.effect.first),E,l=null,T,h=[],g=[],m,y,r,f;if(a)for(f=0;f<o;f+=1)m=t[f],y=i(m,f),r=c.get(y).e,(r.f&N)===0&&(r.nodes?.a?.measure(),(T??=new Set).add(r));for(f=0;f<o;f+=1){if(m=t[f],y=i(m,f),r=c.get(y).e,e.outrogroups!==null)for(const v of e.outrogroups)v.pending.delete(r),v.done.delete(r);if((r.f&N)!==0)if(r.f^=N,r===u)V(r,null,n);else{var x=l?l.next:u;r===e.effect.last&&(e.effect.last=r.prev),r.prev&&(r.prev.next=r.next),r.next&&(r.next.prev=r.prev),O(e,l,r),O(e,r,x),V(r,x,n),l=r,h=[],g=[],u=U(l.next);continue}if((r.f&X)!==0&&(he(r),a&&(r.nodes?.a?.unfix(),(T??=new Set).delete(r))),r!==u){if(E!==void 0&&E.has(r)){if(h.length<g.length){var M=g[0],$;l=M.prev;var k=h[0],P=h[h.length-1];for($=0;$<h.length;$+=1)V(h[$],M,n);for($=0;$<g.length;$+=1)E.delete(g[$]);O(e,k.prev,P.next),O(e,l,k),O(e,P,M),u=M,l=P,f-=1,h=[],g=[]}else E.delete(r),V(r,u,n),O(e,r.prev,r.next),O(e,r,l===null?e.effect.first:l.next),O(e,l,r),l=r;continue}for(h=[],g=[];u!==null&&u!==r;)(E??=new Set).add(u),g.push(u),u=U(u.next);if(u===null)continue}(r.f&N)===0&&h.push(r),l=r,u=U(r.next)}if(e.outrogroups!==null){for(const v of e.outrogroups)v.pending.size===0&&(Z(ee(v.done)),e.outrogroups?.delete(v));e.outrogroups.size===0&&(e.outrogroups=null)}if(u!==null||E!==void 0){var I=[];if(E!==void 0)for(r of E)(r.f&X)===0&&I.push(r);for(;u!==null;)(u.f&X)===0&&u!==e.fallback&&I.push(u),u=U(u.next);var H=I.length;if(H>0){var B=(s&ge)!==0&&o===0?n:null;if(a){for(f=0;f<H;f+=1)I[f].nodes?.a?.measure();for(f=0;f<H;f+=1)I[f].nodes?.a?.fix()}et(e,I,B)}}a&&Fe(()=>{if(T!==void 0)for(r of T)r.nodes?.a?.apply()})}function nt(e,t,n,s,i,a,o,c){var u=(o&xe)!==0?(o&Ce)===0?Ne(n,!1,!1):ne(n):null,E=(o&Ae)!==0?ne(i):null;return{v:u,i:E,e:K(()=>(a(t,u??n,E??i,c),()=>{e.delete(s)}))}}function V(e,t,n){if(e.nodes)for(var s=e.nodes.start,i=e.nodes.end,a=t&&(t.f&N)===0?t.nodes.start:n;s!==null;){var o=Ue(s);if(a.before(s),s===i)return;s=o}}function O(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Ot(e,t,n,s,i,a){let o=w;w&&Q();var c=null;w&&R.nodeType===Ve&&(c=R,Q());var u=w?R:e,E=new Qe(u,!1);fe(()=>{const l=t()||null;var T=n||l==="svg"?qe:void 0;if(l===null){E.ensure(null,null);return}return E.ensure(l,h=>{if(l){if(c=w?c:We(l,T),Xe(c,c),s){w&&Ke(l)&&c.append(document.createComment(""));var g=w?de(c):c.appendChild(G());w&&(g===null?z(!1):F(g)),s(c,g)}Ge.nodes.end=c,h.before(c)}w&&F(h)}),()=>{}},ze),Ye(()=>{}),o&&(z(!0),F(u))}function st(){let e=b(null),t=b(null),n=b(null),s=b(null),i=b("entity"),a=b(null),o=b("general");function c(m,y){p(e)&&(p(e)!==m||p(n)!==y)&&oe(p(e)).catch(()=>{})}function u(m,y,r,f){c(m,r),d(e,m,!0),d(t,y,!0),d(n,r,!0),d(s,f??null,!0)}function E(){d(i,"entity")}function l(){d(i,"graph")}function T(){d(i,"settings")}function h(m,y,r){p(n)===r&&p(e)===m?(d(e,null),d(t,null),d(n,null)):(d(e,m,!0),d(t,y,!0),d(n,r,!0)),d(s,null)}function g(){p(e)&&oe(p(e)).catch(()=>{}),d(e,null),d(t,null),d(n,null),d(s,null)}return{get selectedRepo(){return p(e)},get selectedType(){return p(t)},get selectedId(){return p(n)},get selectedSubPath(){return p(s)},get activeView(){return p(i)},get entityPath(){return p(e)&&p(t)&&p(n)?`/${p(e)}/${p(t)}/${p(n)}`:null},get hoveredEntityId(){return p(a)},set hoveredEntityId(m){d(a,m,!0)},get settingsTab(){return p(o)},set settingsTab(m){d(o,m,!0)},select:u,deselect:g,selectOnGraph:h,showEntity:E,showGraph:l,showSettings:T}}const L=st();function kt(...e){return e.filter(Boolean).join(" ")}const rt=typeof document<"u";let ue=0;class it{#e=b(re([]));get toasts(){return p(this.#e)}set toasts(t){d(this.#e,t,!0)}#t=b(re([]));get heights(){return p(this.#t)}set heights(t){d(this.#t,t,!0)}#n=t=>{const n=this.toasts.findIndex(s=>s.id===t);return n===-1?null:n};addToast=t=>{rt&&this.toasts.unshift(t)};updateToast=({id:t,data:n,type:s,message:i})=>{const a=this.toasts.findIndex(c=>c.id===t),o=this.toasts[a];this.toasts[a]={...o,...n,id:t,title:i,type:s,updated:!0}};create=t=>{const{message:n,...s}=t,i=typeof t?.id=="number"||t.id&&t.id?.length>0?t.id:ue++,a=t.dismissible!==void 0?t.dismissible:t.dismissable!==void 0?t.dismissable:!0,o=t.type===void 0?"default":t.type;return ie(()=>{this.toasts.find(u=>u.id===i)?this.updateToast({id:i,data:t,type:o,message:n,dismissible:a}):this.addToast({...s,id:i,title:n,dismissible:a,type:o})}),i};dismiss=t=>(ie(()=>{if(t===void 0){this.toasts=this.toasts.map(s=>({...s,dismiss:!0}));return}const n=this.toasts.findIndex(s=>s.id===t);this.toasts[n]&&(this.toasts[n]={...this.toasts[n],dismiss:!0})}),t);remove=t=>{if(t===void 0){this.toasts=[];return}const n=this.#n(t);if(n!==null)return this.toasts.splice(n,1),t};message=(t,n)=>this.create({...n,type:"default",message:t});error=(t,n)=>this.create({...n,type:"error",message:t});success=(t,n)=>this.create({...n,type:"success",message:t});info=(t,n)=>this.create({...n,type:"info",message:t});warning=(t,n)=>this.create({...n,type:"warning",message:t});loading=(t,n)=>this.create({...n,type:"loading",message:t});promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:typeof n.loading=="string"?n.loading:n.loading()}));const i=t instanceof Promise?t:t();let a=s!==void 0;return i.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){a=!1;const c=ot(o);this.create({id:s,type:"error",message:c})}else if(n.success!==void 0){a=!1;const c=typeof n.success=="function"?n.success(o):n.success;this.create({id:s,type:"success",message:c})}}).catch(o=>{if(n.error!==void 0){a=!1;const c=typeof n.error=="function"?n.error(o):n.error;this.create({id:s,type:"error",message:c})}}).finally(()=>{a&&(this.dismiss(s),s=void 0),n.finally?.()}),s};custom=(t,n)=>{const s=n?.id||ue++;return this.create({component:t,id:s,...n}),s};removeHeight=t=>{this.heights=this.heights.filter(n=>n.toastId!==t)};setHeight=t=>{const n=this.#n(t.toastId);if(n===null){this.heights.push(t);return}this.heights[n]=t};reset=()=>{this.toasts=[],this.heights=[]}}function ot(e){return e&&typeof e=="object"&&"status"in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}const A=new it;function at(e,t){return A.create({message:e,...t})}class Ht{#e=Je(()=>A.toasts.filter(t=>!t.dismiss));get toasts(){return p(this.#e)}}const lt=at,S=Object.assign(lt,{success:A.success,info:A.info,warning:A.warning,error:A.error,custom:A.custom,message:A.message,promise:A.promise,dismiss:A.dismiss,loading:A.loading,getActiveToasts:()=>A.toasts.filter(e=>!e.dismiss)}),ut=800;function ct(){let e=b(!1),t=b(null),n=b(null),s=null,i=null,a=!1;function o(h,g,m,y){s&&s.repo===h&&s.type===g&&s.id===m?(y.data!==void 0&&(s.payload.data=y.data),y.content!==void 0&&(s.payload.content=y.content)):s={repo:h,type:g,id:m,payload:{...y}},c()}function c(){i&&clearTimeout(i),i=setTimeout(u,ut)}async function u(){if(i=null,!a&&s){const{repo:h,type:g,id:m,payload:y}=s;s=null,a=!0,d(e,!0),d(n,null);try{if(await ae(h,g,m,y),d(t,new Date,!0),y.data?.name){const f=C.repos.find(x=>x.name===h)?.entities.find(x=>x.id===m);f&&(f.title=y.data.name)}}catch(r){d(n,r.message??"Save failed",!0);const f=r.status??r.statusCode;(!f||f>=500)&&(s={repo:h,type:g,id:m,payload:y})}finally{d(e,!1),a=!1,s&&u()}}}function E(){i&&(clearTimeout(i),i=null),s&&u()}async function l(h,g,m,y){d(e,!0),d(n,null);try{const r=await ae(h,g,m,y);return d(t,new Date,!0),r}catch(r){return d(n,r.message??"Save failed",!0),null}finally{d(e,!1)}}function T(){d(n,null),d(t,null),s=null,i&&(clearTimeout(i),i=null)}return{get saving(){return p(e)},get lastSaved(){return p(t)},get error(){return p(n)},get hasPending(){return!!(s||a)},scheduleAutoSave:o,flush:E,saveEntity:l,reset:T}}const ft=ct();let _=null,me=null,ye=null,Ee=[],Y=null,q=1e3,J=b(!1),Te=b(null);const D=new Map,W={},j={};function ce(e,t){D.delete(e);const n=t.entities.length,s=n===1?`${e} updated ${t.entities[0]}`:`${e} updated ${n} entities`;S(s)}function dt(e){for(const[t,n]of D)n.repo===e&&(clearTimeout(n.timer),D.delete(t))}function ht(e){const t=je.user?.displayName;if(e.type==="sync_progress"){const n=W[e.repo];if(n){const s=e.message.trim(),i=s.match(/^Syncing from source:\s*(.+)$/i);i&&(j[e.repo]=`Syncing ${i[1].trim()}…`);const a=j[e.repo]??`Syncing ${e.repo}…`;S.loading(a,{id:n,description:s,duration:36e5})}return}if(e.type==="entity_change"){if(t&&e.actor===t&&e.source==="api"){C.refreshEntities(e.repo);return}if(C.refreshEntities(e.repo),L.selectedRepo===e.repo&&L.selectedType===e.entityType&&L.selectedId===e.entityId){ft.hasPending?S(`${e.actor} also saved changes to this entity`):Ze();return}const s=D.get(e.actor);if(s)clearTimeout(s.timer),s.entities.includes(e.entityId)||s.entities.push(e.entityId),s.timer=setTimeout(()=>ce(e.actor,s),1e4);else{const i={entities:[e.entityId],repo:e.repo,timer:setTimeout(()=>ce(e.actor,i),1e4)};D.set(e.actor,i)}return}if(e.type==="session_commit"){if(t&&e.actor===t){d(Te,e.timestamp,!0);return}const n=e.entities.length,s=n===1?`${e.actor} saved changes to ${e.entities[0]}`:`${e.actor} saved ${n} changes in ${e.repo}`;S(s),C.refreshEntities(e.repo);return}if(e.type==="sync_complete"){if(dt(e.repo),!W[e.repo]){const n=e.created+e.updated+e.deleted,s=n===0?`Sync complete · no changes in ${e.repo}`:`Sync complete · ${n} ${n===1?"entity":"entities"} from ${e.source}`;S.success(s)}C.refreshEntities(e.repo);return}if(e.type==="collection_created"){S(`${e.actor} created collection ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="collection_deleted"){S(`${e.actor} deleted collection ${e.repo}`);return}if(e.type==="repo_sync"){S(`${e.actor} pushed to ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="presence"){me?.(e);return}if(e.type==="online"){ye?.(e);return}if(e.type==="access_granted"||e.type==="access_revoked"){e.type==="access_revoked"&&L.selectedRepo===e.repo&&L.deselect(),C.load();return}}function _e(){if(typeof window>"u"||_&&(_.readyState===WebSocket.OPEN||_.readyState===WebSocket.CONNECTING))return;const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;_=new WebSocket(t),_.binaryType="arraybuffer",_.onopen=()=>{d(J,!0),q=1e3,C.refreshAll();for(const n of Ee)n()},_.onmessage=n=>{if(!(n.data instanceof ArrayBuffer))try{const s=JSON.parse(n.data);if(s?.type==="ping"){_?.send(JSON.stringify({type:"pong"}));return}const i=s;i.type&&i.type!=="toast"&&ht(i)}catch{}},_.onclose=()=>{d(J,!1),_=null,Y=setTimeout(()=>{q=Math.min(q*2,1e4),_e()},q)},_.onerror=()=>{}}function pt(){Y&&(clearTimeout(Y),Y=null),_&&(_.close(),_=null),d(J,!1);for(const[,e]of D)clearTimeout(e.timer);D.clear()}function gt(e,t=4e3){S(e,{duration:t})}function mt(e,t){const n=crypto.randomUUID();return t?.loading?S.loading(e,{id:n,duration:36e5}):S(e,{id:n}),n}function yt(e,t,n){if(n?.loading){S.loading(t,{id:e});return}/failed|error/i.test(t)?S.error(t,{id:e,duration:n?.duration??6e3}):S.success(t,{id:e,duration:n?.duration??4e3})}function Et(e){const t=crypto.randomUUID();W[e]=t,S.loading(`Syncing ${e}…`,{id:t,duration:36e5})}function Tt(e,t,n){const s=W[e];s&&(delete W[e],delete j[e],n?S.error(t,{id:s,duration:6e3}):S.success(t,{id:s,duration:4e3}))}function _t(e){me=e}function St(e){ye=e}function vt(e){Ee.push(e)}function wt(e){_?.readyState===WebSocket.OPEN&&_.send(JSON.stringify(e))}const Rt={get connected(){return p(J)},get lastAutoSaved(){return p(Te)},get ws(){return _},connect:_e,disconnect:pt,showToast:gt,showPersistentToast:mt,updateToast:yt,startSyncToast:Et,finishSyncToast:Tt,send:wt,setPresenceHandler:_t,setOnlineHandler:St,addConnectHandler:vt};export{Ht as S,ft as a,Ot as b,kt as c,Nt as e,Ct as i,L as n,Rt as r,A as t};