p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
1 lines • 65 kB
JavaScript
import{P as _t,S as Lt,a as tt,c as nt,e as E,g as me,i as Rt,j as ce,m as L}from"./chunk-ICS5HBPB.js";import{A as Re,B as Et,l as W,m as Xe,n as Ye,s as ge,v as ue,w as Ze,z as et}from"./chunk-62NZHGBY.js";import{a as Ee,b as Dt}from"./chunk-O7S4L63H.js";var Mn=0,ke=class{constructor(e,t){this.from=e,this.to=t}},k=class{constructor(e={}){this.id=Mn++,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=R.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};k.closedBy=new k({deserialize:r=>r.split(" ")});k.openedBy=new k({deserialize:r=>r.split(" ")});k.group=new k({deserialize:r=>r.split(" ")});k.isolate=new k({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});k.contextHash=new k({perNode:!0});k.lookAhead=new k({perNode:!0});k.mounted=new k({perNode:!0});var se=class{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[k.mounted.id]}},On=Object.create(null),R=class r{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):On,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new r(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[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(k.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(k.group),s=-1;s<(i?i.length:0);s++){let l=t[s<0?n.name:i[s]];if(l)return l}}}};R.none=new R("",Object.create(null),0,8);var Fe=class r{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let s of e){let l=s(n);if(l){i||(i=Object.assign({},n.props));let o=l[1],a=l[0];a.combine&&a.id in i&&(o=a.combine(i[a.id],o)),i[a.id]=o}}t.push(i?new R(n.name,i,n.id,n.flags):n)}return new r(t)}},_e=new WeakMap,Ft=new WeakMap,B=(function(r){return r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed",r})(B||{}),A=class r{constructor(e,t,n,i,s){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[l,o]of s)this.props[typeof l=="number"?l:l.id]=o}}toString(){let e=se.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.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 xe(this.topNode,e)}cursorAt(e,t=0,n=0){let i=_e.get(this)||this.topNode,s=new xe(i);return s.moveTo(e,t),_e.set(this,s._tree),s}get topNode(){return new q(this,0,0,null)}resolve(e,t=0){let n=be(_e.get(this)||this.topNode,e,t,!1);return _e.set(this,n),n}resolveInner(e,t=0){let n=be(Ft.get(this)||this.topNode,e,t,!0);return Ft.set(this,n),n}resolveStack(e,t=0){return Dn(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,l=e.mode||0,o=(l&B.IncludeAnonymous)>0;for(let a=this.cursor(l|B.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=i&&(!o&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(o||!a.type.isAnonymous)&&n(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:ht(R.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new r(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new r(R.none,t,n,i)))}static build(e){return En(e)}};A.empty=new A(R.none,[],[],0);var rt=class r{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 r(this.buffer,this.index)}},Y=class r{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return R.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let l=[];for(;e<n;)l.push(this.childString(e)),e=this.buffer[e+3];return s+"("+l.join(",")+")"}findChild(e,t,n,i,s){let{buffer:l}=this,o=-1;for(let a=e;a!=t&&!(Ut(s,i,l[a+1],l[a+2])&&(o=a,n>0));a=l[a+3]);return o}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),l=0;for(let o=e,a=0;o<t;){s[a++]=i[o++],s[a++]=i[o++]-n;let h=s[a++]=i[o++]-n;s[a++]=i[o++]-e,l=Math.max(l,h)}return new r(s,l,this.set)}};function Ut(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function be(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let l=!n&&r instanceof q&&r.index<0?null:r.parent;if(!l)return r;r=l}let s=n?0:B.IgnoreOverlays;if(n)for(let l=r,o=l.parent;o;l=o,o=l.parent)l instanceof q&&l.index<0&&((i=o.enter(e,t,s))===null||i===void 0?void 0:i.from)!=l.from&&(r=o);for(;;){let l=r.enter(e,t,s);if(!l)return r;r=l}}var ze=class{cursor(e=0){return new xe(this,e)}getChild(e,t=null,n=null){let i=zt(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return zt(this,e,t,n)}resolve(e,t=0){return be(this,e,t,!1)}resolveInner(e,t=0){return be(this,e,t,!0)}matchContext(e){return it(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}get node(){return this}get next(){return this.parent}},q=class r extends ze{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,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,n,i,s=0){for(let l=this;;){for(let{children:o,positions:a}=l._tree,h=t>0?o.length:-1;e!=h;e+=t){let f=o[e],d=a[e]+l.from,g;if(!(!(s&B.EnterBracketed&&f instanceof A&&(g=se.get(f))&&!g.overlay&&g.bracketed&&n>=d&&n<=d+f.length)&&!Ut(i,n,d,d+f.length))){if(f instanceof Y){if(s&B.ExcludeBuffers)continue;let y=f.findChild(0,f.buffer.length,t,n-d,i);if(y>-1)return new ye(new st(l,f,e,d),null,y)}else if(s&B.IncludeAnonymous||!f.type.isAnonymous||at(f)){let y;if(!(s&B.IgnoreMounts)&&(y=se.get(f))&&!y.overlay)return new r(y.tree,d,e,l);let x=new r(f,d,e,l);return s&B.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(t<0?f.children.length-1:0,t,n,i,s)}}}if(s&B.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+t:e=t<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let i;if(!(n&B.IgnoreOverlays)&&(i=se.get(this._tree))&&i.overlay){let s=e-this.from,l=n&B.EnterBracketed&&i.bracketed;for(let{from:o,to:a}of i.overlay)if((t>0||l?o<=s:o<s)&&(t<0||l?a>=s:a>s))return new r(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function zt(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let l=!1;!l;)if(l=i.type.is(t),!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function it(r,e,t=e.length-1){for(let n=r;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}var st=class{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}},ye=class r extends ze{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new r(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&B.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new r(this.context,this,s)}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 r(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 r(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let l=n.buffer[this.index+1];e.push(n.slice(i,s,l)),t.push(0)}return new A(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Wt(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let l=r[s];(l.from>t.from||l.to<t.to)&&(t=l,e=s)}let n=t instanceof q&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new lt(i,t)}var lt=class{constructor(e,t){this.heads=e,this.node=t}get next(){return Wt(this.heads)}};function Dn(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof q?n:n.context.parent;s;s=s.parent)if(s.index<0){let l=s.parent;(i||(i=[n])).push(l.resolve(e,t)),s=l}else{let l=se.get(s.tree);if(l&&l.overlay&&l.overlay[0].from<=e&&l.overlay[l.overlay.length-1].to>=e){let o=new q(l.tree,l.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(be(o,e,t,!1))}}return i?Wt(i):n}var xe=class{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&~B.EnterBracketed,e instanceof q)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof q?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&B.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&B.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&B.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+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<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,l=e<0?-1:n._tree.children.length;s!=l;s+=e){let o=n._tree.children[s];if(this.mode&B.IncludeAnonymous||o instanceof Y||!o.type.isAnonymous||at(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,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let l=e;l;l=l._parent)if(l.index==i){if(i==this.index)return l;t=l,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)t=new ye(this.buffer,t,this.stack[i]);return this.bufferNode=new ye(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return it(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return it(this._tree,e,i);let l=n[t.buffer[this.stack[s]]];if(!l.isAnonymous){if(e[i]&&e[i]!=l.name)return!1;i--}}return!0}};function at(r){return r.children.some(e=>e instanceof Y||!e.type.isAnonymous||at(e))}function En(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=1024,reused:s=[],minRepeatType:l=n.types.length}=r,o=Array.isArray(t)?new rt(t,t.length):t,a=n.types,h=0,f=0;function d(w,C,p,P,v,N){let{id:b,start:m,end:S,size:T}=o,O=f,X=h;if(T<0)if(o.next(),T==-1){let Q=s[b];p.push(Q),P.push(m-w);return}else if(T==-3){h=b;return}else if(T==-4){f=b;return}else throw new RangeError(`Unrecognized record size: ${T}`);let pe=a[b],Oe,re,Mt=m-w;if(S-m<=i&&(re=j(o.pos-C,v))){let Q=new Uint16Array(re.size-re.skip),U=o.pos-re.size,$=Q.length;for(;o.pos>U;)$=D(re.start,Q,$);Oe=new Y(Q,S-re.start,n),Mt=re.start-w}else{let Q=o.pos-T;o.next();let U=[],$=[],ie=b>=l?b:-1,fe=0,De=S;for(;o.pos>Q;)ie>=0&&o.id==ie&&o.size>=0?(o.end<=De-i&&(x(U,$,m,fe,o.end,De,ie,O,X),fe=U.length,De=o.end),o.next()):N>2500?g(m,Q,U,$):d(m,Q,U,$,ie,N+1);if(ie>=0&&fe>0&&fe<U.length&&x(U,$,m,fe,m,De,ie,O,X),U.reverse(),$.reverse(),ie>-1&&fe>0){let Ot=y(pe,X);Oe=ht(pe,U,$,0,U.length,0,S-m,Ot,Ot)}else Oe=I(pe,U,$,S-m,O-S,X)}p.push(Oe),P.push(Mt)}function g(w,C,p,P){let v=[],N=0,b=-1;for(;o.pos>C;){let{id:m,start:S,end:T,size:O}=o;if(O>4)o.next();else{if(b>-1&&S<b)break;b<0&&(b=T-i),v.push(m,S,T),N++,o.next()}}if(N){let m=new Uint16Array(N*4),S=v[v.length-2];for(let T=v.length-3,O=0;T>=0;T-=3)m[O++]=v[T],m[O++]=v[T+1]-S,m[O++]=v[T+2]-S,m[O++]=O;p.push(new Y(m,v[2]-S,n)),P.push(S-w)}}function y(w,C){return(p,P,v)=>{let N=0,b=p.length-1,m,S;if(b>=0&&(m=p[b])instanceof A){if(!b&&m.type==w&&m.length==v)return m;(S=m.prop(k.lookAhead))&&(N=P[b]+m.length+S)}return I(w,p,P,v,N,C)}}function x(w,C,p,P,v,N,b,m,S){let T=[],O=[];for(;w.length>P;)T.push(w.pop()),O.push(C.pop()+p-v);w.push(I(n.types[b],T,O,N-v,m-N,S)),C.push(v-p)}function I(w,C,p,P,v,N,b){if(N){let m=[k.contextHash,N];b=b?[m].concat(b):[m]}if(v>25){let m=[k.lookAhead,v];b=b?[m].concat(b):[m]}return new A(w,C,p,P,b)}function j(w,C){let p=o.fork(),P=0,v=0,N=0,b=p.end-i,m={size:0,start:0,skip:0};e:for(let S=p.pos-w;p.pos>S;){let T=p.size;if(p.id==C&&T>=0){m.size=P,m.start=v,m.skip=N,N+=4,P+=4,p.next();continue}let O=p.pos-T;if(T<0||O<S||p.start<b)break;let X=p.id>=l?4:0,pe=p.start;for(p.next();p.pos>O;){if(p.size<0)if(p.size==-3||p.size==-4)X+=4;else break e;else p.id>=l&&(X+=4);p.next()}v=pe,P+=T,N+=X}return(C<0||P==w)&&(m.size=P,m.start=v,m.skip=N),m.size>4?m:void 0}function D(w,C,p){let{id:P,start:v,end:N,size:b}=o;if(o.next(),b>=0&&P<l){let m=p;if(b>4){let S=o.pos-(b-4);for(;o.pos>S;)p=D(w,C,p)}C[--p]=m,C[--p]=N-w,C[--p]=v-w,C[--p]=P}else b==-3?h=P:b==-4&&(f=P);return p}let _=[],M=[];for(;o.pos>0;)d(r.start||0,r.bufferStart||0,_,M,-1,0);let V=(e=r.length)!==null&&e!==void 0?e:_.length?M[0]+_[0].length:0;return new A(a[r.topID],_.reverse(),M.reverse(),V)}var jt=new WeakMap;function Le(r,e){if(!r.isAnonymous||e instanceof Y||e.type!=r)return 1;let t=jt.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof A)){t=1;break}t+=Le(r,n)}jt.set(e,t)}return t}function ht(r,e,t,n,i,s,l,o,a){let h=0;for(let x=n;x<i;x++)h+=Le(r,e[x]);let f=Math.ceil(h*1.5/8),d=[],g=[];function y(x,I,j,D,_){for(let M=j;M<D;){let V=M,w=I[M],C=Le(r,x[M]);for(M++;M<D;M++){let p=Le(r,x[M]);if(C+p>=f)break;C+=p}if(M==V+1){if(C>f){let p=x[V];y(p.children,p.positions,0,p.children.length,I[V]+_);continue}d.push(x[V])}else{let p=I[M-1]+x[M-1].length-w;d.push(ht(r,x,I,V,M,w,p,null,a))}g.push(w+_-s)}}return y(e,t,n,i,0),(o||a)(d,g,l)}var le=class r{constructor(e,t,n,i,s=!1,l=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(s?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let i=[new r(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,l=e.length?e[0]:null;for(let o=0,a=0,h=0;;o++){let f=o<t.length?t[o]:null,d=f?f.fromA:1e9;if(d-a>=n)for(;l&&l.from<d;){let g=l;if(a>=g.from||d<=g.to||h){let y=Math.max(g.from,a)-h,x=Math.min(g.to,d)-h;g=y>=x?null:new r(y,x,g.tree,g.offset+h,o>0,!!f)}if(g&&i.push(g),l.to>d)break;l=s<e.length?e[s++]:null}if(!f)break;a=f.toA,h=f.toA-f.toB}return i}},we=class{startParse(e,t,n){return typeof e=="string"&&(e=new ot(e)),n=n?n.length?n.map(i=>new ke(i.from,i.to)):[new ke(0,0)]:[new ke(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let s=i.advance();if(s)return s}}},ot=class{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)}};var Br=new k({perNode:!0});var Rn=0,H=class r{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=Rn++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof r&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let i=new r(n,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new He(e);return n=>n.modified.indexOf(t)>-1?n:He.get(n.base||n,n.modified.concat(t).sort((i,s)=>i.id-s.id))}},_n=0,He=class r{constructor(e){this.name=e,this.instances=[],this.id=_n++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(o=>o.base==e&&Ln(t,o.modified));if(n)return n;let i=[],s=new H(e.name,i,e,t);for(let o of t)o.instances.push(s);let l=Fn(t);for(let o of e.set)if(!o.modified.length)for(let a of l)i.push(r.get(o,a));return s}};function Ln(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function Fn(r){let e=[[]];for(let t=0;t<r.length;t++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(r[t]));return e.sort((t,n)=>n.length-t.length)}function $t(r){let e=Object.create(null);for(let t in r){let n=r[t];Array.isArray(n)||(n=[n]);for(let i of t.split(" "))if(i){let s=[],l=2,o=i;for(let d=0;;){if(o=="..."&&d>0&&d+3==i.length){l=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!g)throw new RangeError("Invalid path: "+i);if(s.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),d+=g[0].length,d==i.length)break;let y=i[d++];if(d==i.length&&y=="!"){l=0;break}if(y!="/")throw new RangeError("Invalid path: "+i);o=i.slice(d)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+i);let f=new ae(n,l,a>0?s.slice(0,a):null);e[h]=f.sort(e[h])}}return qt.add(e)}var qt=new k({combine(r,e){let t,n,i;for(;r||e;){if(!r||e&&r.depth>=e.depth?(i=e,e=e.next):(i=r,r=r.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let s=new ae(i.tags,i.mode,i.context);t?t.next=s:n=s,t=s}return n}}),ae=class{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,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}};ae.empty=new ae([],2,null);function dt(r,e){let t=Object.create(null);for(let s of r)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let l of s.tag)t[l.id]=s.class;let{scope:n,all:i=null}=e||{};return{style:s=>{let l=i;for(let o of s)for(let a of o.set){let h=t[a.id];if(h){l=l?l+" "+h:h;break}}return l},scope:n}}function zn(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i)}return t}function Gt(r,e,t,n=0,i=r.length){let s=new ut(n,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),n,i,"",s.highlighters),s.flush(i)}var ut=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,s){let{type:l,from:o,to:a}=e;if(o>=n||a<=t)return;l.isTop&&(s=this.highlighters.filter(y=>!y.scope||y.scope(l)));let h=i,f=jn(e)||ae.empty,d=zn(s,f.tags);if(d&&(h&&(h+=" "),h+=d,f.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(t,o),h),f.opaque)return;let g=e.tree&&e.tree.prop(k.mounted);if(g&&g.overlay){let y=e.node.enter(g.overlay[0].from+o,1),x=this.highlighters.filter(j=>!j.scope||j.scope(g.tree.type)),I=e.firstChild();for(let j=0,D=o;;j++){let _=j<g.overlay.length?g.overlay[j]:null,M=_?_.from+o:a,V=Math.max(t,D),w=Math.min(n,M);if(V<w&&I)for(;e.from<w&&(this.highlightRange(e,V,w,i,s),this.startSpan(Math.min(w,e.to),h),!(e.to>=M||!e.nextSibling())););if(!_||M>n)break;D=_.to+o,D>t&&(this.highlightRange(y.cursor(),Math.max(t,_.from+o),Math.min(n,D),"",x),this.startSpan(Math.min(n,D),h))}I&&e.parent()}else if(e.firstChild()){g&&(i="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}};function jn(r){let e=r.type.prop(qt);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}var u=H.define,je=u(),Z=u(),Ht=u(Z),Vt=u(Z),ee=u(),Ue=u(ee),ft=u(ee),K=u(),oe=u(K),G=u(),J=u(),ct=u(),ve=u(ct),We=u(),c={comment:je,lineComment:u(je),blockComment:u(je),docComment:u(je),name:Z,variableName:u(Z),typeName:Ht,tagName:u(Ht),propertyName:Vt,attributeName:u(Vt),className:u(Z),labelName:u(Z),namespace:u(Z),macroName:u(Z),literal:ee,string:Ue,docString:u(Ue),character:u(Ue),attributeValue:u(Ue),number:ft,integer:u(ft),float:u(ft),bool:u(ee),regexp:u(ee),escape:u(ee),color:u(ee),url:u(ee),keyword:G,self:u(G),null:u(G),atom:u(G),unit:u(G),modifier:u(G),operatorKeyword:u(G),controlKeyword:u(G),definitionKeyword:u(G),moduleKeyword:u(G),operator:J,derefOperator:u(J),arithmeticOperator:u(J),logicOperator:u(J),bitwiseOperator:u(J),compareOperator:u(J),updateOperator:u(J),definitionOperator:u(J),typeOperator:u(J),controlOperator:u(J),punctuation:ct,separator:u(ct),bracket:ve,angleBracket:u(ve),squareBracket:u(ve),paren:u(ve),brace:u(ve),content:K,heading:oe,heading1:u(oe),heading2:u(oe),heading3:u(oe),heading4:u(oe),heading5:u(oe),heading6:u(oe),contentSeparator:u(K),list:u(K),quote:u(K),emphasis:u(K),strong:u(K),link:u(K),monospace:u(K),strikethrough:u(K),inserted:u(),deleted:u(),changed:u(),invalid:u(),meta:We,documentMeta:u(We),annotation:u(We),processingInstruction:u(We),definition:H.defineModifier("definition"),constant:H.defineModifier("constant"),function:H.defineModifier("function"),standard:H.defineModifier("standard"),local:H.defineModifier("local"),special:H.defineModifier("special")};for(let r in c){let e=c[r];e instanceof H&&(e.name=r)}var Dr=dt([{tag:c.link,class:"tok-link"},{tag:c.heading,class:"tok-heading"},{tag:c.emphasis,class:"tok-emphasis"},{tag:c.strong,class:"tok-strong"},{tag:c.keyword,class:"tok-keyword"},{tag:c.atom,class:"tok-atom"},{tag:c.bool,class:"tok-bool"},{tag:c.url,class:"tok-url"},{tag:c.labelName,class:"tok-labelName"},{tag:c.inserted,class:"tok-inserted"},{tag:c.deleted,class:"tok-deleted"},{tag:c.literal,class:"tok-literal"},{tag:c.string,class:"tok-string"},{tag:c.number,class:"tok-number"},{tag:[c.regexp,c.escape,c.special(c.string)],class:"tok-string2"},{tag:c.variableName,class:"tok-variableName"},{tag:c.local(c.variableName),class:"tok-variableName tok-local"},{tag:c.definition(c.variableName),class:"tok-variableName tok-definition"},{tag:c.special(c.variableName),class:"tok-variableName2"},{tag:c.definition(c.propertyName),class:"tok-propertyName tok-definition"},{tag:c.typeName,class:"tok-typeName"},{tag:c.namespace,class:"tok-namespace"},{tag:c.className,class:"tok-className"},{tag:c.macroName,class:"tok-macroName"},{tag:c.propertyName,class:"tok-propertyName"},{tag:c.operator,class:"tok-operator"},{tag:c.comment,class:"tok-comment"},{tag:c.meta,class:"tok-meta"},{tag:c.invalid,class:"tok-invalid"},{tag:c.punctuation,class:"tok-punctuation"}]);var pt,he=new k;function hn(r){return W.define({combine:r?e=>e.concat(r):void 0})}var Un=new k,F=(()=>{class r{constructor(t,n,i=[],s=""){this.data=t,this.name=s,ue.prototype.hasOwnProperty("tree")||Object.defineProperty(ue.prototype,"tree",{get(){return z(this)}}),this.parser=n,this.extension=[te.of(this),ue.languageData.of((l,o,a)=>{let h=Jt(l,o,a),f=h.type.prop(he);if(!f)return[];let d=l.facet(f),g=h.type.prop(Un);if(g){let y=h.resolve(o-h.from,a);for(let x of g)if(x.test(y,l)){let I=l.facet(x.facet);return x.type=="replace"?I:I.concat(d)}}return d})].concat(i)}isActiveAt(t,n,i=-1){return Jt(t,n,i).type.prop(he)==this.data}findRegions(t){let n=t.facet(te);if(n?.data==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let i=[],s=(l,o)=>{if(l.prop(he)==this.data){i.push({from:o,to:o+l.length});return}let a=l.prop(k.mounted);if(a){if(a.tree.prop(he)==this.data){if(a.overlay)for(let h of a.overlay)i.push({from:h.from+o,to:h.to+o});else i.push({from:o,to:o+l.length});return}else if(a.overlay){let h=i.length;if(s(a.tree,a.overlay[0].from+o),i.length>h)return}}for(let h=0;h<l.children.length;h++){let f=l.children[h];f instanceof A&&s(f,l.positions[h]+o)}};return s(z(t),0),i}get allowsNesting(){return!0}}return r.setState=ge.define(),r})();function Jt(r,e,t){let n=r.facet(te),i=z(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,B.ExcludeBuffers|B.EnterBracketed))s.type.isTop&&(i=s);return i}var Kt=class r extends F{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=hn(e.languageData);return new r(t,e.parser.configure({props:[he.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new r(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function z(r){let e=r.field(F.state,!1);return e?e.tree:A.empty}function Wn(r,e,t=50){var n;let i=(n=r.field(F.state,!1))===null||n===void 0?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let l=i.isDone(e)||i.work(t,e)?i.tree:null;return i.updateViewport(s),l}function jr(r,e=r.doc.length){var t;return((t=r.field(F.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function Ur(r,e=r.viewport.to,t=100){let n=Wn(r.state,e,t);return n!=z(r.state)&&r.dispatch({}),!!n}function Wr(r){var e;return((e=r.plugin(un))===null||e===void 0?void 0:e.isWorking())||!1}var kt=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},Se=null,Ce=class r{constructor(e,t,n=[],i,s,l,o,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=l,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new r(e,t,[],A.empty,0,n,[],null)}startParse(){return this.parser.startParse(new kt(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=A.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(le.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(le.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Se;Se=this;try{return e()}finally{Se=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Qt(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:s,viewport:l,skipped:o}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,f,d,g)=>a.push({fromA:h,toA:f,fromB:d,toB:g})),n=le.applyChanges(n,a),i=A.empty,s=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){o=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),d=e.mapPos(h.to,-1);f<d&&o.push({from:f,to:d})}}}return new r(this.parser,t,n,i,s,l,o,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:s}=this.skipped[n];i<e.to&&s>e.from&&(this.fragments=Qt(this.fragments,i,s),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends we{createParse(t,n,i){let s=i[0].from,l=i[i.length-1].to;return{parsedPos:s,advance(){let a=Se;if(a){for(let h of i)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=l,new A(R.none,[],[],l-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Se}};function Qt(r,e,t){return le.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}var Te=class r{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new r(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Ce.create(e.facet(te).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new r(n)}};F.state=Xe.define({create:Te.init,update(r,e){for(let t of e.effects)if(t.is(F.setState))return t.value;return e.startState.facet(te)!=e.state.facet(te)?Te.init(e.state):r.apply(e)}});var fn=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(fn=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var gt=typeof navigator<"u"&&(!((pt=navigator.scheduling)===null||pt===void 0)&&pt.isInputPending)?()=>navigator.scheduling.isInputPending():null,un=ce.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(F.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(F.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=fn(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,s=n.field(F.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let l=Date.now()+Math.min(this.chunkBudget,100,e&&!gt?Math.max(25,e.timeRemaining()-5):1e9),o=s.context.treeLen<i&&n.doc.length>i+1e3,a=s.context.work(()=>gt&>()||Date.now()>l,i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:F.setState.of(new Te(s.context))})),this.chunkBudget>0&&!(a&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Rt(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),te=W.define({combine(r){return r.length?r[0]:null},enables:r=>[F.state,un,L.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]}),Xt=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Yt=class r{constructor(e,t,n,i,s,l=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=l,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new r(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let n=/\.([^.]+)$/.exec(t);if(n){for(let i of e)if(i.extensions.indexOf(n[1])>-1)return i}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(n)for(let i of e)for(let s of i.alias){let l=t.indexOf(s);if(l>-1&&(s.length>2||!/\w/.test(t[l-1])&&!/\w/.test(t[l+s.length])))return i}return null}},Hn=W.define(),cn=W.define({combine:r=>{if(!r.length)return" ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function qe(r){let e=r.facet(cn);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function dn(r,e){let t="",n=r.tabSize,i=r.facet(cn)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let s=0;s<e;s++)t+=i;return t}function pn(r,e){r instanceof ue&&(r=new Pe(r));for(let n of r.state.facet(Hn)){let i=n(r,e);if(i!==void 0)return i}let t=z(r.state);return t.length>=e?Vn(r,t,e):null}function Vr(r,e,t){let n=Object.create(null),i=new Pe(r,{overrideIndentation:l=>{var o;return(o=n[l])!==null&&o!==void 0?o:-1}}),s=[];for(let l=e;l<=t;){let o=r.doc.lineAt(l);l=o.to+1;let a=pn(i,o.from);if(a==null)continue;/\S/.test(o.text)||(a=0);let h=/^\s*/.exec(o.text)[0],f=dn(r,a);h!=f&&(n[o.from]=a,s.push({from:o.from,to:o.from+h.length,insert:f}))}return r.changes(s)}var Pe=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=qe(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.countColumn(n,e-i),l=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return l>-1&&(s+=l-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return Et(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let l=s(i);if(l>-1)return l}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},gn=new k;function Vn(r,e,t){let n=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=n.node){let s=[];for(let l=i;l&&!(l.from<n.node.from||l.to>n.node.to||l.from==n.node.from&&l.type==n.node.type);l=l.parent)s.push(l);for(let l=s.length-1;l>=0;l--)n={node:s[l],next:n}}return mn(n,r,t)}function mn(r,e,t){for(let n=r;n;n=n.next){let i=qn(n.node);if(i)return i(bt.create(e,t,n))}return 0}function $n(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function qn(r){let e=r.type.prop(gn);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(k.closedBy))){let i=r.lastChild,s=i&&n.indexOf(i.name)>-1;return l=>kn(l,!0,1,void 0,s&&!$n(l)?i.from:void 0)}return r.parent==null?Gn:null}function Gn(){return 0}var bt=class r extends Pe{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new r(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Jn(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return mn(this.context.next,this.base,this.pos)}};function Jn(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function Kn(r){let e=r.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let i=r.options.simulateBreak,s=r.state.doc.lineAt(t.from),l=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let o=t.to;;){let a=e.childAfter(o);if(!a||a==n)return null;if(!a.type.isSkipped){if(a.from>=l)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+h}}o=a.to}}function $r({closing:r,align:e=!0,units:t=1}){return n=>kn(n,e,t,r)}function kn(r,e,t,n,i){let s=r.textAfter,l=s.match(/^\s*/)[0].length,o=n&&s.slice(l,l+n.length)==n||i==r.pos+l,a=e?Kn(r):null;return a?o?r.column(a.from):r.column(a.to):r.baseIndent+(o?0:r.unit*t)}var qr=r=>r.baseIndent;function Gr({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}var Qn=200;function Jr(){return ue.transactionFilter.of(r=>{if(!r.docChanged||!r.isUserEvent("input.type")&&!r.isUserEvent("input.complete"))return r;let e=r.startState.languageDataAt("indentOnInput",r.startState.selection.main.head);if(!e.length)return r;let t=r.newDoc,{head:n}=r.newSelection.main,i=t.lineAt(n);if(n>i.from+Qn)return r;let s=t.sliceString(i.from,n);if(!e.some(h=>h.test(s)))return r;let{state:l}=r,o=-1,a=[];for(let{head:h}of l.selection.ranges){let f=l.doc.lineAt(h);if(f.from==o)continue;o=f.from;let d=pn(l,f.from);if(d==null)continue;let g=/^\s*/.exec(f.text)[0],y=dn(l,d);g!=y&&a.push({from:f.from,to:f.from+g.length,insert:y})}return a.length?[r,{changes:a,sequential:!0}]:r})}var Xn=W.define(),Yn=new k;function Kr(r){let e=r.firstChild,t=r.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?r.to:t.from}:null}function Zn(r,e,t){let n=z(r);if(n.length<t)return null;let i=n.resolveStack(t,1),s=null;for(let l=i;l;l=l.next){let o=l.node;if(o.to<=t||o.from>t)continue;if(s&&o.from<e)break;let a=o.type.prop(Yn);if(a&&(o.to<n.length-50||n.length==r.doc.length||!er(o))){let h=a(o,r);h&&h.from<=t&&h.from>=e&&h.to>t&&(s=h)}}return s}function er(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function Ne(r,e,t){for(let n of r.facet(Xn)){let i=n(r,e,t);if(i)return i}return Zn(r,e,t)}function bn(r,e){let t=e.mapPos(r.from,1),n=e.mapPos(r.to,-1);return t>=n?void 0:{from:t,to:n}}var Me=ge.define({map:bn}),de=ge.define({map:bn});function Tt(r){let e=[];for(let{head:t}of r.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(r.lineBlockAt(t));return e}var ne=Xe.define({create(){return E.none},update(r,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,n)=>r=Zt(r,t,n)),r=r.map(e.changes);for(let t of e.effects)if(t.is(Me)&&!tr(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Nt),i=n?E.replace({widget:new yt(n(e.state,t.value))}):en;r=r.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(de)&&(r=r.update({filter:(n,i)=>t.value.from!=n||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(r=Zt(r,e.selection.main.head)),r},provide:r=>L.decorations.from(r),toJSON(r,e){let t=[];return r.between(0,e.doc.length,(n,i)=>{t.push(n,i)}),t},fromJSON(r){if(!Array.isArray(r)||r.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<r.length;){let n=r[t++],i=r[t++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(en.range(n,i))}return E.set(e,!0)}});function Zt(r,e,t=e){let n=!1;return r.between(e,t,(i,s)=>{i<t&&s>e&&(n=!0)}),n?r.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):r}function Qr(r){return r.field(ne,!1)||et.empty}function Ie(r,e,t){var n;let i=null;return(n=r.field(ne,!1))===null||n===void 0||n.between(e,t,(s,l)=>{(!i||i.from>s)&&(i={from:s,to:l})}),i}function tr(r,e,t){let n=!1;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=!0)}),n}function Pt(r,e){return r.field(ne,!1)?e:e.concat(ge.appendConfig.of(yn()))}var nr=r=>{for(let e of Tt(r)){let t=Ne(r.state,e.from,e.to);if(t)return r.dispatch({effects:Pt(r.state,[Me.of(t),Ge(r,t)])}),!0}return!1},rr=r=>{if(!r.state.field(ne,!1))return!1;let e=[];for(let t of Tt(r)){let n=Ie(r.state,t.from,t.to);n&&e.push(de.of(n),Ge(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function Ge(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return L.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}var ir=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let i=r.lineBlockAt(n),s=Ne(e,i.from,i.to);s&&t.push(Me.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1}return t.length&&r.dispatch({effects:Pt(r.state,t)}),!!t.length},sr=r=>{let e=r.state.field(ne,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(de.of({from:n,to:i}))}),r.dispatch({effects:t}),!0};function lr(r,e){for(let t=e;;){let n=Ne(r.state,t.from,t.to);if(n&&n.to>e.from)return n;if(!t.from)return null;t=r.lineBlockAt(t.from-1)}}var Xr=r=>{let e=[];for(let t of Tt(r)){let n=Ie(r.state,t.from,t.to);if(n)e.push(de.of(n),Ge(r,n,!1));else{let i=lr(r,t);i&&e.push(Me.of(i),Ge(r,i))}}return e.length>0&&r.dispatch({effects:Pt(r.state,e)}),!!e.length},Yr=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:nr},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:rr},{key:"Ctrl-Alt-[",run:ir},{key:"Ctrl-Alt-]",run:sr}],or={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Nt=W.define({combine(r){return Ze(r,or)}});function yn(r){let e=[ne,hr];return r&&e.push(Nt.of(r)),e}function xn(r,e){let{state:t}=r,n=t.facet(Nt),i=l=>{let o=r.lineBlockAt(r.posAtDOM(l.target)),a=Ie(r.state,o.from,o.to);a&&r.dispatch({effects:de.of(a)}),l.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(r,i,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}var en=E.replace({widget:new class extends nt{toDOM(r){return xn(r,null)}}}),yt=class extends nt{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return xn(e,this.value)}},ar={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},Ae=class extends _t{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}};function Zr(r={}){let e=Ee(Ee({},ar),r),t=new Ae(e,!0),n=new Ae(e,!1),i=ce.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(te)!=l.state.facet(te)||l.startState.field(ne,!1)!=l.state.field(ne,!1)||z(l.startState)!=z(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let o=new Re;for(let a of l.viewportLineBlocks){let h=Ie(l.state,a.from,a.to)?n:Ne(l.state,a.from,a.to)?t:null;h&&o.add(a.from,a.from,h)}return o.finish()}}),{domEventHandlers:s}=e;return[i,Lt({class:"cm-foldGutter",markers(l){var o;return((o=l.plugin(i))===null||o===void 0?void 0:o.markers)||et.empty},initialSpacer(){return new Ae(e,!1)},domEventHandlers:Dt(Ee({},s),{click:(l,o,a)=>{if(s.click&&s.click(l,o,a))return!0;let h=Ie(l.state,o.from,o.to);if(h)return l.dispatch({effects:de.of(h)}),!0;let f=Ne(l.state,o.from,o.to);return f?(l.dispatch({effects:Me.of(f)}),!0):!1}})}),yn()]}var hr=L.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Je=class r{constructor(e,t){this.specs=e;let n;function i(o){let a=tt.newName();return(n||(n=Object.create(null)))["."+a]=o,a}let s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,l=t.scope;this.scope=l instanceof F?o=>o.prop(he)==l.data:l?o=>o==l:void 0,this.style=dt(e.map(o=>({tag:o.tag,class:o.class||i(Object.assign({},o,{tag:null}))})),{all:s}).style,this.module=n?new tt(n):null,this.themeType=t.themeType}static define(e,t){return new r(e,t||{})}},xt=W.define(),wn=W.define({combine(r){return r.length?[r[0]]:null}});function $e(r){let e=r.facet(xt);return e.length?e:r.facet(wn)}function ei(r,e){let t=[fr],n;return r instanceof Je&&(r.module&&t.push(L.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(wn.of(r)):n?t.push(xt.computeN([L.darkTheme],i=>i.facet(L.darkTheme)==(n=="dark")?[r]:[])):t.push(xt.of(r)),t}function ti(r,e,t){let n=$e(r),i=null;if(n){for(let s of n)if(!s.scope||t&&s.scope(t)){let l=s.style(e);l&&(i=i?i+" "+l:l)}}return i}var wt=class{constructor(e){this.markCache=Object.create(null),this.tree=z(e.state),this.decorations=this.buildDeco(e,$e(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=z(e.state),n=$e(e.state),i=n!=$e(e.startState),{viewport:s}=e.view,l=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&l>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decor