PageSourceSearch

https://survivalbrasil.org/assets/@lezer--common-e3b0a767.js

js survivalbrasil.org collected 2026-09-25 18:52:31 UTC 28,754 bytes, 4 lines download raw bytes

vendor: 9,136 bytes, lines 1-3
1// @lezer/[email protected] downloaded from https://ga.jspm.io/npm:@lezer/[email protected]/dist/index.js
2
3const e=1024;let t=0;class Range{constructor(e,t){this.from=e,this.to=t}}class NodeProp{constructor(e={}){this.id=t++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=NodeType.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}NodeProp.closedBy=new NodeProp({deserialize:e=>e.split(` `)}),NodeProp.openedBy=new NodeProp({deserialize:e=>e.split(` `)}),NodeProp.group=new NodeProp({deserialize:e=>e.split(` `)}),NodeProp.isolate=new NodeProp({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),NodeProp.contextHash=new NodeProp({perNode:!0}),NodeProp.lookAhead=new NodeProp({perNode:!0}),NodeProp.mounted=new NodeProp({perNode:!0});class MountedTree{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[NodeProp.mounted.id]}}const n=Object.create(null);class NodeType{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):n,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new NodeType(e.name||``,t,e.id,r);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);t[n[0].id]=n[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(NodeProp.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 r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(NodeProp.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}NodeType.none=new NodeType(``,Object.create(null),0,8);class NodeSet{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw 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 r=null;for(let t of e){let e=t(n);if(e){r||=Object.assign({},n.props);let t=e[1],i=e[0];i.combine&&i.id in r&&(t=i.combine(r[i.id],t)),r[i.id]=t}}t.push(r?new NodeType(n.name,r,n.id,n.flags):n)}return new NodeSet(t)}}const r=/* @__PURE__ */ new WeakMap,i=/* @__PURE__ */ new WeakMap;var a;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(a||={});class Tree{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=MountedTree.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.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 TreeCursor(this.topNode,e)}cursorAt(e,t=0,n=0){let i=new TreeCursor(r.get(this)||this.topNode);return i.moveTo(e,t),r.set(this,i._tree),i}get topNode(){return new TreeNode(this,0,0,null)}resolve(e,t=0){let n=s(r.get(this)||this.topNode,e,t,!1);return r.set(this,n),n}resolveInner(e,t=0){let n=s(i.get(this)||this.topNode,e,t,!0);return i.set(this,n),n}resolveStack(e,t=0){return d(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&a.IncludeAnonymous)>0;for(let e=this.cursor(o|a.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!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:g(NodeType.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new Tree(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new Tree(NodeType.none,e,t,n)))}static build(e){return p(e)}}Tree.empty=new Tree(NodeType.none,[],[],0);class FlatBufferCursor{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 FlatBufferCursor(this.buffer,this.index)}}class TreeBuffer{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return NodeType.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],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,s=-1;for(let c=e;c!=t&&!(o(i,r,a[c+1],a[c+2])&&(s=c,n>0));c=a[c+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),a=0;for(let o=e,s=0;o<t;){i[s++]=r[o++],i[s++]=r[o++]-n;let t=i[s++]=r[o++]-n;i[s++]=r[o++]-e,a=Math.max(a,t)}return new TreeBuffer(i,a,this.set)}}function o(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function s(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof TreeNode&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:a.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof TreeNode&&r.index<0&&(i=a.enter(t,n,o))?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class BaseNode{cursor(e=0){return new TreeCursor(this,e)}getChild(e,t=null,n=null){let r=c(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return c(this,e,t,n)}resolve(e,t=0){return s(this,e,t,!1)}resolveInner(e,t=0){return s(this,e,t,!0)}matchContext(e){return l(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class TreeNode extends BaseNode{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}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,r,i=0){for(let s=this;;){for(let{children:c,positions:l}=s._tree,u=t>0?c.length:-1;e!=u;e+=t){let u=c[e],d=l[e]+s.from,p;if(!(!(i&a.EnterBracketed&&u instanceof Tree&&(p=MountedTree.get(u))&&!p.overlay&&p.bracketed&&n>=d&&n<=d+u.length)&&!o(r,n,d,d+u.length))){if(u instanceof TreeBuffer){if(i&a.ExcludeBuffers)continue;let o=u.findChild(0,u.buffer.length,t,n-d,r);if(o>-1)return new BufferNode(new BufferContext(s,u,e,d),null,o)}else if(i&a.IncludeAnonymous||!u.type.isAnonymous||f(u)){let o;if(!(i&a.IgnoreMounts)&&(o=MountedTree.get(u))&&!o.overlay)return new TreeNode(o.tree,d,e,s);let c=new TreeNode(u,d,e,s);return i&a.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(t<0?u.children.length-1:0,t,n,r,i)}}}if(i&a.IncludeAnonymous||!s.type.isAnonymous||(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&a.IgnoreOverlays)&&(r=MountedTree.get(this._tree))&&r.overlay){let i=e-this.from,o=n&a.EnterBracketed&&r.bracketed;for(let{from:e,to:n}of r.overlay)if((t>0||o?e<=i:e<i)&&(t<0||o?n>=i:n>i))return new TreeNode(r.tree,r.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 c(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;
vendor: 3,223 bytes, line 3
3if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function l(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class BufferContext{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class BufferNode extends BaseNode{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:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new BufferNode(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)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&a.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new BufferNode(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 BufferNode(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 BufferNode(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new Tree(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function u(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof TreeNode&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new StackIterator(i,n)}class StackIterator{constructor(e,t){this.heads=e,this.node=t}get next(){return u(this.heads)}}function d(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof TreeNode?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=MountedTree.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new TreeNode(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(s(o,t,n,!1))}}return i?u(i):r}class TreeCursor{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&~a.EnterBracketed,e instanceof TreeNode)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;
vendor: 16,308 bytes, line 3
3for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof TreeNode?(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:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);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,n=this.mode){return this.buffer?n&a.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&a.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&a.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 e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}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:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else ({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&a.IncludeAnonymous||e instanceof TreeBuffer||!e.type.isAnonymous||f(e))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)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new BufferNode(this.buffer,t,this.stack[e]);return this.bufferNode=new BufferNode(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return l(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return l(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}}function f(e){return e.children.some(e=>e instanceof TreeBuffer||!e.type.isAnonymous||f(e))}function p(t){var n;let{buffer:r,nodeSet:i,maxBufferLength:a=e,reused:o=[],minRepeatType:s=i.types.length}=t,c=Array.isArray(r)?new FlatBufferCursor(r,r.length):r,l=i.types,u=0,d=0;function f(e,t,n,r,b,x){let{id:S,start:C,end:w,size:T}=c,E=d,D=u;if(T<0)if(c.next(),T==-1){let t=o[S];n.push(t),r.push(C-e);return}else if(T==-3){u=S;return}else if(T==-4){d=S;return}else throw RangeError(`Unrecognized record size: ${T}`);let O=l[S],k,A,j=C-e;if(w-C<=a&&(A=v(c.pos-t,b))){let t=new Uint16Array(A.size-A.skip),n=c.pos-A.size,r=t.length;for(;c.pos>n;)r=y(A.start,t,r);k=new TreeBuffer(t,w-A.start,i),j=A.start-e}else{let e=c.pos-T;c.next();let t=[],n=[],r=S>=s?S:-1,i=0,o=w;for(;c.pos>e;)r>=0&&c.id==r&&c.size>=0?(c.end<=o-a&&(h(t,n,C,i,c.end,o,r,E,D),i=t.length,o=c.end),c.next()):x>2500?p(C,e,t,n):f(C,e,t,n,r,x+1);if(r>=0&&i>0&&i<t.length&&h(t,n,C,i,C,o,r,E,D),t.reverse(),n.reverse(),r>-1&&i>0){let e=m(O,D);k=g(O,t,n,0,t.length,0,w-C,e,e)}else k=_(O,t,n,w-C,E-w,D)}n.push(k),r.push(j)}function p(e,t,n,r){let o=[],s=0,l=-1;for(;c.pos>t;){let{id:e,start:t,end:n,size:r}=c;if(r>4)c.next();else if(l>-1&&t<l)break;else l<0&&(l=n-a),o.push(e,t,n),s++,c.next()}if(s){let t=new Uint16Array(s*4),a=o[o.length-2];for(let e=o.length-3,n=0;e>=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-a,t[n++]=o[e+2]-a,t[n++]=n;n.push(new TreeBuffer(t,o[2]-a,i)),r.push(a-e)}}function m(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof Tree){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(NodeProp.lookAhead))&&(a=r[o]+s.length+c)}return _(e,n,r,i,a,t)}}function h(e,t,n,r,a,o,s,c,l){let u=[],d=[];for(;e.length>r;)u.push(e.pop()),d.push(t.pop()+n-a);e.push(_(i.types[s],u,d,o-a,c-o,l)),t.push(a-n)}function _(e,t,n,r,i,a,o){if(a){let e=[NodeProp.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[NodeProp.lookAhead,i];o=o?[e].concat(o):[e]}return new Tree(e,t,n,r,o)}function v(e,t){let n=c.fork(),r=0,i=0,o=0,l=n.end-a,u={size:0,start:0,skip:0};scan:for(let a=n.pos-e;n.pos>a;){let e=n.size;if(n.id==t&&e>=0){u.size=r,u.start=i,u.skip=o,o+=4,r+=4,n.next();continue}let c=n.pos-e;if(e<0||c<a||n.start<l)break;let d=n.id>=s?4:0,f=n.start;for(n.next();n.pos>c;){if(n.size<0)if(n.size==-3||n.size==-4)d+=4;else break scan;else n.id>=s&&(d+=4);n.next()}i=f,r+=e,o+=d}return(t<0||r==e)&&(u.size=r,u.start=i,u.skip=o),u.size>4?u:void 0}function y(e,t,n){let{id:r,start:i,end:a,size:o}=c;if(c.next(),o>=0&&r<s){let s=n;if(o>4){let r=c.pos-(o-4);for(;c.pos>r;)n=y(e,t,n)}t[--n]=s,t[--n]=a-e,t[--n]=i-e,t[--n]=r}else o==-3?u=r:o==-4&&(d=r);return n}let b=[],x=[];for(;c.pos>0;)f(t.start||0,t.bufferStart||0,b,x,-1,0);let S=(n=t.length)??(b.length?x[0]+b[0].length:0);return new Tree(l[t.topID],b.reverse(),x.reverse(),S)}const m=/* @__PURE__ */ new WeakMap;function h(e,t){if(!e.isAnonymous||t instanceof TreeBuffer||t.type!=e)return 1;let n=m.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Tree)){n=1;break}n+=h(e,r)}m.set(t,n)}return n}function g(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=h(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=h(e,t[s]);for(s++;s<i;s++){let n=h(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(g(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}class NodeWeakMap{constructor(){this.map=/* @__PURE__ */ new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=/* @__PURE__ */ new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof BufferNode?this.setBuffer(e.context.buffer,e.index,t):e instanceof TreeNode&&this.map.set(e.tree,t)}get(e){return e instanceof BufferNode?this.getBuffer(e.context.buffer,e.index):e instanceof TreeNode?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 TreeFragment{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new TreeFragment(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,a=e.length?e[0]:null;for(let o=0,s=0,c=0;;o++){let l=o<t.length?t[o]:null,u=l?l.fromA:1e9;if(u-s>=n)for(;a&&a.from<u;){let t=a;if(s>=t.from||u<=t.to||c){let e=Math.max(t.from,s)-c,n=Math.min(t.to,u)-c;t=e>=n?null:new TreeFragment(e,n,t.tree,t.offset+c,o>0,!!l)}if(t&&r.push(t),a.to>u)break;a=i<e.length?e[i++]:null}if(!l)break;s=l.toA,c=l.toA-l.toB}return r}}class Parser{startParse(e,t,n){return typeof e==`string`&&(e=new StringInput(e)),n=n?n.length?n.map(e=>new Range(e.from,e.to)):[new Range(0,0)]:[new Range(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class StringInput{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 _(e){return(t,n,r,i)=>new MixedParse(t,e,n,r,i)}class InnerParse{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}}function v(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}class ActiveOverlay{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}}const y=new NodeProp({perNode:!0});class MixedParse{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new Tree(e.type,e.children,e.positions,e.length,e.propValues.concat([[y,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[NodeProp.mounted.id]=new MountedTree(t,e.overlay,e.parser,e.bracketed),e.target.props=n}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 FragmentCursor(this.fragments),t=null,n=null,r=new TreeCursor(new TreeNode(this.baseTree,this.ranges[0].from,0,null),a.IncludeAnonymous|a.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=b(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(S(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new ActiveOverlay(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=C(this.ranges,i.overlay||(r.from<r.to?[new Range(r.from,r.to)]:[]));e.length&&v(e),(e.length||!i.overlay)&&this.inner.push(new InnerParse(i.parser,e.length?i.parser.startParse(this.input,T(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new Range(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new Range(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=C(this.ranges,t.ranges);e.length&&(v(e),this.inner.splice(t.index,0,new InnerParse(t.parser,t.parser.startParse(this.input,T(t.mounts,e),e),t.ranges.map(e=>new Range(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function b(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function x(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function S(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];x(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),x(o,s[f+3],r,p,m,a),new Tree(i,p,m,u)}i.children[a]=l(0,s.length,NodeType.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new TreeNode(n,r+e.from,t,e._tree))}}class StructureCursor{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(a.IncludeAnonymous|a.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=e&&t.enter(n,1,a.IgnoreOverlays|a.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}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 Tree)t=t.children[0];else break}return!1}}class FragmentCursor{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(y))??n.to,this.inner=new StructureCursor(n.tree,-n.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(y))??t.to,this.inner=new StructureCursor(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let i=(n=e.tree)?.prop(NodeProp.mounted);if(i&&i.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let n=this.fragments[t];if(n.from>=e.to)break;n.tree==this.curFrag.tree&&r.push({frag:n,pos:e.from-n.offset,mount:i})}}}return r}}function C(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new Range(e.from,o),e.to>s&&n.splice(a+1,0,new Range(s,e.to))):e.to>s?n[a--]=new Range(s,e.to):n.splice(a--,1))}}return r}function w(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new Range(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function T(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=w(t,i.overlay.map(e=>new Range(e.from+r,e.to+r)),s,c);for(let t=0,r=s;;t++){let s=t==o.length,l=s?c:o[t].from;if(l>r&&n.push(new TreeFragment(r,l,i.tree,-e,a.from>=r||a.openStart,a.to<=l||a.openEnd)),s)break;r=o[t].to}}else n.push(new TreeFragment(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}export{e as DefaultBufferLength,a as IterMode,MountedTree,NodeProp,NodeSet,
3NodeType,NodeWeakMap,Parser,Tree,TreeBuffer,TreeCursor,TreeFragment,_ as parseMixed};
4

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.