shell bypass 403

Cubjrnet7 Shell


name : lezer-common.min.js
const ke=1024;let Ce=0;class T{constructor(e,t){this.from=e,this.to=t}}class w{constructor(e={}){this.id=Ce++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=O.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}w.closedBy=new w({deserialize:l=>l.split(" ")}),w.openedBy=new w({deserialize:l=>l.split(" ")}),w.group=new w({deserialize:l=>l.split(" ")}),w.isolate=new w({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}}),w.contextHash=new w({perNode:!0}),w.lookAhead=new w({perNode:!0}),w.mounted=new w({perNode:!0});class ${constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[w.mounted.id]}}const Ae=Object.create(null);class O{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Ae,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new O(e.name||"",t,e.id,r);if(e.props){for(let i of e.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");t[i[0].id]=i[1]}}return n}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(w.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return r=>{for(let n=r.prop(w.group),i=-1;i<(n?n.length:0);i++){let s=t[i<0?r.name:n[i]];if(s)return s}}}}O.none=new O("",Object.create(null),0,8);class le{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let i of e){let s=i(r);s&&(n||(n=Object.assign({},r.props)),n[s[0].id]=s[1])}t.push(n?new O(r.name,n,r.id,r.flags):r)}return new le(t)}}const ee=new WeakMap,ue=new WeakMap;var C;(function(l){l[l.ExcludeBuffers=1]="ExcludeBuffers",l[l.IncludeAnonymous=2]="IncludeAnonymous",l[l.IgnoreMounts=4]="IgnoreMounts",l[l.IgnoreOverlays=8]="IgnoreOverlays"})(C||(C={}));class z{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=Object.create(null);for(let[s,f]of i)this.props[typeof s=="number"?s:s.id]=f}}toString(){let e=$.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let n=r.toString();n&&(t&&(t+=","),t+=n)}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 X(this.topNode,e)}cursorAt(e,t=0,r=0){let n=ee.get(this)||this.topNode,i=new X(n);return i.moveTo(e,t),ee.set(this,i._tree),i}get topNode(){return new B(this,0,0,null)}resolve(e,t=0){let r=Q(ee.get(this)||this.topNode,e,t,!1);return ee.set(this,r),r}resolveInner(e,t=0){let r=Q(ue.get(this)||this.topNode,e,t,!0);return ue.set(this,r),r}resolveStack(e,t=0){return Ie(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e,s=e.mode||0,f=(s&C.IncludeAnonymous)>0;for(let h=this.cursor(s|C.IncludeAnonymous);;){let u=!1;if(h.from<=i&&h.to>=n&&(!f&&h.type.isAnonymous||t(h)!==!1)){if(h.firstChild())continue;u=!0}for(;u&&r&&(f||!h.type.isAnonymous)&&r(h),!h.nextSibling();){if(!h.parent())return;u=!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:ie(O.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,n)=>new z(this.type,t,r,n,this.propValues),e.makeTree||((t,r,n)=>new z(O.none,t,r,n)))}static build(e){return Ne(e)}}z.empty=new z(O.none,[],[],0);class fe{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 fe(this.buffer,this.index)}}class U{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return O.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,t,r,n,i){let{buffer:s}=this,f=-1;for(let h=e;h!=t&&!(ae(i,n,s[h+1],s[h+2])&&(f=h,r>0));h=s[h+3]);return f}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),s=0;for(let f=e,h=0;f<t;){i[h++]=n[f++],i[h++]=n[f++]-r;let u=i[h++]=n[f++]-r;i[h++]=n[f++]-e,s=Math.max(s,u)}return new U(i,s,this.set)}}function ae(l,e,t,r){switch(l){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Q(l,e,t,r){for(var n;l.from==l.to||(t<1?l.from>=e:l.from>e)||(t>-1?l.to<=e:l.to<e);){let s=!r&&l instanceof B&&l.index<0?null:l.parent;if(!s)return l;l=s}let i=r?0:C.IgnoreOverlays;if(r)for(let s=l,f=s.parent;f;s=f,f=s.parent)s instanceof B&&s.index<0&&((n=f.enter(e,t,i))===null||n===void 0?void 0:n.from)!=s.from&&(l=f);for(;;){let s=l.enter(e,t,i);if(!s)return l;l=s}}class pe{cursor(e=0){return new X(this,e)}getChild(e,t=null,r=null){let n=de(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return de(this,e,t,r)}resolve(e,t=0){return Q(this,e,t,!1)}resolveInner(e,t=0){return Q(this,e,t,!0)}matchContext(e){return re(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(r=t,t=n.prevSibling):t=n}return r}get node(){return this}get next(){return this.parent}}class B extends pe{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,i=0){for(let s=this;;){for(let{children:f,positions:h}=s._tree,u=t>0?f.length:-1;e!=u;e+=t){let o=f[e],c=h[e]+s.from;if(ae(n,r,c,c+o.length)){if(o instanceof U){if(i&C.ExcludeBuffers)continue;let d=o.findChild(0,o.buffer.length,t,r-c,n);if(d>-1)return new D(new Se(s,o,e,c),null,d)}else if(i&C.IncludeAnonymous||!o.type.isAnonymous||ne(o)){let d;if(!(i&C.IgnoreMounts)&&(d=$.get(o))&&!d.overlay)return new B(d.tree,c,e,s);let x=new B(o,c,e,s);return i&C.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(t<0?o.children.length-1:0,t,r,n)}}}if(i&C.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+t:e=t<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let n;if(!(r&C.IgnoreOverlays)&&(n=$.get(this._tree))&&n.overlay){let i=e-this.from;for(let{from:s,to:f}of n.overlay)if((t>0?s<=i:s<i)&&(t<0?f>=i:f>i))return new B(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function de(l,e,t,r){let n=l.cursor(),i=[];if(!n.firstChild())return i;if(t!=null){for(let s=!1;!s;)if(s=n.type.is(t),!n.nextSibling())return i}for(;;){if(r!=null&&n.type.is(r))return i;if(n.type.is(e)&&i.push(n.node),!n.nextSibling())return r==null?i:[]}}function re(l,e,t=e.length-1){for(let r=l;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class Se{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class D extends pe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new D(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&C.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new D(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new D(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 D(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let s=r.buffer[this.index+1];e.push(r.slice(n,i,s)),t.push(0)}return new z(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ce(l){if(!l.length)return null;let e=0,t=l[0];for(let i=1;i<l.length;i++){let s=l[i];(s.from>t.from||s.to<t.to)&&(t=s,e=i)}let r=t instanceof B&&t.index<0?null:t.parent,n=l.slice();return r?n[e]=r:n.splice(e,1),new _e(n,t)}class _e{constructor(e,t){this.heads=e,this.node=t}get next(){return ce(this.heads)}}function Ie(l,e,t){let r=l.resolveInner(e,t),n=null;for(let i=r instanceof B?r:r.context.parent;i;i=i.parent)if(i.index<0){let s=i.parent;(n||(n=[r])).push(s.resolve(e,t)),i=s}else{let s=$.get(i.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let f=new B(s.tree,s.overlay[0].from+i.from,-1,i);(n||(n=[r])).push(Q(f,e,t,!1))}}return n?ce(n):r}class X{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof B)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return e?e instanceof B?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&C.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&C.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&C.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(n.buffer.buffer[i+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let i=t+e,s=e<0?-1:r._tree.children.length;i!=s;i+=e){let f=r._tree.children[i];if(this.mode&C.IncludeAnonymous||f instanceof U||!f.type.isAnonymous||ne(f))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=i+1;break e}n=this.stack[--i]}for(let n=r;n<this.stack.length;n++)t=new D(this.buffer,t,this.stack[n]);return this.bufferNode=new D(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return re(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return re(this._tree,e,n);let s=r[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function ne(l){return l.children.some(e=>e instanceof U||!e.type.isAnonymous||ne(e))}function Ne(l){var e;let{buffer:t,nodeSet:r,maxBufferLength:n=1024,reused:i=[],minRepeatType:s=r.types.length}=l,f=Array.isArray(t)?new fe(t,t.length):t,h=r.types,u=0,o=0;function c(m,v,a,A,y,S){let{id:g,start:p,end:b,size:k}=f,N=o,H=u;for(;k<0;)if(f.next(),k==-1){let W=i[g];a.push(W),A.push(p-m);return}else if(k==-3){u=g;return}else if(k==-4){o=g;return}else throw new RangeError(`Unrecognized record size: ${k}`);let K=h[g],Y,J,he=p-m;if(b-p<=n&&(J=F(f.pos-v,y))){let W=new Uint16Array(J.size-J.skip),M=f.pos-J.size,R=W.length;for(;f.pos>M;)R=j(J.start,W,R);Y=new U(W,b-J.start,r),he=J.start-m}else{let W=f.pos-k;f.next();let M=[],R=[],V=g>=s?g:-1,G=0,Z=b;for(;f.pos>W;)V>=0&&f.id==V&&f.size>=0?(f.end<=Z-n&&(_(M,R,p,G,f.end,Z,V,N,H),G=M.length,Z=f.end),f.next()):S>2500?d(p,W,M,R):c(p,W,M,R,V,S+1);if(V>=0&&G>0&&G<M.length&&_(M,R,p,G,p,Z,V,N,H),M.reverse(),R.reverse(),V>-1&&G>0){let oe=x(K,H);Y=ie(K,M,R,0,M.length,0,b-p,oe,oe)}else Y=P(K,M,R,b-p,N-b,H)}a.push(Y),A.push(he)}function d(m,v,a,A){let y=[],S=0,g=-1;for(;f.pos>v;){let{id:p,start:b,end:k,size:N}=f;if(N>4)f.next();else{if(g>-1&&b<g)break;g<0&&(g=k-n),y.push(p,b,k),S++,f.next()}}if(S){let p=new Uint16Array(S*4),b=y[y.length-2];for(let k=y.length-3,N=0;k>=0;k-=3)p[N++]=y[k],p[N++]=y[k+1]-b,p[N++]=y[k+2]-b,p[N++]=N;a.push(new U(p,y[2]-b,r)),A.push(b-m)}}function x(m,v){return(a,A,y)=>{let S=0,g=a.length-1,p,b;if(g>=0&&(p=a[g])instanceof z){if(!g&&p.type==m&&p.length==y)return p;(b=p.prop(w.lookAhead))&&(S=A[g]+p.length+b)}return P(m,a,A,y,S,v)}}function _(m,v,a,A,y,S,g,p,b){let k=[],N=[];for(;m.length>A;)k.push(m.pop()),N.push(v.pop()+a-y);m.push(P(r.types[g],k,N,S-y,p-S,b)),v.push(y-a)}function P(m,v,a,A,y,S,g){if(S){let p=[w.contextHash,S];g=g?[p].concat(g):[p]}if(y>25){let p=[w.lookAhead,y];g=g?[p].concat(g):[p]}return new z(m,v,a,A,g)}function F(m,v){let a=f.fork(),A=0,y=0,S=0,g=a.end-n,p={size:0,start:0,skip:0};e:for(let b=a.pos-m;a.pos>b;){let k=a.size;if(a.id==v&&k>=0){p.size=A,p.start=y,p.skip=S,S+=4,A+=4,a.next();continue}let N=a.pos-k;if(k<0||N<b||a.start<g)break;let H=a.id>=s?4:0,K=a.start;for(a.next();a.pos>N;){if(a.size<0)if(a.size==-3)H+=4;else break e;else a.id>=s&&(H+=4);a.next()}y=K,A+=k,S+=H}return(v<0||A==m)&&(p.size=A,p.start=y,p.skip=S),p.size>4?p:void 0}function j(m,v,a){let{id:A,start:y,end:S,size:g}=f;if(f.next(),g>=0&&A<s){let p=a;if(g>4){let b=f.pos-(g-4);for(;f.pos>b;)a=j(m,v,a)}v[--a]=p,v[--a]=S-m,v[--a]=y-m,v[--a]=A}else g==-3?u=A:g==-4&&(o=A);return a}let E=[],I=[];for(;f.pos>0;)c(l.start||0,l.bufferStart||0,E,I,-1,0);let L=(e=l.length)!==null&&e!==void 0?e:E.length?I[0]+E[0].length:0;return new z(h[l.topID],E.reverse(),I.reverse(),L)}const ge=new WeakMap;function te(l,e){if(!l.isAnonymous||e instanceof U||e.type!=l)return 1;let t=ge.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=l||!(r instanceof z)){t=1;break}t+=te(l,r)}ge.set(e,t)}return t}function ie(l,e,t,r,n,i,s,f,h){let u=0;for(let _=r;_<n;_++)u+=te(l,e[_]);let o=Math.ceil(u*1.5/8),c=[],d=[];function x(_,P,F,j,E){for(let I=F;I<j;){let L=I,m=P[I],v=te(l,_[I]);for(I++;I<j;I++){let a=te(l,_[I]);if(v+a>=o)break;v+=a}if(I==L+1){if(v>o){let a=_[L];x(a.children,a.positions,0,a.children.length,P[L]+E);continue}c.push(_[L])}else{let a=P[I-1]+_[I-1].length-m;c.push(ie(l,_,P,L,I,m,a,null,h))}d.push(m+E-i)}}return x(e,t,r,n,0),(f||h)(c,d,s)}class Pe{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof D?this.setBuffer(e.context.buffer,e.index,t):e instanceof B&&this.map.set(e.tree,t)}get(e){return e instanceof D?this.getBuffer(e.context.buffer,e.index):e instanceof B?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class q{constructor(e,t,r,n,i=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(i?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let n=[new q(0,e.length,e,0,!1,r)];for(let i of t)i.to>e.length&&n.push(i);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],i=1,s=e.length?e[0]:null;for(let f=0,h=0,u=0;;f++){let o=f<t.length?t[f]:null,c=o?o.fromA:1e9;if(c-h>=r)for(;s&&s.from<c;){let d=s;if(h>=d.from||c<=d.to||u){let x=Math.max(d.from,h)-u,_=Math.min(d.to,c)-u;d=x>=_?null:new q(x,_,d.tree,d.offset+u,f>0,!!o)}if(d&&n.push(d),s.to>c)break;s=i<e.length?e[i++]:null}if(!o)break;h=o.toA,u=o.toA-o.toB}return n}}class Be{startParse(e,t,r){return typeof e=="string"&&(e=new ze(e)),r=r?r.length?r.map(n=>new T(n.from,n.to)):[new T(0,0)]:[new T(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let i=n.advance();if(i)return i}}}class ze{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function Ee(l){return(e,t,r,n)=>new Te(e,l,t,r,n)}class me{constructor(e,t,r,n,i){this.parser=e,this.parse=t,this.overlay=r,this.target=n,this.from=i}}function xe(l){if(!l.length||l.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(l))}class Me{constructor(e,t,r,n,i,s,f){this.parser=e,this.predicate=t,this.mounts=r,this.index=n,this.start=i,this.target=s,this.prev=f,this.depth=0,this.ranges=[]}}const se=new w({perNode:!0});class Te{constructor(e,t,r,n,i){this.nest=t,this.input=r,this.fragments=n,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new z(r.type,r.children,r.positions,r.length,r.propValues.concat([[se,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[w.mounted.id]=new $(t,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new je(this.fragments),t=null,r=null,n=new X(new B(this.baseTree,this.ranges[0].from,0,null),C.IncludeAnonymous|C.IgnoreMounts);e:for(let i,s;;){let f=!0,h;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)f=!1;else if(e.hasNode(n)){if(t){let u=t.mounts.find(o=>o.frag.from<=n.from&&o.frag.to>=n.to&&o.mount.overlay);if(u)for(let o of u.mount.overlay){let c=o.from+u.pos,d=o.to+u.pos;c>=n.from&&d<=n.to&&!t.ranges.some(x=>x.from<d&&x.to>c)&&t.ranges.push({from:c,to:d})}}f=!1}else if(r&&(s=Oe(r.ranges,n.from,n.to)))f=s!=2;else if(!n.type.isAnonymous&&(i=this.nest(n,this.input))&&(n.from<n.to||!i.overlay)){n.tree||Fe(n);let u=e.findMounts(n.from,i.parser);if(typeof i.overlay=="function")t=new Me(i.parser,i.overlay,u,this.inner.length,n.from,n.tree,t);else{let o=we(this.ranges,i.overlay||(n.from<n.to?[new T(n.from,n.to)]:[]));o.length&&xe(o),(o.length||!i.overlay)&&this.inner.push(new me(i.parser,o.length?i.parser.startParse(this.input,ve(u,o),o):i.parser.startParse(""),i.overlay?i.overlay.map(c=>new T(c.from-n.from,c.to-n.from)):null,n.tree,o.length?o[0].from:n.from)),i.overlay?o.length&&(r={ranges:o,depth:0,prev:r}):f=!1}}else if(t&&(h=t.predicate(n))&&(h===!0&&(h=new T(n.from,n.to)),h.from<h.to)){let u=t.ranges.length-1;u>=0&&t.ranges[u].to==h.from?t.ranges[u]={from:t.ranges[u].from,to:h.to}:t.ranges.push(h)}if(f&&n.firstChild())t&&t.depth++,r&&r.depth++;else for(;!n.nextSibling();){if(!n.parent())break e;if(t&&!--t.depth){let u=we(this.ranges,t.ranges);u.length&&(xe(u),this.inner.splice(t.index,0,new me(t.parser,t.parser.startParse(this.input,ve(t.mounts,u),u),t.ranges.map(o=>new T(o.from-t.start,o.to-t.start)),t.target,u[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function Oe(l,e,t){for(let r of l){if(r.from>=t)break;if(r.to>e)return r.from<=e&&r.to>=t?2:1}return 0}function ye(l,e,t,r,n,i){if(e<t){let s=l.buffer[e+1];r.push(l.slice(e,t,s)),n.push(s-i)}}function Fe(l){let{node:e}=l,t=[],r=e.context.buffer;do t.push(l.index),l.parent();while(!l.tree);let n=l.tree,i=n.children.indexOf(r),s=n.children[i],f=s.buffer,h=[i];function u(o,c,d,x,_,P){let F=t[P],j=[],E=[];ye(s,o,F,j,E,x);let I=f[F+1],L=f[F+2];h.push(j.length);let m=P?u(F+4,f[F+3],s.set.types[f[F]],I,L-I,P-1):e.toTree();return j.push(m),E.push(I-x),ye(s,f[F+3],c,j,E,x),new z(d,j,E,_)}n.children[i]=u(0,f.length,O.none,0,s.length,t.length-1);for(let o of h){let c=l.tree.children[o],d=l.tree.positions[o];l.yield(new B(c,d+l.from,o,l._tree))}}class be{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(C.IncludeAnonymous|C.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)t.to>=e&&t.enter(r,1,C.IgnoreOverlays|C.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof z)t=t.children[0];else break}return!1}}class je{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(t=r.tree.prop(se))!==null&&t!==void 0?t:r.to,this.inner=new be(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(se))!==null&&e!==void 0?e:t.to,this.inner=new be(t.tree,-t.offset)}}findMounts(e,t){var r;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let i=this.inner.cursor.node;i;i=i.parent){let s=(r=i.tree)===null||r===void 0?void 0:r.prop(w.mounted);if(s&&s.parser==t)for(let f=this.fragI;f<this.fragments.length;f++){let h=this.fragments[f];if(h.from>=i.to)break;h.tree==this.curFrag.tree&&n.push({frag:h,pos:i.from-h.offset,mount:s})}}}return n}}function we(l,e){let t=null,r=e;for(let n=1,i=0;n<l.length;n++){let s=l[n-1].to,f=l[n].from;for(;i<r.length;i++){let h=r[i];if(h.from>=f)break;h.to<=s||(t||(r=t=e.slice()),h.from<s?(t[i]=new T(h.from,s),h.to>f&&t.splice(i+1,0,new T(f,h.to))):h.to>f?t[i--]=new T(f,h.to):t.splice(i--,1))}}return r}function Re(l,e,t,r){let n=0,i=0,s=!1,f=!1,h=-1e9,u=[];for(;;){let o=n==l.length?1e9:s?l[n].to:l[n].from,c=i==e.length?1e9:f?e[i].to:e[i].from;if(s!=f){let d=Math.max(h,t),x=Math.min(o,c,r);d<x&&u.push(new T(d,x))}if(h=Math.min(o,c),h==1e9)break;o==h&&(s?(s=!1,n++):s=!0),c==h&&(f?(f=!1,i++):f=!0)}return u}function ve(l,e){let t=[];for(let{pos:r,mount:n,frag:i}of l){let s=r+(n.overlay?n.overlay[0].from:0),f=s+n.tree.length,h=Math.max(i.from,s),u=Math.min(i.to,f);if(n.overlay){let o=n.overlay.map(d=>new T(d.from+r,d.to+r)),c=Re(e,o,h,u);for(let d=0,x=h;;d++){let _=d==c.length,P=_?u:c[d].from;if(P>x&&t.push(new q(x,P,n.tree,-s,i.from>=x||i.openStart,i.to<=P||i.openEnd)),_)break;x=c[d].to}}else t.push(new q(h,u,n.tree,-s,i.from>=s||i.openStart,i.to<=f||i.openEnd))}return t}export{ke as DefaultBufferLength,C as IterMode,$ as MountedTree,w as NodeProp,le as NodeSet,O as NodeType,Pe as NodeWeakMap,Be as Parser,z as Tree,U as TreeBuffer,X as TreeCursor,q as TreeFragment,Ee as parseMixed};

© 2025 Cubjrnet7