chrome-devtools-frontend
Version:
Chrome DevTools UI
1 lines • 414 kB
JavaScript
const t=1024;let e=0;class i{constructor(t,e){this.from=t,this.to=e}}class n{constructor(t={}){this.id=e++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=o.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}n.closedBy=new n({deserialize:t=>t.split(" ")}),n.openedBy=new n({deserialize:t=>t.split(" ")}),n.group=new n({deserialize:t=>t.split(" ")}),n.contextHash=new n({perNode:!0}),n.lookAhead=new n({perNode:!0}),n.mounted=new n({perNode:!0});class s{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const r=Object.create(null);class o{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):r,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new o(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(n.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(n.group),s=-1;s<(i?i.length:0);s++){let n=e[s<0?t.name:i[s]];if(n)return n}}}}o.none=new o("",Object.create(null),0,8);class a{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let i of this.types){let n=null;for(let e of t){let t=e(i);t&&(n||(n=Object.assign({},i.props)),n[t[0].id]=t[1])}e.push(n?new o(i.name,n,i.id,i.flags):i)}return new a(e)}}const l=new WeakMap,h=new WeakMap;class c{constructor(t,e,i,n,s){if(this.type=t,this.children=e,this.positions=i,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[t,e]of s)this.props["number"==typeof t?t:t.id]=e}}toString(){let t=this.prop(n.mounted);if(t&&!t.overlay)return t.tree.toString();let e="";for(let t of this.children){let i=t.toString();i&&(e&&(e+=","),e+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t,e=0){let i=null!=t&&l.get(this)||this.topNode,n=new w(i);return null!=t&&(n.moveTo(t,e),l.set(this,n._tree)),n}fullCursor(){return new w(this.topNode,1)}get topNode(){return new m(this,0,0,null)}resolve(t,e=0){let i=p(l.get(this)||this.topNode,t,e,!1);return l.set(this,i),i}resolveInner(t,e=0){let i=p(h.get(this)||this.topNode,t,e,!0);return h.set(this,i),i}iterate(t){let{enter:e,leave:i,from:n=0,to:s=this.length}=t;for(let t=this.cursor(),r=()=>t.node;;){let o=!1;if(t.from<=s&&t.to>=n&&(t.type.isAnonymous||!1!==e(t.type,t.from,t.to,r))){if(t.firstChild())continue;t.type.isAnonymous||(o=!0)}for(;o&&i&&i(t.type,t.from,t.to,r),o=t.type.isAnonymous,!t.nextSibling();){if(!t.parent())return;o=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:$(o.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new c(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new c(o.none,t,e,i)))}static build(e){return function(e){var i;let{buffer:s,nodeSet:r,maxBufferLength:o=t,reused:a=[],minRepeatType:l=r.types.length}=e,h=Array.isArray(s)?new u(s,s.length):s,f=r.types,d=0,p=0;function m(t,e,i,n,s){let{id:c,start:u,end:v,size:x}=h,k=p;for(;x<0;){if(h.next(),-1==x){let e=a[c];return i.push(e),void n.push(u-t)}if(-3==x)return void(d=c);if(-4==x)return void(p=c);throw new RangeError(`Unrecognized record size: ${x}`)}let P,S,T=f[c],W=u-t;if(v-u<=o&&(S=w(h.pos-e,s))){let e=new Uint16Array(S.size-S.skip),i=h.pos-S.size,n=e.length;for(;h.pos>i;)n=y(S.start,e,n);P=new O(e,v-S.start,r),W=S.start-t}else{let t=h.pos-x;h.next();let e=[],i=[],n=c>=l?c:-1,s=0,r=v;for(;h.pos>t;)n>=0&&h.id==n&&h.size>=0?(h.end<=r-o&&(Q(e,i,u,s,h.end,r,n,k),s=e.length,r=h.end),h.next()):m(u,t,e,i,n);if(n>=0&&s>0&&s<e.length&&Q(e,i,u,s,u,r,n,k),e.reverse(),i.reverse(),n>-1&&s>0){let t=g(T);P=$(T,e,i,0,e.length,0,v-u,t,t)}else P=b(T,e,i,v-u,k-v)}i.push(P),n.push(W)}function g(t){return(e,i,s)=>{let r,o,a=0,l=e.length-1;if(l>=0&&(r=e[l])instanceof c){if(!l&&r.type==t&&r.length==s)return r;(o=r.prop(n.lookAhead))&&(a=i[l]+r.length+o)}return b(t,e,i,s,a)}}function Q(t,e,i,n,s,o,a,l){let h=[],c=[];for(;t.length>n;)h.push(t.pop()),c.push(e.pop()+i-s);t.push(b(r.types[a],h,c,o-s,l-o)),e.push(s-i)}function b(t,e,i,s,r=0,o){if(d){let t=[n.contextHash,d];o=o?[t].concat(o):[t]}if(r>25){let t=[n.lookAhead,r];o=o?[t].concat(o):[t]}return new c(t,e,i,s,o)}function w(t,e){let i=h.fork(),n=0,s=0,r=0,a=i.end-o,c={size:0,start:0,skip:0};t:for(let o=i.pos-t;i.pos>o;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=s,c.skip=r,r+=4,n+=4,i.next();continue}let h=i.pos-t;if(t<0||h<o||i.start<a)break;let u=i.id>=l?4:0,O=i.start;for(i.next();i.pos>h;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=l&&(u+=4);i.next()}s=O,n+=t,r+=u}return(e<0||n==t)&&(c.size=n,c.start=s,c.skip=r),c.size>4?c:void 0}function y(t,e,i){let{id:n,start:s,end:r,size:o}=h;if(h.next(),o>=0&&n<l){let a=i;if(o>4){let n=h.pos-(o-4);for(;h.pos>n;)i=y(t,e,i)}e[--i]=a,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==o?d=n:-4==o&&(p=n);return i}let v=[],x=[];for(;h.pos>0;)m(e.start||0,e.bufferStart||0,v,x,-1);let k=null!==(i=e.length)&&void 0!==i?i:v.length?x[0]+v[0].length:0;return new c(f[e.topID],v.reverse(),x.reverse(),k)}(e)}}c.empty=new c(o.none,[],[],0);class u{constructor(t,e){this.buffer=t,this.index=e}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 u(this.buffer,this.index)}}class O{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return o.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],n=this.set.types[e],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),i==(t+=4))return s;let r=[];for(;t<i;)r.push(this.childString(t)),t=this.buffer[t+3];return s+"("+r.join(",")+")"}findChild(t,e,i,n,s){let{buffer:r}=this,o=-1;for(let a=t;a!=e&&!(f(s,n,r[a+1],r[a+2])&&(o=a,i>0));a=r[a+3]);return o}slice(t,e,i,n){let s=this.buffer,r=new Uint16Array(e-t);for(let n=t,o=0;n<e;)r[o++]=s[n++],r[o++]=s[n++]-i,r[o++]=s[n++]-i,r[o++]=s[n++]-t;return new O(r,n-i,this.set)}}function f(t,e,i,n){switch(t){case-2:return i<e;case-1:return n>=e&&i<e;case 0:return i<e&&n>e;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function d(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function p(t,e,i,n){for(var s;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let e=!n&&t instanceof m&&t.index<0?null:t.parent;if(!e)return t;t=e}if(n)for(let n=t,r=n.parent;r;n=r,r=n.parent)n instanceof m&&n.index<0&&(null===(s=r.enter(e,i,!0))||void 0===s?void 0:s.from)!=n.from&&(t=r);for(;;){let s=t.enter(e,i,n);if(!s)return t;t=s}}class m{constructor(t,e,i,n){this.node=t,this._from=e,this.index=i,this._parent=n}get type(){return this.node.type}get name(){return this.node.type.name}get from(){return this._from}get to(){return this._from+this.node.length}nextChild(t,e,i,s,r=0){for(let o=this;;){for(let{children:a,positions:l}=o.node,h=e>0?a.length:-1;t!=h;t+=e){let h=a[t],c=l[t]+o._from;if(f(s,i,c,c+h.length))if(h instanceof O){if(2&r)continue;let n=h.findChild(0,h.buffer.length,e,i-c,s);if(n>-1)return new b(new Q(o,h,t,c),null,n)}else if(1&r||!h.type.isAnonymous||y(h)){let a;if(!(1&r)&&h.props&&(a=h.prop(n.mounted))&&!a.overlay)return new m(a.tree,c,t,o);let l=new m(h,c,t,o);return 1&r||!l.type.isAnonymous?l:l.nextChild(e<0?h.children.length-1:0,e,i,s)}}if(1&r||!o.type.isAnonymous)return null;if(t=o.index>=0?o.index+e:e<0?-1:o._parent.node.children.length,o=o._parent,!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this.node.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this.node.children.length-1,-1,t,-2)}enter(t,e,i=!0,s=!0){let r;if(i&&(r=this.node.prop(n.mounted))&&r.overlay){let i=t-this.from;for(let{from:t,to:n}of r.overlay)if((e>0?t<=i:t<i)&&(e<0?n>=i:n>i))return new m(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,s?0:2)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get cursor(){return new w(this)}get tree(){return this.node}toTree(){return this.node}resolve(t,e=0){return p(this,t,e,!1)}resolveInner(t,e=0){return p(this,t,e,!0)}enterUnfinishedNodesBefore(t){return d(this,t)}getChild(t,e=null,i=null){let n=g(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return g(this,t,e,i)}toString(){return this.node.toString()}}function g(t,e,i,n){let s=t.cursor,r=[];if(!s.firstChild())return r;if(null!=i)for(;!s.type.is(i);)if(!s.nextSibling())return r;for(;;){if(null!=n&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return null==n?r:[]}}class Q{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class b{constructor(t,e,i){this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}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]}child(t,e,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return s<0?null:new b(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i,n=!0){if(!n)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new b(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new b(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new b(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get cursor(){return new w(this)}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let r=i.buffer[this.index+1],o=i.buffer[this.index+2];t.push(i.slice(n,s,r,o)),e.push(0)}return new c(this.type,t,e,this.to-this.from)}resolve(t,e=0){return p(this,t,e,!1)}resolveInner(t,e=0){return p(this,t,e,!0)}enterUnfinishedNodesBefore(t){return d(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=g(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return g(this,t,e,i)}}class w{constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof m)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof m?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree.node.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=!0,n=!0){return this.buffer?!!n&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i&&!(1&this.mode),n))}parent(){if(!this.buffer)return this.yieldNode(1&this.mode?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=1&this.mode?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let t=0;t<this.index;t++)if(n.buffer.buffer[t+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;({index:e,_parent:i}=i))if(e>-1)for(let n=e+t,s=t<0?-1:i.node.children.length;n!=s;n+=t){let t=i.node.children[n];if(1&this.mode||t instanceof O||!t.type.isAnonymous||y(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let n=this.index,s=this.stack.length;s>=0;){for(let r=t;r;r=r._parent)if(r.index==n){if(n==this.index)return r;e=r,i=s+1;break t}n=this.stack[--s]}for(let t=i;t<this.stack.length;t++)e=new b(this.buffer,e,this.stack[t]);return this.bufferNode=new b(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree.node}}function y(t){return t.children.some((t=>t instanceof O||!t.type.isAnonymous||y(t)))}const v=new WeakMap;function x(t,e){if(!t.isAnonymous||e instanceof O||e.type!=t)return 1;let i=v.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof c)){i=1;break}i+=x(t,n)}v.set(e,i)}return i}function $(t,e,i,n,s,r,o,a,l){let h=0;for(let i=n;i<s;i++)h+=x(t,e[i]);let c=Math.ceil(1.5*h/8),u=[],O=[];return function e(i,n,s,o,a){for(let h=s;h<o;){let s=h,f=n[h],d=x(t,i[h]);for(h++;h<o;h++){let e=x(t,i[h]);if(d+e>=c)break;d+=e}if(h==s+1){if(d>c){let t=i[s];e(t.children,t.positions,0,t.children.length,n[s]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push($(t,i,n,s,h,f,e,null,l))}O.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,O,o)}class k{constructor(t,e,i,n,s=!1,r=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(s?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new k(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],s=1,r=t.length?t[0]:null;for(let o=0,a=0,l=0;;o++){let h=o<e.length?e[o]:null,c=h?h.fromA:1e9;if(c-a>=i)for(;r&&r.from<c;){let e=r;if(a>=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new k(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=s<t.length?t[s++]:null}if(!h)break;a=h.toA,l=h.toA-h.toB}return n}}class P{startParse(t,e,n){return"string"==typeof t&&(t=new S(t)),n=n?n.length?n.map((t=>new i(t.from,t.to))):[new i(0,0)]:[new i(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class S{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}function T(t){return(e,i,n,s)=>new A(e,t,i,n,s)}class W{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class R{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const X=new n({perNode:!0});class A{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new c(t.type,t.children,t.positions,t.length,t.propValues.concat([[X,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[n.mounted.id]=new s(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].ranges[0].from<t&&(t=Math.min(t,this.inner[e].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].parse.stopAt(t)}startInner(){let t=new Y(this.fragments),e=null,n=null,s=new w(new m(this.baseTree,this.ranges[0].from,0,null),1);t:for(let r,o;null==this.stoppedAt||s.from<this.stoppedAt;){let a,l=!0;if(t.hasNode(s)){if(e){let t=e.mounts.find((t=>t.frag.from<=s.from&&t.frag.to>=s.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let n=i.from+t.pos,r=i.to+t.pos;n>=s.from&&r<=s.to&&e.ranges.push({from:n,to:r})}}l=!1}else if(n&&(o=C(n.ranges,s.from,s.to)))l=2!=o;else if(!s.type.isAnonymous&&s.from<s.to&&(r=this.nest(s,this.input))){s.tree||_(s);let o=t.findMounts(s.from,r.parser);if("function"==typeof r.overlay)e=new R(r.parser,r.overlay,o,this.inner.length,s.from,s.tree,e);else{let t=z(this.ranges,r.overlay||[new i(s.from,s.to)]);t.length&&this.inner.push(new W(r.parser,r.parser.startParse(this.input,D(o,t),t),r.overlay?r.overlay.map((t=>new i(t.from-s.from,t.to-s.from))):null,s.tree,t)),r.overlay?t.length&&(n={ranges:t,depth:0,prev:n}):l=!1}}else e&&(a=e.predicate(s))&&(!0===a&&(a=new i(s.from,s.to)),a.from<a.to&&e.ranges.push(a));if(l&&s.firstChild())e&&e.depth++,n&&n.depth++;else for(;!s.nextSibling();){if(!s.parent())break t;if(e&&!--e.depth){let t=z(this.ranges,e.ranges);t.length&&this.inner.splice(e.index,0,new W(e.parser,e.parser.startParse(this.input,D(e.mounts,t),t),e.ranges.map((t=>new i(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}n&&!--n.depth&&(n=n.prev)}}}}function C(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function Z(t,e,i,n,s,r){if(e<i){let o=t.buffer[e+1],a=t.buffer[i-2];n.push(t.slice(e,i,o,a)),s.push(o-r)}}function _(t){let{node:e}=t,i=0;do{t.parent(),i++}while(!t.tree);let n=0,s=t.tree,r=0;for(;r=s.positions[n]+t.from,!(r<=e.from&&r+s.children[n].length>=e.to);n++);let a=s.children[n],l=a.buffer;s.children[n]=function t(i,n,s,o){let h=i;for(;l[h+2]+r<=e.from;)h=l[h+3];let u=[],O=[];Z(a,i,h,u,O,o);let f=l[h+1]+r==e.from&&l[h+2]+r==e.to&&l[h]==e.type.id;u.push(f?e.toTree():t(h+4,l[h+3],a.set.types[l[h]],l[h+1])),O.push(l[h+1]-o),Z(a,l[h+3],n,u,O,o);let d=u.length-1;return new c(s,u,O,O[d]+u[d].length)}(0,l.length,o.none,0);for(let n=0;n<=i;n++)t.childAfter(e.from)}class U{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.fullCursor()}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from<i;)e.to>=t&&e.enter(i,1,!1,!1)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof c))break;e=e.children[0]}return!1}}class Y{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(X))&&void 0!==e?e:i.to,this.inner=new U(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(X))&&void 0!==t?t:e.to,this.inner=new U(e.tree,-e.offset)}}findMounts(t,e){var i;let s=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let r=null===(i=t.tree)||void 0===i?void 0:i.prop(n.mounted);if(r&&r.parser==e)for(let e=this.fragI;e<this.fragments.length;e++){let i=this.fragments[e];if(i.from>=t.to)break;i.tree==this.curFrag.tree&&s.push({frag:i,pos:t.from-i.offset,mount:r})}}}return s}}function z(t,e){let n=null,s=e;for(let r=1,o=0;r<t.length;r++){let a=t[r-1].to,l=t[r].from;for(;o<s.length;o++){let t=s[o];if(t.from>=l)break;t.to<=a||(n||(s=n=e.slice()),t.from<a?(n[o]=new i(t.from,a),t.to>l&&n.splice(o+1,0,new i(l,t.to))):t.to>l?n[o--]=new i(l,t.to):n.splice(o--,1))}}return s}function L(t,e,n,s){let r=0,o=0,a=!1,l=!1,h=-1e9,c=[];for(;;){let u=r==t.length?1e9:a?t[r].to:t[r].from,O=o==e.length?1e9:l?e[o].to:e[o].from;if(a!=l){let t=Math.max(h,n),e=Math.min(u,O,s);t<e&&c.push(new i(t,e))}if(h=Math.min(u,O),1e9==h)break;u==h&&(a?(a=!1,r++):a=!0),O==h&&(l?(l=!1,o++):l=!0)}return c}function D(t,e){let n=[];for(let{pos:s,mount:r,frag:o}of t){let t=s+(r.overlay?r.overlay[0].from:0),a=t+r.tree.length,l=Math.max(o.from,t),h=Math.min(o.to,a);if(r.overlay){let a=L(e,r.overlay.map((t=>new i(t.from+s,t.to+s))),l,h);for(let e=0,i=l;;e++){let s=e==a.length,l=s?h:a[e].from;if(l>i&&n.push(new k(i,l,r.tree,-t,o.from>=i,o.to<=l)),s)break;i=a[e].to}}else n.push(new k(l,h,r.tree,-t,o.from>=t,o.to<=a))}return n}const V="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),q="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class M{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,e,r,o){let a=[],l=/^@(\w+)\b/.exec(t[0]),h=l&&"keyframes"==l[1];if(l&&null==e)return r.push(t[0]+";");for(let i in e){let o=e[i];if(/&/.test(i))s(i.split(/,\s*/).map((e=>t.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,r);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=E[V]||1;return E[V]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[q]||new j(t)).mount(Array.isArray(e)?e:[e])}}let G=null;class j{constructor(t){if(!t.head&&t.adoptedStyleSheets&&"undefined"!=typeof CSSStyleSheet){if(G)return t.adoptedStyleSheets=[G.sheet].concat(t.adoptedStyleSheets),t[q]=G;this.sheet=new CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(t.adoptedStyleSheets),G=this}else{this.styleTag=(t.ownerDocument||t).createElement("style");let e=t.head||t;e.insertBefore(this.styleTag,e.firstChild)}this.modules=[],t[q]=this}mount(t){let e=this.sheet,i=0,n=0;for(let s=0;s<t.length;s++){let r=t[s],o=this.modules.indexOf(r);if(o<n&&o>-1&&(this.modules.splice(o,1),n--,o=-1),-1==o){if(this.modules.splice(n++,0,r),e)for(let t=0;t<r.rules.length;t++)e.insertRule(r.rules[t],i++)}else{for(;n<o;)i+=this.modules[n++].rules.length;i+=r.rules.length,n++}}if(!e){let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t}}}let N="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((t=>t?parseInt(t,36):1));for(let t=1;t<N.length;t++)N[t]+=N[t-1];function I(t){for(let e=1;e<N.length;e+=2)if(N[e]>t)return N[e-1]<=t;return!1}function B(t){return t>=127462&&t<=127487}function H(t,e,i=!0){return(i?F:K)(t,e)}function F(t,e){if(e==t.length)return e;e&&J(t.charCodeAt(e))&&tt(t.charCodeAt(e-1))&&e--;let i=et(t,e);for(e+=nt(i);e<t.length;){let n=et(t,e);if(8205==i||8205==n||I(n))e+=nt(n),i=n;else{if(!B(n))break;{let i=0,n=e-2;for(;n>=0&&B(et(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function K(t,e){for(;e>0;){let i=F(t,e-2);if(i<e)return i;e--}return 0}function J(t){return t>=56320&&t<57344}function tt(t){return t>=55296&&t<56320}function et(t,e){let i=t.charCodeAt(e);if(!tt(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return J(n)?n-56320+(i-55296<<10)+65536:i}function it(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function nt(t){return t<65536?1:2}function st(t,e,i=t.length){let n=0;for(let s=0;s<i;)9==t.charCodeAt(s)?(n+=e-n%e,s++):(n++,s=H(t,s));return n}class rt{constructor(){}lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),at.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let i=[];return this.decompose(t,e,i,0),at.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new ct(this),s=new ct(t);for(let t=e,r=e;;){if(n.next(t),s.next(t),t=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(r+=n.value.length,n.done||r>=i)return!0}}iter(t=1){return new ct(this,t)}iterRange(t,e=this.length){return new ut(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Ot(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new ot(t):at.from(ot.split(t,[])):rt.empty}}class ot extends rt{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.text[s],o=n+r.length;if((e?i:o)>=t)return new ft(n,o,i,r);n=o+1,i++}}decompose(t,e,i,n){let s=t<=0&&e>=this.length?this:new ot(ht(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&n){let t=i.pop(),e=lt(s.text,t.text.slice(),0,s.length);if(e.length<=32)i.push(new ot(e,t.length+s.length));else{let t=e.length>>1;i.push(new ot(e.slice(0,t)),new ot(e.slice(t)))}}else i.push(s)}replace(t,e,i){if(!(i instanceof ot))return super.replace(t,e,i);let n=lt(this.text,lt(i.text,ht(this.text,0,t)),e),s=this.length+i.length-(e-t);return n.length<=32?new ot(n,s):at.from(ot.split(n,[]),s)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;s<=e&&r<this.text.length;r++){let o=this.text[r],a=s+o.length;s>t&&r&&(n+=i),t<a&&e>s&&(n+=o.slice(Math.max(0,t-s),e-s)),s=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let s of t)i.push(s),n+=s.length+1,32==i.length&&(e.push(new ot(i,n)),i=[],n=-1);return n>-1&&e.push(new ot(i,n)),e}}class at extends rt{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.children[s],o=n+r.length,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s<this.children.length;s++){let o=this.children[s],a=r+o.length;if(t<=a&&e>=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,i){if(i.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let r=this.children[n],o=s+r.length;if(t>=s&&e<=o){let a=r.replace(t-s,e-s,i),l=this.lines-r.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let s=this.children.slice();return s[n]=a,new at(s,this.length-(e-t)+i.length)}return super.replace(s,o,a)}s=o+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;s<this.children.length&&r<=e;s++){let o=this.children[s],a=r+o.length;r>t&&s&&(n+=i),t<a&&e>r&&(n+=o.sliceString(t-r,e-r,i)),r=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof at))return 0;let i=0,[n,s,r,o]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,s+=e){if(n==r||s==o)return i;let a=this.children[n],l=t.children[s];if(a!=l)return i+a.scanIdentical(l,e);i+=a.length+1}}static from(t,e=t.reduce(((t,e)=>t+e.length+1),-1)){let i=0;for(let e of t)i+=e.lines;if(i<32){let i=[];for(let e of t)e.flatten(i);return new ot(i,e)}let n=Math.max(32,i>>5),s=n<<1,r=n>>1,o=[],a=0,l=-1,h=[];function c(t){let e;if(t.lines>s&&t instanceof at)for(let e of t.children)c(e);else t.lines>r&&(a>r||!a)?(u(),o.push(t)):t instanceof ot&&a&&(e=h[h.length-1])instanceof ot&&t.lines+e.lines<=32?(a+=t.lines,l+=t.length+1,h[h.length-1]=new ot(e.text.concat(t.text),e.length+1+t.length)):(a+t.lines>n&&u(),a+=t.lines,l+=t.length+1,h.push(t))}function u(){0!=a&&(o.push(1==h.length?h[0]:at.from(h,l)),l=-1,a=h.length=0)}for(let e of t)c(e);return u(),1==o.length?o[0]:new at(o,e)}}function lt(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r<t.length&&s<=n;r++){let a=t[r],l=s+a.length;l>=i&&(l>n&&(a=a.slice(0,n-s)),s<i&&(a=a.slice(i-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=l+1}return e}function ht(t,e,i){return lt(t,[""],e,i)}rt.empty=new ot([""],0);class ct{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof ot?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],r=s>>1,o=n instanceof ot?n.text.length:n.children.length;if(r==(e>0?o:0)){if(0==i)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(e>0?0:1)){if(this.offsets[i]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(n instanceof ot){let s=n.text[r+(e<0?-1:0)];if(this.offsets[i]+=e,s.length>Math.max(0,t))return this.value=0==t?s:e>0?s.slice(t):s.slice(0,s.length-t),this;t-=s.length}else{let s=n.children[r+(e<0?-1:0)];t>s.length?(t-=s.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(s),this.offsets.push(e>0?1:(s instanceof ot?s.text.length:s.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class ut{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new ct(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class Ot{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(rt.prototype[Symbol.iterator]=function(){return this.iter()},ct.prototype[Symbol.iterator]=ut.prototype[Symbol.iterator]=Ot.prototype[Symbol.iterator]=function(){return this});class ft{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}const dt=/\r\n?|\n/;var pt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(pt||(pt={}));class mt{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,n=0;e<this.sections.length;){let s=this.sections[e++],r=this.sections[e++];r<0?(t(i,n,s),n+=s):n+=r,i+=s}}iterChangedRanges(t,e=!1){wt(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];n<0?t.push(i,n):t.push(n,i)}return new mt(t)}composeDesc(t){return this.empty?t:t.empty?this:vt(this,t)}mapDesc(t,e=!1){return t.empty?this:yt(this,t,e)}mapPos(t,e=-1,i=pt.Simple){let n=0,s=0;for(let r=0;r<this.sections.length;){let o=this.sections[r++],a=this.sections[r++],l=n+o;if(a<0){if(l>t)return s+(t-n);s+=o}else{if(i!=pt.Simple&&l>=t&&(i==pt.TrackDel&&n<t&&l>t||i==pt.TrackBefore&&n<t||i==pt.TrackAfter&&l>t))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let i=0,n=0;i<this.sections.length&&n<=e;){let s=n+this.sections[i++];if(this.sections[i++]>=0&&n<=e&&s>=t)return!(n<t&&s>e)||"cover";n=s}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];t+=(t?" ":"")+i+(n>=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new mt(t)}}class gt extends mt{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return wt(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return yt(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let n=0,s=0;n<e.length;n+=2){let r=e[n],o=e[n+1];if(o>=0){e[n]=o,e[n+1]=r;let a=n>>1;for(;i.length<a;)i.push(rt.empty);i.push(r?t.slice(s,s+r):rt.empty)}s+=r}return new gt(e,i)}compose(t){return this.empty?t:t.empty?this:vt(this,t,!0)}map(t,e=!1){return t.empty?this:yt(this,t,e,!0)}iterChanges(t,e=!1){wt(this,t,e)}get desc(){return new mt(this.sections)}filter(t){let e=[],i=[],n=[],s=new xt(this);t:for(let r=0,o=0;;){let a=r==t.length?1e9:t[r++];for(;o<a||o==a&&0==s.len;){if(s.done)break t;let t=Math.min(s.len,a-o);Qt(n,t,-1);let r=-1==s.ins?-1:0==s.off?s.ins:0;Qt(e,t,r),r>0&&bt(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o<l;){if(s.done)break t;let t=Math.min(s.len,l-o);Qt(e,t,-1),Qt(n,t,-1==s.ins?-1:0==s.off?s.ins:0),s.forward(t),o+=t}}return{changes:new gt(e,i),filtered:new mt(n)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],n=this.sections[e+1];n<0?t.push(i):0==n?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let n=[],s=[],r=0,o=null;function a(t=!1){if(!t&&!n.length)return;r<e&&Qt(n,e-r,-1);let i=new gt(n,s);o=o?o.compose(i.map(o)):i,n=[],s=[],r=0}return function t(l){if(Array.isArray(l))for(let e of l)t(e);else if(l instanceof gt){if(l.length!=e)throw new RangeError(`Mismatched change set length (got ${l.length}, expected ${e})`);a(),o=o?o.compose(l.map(o)):l}else{let{from:t,to:o=t,insert:h}=l;if(t>o||t<0||o>e)throw new RangeError(`Invalid change range ${t} to ${o} (in doc of length ${e})`);let c=h?"string"==typeof h?rt.of(h.split(i||dt)):h:rt.empty,u=c.length;if(t==o&&0==u)return;t<r&&a(),t>r&&Qt(n,t-r,-1),Qt(n,o-t,u),bt(s,n,c),r=o}}(t),a(!o),o}static empty(t){return new gt(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let n=0;n<t.length;n++){let s=t[n];if("number"==typeof s)e.push(s,-1);else{if(!Array.isArray(s)||"number"!=typeof s[0]||s.some(((t,e)=>e&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)e.push(s[0],0);else{for(;i.length<n;)i.push(rt.empty);i[n]=rt.of(s.slice(1)),e.push(s[0],i[n].length)}}}return new gt(e,i)}}function Qt(t,e,i,n=!1){if(0==e&&i<=0)return;let s=t.length-2;s>=0&&i<=0&&i==t[s+1]?t[s]+=e:0==e&&0==t[s]?t[s+1]+=i:n?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function bt(t,e,i){if(0==i.length)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<n;)t.push(rt.empty);t.push(i)}}function wt(t,e,i){let n=t.inserted;for(let s=0,r=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)s+=a,r+=a;else{let h=s,c=r,u=rt.empty;for(;h+=a,c+=l,l&&n&&(u=u.append(n[o-2>>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(s,h,r,c,u),s=h,r=c}}}function yt(t,e,i,n=!1){let s=[],r=n?[]:null,o=new xt(t),a=new xt(e);for(let t=0,e=0;;)if(-1==o.ins)t+=o.len,o.next();else if(-1==a.ins&&e<t){let i=Math.min(a.len,t-e);a.forward(i),Qt(s,i,-1),e+=i}else if(a.ins>=0&&(o.done||e<t||e==t&&(a.len<o.len||a.len==o.len&&!i))){for(Qt(s,a.ins,-1);t>e&&!o.done&&t+o.len<e+a.len;)t+=o.len,o.next();e+=a.len,a.next()}else{if(!(o.ins>=0)){if(o.done&&a.done)return r?new gt(s,r):new mt(s);throw new Error("Mismatched change set lengths")}{let i=0,n=t+o.len;for(;;)if(a.ins>=0&&e>t&&e+a.len<n)i+=a.ins,e+=a.len,a.next();else{if(!(-1==a.ins&&e<n))break;{let t=Math.min(a.len,n-e);i+=t,a.forward(t),e+=t}}Qt(s,i,o.ins),r&&bt(r,s,o.text),t=n,o.next()}}}function vt(t,e,i=!1){let n=[],s=i?[]:null,r=new xt(t),o=new xt(e);for(let t=!1;;){if(r.done&&o.done)return s?new gt(n,s):new mt(n);if(0==r.ins)Qt(n,r.len,0,t),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");{let e=Math.min(r.len2,o.len),i=n.length;if(-1==r.ins){let i=-1==o.ins?-1:o.off?0:o.ins;Qt(n,e,i,t),s&&i&&bt(s,n,o.text)}else-1==o.ins?(Qt(n,r.off?0:r.len,e,t),s&&bt(s,n,r.textBit(e))):(Qt(n,r.off?0:r.len,o.off?0:o.ins,t),s&&!o.off&&bt(s,n,o.text));t=(r.ins>e||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Qt(n,0,o.ins,t),s&&bt(s,n,o.text),o.next()}}class xt{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?rt.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?rt.empty:e[i].slice(this.off,null==t?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class $t{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let t=3&this.flags;return 3==t?null:t}get goalColumn(){let t=this.flags>>5;return 33554431==t?void 0:t}map(t,e=-1){let i=t.mapPos(this.from,e),n=t.mapPos(this.to,e);return i==this.from&&n==this.to?this:new $t(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return kt.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return kt.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return kt.range(t.anchor,t.head)}}class kt{constructor(t,e=0){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:kt.create(this.ranges.map((i=>i.map(t,e))),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new kt([this.main])}addRange(t,e=!0){return kt.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let i=this.ranges.slice();return i[e]=t,kt.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((t=>t.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new kt(t.ranges.map((t=>$t.fromJSON(t))),t.main)}static single(t,e=t){return new kt([kt.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<t.length;n++){let s=t[n];if(s.empty?s.from<=i:s.from<i)return Pt(t.slice(),e);i=s.to}return new kt(t,e)}static cursor(t,e=0,i,n){return new $t(t,t,(0==e?0:e<0?4:8)|(null==i?3:Math.min(2,i))|(null!=n?n:33554431)<<5)}static range(t,e,i){let n=(null!=i?i:33554431)<<5;return e<t?new $t(e,t,16|n):new $t(t,e,n)}}function Pt(t,e=0){let i=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(i);for(let i=1;i<t.length;i++){let n=t[i],s=t[i-1];if(n.empty?n.from<=s.to:n.from<s.to){let r=s.from,o=Math.max(n.to,s.to);i<=e&&e--,t.splice(--i,2,n.anchor>n.head?kt.range(o,r):kt.range(r,o))}}return new kt(t,e)}function St(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let Tt=0;class Wt{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.extensions=s,this.id=Tt++,this.default=t([])}static define(t={}){return new Wt(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:Rt),!!t.static,t.enables)}of(t){return new Xt([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xt(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xt(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function Rt(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class Xt{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=Tt++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=t[this.id]>>1,r=2==this.type,o=!1,a=!1,l=[];for(let i of this.dependencies)"doc"==i?o=!0:"selection"==i?a=!0:0==(1&(null!==(e=t[i.id])&&void 0!==e?e:1))&&l.push(t[i.id]);return(t,e)=>{let h=t.values[s];if(h===jt)return t.values[s]=i(t),1;if(e){if(o&&e.docChanged||a&&(e.docChanged||e.selection)||l.some((e=>(1&Nt(t,e))>0))){let e=i(t);if(r?!function(t,e,i){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],e[n]))return!1;return!0}(e,h,n):!n(e,h))return t.values[s]=e,1}}return 0}}}function At(t,e,i){let n=i.map((e=>t[e.id])),s=i.map((t=>t.type)),r=n.filter((t=>!(1&t))),o=t[e.id]>>1;return(t,i)=>{let a=t.values[o],l=a===jt||!i;for(let e of r)1&Nt(t,e)&&(l=!0);if(!l)return 0;let h=[];for(let e=0;e<n.length;e++){let i=It(t,n[e]);if(2==s[e])for(let t of i)h.push(t);else h.push(i)}let c=e.combine(h);return a!==jt&&e.compare(c,a)?0:(t.values[o]=c,1)}}const Ct=Wt.define({static:!0});class Zt{constructor(t,e,i,n,s){this.id=t,this.createF=e,this.updateF=i,this.compareF=n,this.spec=s,this.provides=void 0}static define(t){let e=new Zt(Tt++,t.create,t.update,t.compare||((t,e)=>t===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Ct).find((t=>t.field==this));return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return(t,i)=>{let n=t.values[e];if(n===jt)return t.values[e]=this.create(t),1;if(i){let s=this.updateF(n,i);if(!this.compareF(n,s))return t.values[e]=s,1}return 0}}init(t){return[this,Ct.of({field:this,create:t})]}get extension(){return this}}const _t=4,Ut=3,Yt=2,zt=1,Lt=0;function Dt(t){return e=>new qt(e,t)}const Vt={lowest:Dt(_t),low:Dt(Ut),default:Dt(Yt),high:Dt(zt),highest:Dt(Lt),fallback:Dt(_t),extend:Dt(zt),override:Dt(Lt)};class qt{constructor(t,e){this.inner=t,this.prec=e}}class Et{of(t){return new Mt(this,t)}reconfigure(t){return Et.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Mt{constructor(t,e){this.compartment=t,this.inner=e}}class Gt{constructor(t,e,i,n,s){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}static resolve(t,e,i){let n=[],s=Object.create(null),r=new Map;for(let i of function(t,e,i){let n=[[],[],[],[],[]],s=new Map;function r(t,o){let a=s.get(t);if(null!=a){if(a>=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof Mt&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof Mt){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof qt)r(t.inner,t.prec);else if(t instanceof Zt)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof Xt)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,o);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,Yt),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof Zt?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[],h=[];for(let t of n)o[t.id]=l.length<<1,l.push((e=>t.slot(e))),h.push([]);for(let t in s){let e=s[t],n=e[0].facet;if(e.every((t=>0==t.type))){o[n.id]=a.length<<1|1;let t=n.combine(e.map((t=>t.value))),s=i?i.config.address[n.id]:null;if(null!=s){let e=It(i,s);n.compare(t,e)&&(t=e)}a.push(t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))),h.push(t.dependencies.filter((t=>"string"!=typeof t)).map((t=>t.id))));