var a=this,b=function(){"use strict";var e,r,t=[[48,57],[65,70],[97,102]];const V={White_Space:[[9,13],32,133,160,5760,[8192,8202],8232,8233,8239,8287,12288],Quotation_Mark:[34,39,171,187,8216,8217,[8218,,8223],8249,8250,11842,[12300,12303],[12317,12319],[65089,65092],65282,65287,65378,65379],Hex_Digit:[...t,[65296,65305],[65313,65318],[65345,65350]],ASCII_Hex_Digit:t,Unified_Ideograph:[[13312,19903],[19968,40959],64014,64015,64017,64019,64020,64031,64033,64035,64036,[64039,64041],[131072,173791],[173824,177977],[177984,178205],[178208,183969],[183984,191456],[196608,201546],[201552,205743]],Ideographic:[12294,12295,[12321,12329],[12344,12346],[13312,19903],[19968,40959],[63744,64109],[64112,64217],94180,[94208,100343],[100352,101589],[101632,101640],[110960,111355],[131072,173791],[173824,177977],[177984,178205],[178208,183969],[183984,191456],[194560,195101],[196608,201546],[201552,205743]]};for([e,r]of Object.entries({Han:[[11904,11929],[11931,12019],[12032,12245],12293,12295,[12321,12329],[12344,12347],[13312,19903],[19968,40959],[63744,64109],[64112,64217],94178,94179,[94192,94193],[131072,173791],[173824,177977],[177984,178205],[178208,183969],[183984,191456],[191472,192093],[194560,195101],[196608,201546],[201552,205743]]}))V["Script="+e]=r;const G={sc:"Script",WSpace:"White_Space",QMark:"Quotation_Mark",Hex:"Hex_Digit",AHex:"ASCII_Hex_Digit",UIdeo:"Unified_Ideograph",Ideo:"Ideographic",N:"Number",Z:"Separator"};function a(e="",B,a={}){let n=e;const t=["[","]"];var i,l,s,o,e=[".","\\d","\\D","\\w","\\W","\\s","\\S","\\b","\\B"],c={n:"\n",r:"\r",f:"\f",t:"\t",v:"\v"},f={edge:["^","$"],bracket:["(",")"],brace:["{","}"],comma:",",repeat:"+",optRepeat:"*",omit:"?",charEcho:t,paramStart:["?"],nameEcho:["<",">"],paramSign:[":","=","!"],branch:"|",const:e},u={num:[["0","9"]],alphabet:[["a","z"],["A","Z"]]},h={charEcho:t[1],const:e.slice(1)},L=Object.keys(f),$=Object.keys(u);const r=[];let p=0,d,g,m=!1;for(;n;){let e=!1,r=!1;if("charEcho"===g)if(d[1]===t[0]){m=!0;for(s of P("^"))if(o=A(s))break;o&&O("charNegation",o)}else m=!1;if(m){if(![t[0],"^"].includes(d[1])&&(o=A("-"))){O("rangeBond",o);continue}for(var v of Object.keys(h)){for(i of P(h[v]))if(o=A(i))break;if(o){e=!0,O(v,o);break}}if(e)continue;r=!0}if(!r)for(var b of L){for(l of P(f[b]))if(o=A(l))break;if(o){e=!0,M(o.length),R([b,o]);break}}if(!e)if(N("\\"))if(N("x",n,1)){if(2!==(x=j(n,2,2)).length)throw Error("Invalid escape at "+p);O("unicode",n.slice(0,2+x.length),F(x))}else{if(a.unicode&&N("u",n,1)){let e=4,r=2,t=!1;"{"===n[2]&&(e=-1,r++,t=!0);var x,k=F(x=j(n,r,e)),y=(1114111=a)break}return i}function F(e){return parseInt(e,16)}function C(e,r,t=0){if(!Array.isArray(r))throw Error("Expect a range array for search.");for(var a of r)if("string"==typeof a){var n=e.substr(t,a.length);if(n===a)return n}else if(J(e,a[0],a[1],t))return e[t];return null}function J(e,r,t,a=0){if("string"!=typeof e)throw Error("Expect a string to search.");var n=e=>"string"==typeof e?e.codePointAt(0):e;if(r=n(r),t=n(t),!_(r)&&!_(t))throw Error("Expect a range for match.");n=e.codePointAt(a);return!(_(r)&&nm[e]||[];F[0]={name:"root",childrenLimit:1};for(var n,x=0;x"===n[1]){if(h.includes(S))throw Error("Duplicate capture group name at pos "+o);h.push(S),i.groupName=S;break}throw Error("Invalid capture group name at pos "+a)}while(0);R(a-x),e=o-y,l.offset=e}i.catchable&&!i.assertion&&(i.captureIndex=u++),F.push(l),f=!1,v.statementStart&&v.statementStart(k,s,i,!1,y,e)}else{if(")"!==s)throw y=s,n=r,Error(`Unrecognized ${n?n+" ":""}token: `+y);{for(let e=F.length;0t)throw Error("Numbers out of order in {} quantifier at pos "+o);R(e-x);l={minTimes:r,maxTimes:t},T=`Expect a value expression before range repeat indicator "${s}", but found `+c}while(L("repeat",s,l,0,0,T),e=!0,0);if(e)continue;r="char"}if("charEcho"===r){let e=!1;do{if("["!==s)break;let e={},a=[],n=x+1,i=b(n);"charNegation"===i[0]&&(e.exclusive=!0,i=b(++n));const J="charRange",re=["escape","unicode","script"],G=(e,r)=>("const"!==e||"."===r)&&!re.includes(e);for(;;){if(!i[0])throw Error('Missing "]" of char set at pos '+o);if("]"===i[1])break;let e=i[0],t=i[1];if("rangeBond"===e){var w=a[a.length-1],I=b(n+1),O=(e,r)=>"char"===e||G(e,r)&&e!==J&&"]"!==r;if(O(w.name,w.value)&&O(I[0],I[1])){let e=w.value,r=I[1];O={minChar:e,maxChar:r};if(e.charCodeAt(0)>r.charCodeAt(0))throw Error("Range out of order in character class at pos "+o);w=$(J,t,O,!0);a.pop(),a.push(w),n+=2,i=b(n);continue}}G(e,t)?e="char":"escape"!==e&&"script"!==e||(t=i[2]||t);I=$(e,t,null,!0);a.push(I),i=b(++n)}var H,j=o,z=(R(n-x),"charList"),j=$(z,s,e,!1,{start:j,offset:o-j});_(j);for(H of a)_(H)}while(P(j),c=z,f=e=!0,e=!0,0);if(e)continue;r="char"}if("repeat"===r||"optRepeat"===r){y="optRepeat"===r?0:1;L("repeat",s,{minTimes:y,maxTimes:null}),c="repeat",f=!0}else if("omit"===r){let e=v.getPriorBrother();if("repeat"!==c||e.param.restraint){if(!U.includes(c))throw Error(`Nothing to omit, unexpected "${s}" at pos `+o);L("repeat",s,{minTimes:0,maxTimes:1}),c="repeat",f=!0}else e.param.restraint=!0}else if("branch"===r){var C=$("branch",s,null,!0,{start:o});Y(C,-1),_({...C,enclosed:!1}),F.push(C),c="branch"}else{if("unicode"===r&&s.startsWith("\\")||"escape"===r&&+i[2]){let a=!1;do{let e=x,r=s.slice(1);for(;r.length<2;){var D=b(e+1);if("num"!==D[0])break;r+=D[1],e++}var V=r.slice(2),A=+r.slice(0,2);if(A>=u||!A)break;var W,Z=o;R(e-x);let t="ref";_(ee(t,A,{},!0,{start:Z,offset:o-Z}));for(W of V)_($(t="char",W,null,!0));c=t,f=a=!0}while(0);if(a)continue}if("escape"===r&&"\\k"===s){let e=!1;do{var N=x+1;if("<"!==b(N++)[1])break;var[M,q]=K(m,N),q=b(N+=q);if(!M||">"!==q[1])break;if(R(N-x),!h.includes(M))throw Error("Invalid named capture referenced at pos "+o)}while(_(ee("ref",M,{isName:!0},!0,{})),c="ref",f=e=!0,0);if(e)continue;throw Error("Invalid named reference at pos "+o)}"script"===r?B(r,i[2],null):"edge"===r||"const"===r?B(r,s,null):"escape"===r?B("char",i[2]||s,null):"unicode"!==r?B("char",s,null):(C=r,i=i[2]||s,c=C,f=!0,v.statementStart&&v.statementStart(C,i,null,!0))}}}if(F[0]&&"root"===F[0].name&&F.shift(),e=function(r,t){for(let e=r.length-1;0<=e;e--)if(t(r[e],e))return e;return-1}(F,e=>!r.includes(e.name)),F.slice(0,e+1).length)throw Error("There is a few unclosed blocks.");function K(e,r=0,t=-1){if(!Array.isArray(e))throw Error("Expect a tokens array to search.");let a="";for(var n=r;n=t)break}return[a,n-r]}function Q(e,r=0,t=-1){if(!Array.isArray(e))throw Error("Expect a tokens array to search.");let a="";for(var n=r;n=t)break}return[a,n-r]}function X(){var e=s.lastEle,r=e&&e.childrenLimit;if(!(0e+r[1].length,0),r}function _(e){v.statementStart&&v.statementStart(e.name,e.value,e.param,e.enclosed,e.startPos,e.offset)}function P(e){v.statementEnd&&v.statementEnd(e.name,e)}function Y(e,r){v.supplant&&v.supplant(e.name,e.value,e.param,e.enclosed,e.startPos,e.offset,r)}function B(e,r,t,a=!0){c=e,f=a,v.statementStart&&v.statementStart(e,r,t,a)}function L(e,r,t,a,n,i){let l={name:e,value:r,param:t,childrenLimit:1,...void 0};if(i=i||"Nothing to repeat",!f||!U.includes(c))throw Error(`${i} at pos ${o}.`);c=e,f=l.enclosed=!0,Y(l)}function ee(e,r,t,a=!0,n){return{name:e,value:r,param:t,enclosed:a,...n}}function $(e,r,t,a,n){return{type:"element",tagType:"statement",name:e,value:r,param:t,enclosed:a,...n}}F}return t}function W(e,r){const{enter:a,leave:n}=r;let i;var l=[],s=[],o=!1;void 0!==r.ignoreRoot&&r.ignoreRoot&&"root"==e.type?((i=m(e)).children=i.children.map(m),l[0]=[...i.children]):(i=m(e),l[0]=[i]),s[0]=0;for(var c=l.length-1,f=(e,r=-1)=>e&&e.length?e[e.length+r]:null;l.length;){var u,h,p,d=f(l);let t=s[c];if(o&&(u=d[t++],n&&(p=0<=(p=s[c-1])&&f(l,-2)[p],void 0!==(h=n(u,c,p))&&g(u,h,p,d,t-1)),o=!1,s[c]=t),t>=d.length)l.pop(),s.pop(),c--,o=!0;else{let e=d[t],r=(a&&(h=0<=(u=s[c-1])&&f(l,-2)[u],void 0!==(p=a(e,c,h))&&(g(e,p,h,d,t),e=p)),e&&e.children);r&&0m(e)),r=e.children,l.push(r),s.push(0),c++):o=!0}}function g(e,r,t,a,n){e===i?i=r:((t=t||i).children[n]=r,t.children!==a&&(a[n]=r))}function m(e){return{...e}}return i}function ke(e,r){const{enter:t,leave:a}=r;let n;var i=[],l=[],s=[],o=!1,c=(void 0!==r.ignoreRoot&&r.ignoreRoot&&"root"==e.type?(n=e,i[0]=n.children):(n=e,i[0]=[n]),s[l[0]=0]={},i.length-1),f=(e,r=-1)=>e&&e.length?e[e.length+r]:null;const u=()=>s[c];for(var h={skipBrothers(){u().brothersSkipped=!0},skipChildren(){u().childrenSkipped=!0},reenter(){u().needReentrant=!0},fallback(){u().needFallback=!0}};0<=c;){var p=f(i);let r=l[c];if(o){var d=p[r++];a&&(g=0<=(g=l[c-1])&&f(i,-2)[g],a(d,c,g,h)),o=!1;let e=u();e.brothersSkipped&&(r=p.length,e.brothersSkipped=!1),e.needReentrant&&(r--,e.needReentrant=!1),e.needFallback&&(1=p.length)i.pop(),l.pop(),s.pop(),c--,o=!0;else{var g,m,d=p[r];t&&(m=0<=(g=l[c-1])&&f(i,-2)[g],t(d,c,m,h));let e=u();e.needFallback&&(e.childrenSkipped=!0),e.brothersSkipped?(l[c]=p.length,e.brothersSkipped=!1):e.childrenSkipped?o=!(e.childrenSkipped=!1):(m=d.children)&&0"branch"===e.tag)&&s.splice(t--,1,...r)}}l=!0}else if(i){var o=n;for(let e=0;e"repeat"===e.tag)){for(let r=0;r"repeat"===e.tag&&(e.param.minTimes||e.param.maxTimes))){for(let t=0;te?((t=E[w]).length&&E[w-1].push(...t),S.pop(),E.pop(),T.pop(),w--,T[w]=m+1):"branch"===r.tag&&S[w]===e&&U(m)}});let O={};for(let r=0;rv[e][0]){O[j]=v[e][0];break}}for([e,r]of Object.entries(O))O[r]?O[e]=[r].concat(O[r]):O[e]=[r];for(let t=1;t<=o;t++){let e=d[t];var C=v.findIndex(r=>e.some(e=>e[0]<=r[1]&&r[0]r[0]<=e&&e<=r[1];for(e of a){let t,a;Array.isArray(e)?[t,a]=e:t=a=e,t>a&&(r=t,t=a,a=r);let n=-1,i=-1,l;for(let r=0;i<0&&re[1]&&n--,o(a,l)&&(l[0]=a+1,i=r+1);else if(n<0&&te[1]&&i++):ae[0]===e[1]?e[0]:e)}());var n,i=P("charList","[",{},!0);for(n of a){var l=Array.isArray(n)?function(e,r){if(!e&&0!==e||!r)throw Error("Both param minChar and maxChar are required.");return P("charRange","-",{minChar:e,maxChar:r},!0)}(n[0],n[1]):D(n);i.children.push(l)}return z(i)}function z(e){if("charList"!==e.tag)return e;var r;let t=[];const a=new Set;for(r of e.children){s.ignoreCase&&"char"===r.tag&&(r.value=r.value.toLowerCase());var n=!r.children.length&&JSON.stringify([r.tag,r.value,r.param]);if(!a.has(n)){n&&a.add(n);let e=R();e.children[0]=r,t.push(e)}}let i=M(),l=i.param;return l.catchable=!1,l.origin="charList",l.exclusive=e.param.exclusive,i.children=t,1===i.children.length&&(i.children=i.children[0].children,1!==i.children.length||i.param.exclusive||(i=i.children[0])),i}function D(e){return P("char",e="number"==typeof e?String.fromCodePoint(e):e,null,!0)}function M(){return P("clause","(",{},!0)}function R(){return P("branch","|",null,!0)}function _(){return P("repeat","{",{},!0)}function P(e,r,t,a){return{type:"element",tagType:"statement",tag:e,value:r,param:t,parent:void 0,enclosed:a,children:[]}}return c.param=c.param||{},c.param.groupNames=l,c.param.groupsBounds=d,c.param.repeatBounds=J,c.param.capInsideRptStarts=b,c.param.refFollowingSerials=$,c.param.refManorSecsMap=y,c.param.captureNum=o,c.param.backwardSerials=h,c.includedStrs=function(){let n=[""],i=0;const l=()=>n[++i]="";ke(c,{enter(e,r,t,a){if(r){if(-1===i)return a.skipBrothers();r=e.tag;if("branch"===r)return l(),a.skipBrothers();if("repeat"===r&&!+e.param.minTimes)return l(),a.skipChildren();if("char"===r)n[i]+=e.value;else if("unicode"!==r){if("clause"===r)return e.param.assertion?a.skipChildren():e.param.exclusive?(l(),a.skipChildren()):void 0;if("edge"===r){if("$"===e.value&&!s.multiline)return i=-1,a.skipBrothers()}else l()}}}}),-1e&&e.length?e[e.length+r]:null,X=["repeat","branch","clause"];var t,s,o,U=!1,F=!1,Y=!1,J=!1,ee=!1,G=null,re=!1;if(ke(a,{enter:function(n,e,r,t){if("root"!==n.type){xe(n);var{tag:i,param:l}=n,{tag:i,param:l}=(Ee(),n),s=(i in q?q[i]=1:q[i]++,F&&"repeat"!==i&&("clause"!==i||l.assertion));if(F&&(s&&"ref"===i?fe(n):(o=se()).children&&ke(o,{enter(e,r){"ref"===e.tag&&fe(e.node)}}),oe()),s)return t.fallback();var o=F,s=!Y&&!F;F=Y=!1,U=!1,I===e?s&&w.index++:I(U=F=!0,t.fallback());if(null!==G){if(G[e]!==w.index)return t.skipChildren();if(G.length-1!==e)return;if(G=null,re)return re=!1,c()}if(a.ended)return J=!0,("clause"!==i||l.assertion)&&("branch"!==i||l&&l.isStatic)&&t.skipChildren();if(J=!1,x.foremostCapSerial&&n.serial[e,H(e.groupIndex)]);JSON.stringify(s)!==b.lastBrief&&Object.defineProperty(b,"lastBrief",{value:JSON.stringify(s),enumerable:!1,writable:!0});let e=k[n.serial];if(!(function(d,l){let i=d.lastRefs;if(i=!i&&d.encore?d:i){let t=d.changedSerials,r=(t=t||(d.changedSerials={}),d.isUnique),a=(d.encore?void 0===r&&(r=d.isUnique=function(){let t={},r=!0;for(var e of d)t[e.groupIndex]=ge(pe(e.groupIndex));var a,n,i,l=Object.keys(t);if(1===l.length&&ie(l[0].groupIndex,t[l[0].groupIndex]))return!1;let s=[];for(a of Object.keys(t)){var o=_[a],o=o&&o[t[a]];o&&s.push(o)}let c=_.combiLenMap,f=(void 0===c&&(_.combiLenMap=c={}),{}),u,h=0;for(n of s){for(var p of Object.keys(n)){let e=f[p];if(e||(f[p]=e={len:c[p]||1,count:0}),e.count++,e.count===e.len&&e.len<=l.length){if(e.len===l.length){r=!1;break}e.len>h&&(u=p,h=e.len)}}if(!r)break}if(!r)return r;void 0===u&&(void 0===_.combiIdInc&&(_.combiIdInc=1),u=_.combiIdInc++);for(i of l){let e=_[i],r=(e||(_[i]=e={}),e[t[i]]);r||(e[t[i]]=r={}),r[u]||(r[u]=!0,c[i]?c[i]++:c[i]=1)}return r}()):r=!1,d.validSerial||0),n=[];for(let e=0;r&&ea;if(o&&(t[s.serial]=!0),s.serial>a&&(JSON.stringify(r),ie(s.groupIndex,r),v),o)if(null===r)n.push(s.groupIndex);else{let e=s.serials;o=e.find(e=>e>a&&((i,r)=>{let t=k[r];if(t,t&&Object.keys(t).filter(e=>t[e]).map(e=>y.slice(e)),t){if(!i)return!0;let e=Object.keys(t).filter(e=>t[e]),a=(K[l]&&(e=e.map(e=>we(e,y))),{serial:r}),n=Q[r]&&{serial:Q[r]};return e.some(e=>{return le(a,i),n&&ne(n,e+i.length),r=e,!((t=le(a,i))&&t[r]||n&&ne(n,e+i.length));var r,t})}})(r,e));if(o){a=o;break}}}if(a&&(d.validSerial=a),ar<=e[1]&&e[0]<=r;return"object"==typeof t?t.some(e):t&&e(t)}(e.groupIndex,l)){n.push(e.groupIndex);break}return a>=l||n.length}}(b,n.serial,a)&&e&&e[a.start])||void a)return a,a,a,e,ee=!0,c();e[a.start]=!1,a,e}}{s=a;let e=n.serial,r=E===y?g:g["t"+E.length],t=(r=r||(g["t"+E.length]={}))[e];t||(r[e]=t={});s=s.start;s in t||(t[s]=!0)}var s=n.value,f=!1;if("char"===i)return(u=function(r,t,a=0){let n="";if(S.ignoreCase&&be(r))return t.substr(a,r.length).toLowerCase()==r.toLowerCase()&&t[a];for(let e=0;el?!e:e;if("."==(e=i))return S.dotAll||"\n"!==a&&"\r"!==a?n:"";const o=[["a","z"],["A","Z"],["0","9"],"_"],c=e=>!!z(e,o);if("\\b"===e)return i=r[t]||"",s(c(r=r[t-1]||"")&&!c(i)||!c(r)&&c(i));if("\\w"===e)return s(c(a))?n:"";if("\\d"===e)return s(z(a,[["0","9"]]))?n:"";if("\\s"===e)return s(z(a,[" "," ","\f","\n","\r","\t","\v"]))?n:"";throw Error("Unknown constant "+e)}(s,E,B);return JSON.stringify(e),e?(!0===e&&(e=""),void(B+=e.length)):c()}if("charRange"===i)return u=function(r,e,t=0){e=S.unicode?D(e,t,1):e[t]||"";const a=[["a","z"],["A","Z"]],n=(e,r)=>e.codePointAt()-r.codePointAt(),i=(e,r)=>0<=n(e,r[0])&&n(e,r[1])<=0;var l,[t,s]=r,o=ve(e,t,s);return o?e:(S.ignoreCase&&be(e)&&a.some(e=>((e,r)=>i(e[0],r)||i(r[0],e))(r,e))&&(l=e.toLowerCase(),o=ve(e===l?e.toUpperCase():l,t,s)),o&&e)}([l.minChar,l.maxChar],E,B),JSON.stringify(u),u?B+=u.length:c();if("unicode"===i)return u=function(e,r,t=0){r=S.unicode?D(r,t,1):r[t]||"";if(r.codePointAt()===e)return r}(s,E,B),JSON.stringify(u),u?B+=u.length:c();if("edge"===i)return function(e,r){var t=e=>["\r","\n"].includes(e);if("^"===e)return 0===B||S.multiline&&t(r[B-1]);if("$"===e)return B===r.length||S.multiline&&t(r[B]);throw Error("Unknown position sign "+e)}(s,y,B)?B+=0:c();if("ref"===i){let t=H(s,l.isName);JSON.stringify(t);{var u=n,h=t,p=a;let e=m[u.serial],r=(e=e||(m[u.serial]={}))[h];r=r||(e[h]={});var u=p.start;u in r||(r[u]=!0)}h=l.isName?C[s]:s;let e=v[h];if((e=e||(v[h]={}))[t]=!0,L&&t&&(t=Te(t,S.unicode)),b.length){l.isName&&C;let e=b.findIndex(e=>e.serial===n.serial);(0<(e=e<0&&n.serial>b[0].serial&&b.encore?0:e)||0===e)&&(b.encore?b.splice(e):b.splice(e,1))}p=L?we(B,y)-(t||"").length:B;return t&&!function(e,r,t=0){if(e instanceof RegExp)return 0==(t?r.slice(t):r).search(e);if("string"!=typeof e)throw Error("Expect a string or regExp for search.");return r.substr(t,e.length)===e}(t,y,p)?(fe(n,t,!0),oe(a),c()):B+=(t||"").length}if("repeat"===i&&!a.reentrant&&l.restraint&&l.minTimes<1)return t.skipChildren();if(o&&"clause"===i&&!l.assertion)return l.exclusive?t.skipChildren():void(a.children.length&&ae(a,n,e));if("clause"!==i||!l.assertion||l.forward||a.reentrant||L||(a.inverted=!0,E=(E=d.reversedText)||(d.reversedText=Te(y,S.unicode)),B=we(B,y),L=!0),"clause"===i&&l.assertion&&(u=n,(s=M[u.serial])&&(R=s),l.forward&&L&&(a.inverted=!0,a.origText=E,E=y,B=we(B,y),L=!1)),!(f=!!["clause","branch","repeat"].includes(i)||f))throw Error("Unrecognized node named "+i)}},leave:function(t,a,e,n){if(a||"root"!==t.type){xe(t);Ee(),I!==a&&I>a&&(T.pop(),w=T[a].children,I=a);let c=w[w.index];if(null===G||G[a]===w.index){E.substr(B,20),B;var{tag:r,param:i}=t,l=e=>{U=F=!0,e||oe(),w.pop(),w.index--,n.fallback()};if(ee)return l(!(ee=!1));if(F&&!X.includes(r))return l(!0);var s=F;if(F=!1,"repeat"===r){const b=(e,r,t)=>{let a={};for(let e=1;e{var t=e in c.statuses;c.statuses[e]=r;let a=c.avlStatusesKeys;t||r.ended||a.push(e)};var o=r=>{if(r in c.statuses&&c.statuses[r].ended){let e=c.avlStatusesKeys;r=e.indexOf(r);0<=r&&e.splice(r,1)}};const k=e=>{var r;Z,e&&c,e||ye?e||B===c.lastStart||(b(c.start,c.lastStart,t.serial),x(c.lastStart,c.children),r=c.statuses[B]||[],c.children=r,c.lastStart=B,r=c.matchMaps[B],A[t.serial]=r):c.children.length=0,!e&&c.children.length&&ae(c,t,a),c,B,Y=!0,n.reenter()};var f=e=>{let r=null;for(var t of c.avlStatusesKeys)a=+t,(!e||e<=a)&&a<=c.lastStart&&(null===r?a>=r:a>r)&&!c.statuses[a].ended&&(r=+t);var a;let n;if(null!==r&&(B=r,n=c.statuses[r]),!n||n.ended)return!1;k()},u=()=>{var e=c.matchMaps[$(c.backtracks,-2)];A[t.serial]=e};if(!c.reentrant&&(c.times=0,c.backtracks=[c.start],c.lastIndex=c.start,c.lastStart=c.start,c.lastEnd=c.start,c.statuses={[c.start]:c.children},c.avlStatusesKeys=Object.keys(c.statuses),c.matchMaps={},c.reentrant=!0,i.restraint&&i.minTimes<1))return c.ended=!0;if(c.ended&&!i.restraint)return(J=!1)!==f($(c.backtracks,-2))?(c.ended=!1,c.backtracks.pop(),c.times--,void c):c.backtracks.length-1<=0||c.times<=i.minTimes?(c,c,A[t.serial]=null,l()):(c.backtracks.pop(),c.times--,B=$(c.backtracks),c.lastStart=B,u(),c.lastEnd=B,c.offset=B-c.start);if(c.ended)return(J=!1)!==f()?(c.ended=!1,c.backtracks.pop(),c.times--,void c):V(i.maxTimes)&&c.times>=i.maxTimes||!c.backtracks.length?l():(B=$(c.backtracks),c.lastEnd=c.lastStart=B,x(c.lastStart,c.children),c.children=[],c.tracking=!0,c.ended=!1,void k());if(U||J){if(U=!1,c.children.ended=!0,o(c.lastStart),c.tracking)return!1!==f()?c.times--:l();if(u(),c.ended=!0,B=c.lastStart,c.times=i.maxTimes||!f)&&(c.ended=!0),i.isStatic&&(c.children.ended=!0,o(c.lastStart))}if(c,!c.ended)if(!i.restraint||c.timesE.length&&(e=!1)):B=c.start),e&&i.catchable){c.offset=B-c.start;var{captureIndex:u,groupName:s}=i,f=L?we(B,y):c.start,o=f+c.offset,f=y.slice(f,o);O[u]=f,j[u]=o,W[u]=t.serial,s&&(C[s]=u)}else if(!e)return l()}if("clause"===r&&i.assertion){f=c.reentrant,o=(c.reentrant||(c.lastIndex=c.start,c.reentrant=!0),()=>{!i.forward&&c.inverted?(B=c.start,E=y,L=!1):i.forward&&c.inverted&&(B=c.start,c.origText&&(E=c.origText,c.origText=null),L=!0)});let e=!U;if(U=!1,e){s=c;let r=M[s.serial],t=(r||(M[s.serial]=r={}),[]);let a=[s.children],n=[0];for(let e=0;ee.tag+"-"+e.serial+" "+e.start)}else i.exclusive&&(c.children=[]);if(f||R&&R===M[t.serial]&&(R=null),(e=i.exclusive?!e:e)||(c.lastFailedEnd=B,B=c.start),!e)return o(),l();o(),B=c.start}c.offset=B-c.start,X.includes(r)||(c.ended=!0)}}else(F||U)&&(B=null)}}),1===x.foremostCapSerial&&he(),d.failedRefs=b,d.spareFailedRefs=x,d.contExemptedTracks=k,d.spareContExeTracks=N,Object.assign(d,{misTracksGroupMap:n,exeTracksGroupMap:i}),"number"!=typeof B)return null;O[0]=E.slice(e,B);for(t of Object.keys(A)){var c,f=A[t];if(f)for(var[u,h]of Object.entries(f)){let e=l[u];e&&(Array.isArray(e)?e.includes(+t):+t===e)&&([h,c]=h,O[u]=c,j[u]=h)}}for([s,o]of Object.entries(C))O.groups[s]=O[o],j[s]=j[o];return O._indices=j,O;function te(e){var r={tag:e.tag,serial:e.serial};return Object.defineProperty(r,"children",{value:Object.assign([],{index:0}),enumerable:!1,writable:!0}),("ref"===e.tag||"clause"===e.tag&&e.param.assertion)&&Object.defineProperty(r,"node",{value:e,enumerable:!1,writable:!0}),r}function ae(e,r,t){e=function(e,r,t){(G=[])[t]=w.index;let a=e,n=r,i=t+1;for(;;i++){var l=a.children&&a.children.length-1;if(!(0<=l))break;if(a=a.children[l],n=n.children[l],G[i]=l,["repeat"].includes(a.tag))break;if("branch"===a.tag&&a.isStatic)break;if("clause"===a.tag&&n.param.exclusive){a=null;break}if("branch"===a.tag&&(a.ended=!1),"ref"===a.tag)break}return a}(e,r,t);e&&!["repeat","branch"].includes(e.tag)&&(re=!0)}function ne(e,r){var t=E===y?g:g["t"+E.length],t=t&&t[e.contId||e.serial];return t&&r in t}function ie(e,r){e=v[e];return e&&e[r]}function le(e,r){e=m[e.serial];if(e)return e[r]}function p(e,r){let t=N,a=t[e];(a=a||(t[e]={}))[r.start]=!0}function se(){return w[w.index]}function oe(e){if(x.length){e=e||se();var r=N[e.serial];if(!(r&&e.start in r)){p(e.serial,e);var n=e=>ke({children:e},{enter(e,r){r&&p(e.serial,e)}});let t=[[e]],a=[0];for(let e=0;efunction(e,r){var e=P[e],t=e=>e[1]e.groupIndex===r),o=(a||0<=s&&(l,s),l.serialMismatchs||(l.serialMismatchs={}),l.serialMismatchs);if((!i&&o[t.serial]||i&&!o[t.serial]&&t.serial in o)&&(l,s),!e&&0<=s){let e=l[s],r=(e.refVal=a,e.valSym=n,e.serial=Math.max(e.serial,t.serial),e.serials);r.includes(t.serial)||r.push(t.serial)}else{s<0&&(s=l.length);e={serial:t.serial,groupIndex:r,refVal:a,valSym:n,serials:[t.serial]};l[s]=e}l.sort((e,r)=>r.serial-e.serial),o[t.serial]=i;a=l[0];if(a){let e=N;e.finalSerial=a.serial}l.foremostCapIndex=l.reduce((e,r)=>!e||r.groupIndexMath.max(e,r.serial),0);x.finalSerial=l;let s={},o={};for(t of x)s[t.groupIndex]=t;if(b.lastRefs)for(i of b.lastRefs){var c=s[i.groupIndex];(!c||c.seriale.serial&&(o[a]=r),n=e.serials.concat(r.serials),o[a].serials=[...new Set(n)]):o[a]=r}x.lastRefs=Object.values(o).sort((e,r)=>r.serial-e.serial),x.foremostCapIndex=x.lastRefs.reduce((e,r)=>0===e||r.groupIndext)){var n,a=A[a];if(a&&a[e])return[n,a]=a[e],a}return O[e]}function pe(e,r){r&&(e=C[e]);let t=l[e];if(t)for(var a of Object.keys(A).reverse())if(Array.isArray(t)?t.includes(+a):+a===t){var n,a=A[a];if(a&&a[e])return[a,n]=a[e],[a-n.length,n.length]}r=O[e];return"string"!=typeof r?r:[j[e]-r.length,r.length]}function de(e,r){return ge(pe(e,r))}function ge(e){return e&&e[0]+"_"+e[1]}function me(e,r,t){r&&(e=C[e]);let a=P[e];r=e=>t<=e[1]&&e[0]<=t;return("object"!=typeof a?r(a):a.some(r))?null:H(e,!1)}function z(e,r,t=0,a=-1){if(!Array.isArray(r))throw Error("Expect a range array for search.");for(var n of r)if("string"==typeof n){var i=!(0"string"==typeof e?e.codePointAt(0):e;if(r=n(r),t=n(t),!V(r)&&!V(t))throw Error("Expect a range for match.");n=e.codePointAt(a);return!(V(r)&&nt)break;a+=i}return a}function xe(e){if("root"!==e.type){var r;(e={...e}).children=e.children.length;for(r of["parent","type","tagType","enclosed"])delete e[r];delete e.children}return e}function V(e){return"number"==typeof e&&!isNaN(e)}}function Ee(){p&&d++}function l(e,r,t=0,a={}){if("string"!=typeof r)return null;for(var n={},i=(a.ignoreCase&&r.toLowerCase(),(p=!(p||!globalThis.ENABLE_PREG_LOOP_COUNT)||p)&&(d=0),()=>{p&&(globalThis.lastPregExecCount=d)}),l=~~t;l<=r.length;l++){var s=g(e,r,l,a,n);if(s){s.index=l,s.input=r;var o=s.groups;if(delete s.groups,Object.keys(o).length&&(s.groups=o),a.hasIndices){var c,f=[],u=(f.groups=s.groups?Object.create(null):void 0,s._indices);u[0]=l+s[0].length;for(c of Object.keys(u)){var h=u[c];isNaN(+c)?f.groups&&(f.groups[c]=[h-s.groups[c].length,h]):f[c]=[h-s[c].length,h]}s.indices=f}return delete s._indices,i(),s}}return i(),null}function Te(e,r){var t=[];if(r)for(var a of e)t.push(a);else t=e.split("");return t.reverse().join("")}function we(e,r){if(0<=e)return r.length-e;throw Error("Invaid index of str.")}class s{constructor(e="",r){var[r,t]=this.parseFlag(r=r||""),r=(this.flags=r,this.flagObj=t,Object.assign(this,t),"object"==typeof e&&e.source?e=e.source:e+="",i(n(a(e=e||"(?:)",0,t)),t));Object.defineProperty(this,"ast",{value:r,enumerable:!1,writable:!0}),this.source=e,this.lastIndex=0}exec(e){var r=0,t=this.flagObj,e=l(this.ast,e,r=0<=(r=t.sticky||t.global?this.lastIndex:r)&&r<=e.length?r:0,t);return t.global&&(this.lastIndex=e?e.index+e[0].length:0),e}_regMatch(e,r=0){return l(this.ast,e,r,this.flagObj)}test(e){return!!this.exec(e)}[Symbol.match](e){if(!this.flagObj.global)return this.exec(e);for(var r=[],t=0;;){var a=this._regMatch(e,t);if(!a)break;t=a.index+(a[0].length||1),r.push(a[0])}return 0p(e.toLowerCase(),"a","z")||["_","$"].includes(e),g=e=>p(e,"0","9");for(;;){var c=s.indexOf("$",o);if(!~c)break;l.push(s.slice(o,c)),o=c;let e=s[++c],r;if("$"===e)r="$",c++;else if(["&","`","'"].includes(e))r={variable:s.slice(o,++c)};else if(p(e,"1","9"))g(e)&&c++,r={type:"index",name:s.slice(o+1,++c)};else if("<"===e){e=s[++c];do{if(!d(e))break;var f=s.indexOf(">",c);if(f<=0)break;f=s.slice(c,f);[...f].every(e=>d(e)||g(e))&&(r={type:"group",name:f},c+=f.length+1)}while(0);r=r||s.slice(o,c)}r&&l.push(r),o=c}o{return"string"==typeof e?e:"index"===e.type?void 0===(r=h[e.name])?"$"+e.name:r:"group"===e.type?h.groups?h.groups[e.name]:"$<"+e.name+">":u[e.variable];var r}).join(""))}function p(e,r,t,a=0){var n=e=>"string"==typeof e?e.charCodeAt(0):e,i=e=>"number"==typeof e&&!isNaN(e);if(r=n(r),t=n(t),!i(r)&&!i(t))throw Error("Expect a range for match.");n=e.charCodeAt(a);return!(i(r)&&n