"use strict";(self.webpackChunkgrafana_metricsdrilldown_app=self.webpackChunkgrafana_metricsdrilldown_app||[]).push([[782],{782:(t,e,s)=>{s.d(e,{U1:()=>A});var i=s(7203);class r{constructor(t,e,s,i,r,n,h,o,l,a=0,u){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=r,this.score=n,this.buffer=h,this.bufferBase=o,this.curContext=l,this.lookAhead=a,this.parent=u}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new r(t,[],e,s,s,0,[],0,i?new n(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=65535&t,{parser:r}=this.p,n=this.reducePos=2e3&&!(null===(e=this.p.parser.nodeSet.types[i])||void 0===e?void 0:e.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=a):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(i,l)}storeNode(t,e,s,i=4,r=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[i-4]&&t.buffer[i-1]>-1){if(e==s)return;if(t.buffer[i-2]>=e)return void(t.buffer[i-2]=s)}}if(r&&this.pos!=s){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4]){let t=!1;for(let e=r;e>0&&this.buffer[e-2]>s;e-=4)if(this.buffer[e-1]>=0){t=!0;break}if(t)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}else this.buffer.push(t,e,s,i)}shift(t,e,s,i){if(131072&t)this.pushState(65535&t,this.pos);else if(262144&t)this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4);else{let r=t,{parser:n}=this.p;(i>this.pos||e<=n.maxNode)&&(this.pos=i,n.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,s),this.shiftContext(e,s),e<=n.maxNode&&this.buffer.push(e,s,i,4)}}apply(t,e,s,i){65536&t?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new r(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new h(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==s)return!1;if(!(65536&s))return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let s=[];for(let i,r=0;r1&e&&t==i)||s.push(e[t],i)}e=s}let s=[];for(let t=0;t>19,i=65535&e,r=this.stack.length-3*s;if(r<0||t.getGoto(this.stack[r],i,!1)<0){let t=this.findForcedReduction();if(null==t)return!1;e=t}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,r)=>{if(!e.includes(i))return e.push(i),t.allActions(i,e=>{if(393216&e);else if(65536&e){let s=(e>>19)-r;if(s>1){let i=65535&e,r=this.stack.length-3*s;if(r>=0&&t.getGoto(this.stack[r],i,!1)>=0)return s<<19|65536|i}}else{let t=s(e,r+1);if(null!=t)return t}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class n{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class h{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,s=t>>19;0==s?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(s-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class o{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new o(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}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]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new o(this.stack,this.pos,this.index)}}function l(t,e=Uint16Array){if("string"!=typeof t)return t;let s=null;for(let i=0,r=0;i=92&&e--,e>=34&&e--;let r=e-32;if(r>=46&&(r-=46,s=!0),n+=r,s)break;n*=46}s?s[r++]=n:s=new e(n)}return s}class a{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const u=new a;class f{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=u,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,r=this.pos+t;for(;rs.to:r>=s.to;){if(i==this.ranges.length-1)return null;let t=this.ranges[++i];r+=t.from-s.to,s=t}return r}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,s,i=this.chunkOff+t;if(i>=0&&i=this.chunk2Pos&&ei.to&&(this.chunk2=this.chunk2.slice(0,i.to-e)),s=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),s}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(null==s||s=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=u,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class c{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;p(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}c.prototype.contextual=c.prototype.fallback=c.prototype.extend=!1;c.prototype.fallback=c.prototype.extend=!1;function p(t,e,s,i,r,n){let h=0,o=1<0){let s=t[i];if(l.allows(s)&&(-1==e.token.value||e.token.value==s||g(s,e.token.value,r,n))){e.acceptToken(s);break}}let i=e.next,a=0,u=t[h+2];if(!(e.next<0&&u>a&&65535==t[s+3*u-3])){for(;a>1,n=s+r+(r<<1),o=t[n],l=t[n+1]||65536;if(i=l)){h=t[n+2],e.advance();continue t}a=r+1}}break}h=t[s+3*u-1]}}function d(t,e,s){for(let i,r=e;65535!=(i=t[r]);r++)if(i==s)return r-e;return-1}function g(t,e,s,i){let r=d(s,i,e);return r<0||d(s,i,t)e)&&!r.type.isError)return s<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(s<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return s<0?0:t.length}}class b{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?m(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?m(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=h,null;if(n instanceof i.PH){if(h==t){if(h=Math.max(this.safeFrom,t)&&(this.trees.push(n),this.start.push(h),this.index.push(0))}else this.index[e]++,this.nextStart=h+n.length}}}class y{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(t=>new a)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:r}=i,n=i.stateSlot(t.state,3),h=t.curContext?t.curContext.hash:0,o=0;for(let i=0;ia.end+25&&(o=Math.max(a.lookAhead,o)),0!=a.value)){let i=e;if(a.extended>-1&&(e=this.addActions(t,a.extended,a.end,e)),e=this.addActions(t,a.value,a.end,e),!l.extend&&(s=a,e>i))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),s||t.pos!=this.stream.end||(s=new a,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new a,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:e}=s.p;for(let i=0;i=0&&s.p.parser.dialect.allows(r>>1)){1&r?t.extended=r>>1:t.value=r>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let e=0;e4*t.bufferLength?new b(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,s=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==s.length){let[t]=s;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let n=0;ni)r.push(h);else{if(this.advanceStack(h,r,s))continue;{t||(t=[],e=[]),t.push(h);let s=this.tokens.getMainToken(h);e.push(s.value,s.end)}}break}}if(!r.length){let e=t&&function(t){let e=null;for(let s of t){let t=s.p.stoppedAt;(s.pos==s.p.stream.end||null!=t&&s.pos>t)&&s.p.parser.stateFlag(s.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,r);if(s)return this.stackToTree(s.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(r.length>t)for(r.sort((t,e)=>e.score-t.score);r.length>t;)r.pop();r.some(t=>t.reducePos>i)&&this.recovering--}else if(r.length>1){t:for(let t=0;t500&&i.buffer.length>500){if(!((e.score-i.score||e.buffer.length-i.buffer.length)>0)){r.splice(t--,1);continue t}r.splice(s--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let t=1;tthis.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,s=e?t.curContext.hash:0;for(let h=this.fragments.nodeAt(r);h;){let r=this.parser.nodeSet.types[h.type.id]==h.type?n.getGoto(t.state,h.type.id):-1;if(r>-1&&h.length&&(!e||(h.prop(i.uY.contextHash)||0)==s))return t.useNode(h,r),!0;if(!(h instanceof i.PH)||0==h.children.length||h.positions[0]>0)break;let o=h.children[0];if(!(o instanceof i.PH&&0==h.positions[0]))break;h=o}}let h=n.stateSlot(t.state,4);if(h>0)return t.reduce(h),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let i=0;ir?e.push(u):s.push(u)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return v(t,e),!0}}runRecovery(t,e,s){let i=null,r=!1;for(let n=0;n ":"";if(h.deadEnd){if(r)continue;if(r=!0,h.restart(),this.advanceFully(h,s))continue}let u=h.split(),f=a;for(let t=0;u.forceReduce()&&t<10;t++){if(this.advanceFully(u,s))break;k&&(f=this.stackID(u)+" -> ")}for(let t of h.recoverByInsert(o))this.advanceFully(t,s);this.stream.end>h.pos?(l==h.pos&&(l++,o=0),h.recoverByDelete(o,l),v(h,s)):(!i||i.scoret.topRules[e][1]),r=[];for(let t=0;t=0)n(i,t,e[s++]);else{let r=e[s+-i];for(let h=-i;h>0;h--)n(e[s++],t,r);s++}}}this.nodeSet=new i.fI(e.map((e,n)=>i.Z6.define({name:n>=this.minRepeatTerm?void 0:e,id:n,props:r[n],top:s.indexOf(n)>-1,error:0==n,skipped:t.skippedNodes&&t.skippedNodes.indexOf(n)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=i.cF;let h=l(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new c(h,t):t),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new S(this,t,e,s);for(let r of this.wrappers)i=r(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let r=i[e+1];;){let e=i[r++],n=1&e,h=i[r++];if(n&&s)return h;for(let s=r+(e>>1);r0}validAction(t,e){return!!this.allActions(t,t=>t==e||null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let s=this.stateSlot(t,1);null==i;s+=3){if(65535==this.data[s]){if(1!=this.data[s+1])break;s=C(this.data,s+2)}i=e(C(this.data,s+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(65535==this.data[s]){if(1!=this.data[s+1])break;s=C(this.data,s+2)}if(!(1&this.data[s+2])){let t=this.data[s+1];e.some((e,s)=>1&s&&e==t)||e.push(this.data[s],t)}}return e}configure(t){let e=Object.assign(Object.create(A.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(e=>{let s=t.tokenizers.find(t=>t.from==e);return s?s.to:e})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let r=t.specializers.find(t=>t.from==s.external);if(!r)return s;let n=Object.assign(Object.assign({},s),{external:r.to});return e.specializers[i]=P(n),n})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let i of t.split(" ")){let t=e.indexOf(i);t>=0&&(s[t]=!0)}let i=null;for(let t=0;tt.external(s,i)<<1|e}return t.get}},7203:(t,e,s)=>{s.d(e,{PH:()=>d,Qj:()=>p,Z6:()=>a,cF:()=>i,fI:()=>u,iX:()=>R,uY:()=>h});const i=1024;let r=0;class n{constructor(t,e){this.from=t,this.to=e}}class h{constructor(t={}){this.id=r++,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=a.match(t)),e=>{let s=t(e);return void 0===s?null:[this,s]}}}h.closedBy=new h({deserialize:t=>t.split(" ")}),h.openedBy=new h({deserialize:t=>t.split(" ")}),h.group=new h({deserialize:t=>t.split(" ")}),h.isolate=new h({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),h.contextHash=new h({perNode:!0}),h.lookAhead=new h({perNode:!0}),h.mounted=new h({perNode:!0});class o{constructor(t,e,s){this.tree=t,this.overlay=e,this.parser=s}static get(t){return t&&t.props&&t.props[h.mounted.id]}}const l=Object.create(null);class a{constructor(t,e,s,i=0){this.name=t,this.props=e,this.id=s,this.flags=i}static define(t){let e=t.props&&t.props.length?Object.create(null):l,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new a(t.name||"",e,t.id,s);if(t.props)for(let s of t.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[s[0].id]=s[1]}return i}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(h.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let s in t)for(let i of s.split(" "))e[i]=t[s];return t=>{for(let s=t.prop(h.group),i=-1;i<(s?s.length:0);i++){let r=e[i<0?t.name:s[i]];if(r)return r}}}}a.none=new a("",Object.create(null),0,8);class u{constructor(t){this.types=t;for(let e=0;e=e){let h=new y(n.tree,n.overlay[0].from+t.from,-1,t);(r||(r=[i])).push(m(h,e,s,!1))}}return r?C(r):i}(this,t,e)}iterate(t){let{enter:e,leave:s,from:i=0,to:r=this.length}=t,n=t.mode||0,h=(n&p.IncludeAnonymous)>0;for(let t=this.cursor(n|p.IncludeAnonymous);;){let n=!1;if(t.from<=r&&t.to>=i&&(!h&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;n=!0}for(;n&&s&&(h||!t.type.isAnonymous)&&s(t),!t.nextSibling();){if(!t.parent())return;n=!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:B(a.none,this.children,this.positions,0,this.children.length,0,this.length,(t,e,s)=>new d(this.type,t,e,s,this.propValues),t.makeTree||((t,e,s)=>new d(a.none,t,e,s)))}static build(t){return function(t){var e;let{buffer:s,nodeSet:r,maxBufferLength:n=i,reused:o=[],minRepeatType:l=r.types.length}=t,a=Array.isArray(s)?new g(s,s.length):s,u=r.types,f=0,c=0;function p(t,e,s,i,h,d){let{id:g,start:w,end:A,size:C}=a,P=c,N=f;for(;C<0;){if(a.next(),-1==C){let e=o[g];return s.push(e),void i.push(w-t)}if(-3==C)return void(f=g);if(-4==C)return void(c=g);throw new RangeError(`Unrecognized record size: ${C}`)}let _,z,T=u[g],R=w-t;if(A-w<=n&&(z=S(a.pos-e,h))){let e=new Uint16Array(z.size-z.skip),s=a.pos-z.size,i=e.length;for(;a.pos>s;)i=v(z.start,e,i);_=new k(e,A-z.start,r),R=z.start-t}else{let t=a.pos-C;a.next();let e=[],s=[],i=g>=l?g:-1,r=0,h=A;for(;a.pos>t;)i>=0&&a.id==i&&a.size>=0?(a.end<=h-n&&(b(e,s,w,r,a.end,h,i,P,N),r=e.length,h=a.end),a.next()):d>2500?x(w,t,e,s):p(w,t,e,s,i,d+1);if(i>=0&&r>0&&r-1&&r>0){let t=m(T,N);_=B(T,e,s,0,e.length,0,A-w,t,t)}else _=y(T,e,s,A-w,P-A,N)}s.push(_),i.push(R)}function x(t,e,s,i){let h=[],o=0,l=-1;for(;a.pos>e;){let{id:t,start:e,end:s,size:i}=a;if(i>4)a.next();else{if(l>-1&&e=0;t-=3)e[s++]=h[t],e[s++]=h[t+1]-n,e[s++]=h[t+2]-n,e[s++]=s;s.push(new k(e,h[2]-n,r)),i.push(n-t)}}function m(t,e){return(s,i,r)=>{let n,o,l=0,a=s.length-1;if(a>=0&&(n=s[a])instanceof d){if(!a&&n.type==t&&n.length==r)return n;(o=n.prop(h.lookAhead))&&(l=i[a]+n.length+o)}return y(t,s,i,r,l,e)}}function b(t,e,s,i,n,h,o,l,a){let u=[],f=[];for(;t.length>i;)u.push(t.pop()),f.push(e.pop()+s-n);t.push(y(r.types[o],u,f,h-n,l-h,a)),e.push(n-s)}function y(t,e,s,i,r,n,o){if(n){let t=[h.contextHash,n];o=o?[t].concat(o):[t]}if(r>25){let t=[h.lookAhead,r];o=o?[t].concat(o):[t]}return new d(t,e,s,i,o)}function S(t,e){let s=a.fork(),i=0,r=0,h=0,o=s.end-n,u={size:0,start:0,skip:0};t:for(let n=s.pos-t;s.pos>n;){let t=s.size;if(s.id==e&&t>=0){u.size=i,u.start=r,u.skip=h,h+=4,i+=4,s.next();continue}let a=s.pos-t;if(t<0||a=l?4:0,c=s.start;for(s.next();s.pos>a;){if(s.size<0){if(-3!=s.size)break t;f+=4}else s.id>=l&&(f+=4);s.next()}r=c,i+=t,h+=f}return(e<0||i==t)&&(u.size=i,u.start=r,u.skip=h),u.size>4?u:void 0}function v(t,e,s){let{id:i,start:r,end:n,size:h}=a;if(a.next(),h>=0&&i4){let i=a.pos-(h-4);for(;a.pos>i;)s=v(t,e,s)}e[--s]=o,e[--s]=n-t,e[--s]=r-t,e[--s]=i}else-3==h?f=i:-4==h&&(c=i);return s}let w=[],A=[];for(;a.pos>0;)p(t.start||0,t.bufferStart||0,w,A,-1,0);let C=null!==(e=t.length)&&void 0!==e?e:w.length?A[0]+w[0].length:0;return new d(u[t.topID],w.reverse(),A.reverse(),C)}(t)}}d.empty=new d(a.none,[],[],0);class g{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 g(this.buffer,this.index)}}class k{constructor(t,e,s){this.buffer=t,this.length=e,this.set=s}get type(){return a.none}toString(){let t=[];for(let e=0;e0));o=n[o+3]);return h}slice(t,e,s){let i=this.buffer,r=new Uint16Array(e-t),n=0;for(let h=t,o=0;h=e&&se;case 1:return s<=e&&i>e;case 2:return i>e;case 4:return!0}}function m(t,e,s,i){for(var r;t.from==t.to||(s<1?t.from>=e:t.from>e)||(s>-1?t.to<=e:t.to0?h.length:-1;t!=a;t+=e){let a=h[t],u=l[t]+n.from;if(x(i,s,u,u+a.length))if(a instanceof k){if(r&p.ExcludeBuffers)continue;let h=a.findChild(0,a.buffer.length,e,s-u,i);if(h>-1)return new A(new w(n,a,t,u),null,h)}else if(r&p.IncludeAnonymous||!a.type.isAnonymous||_(a)){let h;if(!(r&p.IgnoreMounts)&&(h=o.get(a))&&!h.overlay)return new y(h.tree,u,t,n);let l=new y(a,u,t,n);return r&p.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,s,i)}}if(r&p.IncludeAnonymous||!n.type.isAnonymous)return null;if(t=n.index>=0?n.index+e:e<0?-1:n._parent._tree.children.length,n=n._parent,!n)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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,s=0){let i;if(!(s&p.IgnoreOverlays)&&(i=o.get(this._tree))&&i.overlay){let s=t-this.from;for(let{from:t,to:r}of i.overlay)if((e>0?t<=s:t=s:r>s))return new y(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,s)}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 tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function S(t,e,s,i){let r=t.cursor(),n=[];if(!r.firstChild())return n;if(null!=s)for(let t=!1;!t;)if(t=r.type.is(s),!r.nextSibling())return n;for(;;){if(null!=i&&r.type.is(i))return n;if(r.type.is(e)&&n.push(r.node),!r.nextSibling())return null==i?n:[]}}function v(t,e,s=e.length-1){for(let i=t;s>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[s]&&e[s]!=i.name)return!1;s--}}return!0}class w{constructor(t,e,s,i){this.parent=t,this.buffer=e,this.index=s,this.start=i}}class A extends b{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(t,e,s){super(),this.context=t,this._parent=e,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,e,s){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.context.start,s);return r<0?null:new A(this.context,this,r)}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,s=0){if(s&p.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new A(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 A(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 A(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:s}=this.context,i=this.index+4,r=s.buffer[this.index+3];if(r>i){let n=s.buffer[this.index+1];t.push(s.slice(i,r,n)),e.push(0)}return new d(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function C(t){if(!t.length)return null;let e=0,s=t[0];for(let i=1;is.from||r.to0){if(this.index-1)for(let i=e+t,r=t<0?-1:s._tree.children.length;i!=r;i+=t){let t=s._tree.children[i];if(this.mode&p.IncludeAnonymous||t instanceof k||!t.type.isAnonymous||_(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=0;){for(let n=t;n;n=n._parent)if(n.index==i){if(i==this.index)return n;e=n,s=r+1;break t}i=this.stack[--r]}for(let t=s;t=0;r--){if(r<0)return v(this._tree,t,i);let n=s[e.buffer[this.stack[r]]];if(!n.isAnonymous){if(t[i]&&t[i]!=n.name)return!1;i--}}return!0}}function _(t){return t.children.some(t=>t instanceof k||!t.type.isAnonymous||_(t))}const z=new WeakMap;function T(t,e){if(!t.isAnonymous||e instanceof k||e.type!=t)return 1;let s=z.get(e);if(null==s){s=1;for(let i of e.children){if(i.type!=t||!(i instanceof d)){s=1;break}s+=T(t,i)}z.set(e,s)}return s}function B(t,e,s,i,r,n,h,o,l){let a=0;for(let s=i;s=u)break;d+=e}if(a==r+1){if(d>u){let t=s[r];e(t.children,t.positions,0,t.children.length,i[r]+o);continue}f.push(s[r])}else{let e=i[a-1]+s[a-1].length-p;f.push(B(t,s,i,r,a,p,e,null,l))}c.push(p+o-n)}}(e,s,i,r,0),(o||l)(f,c,h)}class R{startParse(t,e,s){return"string"==typeof t&&(t=new I(t)),s=s?s.length?s.map(t=>new n(t.from,t.to)):[new n(0,0)]:[new n(0,t.length)],this.createParse(t,e||[],s)}parse(t,e,s){let i=this.startParse(t,e,s);for(;;){let t=i.advance();if(t)return t}}}class I{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)}}new h({perNode:!0})}}]); //# sourceMappingURL=782.js.map?_cache=35041ce5d612c8c83ccf