@jsonic/expr
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JsonicExpr=e()}}((function(){var e={exports:{}};(function(n){(function(){!function(t){"object"==typeof e.exports?e.exports=t():("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).Jsonic=t()}((function(){var e=function(e){var n;return function(t){return n||e(n={exports:{},parent:t},n.exports),n.exports}},n=e((function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.modlist=n.findTokenSet=n.values=n.keys=n.omap=n.str=n.prop=n.parserwrap=n.trimstk=n.tokenize=n.srcfmt=n.snip=n.regexp=n.mesc=n.makelog=n.isarr=n.filterRules=n.extract=n.escre=n.errinject=n.errdesc=n.entries=n.defprop=n.deep=n.configure=n.clone=n.clean=n.charset=n.badlex=n.assign=n.S=n.JsonicError=void 0;const i=t({}),l=e=>null==e?[]:Object.keys(e);n.keys=l;const s=e=>null==e?[]:Object.values(e);n.values=s;const o=e=>null==e?[]:Object.entries(e);n.entries=o;const a=(e,...n)=>Object.assign(null==e?{}:e,...n);n.assign=a,n.isarr=e=>Array.isArray(e);const c=Object.defineProperty;n.defprop=c;const u=(e,n)=>Object.entries(e||{}).reduce((e,t)=>{let r=n?n(t):t;void 0===r[0]?delete e[t[0]]:e[r[0]]=r[1];let i=2;for(;void 0!==r[i];)e[r[i]]=r[i+1],i+=2;return e},{});n.omap=u;const p={indent:". ",logindent:" ",space:" ",gap:" ",Object:"Object",Array:"Array",object:"object",string:"string",function:"function",unexpected:"unexpected",map:"map",list:"list",elem:"elem",pair:"pair",val:"val",node:"node",no_re_flags:r.EMPTY,unprintable:"unprintable",invalid_ascii:"invalid_ascii",invalid_unicode:"invalid_unicode",invalid_lex_state:"invalid_lex_state",unterminated_string:"unterminated_string",unterminated_comment:"unterminated_comment",lex:"lex",parse:"parse",error:"error",none:"none",imp_map:"imp,map",imp_list:"imp,list",imp_null:"imp,null",end:"end",open:"open",close:"close",rule:"rule",stack:"stack",nUll:"null",name:"name",make:"make",colon:":"};n.S=p;class d extends SyntaxError{constructor(e,n,t,r,i){let l=b(e,n=g({},n),t,r,i);super(l.message),a(this,l),v(this)}toJSON(){return{...this,__error:!0,name:this.name,message:this.message,stack:this.stack}}}function f(e,n,t){let i=n.t,l=i[e];return null==l&&r.STRING===typeof e&&(l=n.tI++,i[l]=e,i[e]=l,i[e.substring(1)]=l,null!=t&&a(t.token,n.t)),l}function m(e,...n){return new RegExp(n.map(e=>e.esc?h(e.toString()):e).join(r.EMPTY),null==e?"":e)}function h(e){return null==e?"":e.replace(/[-\\|\]{}()[^$+*?.!=]/g,"\\$&").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\n/g,"\\n")}function g(e,...n){let t=p.function===typeof e,r=null!=e&&(p.object===typeof e||t);for(let i of n){let n,l=p.function===typeof i,s=null!=i&&(p.object===typeof i||l);if(r&&s&&!l&&Array.isArray(e)===Array.isArray(i))for(let t in i)e[t]=g(e[t],i[t]);else e=void 0===i?e:l?i:s?p.function===typeof(n=i.constructor)&&p.Object!==n.name&&p.Array!==n.name?i:g(Array.isArray(i)?[]:{},i):i,t=p.function===typeof e,r=null!=e&&(p.object===typeof e||t)}return e}function x(e,n,t,r,i,l){let s={code:n,details:t,token:r,rule:i,ctx:l};return null==e?"":e.replace(/\$([\w_]+)/g,(e,n)=>{let o=JSON.stringify(null!=s[n]?s[n]:null!=t[n]?t[n]:l.meta&&null!=l.meta[n]?l.meta[n]:null!=r[n]?r[n]:null!=i[n]?i[n]:null!=l.opts[n]?l.opts[n]:null!=l.cfg[n]?l.cfg[n]:null!=l[n]?l[n]:"$"+n);return null==o?"":o})}function v(e){e.stack&&(e.stack=e.stack.split("\n").filter(e=>!e.includes("jsonic/jsonic")).map(e=>e.replace(/ at /,"at ")).join("\n"))}function k(e,n,t){let i=0<t.sI?t.sI:0,l=0<t.rI?t.rI:1,s=0<t.cI?t.cI:1,o=null==t.src?r.EMPTY:t.src,a=e.substring(Math.max(0,i-333),i).split("\n"),c=e.substring(i,i+333).split("\n"),u=2+(r.EMPTY+(l+2)).length,p=l<3?1:l-2,d=e=>"\x1b[34m"+(r.EMPTY+p++).padStart(u," ")+" | \x1b[0m"+(null==e?r.EMPTY:e),f=a.length;return[2<f?d(a[f-3]):null,1<f?d(a[f-2]):null,d(a[f-1]+c[0])," ".repeat(u)+" "+" ".repeat(s-1)+"\x1b[31m"+"^".repeat(o.length||1)+" "+n+"\x1b[0m",d(c[1]),d(c[2])].filter(e=>null!=e).join("\n")}function b(e,n,t,r,i){var l,s,o;try{let a=i.cfg,c=i.meta,u=x(a.error[e]||(null===(l=null==n?void 0:n.use)||void 0===l?void 0:l.err)&&(n.use.err.code||n.use.err.message)||a.error.unknown,e,n,t,r,i);p.function===typeof a.hint&&(a.hint={...a.hint(),...a.hint});let d=["\x1b[31m[jsonic/"+e+"]:\x1b[0m "+u," \x1b[34m--\x3e\x1b[0m "+(c&&c.fileName||"<no-file>")+":"+t.rI+":"+t.cI,k(i.src(),u,t),"",x((a.hint[e]||(null===(o=null===(s=n.use)||void 0===s?void 0:s.err)||void 0===o?void 0:o.message)||a.hint.unknown||"").trim().split("\n").map(e=>" "+e).join("\n"),e,n,t,r,i),""," \x1b[2mhttps://jsonic.senecajs.org\x1b[0m"," \x1b[2m--internal: rule="+r.name+"~"+r.state+"; token="+f(t.tin,i.cfg)+(null==t.why?"":"~"+t.why)+"; plugins="+i.plgn().map(e=>e.name).join(",")+"--\x1b[0m\n"].join("\n"),m={internal:{token:t,ctx:i}};return m={...Object.create(m),message:d,code:e,details:n,meta:c,fileName:c?c.fileName:void 0,lineNumber:t.rI,columnNumber:t.cI},m}catch(a){return console.log(a),{}}}function y(e){return"function"==typeof e.debug.print.src?e.debug.print.src:n=>{let t=null==n?r.EMPTY:Array.isArray(n)?JSON.stringify(n).replace(/]$/,o(n).filter(e=>isNaN(e[0])).map((e,n)=>(0===n?", ":"")+e[0]+": "+JSON.stringify(e[1]))+"]"):JSON.stringify(n);return t=t.substring(0,e.debug.maxlen)+(e.debug.maxlen<t.length?"...":r.EMPTY),t}}function _(e,n=44){let t;try{t="object"==typeof e?JSON.stringify(e):""+e}catch(r){t=""+e}return S(n<t.length?t.substring(0,n-3)+"...":t,n)}function S(e,n=5){return void 0===e?"":(""+e).substring(0,n).replace(/[\r\n\t]/g,".")}function E(...e){return null==e?{}:e.filter(e=>!1!==e).map(e=>"object"==typeof e?l(e).join(r.EMPTY):e).join(r.EMPTY).split(r.EMPTY).reduce((e,n)=>(e[n]=n.charCodeAt(0),e),{})}function O(e){for(let n in e)null==e[n]&&delete e[n];return e}n.JsonicError=d,n.configure=function(e,n,t){var r,i,c,p,d,g,x,v,k,b,y,_,S,j,I,T,M,N,P,C,R,w,A,L,Y,F,$,U,J,K,B,V,D,G,z,Z,q,W,X,H,Q,ee,ne,te,re,ie,le,se,oe;const ae=n||{};ae.t=ae.t||{},ae.tI=ae.tI||1;const ce=e=>f(e,ae);!1!==t.standard$&&(ce("#BD"),ce("#ZZ"),ce("#UK"),ce("#AA"),ce("#SP"),ce("#LN"),ce("#CM"),ce("#NR"),ce("#ST"),ce("#TX"),ce("#VL")),ae.fixed={lex:!!(null===(r=t.fixed)||void 0===r?void 0:r.lex),token:t.fixed?u(O(t.fixed.token),([e,n])=>[n,f(e,ae)]):{},ref:void 0,check:null===(i=t.fixed)||void 0===i?void 0:i.check},ae.fixed.ref=u(ae.fixed.token,([e,n])=>[e,n]),ae.fixed.ref=Object.assign(ae.fixed.ref,u(ae.fixed.ref,([e,n])=>[n,e])),ae.match={lex:!!(null===(c=t.match)||void 0===c?void 0:c.lex),value:t.match?u(O(t.match.value),([e,n])=>[e,n]):{},token:t.match?u(O(t.match.token),([e,n])=>[f(e,ae),n]):{},check:null===(p=t.match)||void 0===p?void 0:p.check},u(ae.match.token,([e,n])=>[e,(n.tin$=+e,n)]);const ue=t.tokenSet?Object.keys(t.tokenSet).reduce((e,n)=>(e[n]=t.tokenSet[n].filter(e=>null!=e).map(e=>ce(e)),e),{}):{};ae.tokenSet=ae.tokenSet||{},o(ue).map(e=>{let n=e[0],t=e[1];ae.tokenSet[n]?(ae.tokenSet[n].length=0,ae.tokenSet[n].push(...t)):ae.tokenSet[n]=t}),ae.tokenSetTins=o(ae.tokenSet).reduce((e,n)=>(e[n[0]]=e[n[0]]||{},n[1].map(t=>e[n[0]][t]=!0),e),{}),ae.tokenSetTins.IGNORE=ae.tokenSetTins.IGNORE||{},ae.space={lex:!!(null===(d=t.space)||void 0===d?void 0:d.lex),chars:E(null===(g=t.space)||void 0===g?void 0:g.chars),check:null===(x=t.space)||void 0===x?void 0:x.check},ae.line={lex:!!(null===(v=t.line)||void 0===v?void 0:v.lex),chars:E(null===(k=t.line)||void 0===k?void 0:k.chars),rowChars:E(null===(b=t.line)||void 0===b?void 0:b.rowChars),single:!!(null===(y=t.line)||void 0===y?void 0:y.single),check:null===(_=t.line)||void 0===_?void 0:_.check},ae.text={lex:!!(null===(S=t.text)||void 0===S?void 0:S.lex),modify:((null===(j=ae.text)||void 0===j?void 0:j.modify)||[]).concat(([null===(I=t.text)||void 0===I?void 0:I.modify]||[]).flat()).filter(e=>null!=e),check:null===(T=t.text)||void 0===T?void 0:T.check},ae.number={lex:!!(null===(M=t.number)||void 0===M?void 0:M.lex),hex:!!(null===(N=t.number)||void 0===N?void 0:N.hex),oct:!!(null===(P=t.number)||void 0===P?void 0:P.oct),bin:!!(null===(C=t.number)||void 0===C?void 0:C.bin),sep:null!=(null===(R=t.number)||void 0===R?void 0:R.sep)&&""!==t.number.sep,exclude:null===(w=t.number)||void 0===w?void 0:w.exclude,sepChar:null===(A=t.number)||void 0===A?void 0:A.sep,check:null===(L=t.number)||void 0===L?void 0:L.check},ae.value={lex:!!(null===(Y=t.value)||void 0===Y?void 0:Y.lex),def:o((null===(F=t.value)||void 0===F?void 0:F.def)||{}).reduce((e,n)=>(null==n[1]||!1===n[1]||n[1].match||(e[n[0]]=n[1]),e),{}),defre:o((null===($=t.value)||void 0===$?void 0:$.def)||{}).reduce((e,n)=>(n[1]&&n[1].match&&(e[n[0]]=n[1],e[n[0]].consume=!!e[n[0]].consume),e),{})},ae.rule={start:null==(null===(U=t.rule)||void 0===U?void 0:U.start)?"val":t.rule.start,maxmul:null==(null===(J=t.rule)||void 0===J?void 0:J.maxmul)?3:t.rule.maxmul,finish:!!(null===(K=t.rule)||void 0===K?void 0:K.finish),include:(null===(B=t.rule)||void 0===B?void 0:B.include)?t.rule.include.split(/\s*,+\s*/).filter(e=>""!==e):[],exclude:(null===(V=t.rule)||void 0===V?void 0:V.exclude)?t.rule.exclude.split(/\s*,+\s*/).filter(e=>""!==e):[]},ae.map={extend:!!(null===(D=t.map)||void 0===D?void 0:D.extend),merge:null===(G=t.map)||void 0===G?void 0:G.merge},ae.list={property:!!(null===(z=t.list)||void 0===z?void 0:z.property)};let pe=Object.keys(ae.fixed.token).sort((e,n)=>n.length-e.length).map(e=>h(e)).join("|"),de=(null===(Z=t.comment)||void 0===Z?void 0:Z.lex)?(t.comment.def?s(t.comment.def):[]).filter(e=>e&&e.lex).map(e=>h(e.start)).join("|"):"",fe=["([",h(l(E(ae.space.lex&&ae.space.chars,ae.line.lex&&ae.line.chars)).join("")),"]",("string"==typeof t.ender?t.ender.split(""):Array.isArray(t.ender)?t.ender:[]).map(e=>"|"+h(e)).join(""),""===pe?"":"|",pe,""===de?"":"|",de,"|$)"];return ae.rePart={fixed:pe,ender:fe,commentStart:de},ae.re={ender:m(null,...fe),rowChars:m(null,h(null===(q=t.line)||void 0===q?void 0:q.rowChars)),columns:m(null,"["+h(null===(W=t.line)||void 0===W?void 0:W.chars)+"]","(.*)$")},ae.lex={empty:!!(null===(X=t.lex)||void 0===X?void 0:X.empty),emptyResult:null===(H=t.lex)||void 0===H?void 0:H.emptyResult,match:(null===(Q=t.lex)||void 0===Q?void 0:Q.match)?o(t.lex.match).reduce((e,n)=>{let r=n[0],i=n[1];if(i){let n=i.make(ae,t);n&&(n.matcher=r,n.make=i.make,n.order=i.order),e.push(n)}return e},[]).filter(e=>null!=e&&!1!==e&&-1<+e.order).sort((e,n)=>e.order-n.order):[]},ae.parse={prepare:s(null===(ee=t.parse)||void 0===ee?void 0:ee.prepare)},ae.debug={get_console:(null===(ne=t.debug)||void 0===ne?void 0:ne.get_console)||(()=>console),maxlen:null==(null===(te=t.debug)||void 0===te?void 0:te.maxlen)?99:t.debug.maxlen,print:{config:!!(null===(ie=null===(re=t.debug)||void 0===re?void 0:re.print)||void 0===ie?void 0:ie.config),src:null===(se=null===(le=t.debug)||void 0===le?void 0:le.print)||void 0===se?void 0:se.src}},ae.error=t.error||{},ae.hint=t.hint||{},(null===(oe=t.config)||void 0===oe?void 0:oe.modify)&&l(t.config.modify).forEach(e=>t.config.modify[e](ae,t)),ae.debug.print.config&&ae.debug.get_console().dir(ae,{depth:null}),ae.result={fail:[]},t.result&&(ae.result.fail=[...t.result.fail]),a(e.options,t),a(e.token,ae.t),a(e.tokenSet,ae.tokenSet),a(e.fixed,ae.fixed.ref),ae},n.tokenize=f,n.findTokenSet=function(e,n){return n.tokenSet[e]},n.mesc=function(e,n){return(n=new String(e)).esc=!0,n},n.regexp=m,n.escre=h,n.deep=g,n.errinject=x,n.trimstk=v,n.extract=k,n.errdesc=b,n.badlex=function(e,n,t){let r=e.next.bind(e);return e.next=(e,i,l,s)=>{let o=r(e,i,l,s);if(n===o.tin){let n={};throw null!=o.use&&(n.use=o.use),new d(o.why||p.unexpected,n,o,e,t)}return o},e},n.makelog=function(e,n){var t,r,i;let l=null===(i=null===(r=null===(t=e.opts)||void 0===t?void 0:t.plugin)||void 0===r?void 0:r.debug)||void 0===i?void 0:i.trace;if(n||l)if("number"==typeof(null==n?void 0:n.log)||l){let t=!1,r=null==n?void 0:n.log;(-1===r||l)&&(r=1,t=!0),e.log=(...n)=>{if(t){let t=n.filter(e=>p.object!=typeof e).map(e=>p.function==typeof e?e.name:e).join(p.gap);e.cfg.debug.get_console().log(t)}else e.cfg.debug.get_console().dir(n,{depth:r})}}else"function"==typeof n.log&&(e.log=n.log);return e.log},n.srcfmt=y,n.str=_,n.snip=S,n.clone=function(e){return g(Object.create(Object.getPrototypeOf(e)),e)},n.charset=E,n.clean=O,n.filterRules=function(e,n){let t=["open","close"];for(let r of t)e.def[r]=e.def[r].map(e=>(e.g="string"==typeof e.g?(e.g||"").split(/\s*,+\s*/):e.g||[],e)).filter(e=>n.rule.include.reduce((n,t)=>n||null!=e.g&&-1!==e.g.indexOf(t),0===n.rule.include.length)).filter(e=>n.rule.exclude.reduce((n,t)=>n&&(null==e.g||-1===e.g.indexOf(t)),!0));return e},n.prop=function(e,n,t){let r=e;try{let r,i=n.split(".");for(let n=0;n<i.length;n++)r=i[n],n<i.length-1&&(e=e[r]=e[r]||{});return void 0!==t&&(e[r]=t),e[r]}catch(i){throw new Error("Cannot "+(void 0===t?"get":"set")+" path "+n+" on object: "+_(r)+(void 0===t?"":" to value: "+_(t,22)))}},n.modlist=function(e,n){if(n&&e){if(0<e.length){if(n.delete&&0<n.delete.length)for(let r=0;r<n.delete.length;r++){let t=n.delete[r];(t<0?-1*t<=e.length:t<e.length)&&(e[(e.length+t)%e.length]=null)}if(n.move)for(let r=0;r<n.move.length;r+=2){let t=(e.length+n.move[r])%e.length,i=(e.length+n.move[r+1])%e.length,l=e[t];e.splice(t,1),e.splice(i,0,l)}let t=e.filter(e=>null!=e);t.length!==e.length&&(e.length=0,e.push(...t))}if(n.custom){let t=n.custom(e);null!=t&&(e=t)}}return e},n.parserwrap=function(e){return{start:function(n,t,l,s){try{return e.start(n,t,l,s)}catch(o){if("SyntaxError"===o.name){let s=0,a=0,c=0,u=r.EMPTY,p=o.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);if(p){u=p[1],s=parseInt(p[2]),a=n.substring(0,s).replace(/[^\n]/g,r.EMPTY).length;let e=s-1;for(;-1<e&&"\n"!==n.charAt(e);)e--;c=Math.max(n.substring(e,s).length,0)}let m=o.token||(0,i.makeToken)("#UK",f("#UK",t.internal().config),void 0,u,(0,i.makePoint)(u.length,s,o.lineNumber||a,o.columnNumber||c));throw new d(o.code||"json",o.details||{msg:o.message},m,{},o.ctx||{uI:-1,opts:t.options,cfg:t.internal().config,token:m,meta:l,src:()=>n,root:()=>{},plgn:()=>t.internal().plugins,rule:{name:"no-rule"},sub:{},xs:-1,v2:m,v1:m,t0:m,t1:m,tC:-1,kI:-1,rs:[],rsI:0,rsm:{},n:{},log:l?l.log:void 0,F:y(t.internal().config),use:{},NORULE:{name:"no-rule"},NOTOKEN:{name:"no-token"}})}throw o}}}}})),t=e((function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeTextMatcher=t.makeNumberMatcher=t.makeCommentMatcher=t.makeStringMatcher=t.makeLineMatcher=t.makeSpaceMatcher=t.makeFixedMatcher=t.makeMatchMatcher=t.makeToken=t.makePoint=t.makeLex=t.makeNoToken=void 0;const i=n({});class l{constructor(e,n,t,r){this.len=-1,this.sI=0,this.rI=1,this.cI=1,this.token=[],this.len=e,null!=n&&(this.sI=n),null!=t&&(this.rI=t),null!=r&&(this.cI=r)}toString(){return"Point["+[this.sI+"/"+this.len,this.rI,this.cI]+(0<this.token.length?" "+this.token:"")+"]"}[r.INSPECT](){return this.toString()}}const s=(...e)=>new l(...e);t.makePoint=s;class o{constructor(e,n,t,i,l,s,o){this.isToken=!0,this.name=r.EMPTY,this.tin=-1,this.val=void 0,this.src=r.EMPTY,this.sI=-1,this.rI=-1,this.cI=-1,this.len=-1,this.name=e,this.tin=n,this.src=i,this.val=t,this.sI=l.sI,this.rI=l.rI,this.cI=l.cI,this.use=s,this.why=o,this.len=null==i?0:i.length}resolveVal(e,n){return"function"==typeof this.val?this.val(e,n):this.val}bad(e,n){return this.err=e,null!=n&&(this.use=(0,i.deep)(this.use||{},n)),this}toString(){return"Token["+this.name+"="+this.tin+" "+(0,i.snip)(this.src)+(void 0===this.val||"#ST"===this.name||"#TX"===this.name?"":"="+(0,i.snip)(this.val))+" "+[this.sI,this.rI,this.cI]+(null==this.use?"":" "+(0,i.snip)(""+JSON.stringify(this.use).replace(/"/g,""),22))+(null==this.err?"":" "+this.err)+(null==this.why?"":" "+(0,i.snip)(""+this.why,22))+"]"}[r.INSPECT](){return this.toString()}}const a=(...e)=>new o(...e);function c(e,n,t){let r=e.pnt,i=n;if(e.cfg.fixed.lex&&null!=t&&0<t.length){let l,s=e.cfg.fixed.token[t];null!=s&&(l=e.token(s,void 0,t,r)),null!=l&&(r.sI+=l.src.length,r.cI+=l.src.length,null==n?i=l:r.token.push(l))}return i}t.makeToken=a,t.makeNoToken=()=>a("",-1,void 0,r.EMPTY,s(-1)),t.makeFixedMatcher=(e,n)=>{let t=(0,i.regexp)(null,"^(",e.rePart.fixed,")");return function(n){let r=e.fixed;if(!r.lex)return;if(e.fixed.check){let t=e.fixed.check(n);if(t&&t.done)return t.token}let i=n.pnt,l=n.src.substring(i.sI).match(t);if(l){let e=l[1],t=e.length;if(0<t){let l,s=r.token[e];return null!=s&&(l=n.token(s,void 0,e,i),i.sI+=t,i.cI+=t),l}}}},t.makeMatchMatcher=(e,n)=>{let t=(0,i.values)(e.match.value),r=(0,i.values)(e.match.token);return 0===t.length&&0===r.length?null:function(n,i,l=0){if(!e.match.lex)return;if(e.match.check){let t=e.match.check(n);if(t&&t.done)return t.token}let s=n.pnt,o=n.src.substring(s.sI),a="o"===i.state?0:1;for(let e of t)if(e.match instanceof RegExp){let t=o.match(e.match);if(t){let r=t[0],i=r.length;if(0<i){let l,o=e.val?e.val(t):r;return l=n.token("#VL",o,r,s),s.sI+=i,s.cI+=i,l}}}else{let t=e.match(n,i);if(null!=t)return t}for(let e of r)if(!e.tin$||i.spec.def.tcol[a][l].includes(e.tin$))if(e instanceof RegExp){let t=o.match(e);if(t){let r=t[0],i=r.length;if(0<i){let t,l=e.tin$;return t=n.token(l,r,r,s),s.sI+=i,s.cI+=i,t}}}else{let t=e(n,i);if(null!=t)return t}}},t.makeCommentMatcher=(e,n)=>{let t=n.comment;e.comment={lex:!!t&&!!t.lex,def:((null==t?void 0:t.def)?(0,i.entries)(t.def):[]).reduce((e,[n,t])=>{if(null==t||!1===t)return e;let r={name:n,start:t.start,end:t.end,line:!!t.line,lex:!!t.lex,eatline:!!t.eatline};return e[n]=r,e},{})};let r=e.comment.lex?(0,i.values)(e.comment.def).filter(e=>e.lex&&e.line):[],l=e.comment.lex?(0,i.values)(e.comment.def).filter(e=>e.lex&&!e.line):[];return function(n,t){if(!e.comment.lex)return;if(e.comment.check){let t=e.comment.check(n);if(t&&t.done)return t.token}let s=n.pnt,o=n.src.substring(s.sI),a=s.rI,c=s.cI;for(let i of r)if(o.startsWith(i.start)){let t=o.length,r=i.start.length;for(c+=i.start.length;r<t&&!e.line.chars[o[r]];)c++,r++;if(i.eatline)for(;r<t&&e.line.chars[o[r]];)e.line.rowChars[o[r]]&&a++,r++;let l=o.substring(0,r),u=n.token("#CM",void 0,l,s);return s.sI+=l.length,s.cI=c,s.rI=a,u}for(let r of l)if(o.startsWith(r.start)){let t=o.length,l=r.start.length,u=r.end;for(c+=r.start.length;l<t&&!o.substring(l).startsWith(u);)e.line.rowChars[o[l]]&&(a++,c=0),c++,l++;if(o.substring(l).startsWith(u)){if(c+=u.length,r.eatline)for(;l<t&&e.line.chars[o[l]];)e.line.rowChars[o[l]]&&a++,l++;let i=o.substring(0,l+u.length),p=n.token("#CM",void 0,i,s);return s.sI+=i.length,s.rI=a,s.cI=c,p}return n.bad(i.S.unterminated_comment,s.sI,s.sI+9*r.start.length)}}},t.makeTextMatcher=(e,n)=>{let t=(0,i.regexp)(e.line.lex?null:"s","^(.*?)",...e.rePart.ender);return function(r){if(e.text.check){let n=e.text.check(r);if(n&&n.done)return n.token}let i=e.text,l=r.pnt,s=r.src.substring(l.sI),o=e.value.def,a=e.value.defre,u=s.match(t);if(u){let t,p=u[1],d=u[2];if(null!=p){let n=p.length;if(0<n){let c;if(e.value.lex)if(void 0!==(c=o[p]))t=r.token("#VL",c.val,p,l),l.sI+=n,l.cI+=n;else for(let e in a){let n=a[e];if(n.match){let e=n.match.exec(n.consume?s:p);if(e&&(n.consume||e[0].length===p.length)){let i=e[0];if(null==n.val)t=r.token("#VL",i,i,l);else{let s=n.val(e);t=r.token("#VL",s,i,l)}l.sI+=i.length,l.cI+=i.length}}}null==t&&i.lex&&(t=r.token("#TX",p,p,l),l.sI+=n,l.cI+=n)}}if(t&&(t=c(r,t,d)),t&&0<e.text.modify.length){const i=e.text.modify;for(let l=0;l<i.length;l++)t.val=i[l](t.val,r,e,n)}return t}}},t.makeNumberMatcher=(e,n)=>{let t=e.number,r=(0,i.regexp)(null,["^([-+]?(0(",[t.hex?"x[0-9a-fA-F_]+":null,t.oct?"o[0-7_]+":null,t.bin?"b[01_]+":null].filter(e=>null!=e).join("|"),")|\\.?[0-9]+([0-9_]*[0-9])?)","(\\.[0-9]?([0-9_]*[0-9])?)?","([eE][-+]?[0-9]+([0-9_]*[0-9])?)?"].join("").replace(/_/g,t.sep?(0,i.escre)(t.sepChar):""),")",...e.rePart.ender),l=t.sep?(0,i.regexp)("g",(0,i.escre)(t.sepChar)):void 0;return function(n){if(t=e.number,!t.lex)return;if(e.number.check){let t=e.number.check(n);if(t&&t.done)return t.token}let i=n.pnt,s=n.src.substring(i.sI),o=e.value.def,a=s.match(r);if(a){let t,r=a[1],s=a[9],u=!0;if(null!=r&&(u=!e.number.exclude||!r.match(e.number.exclude))){let s=r.length;if(0<s){let a;if(e.value.lex&&void 0!==(a=o[r]))t=n.token("#VL",a.val,r,i);else{let e=l?r.replace(l,""):r,o=+e;if(isNaN(o)){let n=e[0];"-"!==n&&"+"!==n||(o=("-"===n?-1:1)*+e.substring(1))}isNaN(o)||(t=n.token("#NR",o,r,i),i.sI+=s,i.cI+=s)}}}return u&&(t=c(n,t,s)),t}}},t.makeStringMatcher=(e,n)=>{let t=n.string||{};return e.string=e.string||{},e.string=(0,i.deep)(e.string,{lex:!!(null==t?void 0:t.lex),quoteMap:(0,i.charset)(t.chars),multiChars:(0,i.charset)(t.multiChars),escMap:{...t.escape},escChar:t.escapeChar,escCharCode:null==t.escapeChar?void 0:t.escapeChar.charCodeAt(0),allowUnknown:!!t.allowUnknown,replaceCodeMap:(0,i.omap)((0,i.clean)({...t.replace}),([e,n])=>[e.charCodeAt(0),n]),hasReplace:!1,abandon:!!t.abandon}),e.string.escMap=(0,i.clean)(e.string.escMap),e.string.hasReplace=0<(0,i.keys)(e.string.replaceCodeMap).length,function(n){let t=e.string;if(!t.lex)return;if(e.string.check){let t=e.string.check(n);if(t&&t.done)return t.token}let{quoteMap:l,escMap:s,escChar:o,escCharCode:a,multiChars:c,allowUnknown:u,replaceCodeMap:p,hasReplace:d}=t,{pnt:f,src:m}=n,{sI:h,rI:g,cI:x}=f,v=m.length;if(l[m[h]]){const l=m[h],k=h,b=g,y=c[l];++h,++x;let _,S=[];for(;h<v;h++){x++;let r=m[h];if(_=void 0,l===r){h++;break}if(o===r){h++,x++;let e=s[m[h]];if(null!=e)S.push(e);else if("x"===m[h]){h++;let e=parseInt(m.substring(h,h+2),16);if(isNaN(e)){if(t.abandon)return;return h-=2,x-=2,f.sI=h,f.cI=x,n.bad(i.S.invalid_ascii,h,h+4)}let r=String.fromCharCode(e);S.push(r),h+=1,x+=2}else if("u"===m[h]){h++;let e="{"===m[h]?(h++,1):0,r=e?6:4,l=parseInt(m.substring(h,h+r),16);if(isNaN(l)){if(t.abandon)return;return h=h-2-e,x-=2,f.sI=h,f.cI=x,n.bad(i.S.invalid_unicode,h,h+r+2+2*e)}let s=String.fromCodePoint(l);S.push(s),h+=r-1+e,x+=r+e}else{if(!u){if(t.abandon)return;return f.sI=h,f.cI=x-1,n.bad(i.S.unexpected,h,h+1)}S.push(m[h])}}else if(d&&void 0!==(_=p[m.charCodeAt(h)]))S.push(_),x++;else{let r=h,s=l.charCodeAt(0),o=m.charCodeAt(h);for(;(!d||void 0===(_=p[o]))&&h<v&&32<=o&&s!==o&&a!==o;)o=m.charCodeAt(++h),x++;if(x--,void 0===_&&o<32){if(!y||!e.line.chars[m[h]]){if(t.abandon)return;return f.sI=h,f.cI=x,n.bad(i.S.unprintable,h,h+1)}e.line.rowChars[m[h]]&&(f.rI=++g),x=1,S.push(m.substring(r,h+1))}else S.push(m.substring(r,h)),h--}}if(m[h-1]!==l||f.sI===h-1){if(t.abandon)return;return f.rI=b,n.bad(i.S.unterminated_string,k,h)}const E=n.token("#ST",S.join(r.EMPTY),m.substring(f.sI,h),f);return f.sI=h,f.rI=g,f.cI=x,E}}},t.makeLineMatcher=(e,n)=>function(n){if(!e.line.lex)return;if(e.line.check){let t=e.line.check(n);if(t&&t.done)return t.token}let t,{chars:r,rowChars:i}=e.line,{pnt:l,src:s}=n,{sI:o,rI:a}=l,c=e.line.single;for(c&&(t={});r[s[o]]&&!(t&&(t[s[o]]=(t[s[o]]||0)+1,c&&1<t[s[o]]));)a+=i[s[o]]?1:0,o++;if(l.sI<o){let e=s.substring(l.sI,o);const t=n.token("#LN",void 0,e,l);return l.sI+=e.length,l.rI=a,l.cI=1,t}},t.makeSpaceMatcher=(e,n)=>function(n){if(!e.space.lex)return;if(e.space.check){let t=e.space.check(n);if(t&&t.done)return t.token}let{chars:t}=e.space,{pnt:r,src:i}=n,{sI:l,cI:s}=r;for(;t[i[l]];)l++,s++;if(r.sI<l){let e=i.substring(r.sI,l);const t=n.token("#SP",void 0,e,r);return r.sI+=e.length,r.cI=s,t}};class u{constructor(e){this.src=r.EMPTY,this.ctx={},this.cfg={},this.pnt=s(-1),this.ctx=e,this.src=e.src(),this.cfg=e.cfg,this.pnt=s(this.src.length)}token(e,n,t,r,l,s){let o,c;return"string"==typeof e?(c=e,o=(0,i.tokenize)(c,this.cfg)):(o=e,c=(0,i.tokenize)(e,this.cfg)),a(c,o,n,t,r||this.pnt,l,s)}next(e,n,t,r){let l,s,o=this.pnt,a=o.sI;if(o.end)l=o.end;else if(0<o.token.length)l=o.token.shift();else if(o.len<=o.sI)o.end=this.token("#ZZ",void 0,"",o),l=o.end;else{try{for(let n of this.cfg.lex.match)if(l=n(this,e,r)){s=n;break}}catch(c){l=l||this.token("#BD",void 0,this.src[o.sI],o,{err:c},c.code||i.S.unexpected)}l=l||this.token("#BD",void 0,this.src[o.sI],o,void 0,i.S.unexpected)}return this.ctx.log&&this.ctx.log(i.S.lex,this.ctx,e,this,o,a,s,l,n,t,r),this.ctx.sub.lex&&this.ctx.sub.lex.map(n=>n(l,e,this.ctx)),l}tokenize(e){return(0,i.tokenize)(e,this.cfg)}bad(e,n,t){return this.token("#BD",void 0,0<=n&&n<=t?this.src.substring(n,t):this.src[this.pnt.sI],void 0,void 0,e)}}t.makeLex=(...e)=>new u(...e)})),r={};Object.defineProperty(r,"__esModule",{value:!0}),r.STRING=r.INSPECT=r.EMPTY=r.AFTER=r.BEFORE=r.CLOSE=r.OPEN=void 0,r.OPEN="o",r.CLOSE="c",r.BEFORE="b",r.AFTER="a",r.EMPTY="",r.INSPECT=Symbol.for("nodejs.util.inspect.custom"),r.STRING="string";var i={};Object.defineProperty(i,"__esModule",{value:!0}),i.defaults=void 0;const l=t({}),s={tag:"-",fixed:{lex:!0,token:{"#OB":"{","#CB":"}","#OS":"[","#CS":"]","#CL":":","#CA":","}},match:{lex:!0,token:{}},tokenSet:{IGNORE:["#SP","#LN","#CM"],VAL:["#TX","#NR","#ST","#VL"],KEY:["#TX","#NR","#ST","#VL"]},space:{lex:!0,chars:" \t"},line:{lex:!0,chars:"\r\n",rowChars:"\n",single:!1},text:{lex:!0},number:{lex:!0,hex:!0,oct:!0,bin:!0,sep:"_",exclude:void 0},comment:{lex:!0,def:{hash:{line:!0,start:"#",lex:!0,eatline:!1},slash:{line:!0,start:"//",lex:!0,eatline:!1},multi:{line:!1,start:"/*",end:"*/",lex:!0,eatline:!1}}},string:{lex:!0,chars:"'\"`",multiChars:"`",escapeChar:"\\",escape:{b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","`":"`","\\":"\\","/":"/"},allowUnknown:!0,abandon:!1},map:{extend:!0,merge:void 0},list:{property:!0},value:{lex:!0,def:{true:{val:!0},false:{val:!1},null:{val:null}}},ender:[],plugin:{},debug:{get_console:()=>console,maxlen:99,print:{config:!1,src:void 0}},error:{unknown:"unknown error: $code",unexpected:"unexpected character(s): $src",invalid_unicode:"invalid unicode escape: $src",invalid_ascii:"invalid ascii escape: $src",unprintable:"unprintable character: $src",unterminated_string:"unterminated string: $src",unterminated_comment:"unterminated comment: $src",unknown_rule:"unknown rule: $rulename"},hint:function(e=((e,n="replace")=>e[n](/[A-Z]/g,e=>" "+e.toLowerCase())[n](/[~%][a-z]/g,e=>("~"==e[0]?" ":"")+e[1].toUpperCase())),n="~sinceTheErrorIsUnknown,ThisIsProbablyABugInsideJsonic\nitself,OrAPlugin.~pleaseConsiderPostingAGithubIssue -Thanks!\n\n~code: $code,~details: \n$details|~theCharacter(s) $srcWereNotExpectedAtThisPointAsTheyDoNot\nmatchTheExpectedSyntax,EvenUnderTheRelaxedJsonicRules.~ifIt\nisNotObviouslyWrong,TheActualSyntaxErrorMayBeElsewhere.~try\ncommentingOutLargerAreasAroundThisPointUntilYouGetNoErrors,\nthenRemoveTheCommentsInSmallSectionsUntilYouFindThe\noffendingSyntax.~n%o%t%e:~alsoCheckIfAnyPluginsYouAreUsing\nexpectDifferentSyntaxInThisCase.|~theEscapeSequence $srcDoesNotEncodeAValidUnicodeCodePoint\nnumber.~youMayNeedToValidateYourStringDataManuallyUsingTest\ncodeToSeeHow~javaScriptWillInterpretIt.~alsoConsiderThatYour\ndataMayHaveBecomeCorrupted,OrTheEscapeSequenceHasNotBeen\ngeneratedCorrectly.|~theEscapeSequence $srcDoesNotEncodeAValid~a%s%c%i%iCharacter.~you\nmayNeedToValidateYourStringDataManuallyUsingTestCodeToSee\nhow~javaScriptWillInterpretIt.~alsoConsiderThatYourDataMay\nhaveBecomeCorrupted,OrTheEscapeSequenceHasNotBeenGenerated\ncorrectly.|~stringValuesCannotContainUnprintableCharacters (characterCodes\nbelow 32).~theCharacter $srcIsUnprintable.~youMayNeedToRemove\ntheseCharactersFromYourSourceData.~alsoCheckThatItHasNot\nbecomeCorrupted.|~thisStringHasNoEndQuote.|~thisCommentIsNeverClosed.|~noRuleNamed $rulenameIsDefined.~thisIsProbablyAnErrorInThe\ngrammarOfAPlugin.".split("|")){return"unknown|unexpected|invalid_unicode|invalid_ascii|unprintable|unterminated_string|unterminated_comment|unknown_rule".split("|").reduce((t,r,i)=>(t[r]=e(n[i]),t),{})},lex:{match:{match:{order:1e6,make:l.makeMatchMatcher},fixed:{order:2e6,make:l.makeFixedMatcher},space:{order:3e6,make:l.makeSpaceMatcher},line:{order:4e6,make:l.makeLineMatcher},string:{order:5e6,make:l.makeStringMatcher},comment:{order:6e6,make:l.makeCommentMatcher},number:{order:7e6,make:l.makeNumberMatcher},text:{order:8e6,make:l.makeTextMatcher}},empty:!0,emptyResult:void 0},parse:{prepare:{}},rule:{start:"val",finish:!0,maxmul:3,include:"",exclude:""},result:{fail:[]},config:{modify:{}},parser:{start:void 0}};i.defaults=s;var o={};Object.defineProperty(o,"__esModule",{value:!0}),o.makeRuleSpec=o.makeNoRule=o.makeRule=void 0;const a=n({});class c{constructor(e,n,t){this.i=-1,this.name=r.EMPTY,this.node=null,this.state=r.OPEN,this.n=Object.create(null),this.d=-1,this.use=Object.create(null),this.keep=Object.create(null),this.bo=!1,this.ao=!1,this.bc=!1,this.ac=!1,this.os=0,this.cs=0,this.need=0,this.i=n.uI++,this.name=e.name,this.spec=e,this.child=n.NORULE,this.parent=n.NORULE,this.prev=n.NORULE,this.o0=n.NOTOKEN,this.o1=n.NOTOKEN,this.c0=n.NOTOKEN,this.c1=n.NOTOKEN,this.node=t,this.d=n.rsI,this.bo=null!=e.def.bo,this.ao=null!=e.def.ao,this.bc=null!=e.def.bc,this.ac=null!=e.def.ac}process(e,n){return this.spec.process(this,e,n,this.state)}toString(){return"[Rule "+this.name+"~"+this.i+"]"}}const u=(...e)=>new c(...e);o.makeRule=u,o.makeNoRule=e=>u(g(e.cfg,{}),e);class p{constructor(){this.p=r.EMPTY,this.r=r.EMPTY,this.b=0}}const d=(...e)=>new p(...e),f=d(),m=d();class h{constructor(e,n){this.name=r.EMPTY,this.def={open:[],close:[],bo:[],bc:[],ao:[],ac:[],tcol:[]},this.cfg=e,this.def=Object.assign(this.def,n),this.def.open=(this.def.open||[]).filter(e=>null!=e),this.def.close=(this.def.close||[]).filter(e=>null!=e);for(let t of[...this.def.open,...this.def.close])x(t)}tin(e){return(0,a.tokenize)(e,this.cfg)}add(e,n,t){let r=(null==t?void 0:t.append)?"push":"unshift",i=((0,a.isarr)(n)?n:[n]).filter(e=>null!=e&&"object"==typeof e).map(e=>x(e)),l="o"===e?"open":"close",s=this.def[l];return s[r](...i),s=this.def[l]=(0,a.modlist)(s,t),(0,a.filterRules)(this,this.cfg),this.norm(),this}open(e,n){return this.add("o",e,n)}close(e,n){return this.add("c",e,n)}action(e,n,t,r){let i=this.def[n+t];return e?i.push(r):i.unshift(r),this}bo(e,n){return this.action(!n||!!e,r.BEFORE,r.OPEN,n||e)}ao(e,n){return this.action(!n||!!e,r.AFTER,r.OPEN,n||e)}bc(e,n){return this.action(!n||!!e,r.BEFORE,r.CLOSE,n||e)}ac(e,n){return this.action(!n||!!e,r.AFTER,r.CLOSE,n||e)}clear(){return this.def.open.length=0,this.def.close.length=0,this.def.bo.length=0,this.def.ao.length=0,this.def.bc.length=0,this.def.ac.length=0,this}norm(){this.def.open.map(e=>x(e)),this.def.close.map(e=>x(e));const e=[];function n(e,n,t){return t[e]=t[e]||[],[function(e,t){if(t.s&&t.s[n]){let r=[...new Set(e.concat(t.s[n]))];e.length=0,e.push(...r)}return e},t[e][n]=t[e][n]||[]]}return this.def.open.reduce(...n(0,0,e)),this.def.open.reduce(...n(0,1,e)),this.def.close.reduce(...n(1,0,e)),this.def.close.reduce(...n(1,1,e)),this.def.tcol=e,this}process(e,n,t,i){n.log&&n.log(a.S.rule,n,e,t);let l="o"===i,s=l?e:n.NORULE,o=l?"O":"C",c=this.def,p=l?c.open:c.close,d=l?e.bo?c.bo:null:e.bc?c.bc:null;if(d){let t;for(let r=0;r<d.length;r++)if(t=d[r].call(this,e,n,s,t),(null==t?void 0:t.isToken)&&(null==t?void 0:t.err))return this.bad(t,e,n,{is_open:l})}let h=0<p.length?function(e,n,t,i,l){let s=f;s.b=0,s.p=r.EMPTY,s.r=r.EMPTY,s.n=void 0,s.h=void 0,s.a=void 0,s.u=void 0,s.k=void 0,s.e=void 0;let o=null,c=0,u=!0,p=1<<l.cfg.t.AA-1,d=l.cfg.tokenSetTins.IGNORE;function m(e,n,r,i){let s;do{s=t.next(e,n,r,i),l.tC++}while(d[s.tin]);return s}let h=n.length;for(c=0;c<h;c++){o=n[c];let t=!1,r=!1;if(u=!0,o.S0){let e=(l.t0=l.NOTOKEN!==l.t0?l.t0:l.t0=m(i,o,c,0)).tin;if(t=!0,u=!!(o.S0[e/31|0]&(1<<e%31-1|p)),u&&(r=null!=o.S1,o.S1)){let e=(l.t1=l.NOTOKEN!==l.t1?l.t1:l.t1=m(i,o,c,1)).tin;r=!0,u=!!(o.S1[e/31|0]&(1<<e%31-1|p))}}if(e?(i.o0=t?l.t0:l.NOTOKEN,i.o1=r?l.t1:l.NOTOKEN,i.os=(t?1:0)+(r?1:0)):(i.c0=t?l.t0:l.NOTOKEN,i.c1=r?l.t1:l.NOTOKEN,i.cs=(t?1:0)+(r?1:0)),u&&o.c&&(u=u&&o.c(i,l,s)),u)break;o=null}u||(s.e=l.t0),o&&(s.n=null!=o.n?o.n:s.n,s.h=null!=o.h?o.h:s.h,s.a=null!=o.a?o.a:s.a,s.u=null!=o.u?o.u:s.u,s.k=null!=o.k?o.k:s.k,s.g=null!=o.g?o.g:s.g,s.e=o.e&&o.e(i,l,s)||void 0,s.p=null!=o.p&&!1!==o.p?"string"==typeof o.p?o.p:o.p(i,l,s):s.p,s.r=null!=o.r&&!1!==o.r?"string"==typeof o.r?o.r:o.r(i,l,s):s.r,s.b=null!=o.b&&!1!==o.b?"number"==typeof o.b?o.b:o.b(i,l,s):s.b);let g=c<n.length;return l.log&&l.log(a.S.parse,l,i,t,g,u,c,o,s),s}(l,p,t,e,n):m;if(h.h&&(h=h.h(e,n,h,s)||h,o+="H"),h.e)return this.bad(h.e,e,n,{is_open:l});if(h.n)for(let r in h.n)e.n[r]=0===h.n[r]?0:(null==e.n[r]?0:e.n[r])+h.n[r];if(h.u&&(e.use=Object.assign(e.use,h.u)),h.k&&(e.keep=Object.assign(e.keep,h.k)),h.a){o+="A";let t=h.a(e,n,h);if(t&&t.isToken&&t.err)return this.bad(t,e,n,{is_open:l})}if(h.p){n.rs[n.rsI++]=e;let t=n.rsm[h.p];if(!t)return this.bad(this.unknownRule(n.t0,h.p),e,n,{is_open:l});s=e.child=u(t,n,e.node),s.parent=e,s.n={...e.n},0<Object.keys(e.keep).length&&(s.keep={...e.keep}),o+="P`"+h.p+"`"}else if(h.r){let t=n.rsm[h.r];if(!t)return this.bad(this.unknownRule(n.t0,h.r),e,n,{is_open:l});s=u(t,n,e.node),s.parent=e.parent,s.prev=e,s.n={...e.n},0<Object.keys(e.keep).length&&(s.keep={...e.keep}),o+="R`"+h.r+"`"}else l||(s=n.rs[--n.rsI]||n.NORULE);let g=l?e.ao?c.ao:null:e.ac?c.ac:null;if(g){let t;for(let r=0;r<g.length;r++)if(t=g[r](e,n,s,t),(null==t?void 0:t.isToken)&&(null==t?void 0:t.err))return this.bad(t,e,n,{is_open:l})}s.why=o,n.log&&n.log(a.S.node,n,e,t,s),r.OPEN===e.state&&(e.state=r.CLOSE);let x=e[l?"os":"cs"]-(h.b||0);return 1===x?(n.v2=n.v1,n.v1=n.t0,n.t0=n.t1,n.t1=n.NOTOKEN):2==x&&(n.v2=n.t1,n.v1=n.t0,n.t0=n.NOTOKEN,n.t1=n.NOTOKEN),s}bad(e,n,t,r){throw new a.JsonicError(e.err||a.S.unexpected,{...e.use,state:r.is_open?a.S.open:a.S.close},e,n,t)}unknownRule(e,n){return e.err="unknown_rule",e.use=e.use||{},e.use.rulename=n,e}}const g=(...e)=>new h(...e);function x(e){if(null!=e.c){let n=e.c.n,t=e.c.d;null==n&&null==t||(e.c=function(e){let r=!0;if(null!=n)for(let t in n)r=r&&(null==e.n[t]||e.n[t]<=(null==n[t]?0:n[t]));return null!=t&&(r=r&&e.d<=t),r},null!=n&&(e.c.n=n),null!=t&&(e.c.d=t))}if(r.STRING===typeof e.g?e.g=e.g.split(/\s*,\s*/):null==e.g&&(e.g=[]),e.g=e.g.sort(),e.s&&0!==e.s.length){const n=e=>e.flat().filter(e=>"number"==typeof e),t=(e,n)=>e.filter(e=>31*n<=e&&e<31*(n+1)),r=(e,n)=>e.reduce((e,t)=>1<<t-(31*n+1)|e,0),i=n([e.s[0]]),l=n([e.s[1]]),s=e;s.S0=0<i.length?new Array(Math.max(...i.map(e=>1+e/31|0))).fill(null).map((e,n)=>n).map(e=>r(t(i,e),e)):null,s.S1=0<l.length?new Array(Math.max(...l.map(e=>1+e/31|0))).fill(null).map((e,n)=>n).map(e=>r(t(l,e),e)):null}else e.s=null;return e.p||(e.p=null),e.r||(e.r=null),e.b||(e.b=null),e}o.makeRuleSpec=g;var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.makeParser=v.makeRuleSpec=v.makeRule=void 0;const k=n({}),b=t({});Object.defineProperty(v,"makeRule",{enumerable:!0,get:function(){return o.makeRule}}),Object.defineProperty(v,"makeRuleSpec",{enumerable:!0,get:function(){return o.makeRuleSpec}});class y{constructor(e,n){this.rsm={},this.options=e,this.cfg=n}rule(e,n){if(null==e)return this.rsm;let t=this.rsm[e];if(null===n)delete this.rsm[e];else if(void 0!==n)return t=this.rsm[e]=this.rsm[e]||(0,o.makeRuleSpec)(this.cfg,{}),t=this.rsm[e]=n(this.rsm[e],this)||this.rsm[e],void(t.name=e);return t}start(e,n,t,i){let l,s=(0,b.makeToken)("#ZZ",(0,k.tokenize)("#ZZ",this.cfg),void 0,r.EMPTY,(0,b.makePoint)(-1)),a=(0,b.makeNoToken)(),c={uI:0,opts:this.options,cfg:this.cfg,meta:t||{},src:()=>e,root:()=>l,plgn:()=>n.internal().plugins,rule:{},sub:n.internal().sub,xs:-1,v2:s,v1:s,t0:a,t1:a,tC:-2,kI:-1,rs:[],rsI:0,rsm:this.rsm,log:void 0,F:(0,k.srcfmt)(this.cfg),use:{},NOTOKEN:a,NORULE:{}};c=(0,k.deep)(c,i);let u=(0,o.makeNoRule)(c);if(c.NORULE=u,c.rule=u,t&&k.S.function===typeof t.log&&(c.log=t.log),this.cfg.parse.prepare.forEach(e=>e(n,c,t)),""===e){if(this.cfg.lex.empty)return this.cfg.lex.emptyResult;throw new k.JsonicError(k.S.unexpected,{src:e},c.t0,u,c)}let p=(0,k.badlex)((0,b.makeLex)(c),(0,k.tokenize)("#BD",this.cfg),c),d=this.rsm[this.cfg.rule.start];if(null==d)return;let f=(0,o.makeRule)(d,c);l=f;let m=2*(0,k.keys)(this.rsm).length*p.src.length*2*c.cfg.rule.maxmul,h=0;for(;u!==f&&h<m;)c.kI=h,c.rule=f,c.log&&c.log("",c.kI+":"),c.sub.rule&&c.sub.rule.map(e=>e(f,c)),f=f.process(c,p),c.log&&c.log(k.S.stack,c,f,p),h++;if(s.tin!==p.next(f).tin)throw new k.JsonicError(k.S.unexpected,{},c.t0,u,c);const g=c.root().node;if(this.cfg.result.fail.includes(g))throw new k.JsonicError(k.S.unexpected,{},c.t0,u,c);return g}clone(e,n){let t=new y(e,n);return t.rsm=Object.keys(this.rsm).reduce((e,n)=>(e[n]=(0,k.filterRules)(this.rsm[n],this.cfg),e),{}),t.norm(),t}norm(){(0,k.values)(this.rsm).map(e=>e.norm())}}v.makeParser=(...e)=>new y(...e);var _={};function S(e){const{deep:n}=e.util,{OB:t,CB:r,OS:i,CS:l,CL:s,CA:o,TX:a,ST:c,ZZ:u}=e.token,{VAL:p,KEY:d}=e.tokenSet,f=(e,n)=>{if(!n.cfg.rule.finish)return n.t0.src="END_OF_SOURCE",n.t0},m=e=>{const n=e.o0,t=c===n.tin||a===n.tin?n.val:n.src;e.use.key=t};e.rule("val",e=>{e.bo(e=>e.node=void 0).open([{s:[t],p:"map",b:1,g:"map,json"},{s:[i],p:"list",b:1,g:"list,json"},{s:[p],g:"val,json"}]).close([{s:[u],g:"end,json"},{b:1,g:"more,json"}]).bc((e,n)=>{e.node=void 0===e.node?void 0===e.child.node?0===e.os?void 0:e.o0.resolveVal(e,n):e.child.node:e.node})}),e.rule("map",e=>{e.bo(e=>{e.node={}}).open([{s:[t,r],b:1,n:{pk:0},g:"map,json"},{s:[t],p:"pair",n:{pk:0},g:"map,json,pair"}]).close([{s:[r],g:"end,json"}])}),e.rule("list",e=>{e.bo(e=>{e.node=[]}).open([{s:[i,l],b:1,g:"list,json"},{s:[i],p:"elem",g:"list,elem,json"}]).close([{s:[l],g:"end,json"}])}),e.rule("pair",e=>{e.open([{s:[d,s],p:"val",u:{pair:!0},a:m,g:"map,pair,key,json"}]).bc((e,n)=>{e.use.pair&&(e.use.prev=e.node[e.use.key],e.node[e.use.key]=e.child.node)}).close([{s:[o],r:"pair",g:"map,pair,json"},{s:[r],b:1,g:"map,pair,json"}])}),e.rule("elem",e=>{e.open([{p:"val",g:"list,elem,val,json"}]).bc(e=>{!0!==e.use.done&&e.node.push(e.child.node)}).close([{s:[o],r:"elem",g:"list,elem,json"},{s:[l],b:1,g:"list,elem,json"}])});const h=(e,t)=>{let r=e.use.key,i=e.child.node;const l=e.use.prev;i=void 0===i?null:i,e.node[r]=null==l?i:t.cfg.map.merge?t.cfg.map.merge(l,i,e,t):t.cfg.map.extend?n(l,i):i};e.rule("val",e=>{e.open([{s:[d,s],p:"map",b:2,n:{pk:1},g:"pair,jsonic"},{s:[p],g:"val,json"},{s:[[r,l]],b:1,c:e=>0<e.d,g:"val,imp,null,jsonic"},{s:[o],c:e=>0===e.d,p:"list",b:1,g:"list,imp,jsonic"},{s:[o],b:1,g:"list,val,imp,null,jsonic"},{s:[u],g:"jsonic"}],{append:!0,delete:[2]}).close([{s:[[r,l]],b:1,g:"val,json,close",e:(e,n)=>0===e.d?n.t0:void 0},{s:[o],c:{n:{dlist:0,dmap:0}},r:"list",u:{implist:!0},g:"list,val,imp,comma,jsonic"},{c:{n:{dlist:0,dmap:0}},r:"list",u:{implist:!0},g:"list,val,imp,space,jsonic",b:1},{s:[u],g:"jsonic"}],{append:!0,move:[1,-1]})}),e.rule("map",e=>{e.bo(e=>{e.n.dmap=1+(e.n.dmap?e.n.dmap:0)}).open([{s:[t,u],b:1,e:f,g:"end,jsonic"}]).open([{s:[d,s],p:"pair",b:2,g:"pair,list,val,imp,jsonic"}],{append:!0}).close([{s:[r],c:{n:{pk:0}},g:"end,json"},{s:[r],b:1,g:"path,jsonic"},{s:[[o,l,...p]],b:1,g:"end,path,jsonic"},{s:[u],e:f,g:"end,jsonic"}],{append:!0,delete:[0]})}),e.rule("list",e=>{e.bo(e=>{e.n.dlist=1+(e.n.dlist?e.n.dlist:0),e.prev.use.implist&&(e.node.push(e.prev.node),e.prev.node=e.node)}).open({c:e=>e.prev.use.implist,p:"elem"}).open([{s:[o],p:"elem",b:1,g:"list,elem,val,imp,jsonic"},{p:"elem",g:"list,elem.jsonic"}],{append:!0}).close([{s:[u],e:f,g:"end,jsonic"}],{append:!0})}),e.rule("pair",(e,n)=>{e.open([{s:[o],g:"map,pair,comma,jsonic"}],{append:!0}).bc((e,n)=>{e.use.pair&&h(e,n)}).close([{s:[r],c:{n:{pk:0}},b:1,g:"map,pair,json"},{s:[o,r],c:{n:{pk:0}},b:1,g:"map,pair,comma,jsonic"},{s:[o,u],g:"end,jsonic"},{s:[o],c:{n:{pk:0}},r:"pair",g:"map,pair,json"},{s:[o],c:{n:{dmap:1}},r:"pair",g:"map,pair,jsonic"},{s:[d],c:{n:{dmap:1}},r:"pair",b:1,g:"map,pair,imp,jsonic"},{s:[[r,o,l,...d]],b:1,g:"map,pair,imp,path,jsonic",c:e=>0<e.n.pk},{s:[l],e:e=>e.c0,g:"end,jsonic"},{s:[u],e:f,g:"map,pair,json"},{r:"pair",b:1,g:"map,pair,imp,jsonic"}],{append:!0,delete:[0,1]})}),e.rule("elem",(e,n)=>{e.open([{s:[o,o],b:2,u:{done:!0},a:e=>e.node.push(null),g:"list,elem,imp,null,jsonic"},{s:[o],u:{done:!0},a:e=>e.node.push(null),g:"list,elem,imp,null,jsonic"},{s:[d,s],e:n.cfg.list.property?void 0:(e,n)=>n.t0,p:"val",n:{pk:1,dmap:1},u:{done:!0,pair:!0},a:m,g:"elem,pair,jsonic"}]).bc((e,n)=>{!0===e.use.pair&&(e.use.prev=e.node[e.use.key],h(e,n))}).close([{s:[o,[l,u]],b:1,g:"list,elem,comma,jsonic"},{s:[o],r:"elem",g:"list,elem,json"},{s:[l],b:1,g:"list,elem,json"},{s:[u],e:f,g:"list,elem,json"},{s:[r],e:e=>e.c0,g:"end,jsonic"},{r:"elem",b:1,g:"list,elem,imp,jsonic"}],{delete:[-1,-2]})})}Object.defineProperty(_,"__esModule",{value:!0}),_.makeJSON=_.grammar=void 0,_.grammar=S,_.makeJSON=function(e){let n=e.make({grammar$:!1,text:{lex:!1},number:{hex:!1,oct:!1,bin:!1,sep:null,exclude:/^00+/},string:{chars:'"',multiChars:"",allowUnknown:!1,escape:{v:null}},comment:{lex:!1},map:{extend:!1},lex:{empty:!1},rule:{finish:!1,include:"json"},result:{fail:[void 0,NaN]},tokenSet:{KEY:["#ST",null,null,null]}});return S(n),n};var E={};Object.defineProperty(E,"__esModule",{value:!0}),E.root=E.foo=E.S=E.EMPTY=E.AFTER=E.BEFORE=E.CLOSE=E.OPEN=E.makeTextMatcher=E.makeNumberMatcher=E.makeCommentMatcher=E.makeStringMatcher=E.makeLineMatcher=E.makeSpaceMatcher=E.makeFixedMatcher=E.makeParser=E.makeLex=E.makeRuleSpec=E.makeRule=E.makePoint=E.makeToken=E.make=E.util=E.JsonicError=E.Jsonic=void 0,Object.defineProperty(E,"OPEN",{enumerable:!0,get:function(){return r.OPEN}}),Object.defineProperty(E,"CLOSE",{enumerable:!0,get:function(){return r.CLOSE}}),Object.defineProperty(E,"BEFORE",{enumerable:!0,get:function(){return r.BEFORE}}),Object.defineProperty(E,"AFTER",{enumerable:!0,get:function(){return r.AFTER}}),Object.defineProperty(E,"EMPTY",{enumerable:!0,get:function(){return r.EMPTY}});const O=n({});Object.defineProperty(E,"JsonicError",{enumerable:!0,get:function(){return O.JsonicError}}),Object.defineProperty(E,"S",{enumerable:!0,get:function(){return O.S}});const j=t({});Object.defineProperty(E,"makePoint",{enumerable:!0,get:function(){return j.makePoint}}),Object.defineProperty(E,"makeToken",{enumerable:!0,get:function(){return j.makeToken}}),Object.defineProperty(E,"makeLex",{enumerable:!0,get:function(){return j.makeLex}}),Object.defineProperty(E,"makeFixedMatcher",{enumerable:!0,get:function(){return j.makeFixedMatcher}}),Object.defineProperty(E,"makeSpaceMatcher",{enumerable:!0,get:function(){return j.makeSpaceMatcher}}),Object.defineProperty(E,"makeLineMatcher",{enumerable:!0,get:function(){return j.makeLineMatcher}}),Object.defineProperty(E,"makeStringMatcher",{enumerable:!0,get:function(){return j.makeStringMatcher}}),Object.defineProperty(E,"makeCommentMatcher",{enumerable:!0,get:function(){return j.makeCommentMatcher}}),Object.defineProperty(E,"makeNumberMatcher",{enumerable:!0,get:function(){return j.makeNumberMatcher}}),Object.defineProperty(E,"makeTextMatcher",{enumerable:!0,get:function(){return j.makeTextMatcher}}),Object.defineProperty(E,"makeRule",{enumerable:!0,get:function(){return v.makeRule}}),Object.defineProperty(E,"makeRuleSpec",{enumerable:!0,get:function(){return v.makeRuleSpec}}),Object.defineProperty(E,"makeParser",{enumerable:!0,get:function(){return v.makeParser}});const I={tokenize:O.tokenize,srcfmt:O.srcfmt,clone:O.clone,charset:O.charset,trimstk:O.trimstk,makelog:O.makelog,badlex:O.badlex,extract:O.extract,errinject:O.errinject,errdesc:O.errdesc,configure:O.configure,parserwrap:O.parserwrap,mesc:O.mesc,escre:O.escre,regexp:O.regexp,prop:O.prop,str:O.str,clean:O.clean,deep:O.deep,omap:O.omap,keys:O.keys,values:O.values,entries:O.entries};function T(e,n){let t=!0;if("jsonic"===e)t=!1;else if("json"===e)return(0,_.makeJSON)(M);e="string"==typeof e?{}:e;let r={parser:null,config:null,plugins:[],sub:{lex:void 0,rule:void 0},mark:Math.random()},l=(0,O.deep)({},n?{...n.options}:!1===(null==e?void 0:e.defaults$)?{}:i.defaults,e||{}),s=function(e,n,t){var r;if(O.S.string===typeof e){let i=s.internal();return((null===(r=o.parser)||void 0===r?void 0:r.start)?(0,O.parserwrap)(o.parser):i.parser).start(e,s,n,t)}return e},o=e=>{if(null!=e&&O.S.object===typeof e){(0,O.deep)(l,e),(0,O.configure)(s,r.config,l);let n=s.internal().parser;r.parser=n.clone(l,r.config)}return{...s.options}},a={token:e=>(0,O.tokenize)(e,r.config,s),tokenSet:e=>(0,O.findTokenSet)(e,r.config),fixed:e=>r.config.fixed.ref[e],options:(0,O.deep)(o,l),config:()=>(0,O.deep)(r.config),parse:s,use:function(e,n){const t=e.name.toLowerCase(),r=(0,O.deep)({},e.defaults||{},n||{});s.options({plugin:{[t]:r}});let i=s.options.plugin[t];return s.internal().plugins.push(e),e.options=i,e(s,i)||s},rule:(e,n)=>s.internal().parser.rule(e,n)||s,make:e=>T(e,s),empty:e=>T({defaults$:!1,standard$:!1,grammar$:!1,...e||{}}),id:"Jsonic/"+Date.now()+"/"+(""+Math.random()).substring(2,8).padEnd(6,"0")+(null==o.tag?"":"/"+o.tag),toString:()=>a.id,sub:e=>(e.lex&&(r.sub.lex=r.sub.lex||[],r.sub.lex.push(e.lex)),e.rule&&(r.sub.rule=r.sub.rule||[],r.sub.rule.push(e.rule)),s),util:I};if((0,O.defprop)(a.make,O.S.name,{value:O.S.make}),t?(0,O.assign)(s,a):(0,O.assign)(s,{empty:a.empty,parse:a.parse,sub:a.sub,id:a.id,toString:a.toString}),(0,O.defprop)(s,"internal",{value:()=>r}),n){for(let t in n)void 0===s[t]&&(s[t]=n[t]);s.parent=n;let e=n.internal();r.config=(0,O.deep)({},e.config),(0,O.configure)(s,r.config,l),(0,O.assign)(s.token,r.config.t),r.plugins=[...e.plugins],r.parser=e.parser.clone(l,r.config)}else{let e={...s,...a};r.config=(0,O.configure)(e,void 0,l),r.plugins=[],r.parser=(0,v.makeParser)(l,r.config),!1!==l.grammar$&&(0,_.grammar)(e)}return s}let M;E.util=I,E.make=T,E.root=M;let N=E.root=M=T("jsonic");return E.Jsonic=N,M.Jsonic=M,M.JsonicError=O.JsonicError,M.makeLex=j.makeLex,M.makeParser=v.makeParser,M.makeToken=j.makeToken,M.makePoint=j.makePoint,M.makeRule=v.makeRule,M.makeRuleSpec=v.makeRuleSpec,M.makeFixedMatcher=j.makeFixedMatcher,M.makeSpaceMatcher=j.makeSpaceMatcher,M.makeLineMatcher=j.makeLineMatcher,M.makeStringMatcher=j.makeStringMatcher,M.makeCommentMatcher=j.makeCommentMatcher,M.makeNumberMatcher=j.makeNumberMatcher,M.makeTextMatcher=j.makeTextMatcher,M.OPEN=r.OPEN,M.CLOSE=r.CLOSE,M.BEFORE=r.BEFORE,M.AFTER=r.AFTER,M.EMPTY=r.EMPTY,M.util=I,M.make=T,M.S=O.S,E.foo="FOO",E.default=N,E}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),e=e.exports;var n={};Object.defineProperty(n,"__esModule",{value:!0}),n.testing=n.evaluate=n.Expr=void 0;const{omap:t,entries:r,values:i}=e.util,l={};let s=function(e,n){let s=e.token.bind(e),y=e.fixed.bind(e),_=n.op||{};const S=v(s,y,_,"prefix"),E=v(s,y,_,"suffix"),O=v(s,y,_,"infix"),j=v(s,y,_,"ternary"),I=function(e,n,t){return r(t).reduce((t,[r,i])=>{if(i.paren){let s=n(i.osrc)||e("#E"+i.osrc),o=e(s),a=n(i.csrc)||e("#E"+i.csrc),c=e(a);t[s]={name:r+"-paren",osrc:i.osrc,csrc:i.csrc,otkn:o,otin:s,ctkn:c,ctin:a,preval:{active:null!=i.preval&&(null==i.preval.active||i.preval.active),required:null!=i.preval&&null!=i.preval.required&&i.preval.required},use:{},paren:!0,src:i.osrc,left:Number.MIN_SAFE_INTEGER,right:Number.MAX_SAFE_INTEGER,infix:!1,prefix:!1,suffix:!1,ternary:!1,tkn:"",tin:-1,terms:1,token:{},OP_MARK:l}}return t},{})}(s,y,_),T=t(I,([e,n])=>[void 0,void 0,n.ctin,n]);let M=Object.values({...I,...T}).reduce((e,n)=>(e[n.otkn]=n.osrc,e[n.ctkn]=n.csrc,e),{}),N=Object.values({...S,...E,...O,...j}).reduce((e,n)=>(e[n.tkn]=n.src,e),{});e.options({fixed:{token:{...N,...M}},lex:{match:{comment:{order:1e5}}}});const P=i(S).map(e=>e.tin),C=i(O).map(e=>e.tin),R=i(E).map(e=>e.tin),w=i(j).filter(e=>0===e.use.ternary.opI).map(e=>e.tin),A=i(j).filter(e=>1===e.use.ternary.opI).map(e=>e.tin),L=i(I).map(e=>e.otin),Y=i(T).map(e=>e.ctin),F=0<P.length,$=0<C.length,U=0<R.length,J=0<w.length&&0<A.length,K=0<L.length&&0<Y.length,B=e.token.CA,V=e.token.CS,D=e.token.CB,G=e.token.TX,z=e.token.NR,Z=e.token.ST,q=e.token.VL,W=e.token.ZZ,X=[G,z,Z,q];e.rule("val",n=>{J&&A.includes(e.token.CL)&&(n.def.open.find(e=>e.g.includes("pair")).c=e=>!e.n.expr_ternary),n.open([F?{s:[P],b:1,n:{expr_prefix:1,expr_suffix:0},p:"expr",g:"expr,expr-prefix"}:null,K?{s:[L],b:1,p:"paren",c:(e,n)=>{let t=!0;return I[e.o0.tin].preval.required&&(t="val"===e.prev.name&&e.prev.use.paren_preval),t&&1===e.prev.i&&(n.root=()=>e),t},g:"expr,expr-paren"}:null]).close([J?{s:[w],c:e=>!e.n.expr,b:1,r:"ternary",g:"expr,expr-ternary"}:null,$?{s:[C],b:1,n:{expr_prefix:0,expr_suffix:0},r:e=>e.n.expr?"":"expr",g:"expr,expr-infix"}:null,U?{s:[R],b:1,n:{expr_prefix:0,expr_suffix:1},r:e=>e.n.expr?"":"expr",g:"expr,expr-suffix"}:null,K?{s:[Y],c:e=>!!e.n.expr_paren,b:1,g:"expr,expr-paren"}:null,K?{s:[L],b:1,r:"val",c:e=>I[e.c0.tin].preval.active,u:{paren_preval:!0},g:"expr,expr-paren,expr-paren-preval"}:null,J?{s:[A],c:e=>!!e.n.expr_ternary,b:1,g:"expr,expr-ternary"}:null,{s:[B],c:e=>1===e.d&&(1<=e.n.expr||1<=e.n.expr_ternary)||1<=e.n.expr_ternary&&1<=e.n.expr_paren,b:1,g:"expr,list,val,imp,comma,top"},{s:[X],c:e=>1===e.d&&(1<=e.n.expr||1<=e.n.expr_ternary)||1<=e.n.expr_ternary&&1<=e.n.expr_paren,b:1,g:"expr,list,val,imp,space,top"}])}),e.rule("list",e=>{e.bo(!1,e=>{e.prev.use.implist||(e.n.expr=0,e.n.expr_prefix=0,e.n.expr_suffix=0,e.n.expr_paren=0,e.n.expr_ternary=0)}).close([K&&{s:[Y],b:e=>V!==e.c0.tin||e.n.expr_paren?1:0}])}),e.rule("map",e=>{e.bo(!1,(...e)=>{e[0].n.expr=0,e[0].n.expr_prefix=0,e[0].n.expr_suffix=0,e[0].n.expr_paren=0,e[0].n.expr_ternary=0}).close([K&&{s:[Y],b:e=>D!==e.c0.tin||e.n.expr_paren?1:0}])}),e.rule("elem",e=>{e.close([K?{s:[Y],b:1,c:e=>!!e.n.expr_paren,g:"expr,expr-paren,imp,close,list"}:null,K?{s:[L],b:1,r:"elem",g:"expr,expr-paren,imp,open,list"}:null])}),e.rule("pair",e=>{e.close([K?{s:[Y],b:1,c:e=>!!e.n.expr_paren||0<e.n.pk,g:"expr,expr-paren,imp,map"}:null])}),e.rule("expr",e=>{e.open([F?{s:[P],c:e=>!!e.n.expr_prefix,n:{expr:1,dlist:1,dmap:1},p:"val",g:"expr,expr-prefix",a:e=>{const n=a(e.o0,S);e.node=x(e.parent.node)?k(e.parent.node,n):o(e,e.parent,n)}}:null,$?{s:[C],p:"val",n:{expr:1,expr_prefix:0,dlist:1,dmap:1},a:e=>{const n=e.prev,t=e.parent,r=a(e.o0,O);x(t.node)&&!g("ternary",t.node)?e.node=k(t.node,r):x(n.node)?(e.node=k(n.node,r),e.parent=n):e.node=o(e,n,r)},g:"expr,expr-infix"}:null,U?{s:[R],n:{expr:1,expr_prefix:0,dlist:1,dmap:1},a:e=>{const n=e.prev,t=a(e.o0,E);e.node=x(n.node)?k(n.node,t):o(e,n,t)},g:"expr,expr-suffix"}:null]).bc(e=>{var n;x(e.node)&&(null===(n=e.node)||void 0===n?void 0:n.length)-1<e.node[0].terms&&e.node.push(e.child.node)}).close([$?{s:[C],c:e=>!e.n.expr_prefix,b:1,r:"expr",g:"expr,expr-infix"}:null,U?{s:[R],c:e=>!e.n.expr_prefix,b:1,r:"expr",g:"expr,expr-suffix"}:null,K?{s:[Y],c:e=>!!e.n.expr_paren,b:1}:null,J?{s:[w],c:e=>!e.n.expr_prefix,b:1,r:"ternary",g:"expr,expr-ternary"}:null,{s:[B],c:{d:0},n:{expr:0},r:"elem",a:e=>e.parent.node=e.node=[e.node],g:"expr,comma,list,top"},{s:[X],c:{d:0},n:{expr:0},b:1,r:"elem",a:e=>e.parent.node=e.node=[e.node],g:"expr,space,list,top"},{s:[B],c:{n:{pk:0}},n:{expr:0},b:1,h:f,g:"expr,list,val,imp,comma"},{c:{n:{pk:0,expr_suffix:0}},n:{expr:0},h:f,g:"expr,list,val,imp,space"},{n:{expr:0},g:"expr,expr-end"}]).ac(e=>{n.evaluate&&0===e.n.expr&&(e.parent.node=b(e.parent,e.parent.node,n.evaluate))})}),e.rule("paren",e=>{e.bo(e=>{e.n.dmap=0,e.n.dlist=0,e.n.pk=0}).open([K?{s:[L,Y],b:1,g:"expr,expr-paren,empty",c:e=>I[e.o0.tin].name===T[e.o1.tin].name,a:p(I)}:null,K?{s:[L],p:"val",n:{expr_paren:1,expr:0,expr_prefix:0,expr_suffix:0},g:"expr,expr-paren,open",a:p(I)}:null]).close([K?{s:[Y],c:e=>{let n="expr_paren_depth_"+T[e.c0.tin].name;return!!e.n[n]},a:d(T),g:"expr,expr-paren,close"}:null])}),J&&e.rule("ternary",e=>{e.open([{s:[w],p:"val",n:{expr_ternary:1,expr:0,expr_prefix:0,expr_suffix:0},u:{expr_ternary_step:1},g:"expr,expr-ternary,open",a:e=>{let n=a(e.o0,j);e.use.expr_ternary_name=n.name,x(e.prev.node)?e.node=c(e.prev.node,n,u(e.prev.node)):e.node=e.prev.node=c([],n,e.prev.node),e.use.expr_ternary_paren=e.n.expr_paren||e.prev.use.expr_ternary_paren||0,e.n.expr_paren=0}},{p:"val",c:e=>2===e.prev.use.expr_ternary_step,a:e=>{e.use.expr_ternary_step=e.prev.use.expr_ternary_step,e.n.expr_paren=e.use.expr_ternary_paren=e.prev.use.expr_ternary_paren},g:"expr,expr-ternary,step"}]).close([{s:[A],c:e=>1===e.use.expr_ternary_step&&e.use.expr_ternary_name===j[e.c0.tin].name,r:"ternary",a:e=>{e.use.expr_ternary_step++,e.node.push(e.child.node)},g:"expr,expr-ternary,step"},{s:[[B,...Y]],c:m,b:(e,n)=>Y.includes(n.t0.tin)?1:0,r:(e,n)=>{var t;return Y.includes(n.t0.tin)||0!==e.d&&(!e.prev.use.expr_ternary_paren||(null===(t=e.parent.node)||void 0===t?void 0:t.length))?"":"elem"},a:h,g:"expr,expr-ternary,list,val,imp,comma"},{c:m,r:(e,n)=>{var t;return 0!==e.d&&Y.includes(n.t0.tin)&&!e.prev.use.expr_ternary_paren||(null===(t=e.parent.node)||void 0===t?void 0:t.length)||W===n.t0.tin?"":"elem"},a:h,g:"expr,expr-ternary,list,val,imp,space"},{c:e=>0<e.d&&2===e.use.expr_ternary_step,a:e=>{e.node.push(e.child.node)},g:"expr,expr-ternary,close"}])})};function o(e,n,t){let r=n.node;return x(n.node)?r=u(n.node):n.node=[],c(n.node,t),t.prefix||(n.node[1]=r),e.parent=n,n.node}function a(e,n){return{...n[e.tin],token:e,OP_MARK:l}}function c(e,n,...t){let r=e;r[0]=n;let i=0;for(;i<t.length;i++)r[i+1]=t[i];return r.length=i+1,r}function u(e){return[...e]}function p(e){return function(n){let t="expr_paren_depth_"+a(n.o0,e).name;n.use[t]=n.n[t]=1,n.node=void 0}}function d(e){return function(n){(x(n.child.node)||void 0===n.node)&&(n.node=n.child.node);const t=a(n.c0,e);let r="expr_paren_depth_"+t.name;if(n.use[r]===n.n[r]){const e=n.node;n.node=[t],void 0!==e&&(n.node[1]=e),n.parent.prev.use.paren_preval&&(g("paren",n.parent.prev.node)?n.node=c(n.parent.prev.node,n.node[0],u(n.parent.prev.node),n.node[1]):(n.node.splice(1,0,n.parent.prev.node),n.parent.prev.node=n.node))}}}function f(e,n,t){let r=null;for(let i=n.rsI-1;-1<i;i--)if("paren"===n.rs[i].name){r=n.rs[i];break}return r&&(null==r.child.node?(r.child.node=[e.node],t.r="elem",t.b=0):x(r.child.node)&&(r.child.node=[r.child.node],t.r="elem",t.b=0),e.node=r.child.node),t}function m(e){return(0===e.d||1<=e.n.expr_paren)&&!e.n.pk&&2===e.use.expr_ternary_step}function h(e,n,t){e.n.expr_paren=e.prev.use.expr_ternary_paren,e.node.push(e.child.node),"elem"===t.r&&(e.node[0]=u(e.node),e.node.length=1)}function g(e,n){return null!=n&&x(n)&&!0===n[0][e]}function x(e){return null!=e&&e[0]&&e[0].OP_MARK===l}function v(e,n,t,r){return Object.entries(t).filter(([e,n])=>n[r]).reduce((t,[i,s])=>{let o="",a=-1,c="";c="string"==typeof s.src?s.src:s.src[0],a=n(c)||e("#E"+c),o=e(a);let u=t[a]={src:c,left:s.left||Number.MIN_SAFE_INTEGER,right:s.right||Number.MAX_SAFE_INTEGER,name:i+(i.endsWith("-"+r)?"":"-"+r),infix:"infix"===r,prefix:"prefix"===r,suffix:"suffix"===r,ternary:"ternary"===r,tkn:o,tin:a,terms:"ternary"===r?3:"infix"===r?2:1,use:{},paren:!1,osrc:"",csrc:"",otkn:"",ctkn:"",otin:-1,ctin:-1,preval:{active:!1,required:!1},token:{},OP_MARK:l};if(u.ternary){let r=s.src;u.src=r[0],u.use.ternary={opI:0};let i={...u};c=s.src[1],a=n(c)||e("#E"+c),o=e(a),i.src=c,i.use={ternary:{opI:1}},i.tkn=o,i.tin=a,t[a]=i}return t},{})}function k(e,n){let t=e,r=e[0];if(n)if(n.infix)if(r.suffix||n.left<=r.right)c(e,n,u(e));else{const i=r.terms;t=x(e[i])&&e[i][0].right<n.left?k(e[i],n):e[i]=c([],n,e[i])}else if(n.prefix)t=e[r.terms]=c([],n);else if(n.suffix)if(!r.suffix&&r.right<=n.left){const t=r.terms;x(e[t])&&e[t][0].prefix&&e[t][0].right<n.left?k(e[t],n):e[t]=c([],n,e[t])}else c(e,n,u(e));return t}function b(e,n,t){return null==n?n:x(n)?t(e,n[0],n.slice(1).map(n=>b(e,n,t))):n}n.Expr=s,s.defaults={op:{positive:{prefix:!0,right:14e3,src:"+"},negative:{prefix:!0,right:14e3,src:"-"},addition:{infix:!0,left:140,right:150,src:"+"},subtraction:{infix:!0,left:140,right:150,src:"-"},multiplication:{infix:!0,left:160,right:170,src:"*"},division:{infix:!0,left:160,right:170,src:"/"},remainder:{infix:!0,left:160,right:170,src:"%"},plain:{paren:!0,osrc:"(",csrc:")"}}},n.evaluate=b;const y={prattify:k,opify:e=>(e.OP_MARK=l,e)};return n.testing=y,n})); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JsonicExpr=e()}}((function(){var e={exports:{}};(function(n){(function(){!function(t){"object"==typeof e.exports?e.exports=t():("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).Jsonic=t()}((function(){var e=function(e){var n;return function(t){return n||e(n={exports:{},parent:t},n.exports),n.exports}},n=e((function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.modlist=n.findTokenSet=n.values=n.keys=n.omap=n.str=n.prop=n.parserwrap=n.trimstk=n.tokenize=n.srcfmt=n.snip=n.regexp=n.mesc=n.makelog=n.isarr=n.filterRules=n.extract=n.escre=n.errinject=n.errdesc=n.entries=n.defprop=n.deep=n.configure=n.clone=n.clean=n.charset=n.badlex=n.assign=n.S=n.JsonicError=void 0;const i=t({}),l=e=>null==e?[]:Object.keys(e);n.keys=l;const s=e=>null==e?[]:Object.values(e);n.values=s;const o=e=>null==e?[]:Object.entries(e);n.entries=o;const a=(e,...n)=>Object.assign(null==e?{}:e,...n);n.assign=a,n.isarr=e=>Array.isArray(e);const c=Object.defineProperty;n.defprop=c;const u=(e,n)=>Object.entries(e||{}).reduce((e,t)=>{let r=n?n(t):t;void 0===r[0]?delete e[t[0]]:e[r[0]]=r[1];let i=2;for(;void 0!==r[i];)e[r[i]]=r[i+1],i+=2;return e},{});n.omap=u;const p={indent:". ",logindent:" ",space:" ",gap:" ",Object:"Object",Array:"Array",object:"object",string:"string",function:"function",unexpected:"unexpected",map:"map",list:"list",elem:"elem",pair:"pair",val:"val",node:"node",no_re_flags:r.EMPTY,unprintable:"unprintable",invalid_ascii:"invalid_ascii",invalid_unicode:"invalid_unicode",invalid_lex_state:"invalid_lex_state",unterminated_string:"unterminated_string",unterminated_comment:"unterminated_comment",lex:"lex",parse:"parse",error:"error",none:"none",imp_map:"imp,map",imp_list:"imp,list",imp_null:"imp,null",end:"end",open:"open",close:"close",rule:"rule",stack:"stack",nUll:"null",name:"name",make:"make",colon:":"};n.S=p;class d extends SyntaxError{constructor(e,n,t,r,i){let l=b(e,n=g({},n),t,r,i);super(l.message),a(this,l),v(this)}toJSON(){return{...this,__error:!0,name:this.name,message:this.message,stack:this.stack}}}function f(e,n,t){let i=n.t,l=i[e];return null==l&&r.STRING===typeof e&&(l=n.tI++,i[l]=e,i[e]=l,i[e.substring(1)]=l,null!=t&&a(t.token,n.t)),l}function m(e,...n){return new RegExp(n.map(e=>e.esc?h(e.toString()):e).join(r.EMPTY),null==e?"":e)}function h(e){return null==e?"":e.replace(/[-\\|\]{}()[^$+*?.!=]/g,"\\$&").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\n/g,"\\n")}function g(e,...n){let t=p.function===typeof e,r=null!=e&&(p.object===typeof e||t);for(let i of n){let n,l=p.function===typeof i,s=null!=i&&(p.object===typeof i||l);if(r&&s&&!l&&Array.isArray(e)===Array.isArray(i))for(let t in i)e[t]=g(e[t],i[t]);else e=void 0===i?e:l?i:s?p.function===typeof(n=i.constructor)&&p.Object!==n.name&&p.Array!==n.name?i:g(Array.isArray(i)?[]:{},i):i,t=p.function===typeof e,r=null!=e&&(p.object===typeof e||t)}return e}function x(e,n,t,r,i,l){let s={code:n,details:t,token:r,rule:i,ctx:l};return null==e?"":e.replace(/\$(\{?)([\w_0-9]+)(\}?)/g,(e,n,o,a)=>{let c=null!=s[o]?s[o]:null!=t[o]?t[o]:l.meta&&null!=l.meta[o]?l.meta[o]:null!=r[o]?r[o]:null!=i[o]?i[o]:null!=l.opts[o]?l.opts[o]:null!=l.cfg[o]?l.cfg[o]:null!=l[o]?l[o]:"$"+o,u=n&&a?c:JSON.stringify(c);return u=null==u?"":u,u.replace(/\n/g,"\n ")})}function v(e){e.stack&&(e.stack=e.stack.split("\n").filter(e=>!e.includes("jsonic/jsonic")).map(e=>e.replace(/ at /,"at ")).join("\n"))}function k(e,n,t){let i=0<t.sI?t.sI:0,l=0<t.rI?t.rI:1,s=0<t.cI?t.cI:1,o=null==t.src?r.EMPTY:t.src,a=e.substring(Math.max(0,i-333),i).split("\n"),c=e.substring(i,i+333).split("\n"),u=2+(r.EMPTY+(l+2)).length,p=l<3?1:l-2,d=e=>"\x1b[34m"+(r.EMPTY+p++).padStart(u," ")+" | \x1b[0m"+(null==e?r.EMPTY:e),f=a.length;return[2<f?d(a[f-3]):null,1<f?d(a[f-2]):null,d(a[f-1]+c[0])," ".repeat(u)+" "+" ".repeat(s-1)+"\x1b[31m"+"^".repeat(o.length||1)+" "+n+"\x1b[0m",d(c[1]),d(c[2])].filter(e=>null!=e).join("\n")}function b(e,n,t,r,i){var l,s,o;try{let a=i.cfg,c=i.meta,u=x(a.error[e]||(null===(l=null==n?void 0:n.use)||void 0===l?void 0:l.err)&&(n.use.err.code||n.use.err.message)||a.error.unknown,e,n,t,r,i);p.function===typeof a.hint&&(a.hint={...a.hint(),...a.hint});let d=["\x1b[31m[jsonic/"+e+"]:\x1b[0m "+u," \x1b[34m--\x3e\x1b[0m "+(c&&c.fileName||"<no-file>")+":"+t.rI+":"+t.cI,k(i.src(),u,t),"",x((a.hint[e]||(null===(o=null===(s=n.use)||void 0===s?void 0:s.err)||void 0===o?void 0:o.message)||a.hint.unknown||"").trim().split("\n").map(e=>" "+e).join("\n"),e,n,t,r,i),""," \x1b[2mhttps://jsonic.senecajs.org\x1b[0m"," \x1b[2m--internal: rule="+r.name+"~"+r.state+"; token="+f(t.tin,i.cfg)+(null==t.why?"":"~"+t.why)+"; plugins="+i.plgn().map(e=>e.name).join(",")+"--\x1b[0m\n"].join("\n"),m={internal:{token:t,ctx:i}};return m={...Object.create(m),message:d,code:e,details:n,meta:c,fileName:c?c.fileName:void 0,lineNumber:t.rI,columnNumber:t.cI},m}catch(a){return console.log(a),{}}}function y(e){return"function"==typeof e.debug.print.src?e.debug.print.src:n=>{let t=null==n?r.EMPTY:Array.isArray(n)?JSON.stringify(n).replace(/]$/,o(n).filter(e=>isNaN(e[0])).map((e,n)=>(0===n?", ":"")+e[0]+": "+JSON.stringify(e[1]))+"]"):JSON.stringify(n);return t=t.substring(0,e.debug.maxlen)+(e.debug.maxlen<t.length?"...":r.EMPTY),t}}function _(e,n=44){let t;try{t="object"==typeof e?JSON.stringify(e):""+e}catch(r){t=""+e}return S(n<t.length?t.substring(0,n-3)+"...":t,n)}function S(e,n=5){return void 0===e?"":(""+e).substring(0,n).replace(/[\r\n\t]/g,".")}function E(...e){return null==e?{}:e.filter(e=>!1!==e).map(e=>"object"==typeof e?l(e).join(r.EMPTY):e).join(r.EMPTY).split(r.EMPTY).reduce((e,n)=>(e[n]=n.charCodeAt(0),e),{})}function j(e){for(let n in e)null==e[n]&&delete e[n];return e}n.JsonicError=d,n.configure=function(e,n,t){var r,i,c,p,d,g,x,v,k,b,y,_,S,O,I,T,M,N,P,C,R,w,A,L,Y,F,$,J,U,K,B,V,D,G,z,Z,q,W,X,H,Q,ee,ne,te,re,ie,le,se,oe,ae;const ce=n||{};ce.t=ce.t||{},ce.tI=ce.tI||1;const ue=e=>f(e,ce);!1!==t.standard$&&(ue("#BD"),ue("#ZZ"),ue("#UK"),ue("#AA"),ue("#SP"),ue("#LN"),ue("#CM"),ue("#NR"),ue("#ST"),ue("#TX"),ue("#VL")),ce.safe={key:!1!==(null===(r=t.safe)||void 0===r?void 0:r.key)},ce.fixed={lex:!!(null===(i=t.fixed)||void 0===i?void 0:i.lex),token:t.fixed?u(j(t.fixed.token),([e,n])=>[n,f(e,ce)]):{},ref:void 0,check:null===(c=t.fixed)||void 0===c?void 0:c.check},ce.fixed.ref=u(ce.fixed.token,([e,n])=>[e,n]),ce.fixed.ref=Object.assign(ce.fixed.ref,u(ce.fixed.ref,([e,n])=>[n,e])),ce.match={lex:!!(null===(p=t.match)||void 0===p?void 0:p.lex),value:t.match?u(j(t.match.value),([e,n])=>[e,n]):{},token:t.match?u(j(t.match.token),([e,n])=>[f(e,ce),n]):{},check:null===(d=t.match)||void 0===d?void 0:d.check},u(ce.match.token,([e,n])=>[e,(n.tin$=+e,n)]);const pe=t.tokenSet?Object.keys(t.tokenSet).reduce((e,n)=>(e[n]=t.tokenSet[n].filter(e=>null!=e).map(e=>ue(e)),e),{}):{};ce.tokenSet=ce.tokenSet||{},o(pe).map(e=>{let n=e[0],t=e[1];ce.tokenSet[n]?(ce.tokenSet[n].length=0,ce.tokenSet[n].push(...t)):ce.tokenSet[n]=t}),ce.tokenSetTins=o(ce.tokenSet).reduce((e,n)=>(e[n[0]]=e[n[0]]||{},n[1].map(t=>e[n[0]][t]=!0),e),{}),ce.tokenSetTins.IGNORE=ce.tokenSetTins.IGNORE||{},ce.space={lex:!!(null===(g=t.space)||void 0===g?void 0:g.lex),chars:E(null===(x=t.space)||void 0===x?void 0:x.chars),check:null===(v=t.space)||void 0===v?void 0:v.check},ce.line={lex:!!(null===(k=t.line)||void 0===k?void 0:k.lex),chars:E(null===(b=t.line)||void 0===b?void 0:b.chars),rowChars:E(null===(y=t.line)||void 0===y?void 0:y.rowChars),single:!!(null===(_=t.line)||void 0===_?void 0:_.single),check:null===(S=t.line)||void 0===S?void 0:S.check},ce.text={lex:!!(null===(O=t.text)||void 0===O?void 0:O.lex),modify:((null===(I=ce.text)||void 0===I?void 0:I.modify)||[]).concat(([null===(T=t.text)||void 0===T?void 0:T.modify]||[]).flat()).filter(e=>null!=e),check:null===(M=t.text)||void 0===M?void 0:M.check},ce.number={lex:!!(null===(N=t.number)||void 0===N?void 0:N.lex),hex:!!(null===(P=t.number)||void 0===P?void 0:P.hex),oct:!!(null===(C=t.number)||void 0===C?void 0:C.oct),bin:!!(null===(R=t.number)||void 0===R?void 0:R.bin),sep:null!=(null===(w=t.number)||void 0===w?void 0:w.sep)&&""!==t.number.sep,exclude:null===(A=t.number)||void 0===A?void 0:A.exclude,sepChar:null===(L=t.number)||void 0===L?void 0:L.sep,check:null===(Y=t.number)||void 0===Y?void 0:Y.check},ce.value={lex:!!(null===(F=t.value)||void 0===F?void 0:F.lex),def:o((null===($=t.value)||void 0===$?void 0:$.def)||{}).reduce((e,n)=>(null==n[1]||!1===n[1]||n[1].match||(e[n[0]]=n[1]),e),{}),defre:o((null===(J=t.value)||void 0===J?void 0:J.def)||{}).reduce((e,n)=>(n[1]&&n[1].match&&(e[n[0]]=n[1],e[n[0]].consume=!!e[n[0]].consume),e),{})},ce.rule={start:null==(null===(U=t.rule)||void 0===U?void 0:U.start)?"val":t.rule.start,maxmul:null==(null===(K=t.rule)||void 0===K?void 0:K.maxmul)?3:t.rule.maxmul,finish:!!(null===(B=t.rule)||void 0===B?void 0:B.finish),include:(null===(V=t.rule)||void 0===V?void 0:V.include)?t.rule.include.split(/\s*,+\s*/).filter(e=>""!==e):[],exclude:(null===(D=t.rule)||void 0===D?void 0:D.exclude)?t.rule.exclude.split(/\s*,+\s*/).filter(e=>""!==e):[]},ce.map={extend:!!(null===(G=t.map)||void 0===G?void 0:G.extend),merge:null===(z=t.map)||void 0===z?void 0:z.merge},ce.list={property:!!(null===(Z=t.list)||void 0===Z?void 0:Z.property)};let de=Object.keys(ce.fixed.token).sort((e,n)=>n.length-e.length).map(e=>h(e)).join("|"),fe=(null===(q=t.comment)||void 0===q?void 0:q.lex)?(t.comment.def?s(t.comment.def):[]).filter(e=>e&&e.lex).map(e=>h(e.start)).join("|"):"",me=["([",h(l(E(ce.space.lex&&ce.space.chars,ce.line.lex&&ce.line.chars)).join("")),"]",("string"==typeof t.ender?t.ender.split(""):Array.isArray(t.ender)?t.ender:[]).map(e=>"|"+h(e)).join(""),""===de?"":"|",de,""===fe?"":"|",fe,"|$)"];return ce.rePart={fixed:de,ender:me,commentStart:fe},ce.re={ender:m(null,...me),rowChars:m(null,h(null===(W=t.line)||void 0===W?void 0:W.rowChars)),columns:m(null,"["+h(null===(X=t.line)||void 0===X?void 0:X.chars)+"]","(.*)$")},ce.lex={empty:!!(null===(H=t.lex)||void 0===H?void 0:H.empty),emptyResult:null===(Q=t.lex)||void 0===Q?void 0:Q.emptyResult,match:(null===(ee=t.lex)||void 0===ee?void 0:ee.match)?o(t.lex.match).reduce((e,n)=>{let r=n[0],i=n[1];if(i){let n=i.make(ce,t);n&&(n.matcher=r,n.make=i.make,n.order=i.order),e.push(n)}return e},[]).filter(e=>null!=e&&!1!==e&&-1<+e.order).sort((e,n)=>e.order-n.order):[]},ce.parse={prepare:s(null===(ne=t.parse)||void 0===ne?void 0:ne.prepare)},ce.debug={get_console:(null===(te=t.debug)||void 0===te?void 0:te.get_console)||(()=>console),maxlen:null==(null===(re=t.debug)||void 0===re?void 0:re.maxlen)?99:t.debug.maxlen,print:{config:!!(null===(le=null===(ie=t.debug)||void 0===ie?void 0:ie.print)||void 0===le?void 0:le.config),src:null===(oe=null===(se=t.debug)||void 0===se?void 0:se.print)||void 0===oe?void 0:oe.src}},ce.error=t.error||{},ce.hint=t.hint||{},(null===(ae=t.config)||void 0===ae?void 0:ae.modify)&&l(t.config.modify).forEach(e=>t.config.modify[e](ce,t)),ce.debug.print.config&&ce.debug.get_console().dir(ce,{depth:null}),ce.result={fail:[]},t.result&&(ce.result.fail=[...t.result.fail]),a(e.options,t),a(e.token,ce.t),a(e.tokenSet,ce.tokenSet),a(e.fixed,ce.fixed.ref),ce},n.tokenize=f,n.findTokenSet=function(e,n){return n.tokenSet[e]},n.mesc=function(e,n){return(n=new String(e)).esc=!0,n},n.regexp=m,n.escre=h,n.deep=g,n.errinject=x,n.trimstk=v,n.extract=k,n.errdesc=b,n.badlex=function(e,n,t){let r=e.next.bind(e);return e.next=(e,i,l,s)=>{let o=r(e,i,l,s);if(n===o.tin){let n={};throw null!=o.use&&(n.use=o.use),new d(o.why||p.unexpected,n,o,e,t)}return o},e},n.makelog=function(e,n){var t,r,i;let l=null===(i=null===(r=null===(t=e.opts)||void 0===t?void 0:t.plugin)||void 0===r?void 0:r.debug)||void 0===i?void 0:i.trace;if(n||l)if("number"==typeof(null==n?void 0:n.log)||l){let t=!1,r=null==n?void 0:n.log;(-1===r||l)&&(r=1,t=!0),e.log=(...n)=>{if(t){let t=n.filter(e=>p.object!=typeof e).map(e=>p.function==typeof e?e.name:e).join(p.gap);e.cfg.debug.get_console().log(t)}else e.cfg.debug.get_console().dir(n,{depth:r})}}else"function"==typeof n.log&&(e.log=n.log);return e.log},n.srcfmt=y,n.str=_,n.snip=S,n.clone=function(e){return g(Object.create(Object.getPrototypeOf(e)),e)},n.charset=E,n.clean=j,n.filterRules=function(e,n){let t=["open","close"];for(let r of t)e.def[r]=e.def[r].map(e=>(e.g="string"==typeof e.g?(e.g||"").split(/\s*,+\s*/):e.g||[],e)).filter(e=>n.rule.include.reduce((n,t)=>n||null!=e.g&&-1!==e.g.indexOf(t),0===n.rule.include.length)).filter(e=>n.rule.exclude.reduce((n,t)=>n&&(null==e.g||-1===e.g.indexOf(t)),!0));return e},n.prop=function(e,n,t){let r=e;try{let r,i=n.split(".");for(let n=0;n<i.length;n++)r=i[n],n<i.length-1&&(e=e[r]=e[r]||{});return void 0!==t&&(e[r]=t),e[r]}catch(i){throw new Error("Cannot "+(void 0===t?"get":"set")+" path "+n+" on object: "+_(r)+(void 0===t?"":" to value: "+_(t,22)))}},n.modlist=function(e,n){if(n&&e){if(0<e.length){if(n.delete&&0<n.delete.length)for(let r=0;r<n.delete.length;r++){let t=n.delete[r];(t<0?-1*t<=e.length:t<e.length)&&(e[(e.length+t)%e.length]=null)}if(n.move)for(let r=0;r<n.move.length;r+=2){let t=(e.length+n.move[r])%e.length,i=(e.length+n.move[r+1])%e.length,l=e[t];e.splice(t,1),e.splice(i,0,l)}let t=e.filter(e=>null!=e);t.length!==e.length&&(e.length=0,e.push(...t))}if(n.custom){let t=n.custom(e);null!=t&&(e=t)}}return e},n.parserwrap=function(e){return{start:function(n,t,l,s){try{return e.start(n,t,l,s)}catch(o){if("SyntaxError"===o.name){let s=0,a=0,c=0,u=r.EMPTY,p=o.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);if(p){u=p[1],s=parseInt(p[2]),a=n.substring(0,s).replace(/[^\n]/g,r.EMPTY).length;let e=s-1;for(;-1<e&&"\n"!==n.charAt(e);)e--;c=Math.max(n.substring(e,s).length,0)}let m=o.token||(0,i.makeToken)("#UK",f("#UK",t.internal().config),void 0,u,(0,i.makePoint)(u.length,s,o.lineNumber||a,o.columnNumber||c));throw new d(o.code||"json",o.details||{msg:o.message},m,{},o.ctx||{uI:-1,opts:t.options,cfg:t.internal().config,token:m,meta:l,src:()=>n,root:()=>{},plgn:()=>t.internal().plugins,inst:()=>t,rule:{name:"no-rule"},sub:{},xs:-1,v2:m,v1:m,t0:m,t1:m,tC:-1,kI:-1,rs:[],rsI:0,rsm:{},n:{},log:l?l.log:void 0,F:y(t.internal().config),use:{},NORULE:{name:"no-rule"},NOTOKEN:{name:"no-token"}})}throw o}}}}})),t=e((function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeTextMatcher=t.makeNumberMatcher=t.makeCommentMatcher=t.makeStringMatcher=t.makeLineMatcher=t.makeSpaceMatcher=t.makeFixedMatcher=t.makeMatchMatcher=t.makeToken=t.makePoint=t.makeLex=t.makeNoToken=void 0;const i=n({});class l{constructor(e,n,t,r){this.len=-1,this.sI=0,this.rI=1,this.cI=1,this.token=[],this.len=e,null!=n&&(this.sI=n),null!=t&&(this.rI=t),null!=r&&(this.cI=r)}toString(){return"Point["+[this.sI+"/"+this.len,this.rI,this.cI]+(0<this.token.length?" "+this.token:"")+"]"}[r.INSPECT](){return this.toString()}}const s=(...e)=>new l(...e);t.makePoint=s;class o{constructor(e,n,t,i,l,s,o){this.isToken=!0,this.name=r.EMPTY,this.tin=-1,this.val=void 0,this.src=r.EMPTY,this.sI=-1,this.rI=-1,this.cI=-1,this.len=-1,this.name=e,this.tin=n,this.src=i,this.val=t,this.sI=l.sI,this.rI=l.rI,this.cI=l.cI,this.use=s,this.why=o,this.len=null==i?0:i.length}resolveVal(e,n){return"function"==typeof this.val?this.val(e,n):this.val}bad(e,n){return this.err=e,null!=n&&(this.use=(0,i.deep)(this.use||{},n)),this}toString(){return"Token["+this.name+"="+this.tin+" "+(0,i.snip)(this.src)+(void 0===this.val||"#ST"===this.name||"#TX"===this.name?"":"="+(0,i.snip)(this.val))+" "+[this.sI,this.rI,this.cI]+(null==this.use?"":" "+(0,i.snip)(""+JSON.stringify(this.use).replace(/"/g,""),22))+(null==this.err?"":" "+this.err)+(null==this.why?"":" "+(0,i.snip)(""+this.why,22))+"]"}[r.INSPECT](){return this.toString()}}const a=(...e)=>new o(...e);function c(e,n,t){let r=e.pnt,i=n;if(e.cfg.fixed.lex&&null!=t&&0<t.length){let l,s=e.cfg.fixed.token[t];null!=s&&(l=e.token(s,void 0,t,r)),null!=l&&(r.sI+=l.src.length,r.cI+=l.src.length,null==n?i=l:r.token.push(l))}return i}t.makeToken=a,t.makeNoToken=()=>a("",-1,void 0,r.EMPTY,s(-1)),t.makeFixedMatcher=(e,n)=>{let t=(0,i.regexp)(null,"^(",e.rePart.fixed,")");return function(n){let r=e.fixed;if(!r.lex)return;if(e.fixed.check){let t=e.fixed.check(n);if(t&&t.done)return t.token}let i=n.pnt,l=n.src.substring(i.sI).match(t);if(l){let e=l[1],t=e.length;if(0<t){let l,s=r.token[e];return null!=s&&(l=n.token(s,void 0,e,i),i.sI+=t,i.cI+=t),l}}}},t.makeMatchMatcher=(e,n)=>{let t=(0,i.values)(e.match.value),r=(0,i.values)(e.match.token);return 0===t.length&&0===r.length?null:function(n,i,l=0){if(!e.match.lex)return;if(e.match.check){let t=e.match.check(n);if(t&&t.done)return t.token}let s=n.pnt,o=n.src.substring(s.sI),a="o"===i.state?0:1;for(let e of t)if(e.match instanceof RegExp){let t=o.match(e.match);if(t){let r=t[0],i=r.length;if(0<i){let l,o=e.val?e.val(t):r;return l=n.token("#VL",o,r,s),s.sI+=i,s.cI+=i,l}}}else{let t=e.match(n,i);if(null!=t)return t}for(let e of r)if(!e.tin$||i.spec.def.tcol[a][l].includes(e.tin$))if(e instanceof RegExp){let t=o.match(e);if(t){let r=t[0],i=r.length;if(0<i){let t,l=e.tin$;return t=n.token(l,r,r,s),s.sI+=i,s.cI+=i,t}}}else{let t=e(n,i);if(null!=t)return t}}},t.makeCommentMatcher=(e,n)=>{let t=n.comment;e.comment={lex:!!t&&!!t.lex,def:((null==t?void 0:t.def)?(0,i.entries)(t.def):[]).reduce((e,[n,t])=>{if(null==t||!1===t)return e;let r={name:n,start:t.start,end:t.end,line:!!t.line,lex:!!t.lex,eatline:!!t.eatline};return e[n]=r,e},{})};let r=e.comment.lex?(0,i.values)(e.comment.def).filter(e=>e.lex&&e.line):[],l=e.comment.lex?(0,i.values)(e.comment.def).filter(e=>e.lex&&!e.line):[];return function(n,t){if(!e.comment.lex)return;if(e.comment.check){let t=e.comment.check(n);if(t&&t.done)return t.token}let s=n.pnt,o=n.src.substring(s.sI),a=s.rI,c=s.cI;for(let i of r)if(o.startsWith(i.start)){let t=o.length,r=i.start.length;for(c+=i.start.length;r<t&&!e.line.chars[o[r]];)c++,r++;if(i.eatline)for(;r<t&&e.line.chars[o[r]];)e.line.rowChars[o[r]]&&a++,r++;let l=o.substring(0,r),u=n.token("#CM",void 0,l,s);return s.sI+=l.length,s.cI=c,s.rI=a,u}for(let r of l)if(o.startsWith(r.start)){let t=o.length,l=r.start.length,u=r.end;for(c+=r.start.length;l<t&&!o.substring(l).startsWith(u);)e.line.rowChars[o[l]]&&(a++,c=0),c++,l++;if(o.substring(l).startsWith(u)){if(c+=u.length,r.eatline)for(;l<t&&e.line.chars[o[l]];)e.line.rowChars[o[l]]&&a++,l++;let i=o.substring(0,l+u.length),p=n.token("#CM",void 0,i,s);return s.sI+=i.length,s.rI=a,s.cI=c,p}return n.bad(i.S.unterminated_comment,s.sI,s.sI+9*r.start.length)}}},t.makeTextMatcher=(e,n)=>{let t=(0,i.regexp)(e.line.lex?null:"s","^(.*?)",...e.rePart.ender);return function(r){if(e.text.check){let n=e.text.check(r);if(n&&n.done)return n.token}let i=e.text,l=r.pnt,s=r.src.substring(l.sI),o=e.value.def,a=e.value.defre,u=s.match(t);if(u){let t,p=u[1],d=u[2];if(null!=p){let n=p.length;if(0<n){let c;if(e.value.lex)if(void 0!==(c=o[p]))t=r.token("#VL",c.val,p,l),l.sI+=n,l.cI+=n;else for(let e in a){let n=a[e];if(n.match){let e=n.match.exec(n.consume?s:p);if(e&&(n.consume||e[0].length===p.length)){let i=e[0];if(null==n.val)t=r.token("#VL",i,i,l);else{let s=n.val(e);t=r.token("#VL",s,i,l)}l.sI+=i.length,l.cI+=i.length}}}null==t&&i.lex&&(t=r.token("#TX",p,p,l),l.sI+=n,l.cI+=n)}}if(t&&(t=c(r,t,d)),t&&0<e.text.modify.length){const i=e.text.modify;for(let l=0;l<i.length;l++)t.val=i[l](t.val,r,e,n)}return t}}},t.makeNumberMatcher=(e,n)=>{let t=e.number,r=(0,i.regexp)(null,["^([-+]?(0(",[t.hex?"x[0-9a-fA-F_]+":null,t.oct?"o[0-7_]+":null,t.bin?"b[01_]+":null].filter(e=>null!=e).join("|"),")|\\.?[0-9]+([0-9_]*[0-9])?)","(\\.[0-9]?([0-9_]*[0-9])?)?","([eE][-+]?[0-9]+([0-9_]*[0-9])?)?"].join("").replace(/_/g,t.sep?(0,i.escre)(t.sepChar):""),")",...e.rePart.ender),l=t.sep?(0,i.regexp)("g",(0,i.escre)(t.sepChar)):void 0;return function(n){if(t=e.number,!t.lex)return;if(e.number.check){let t=e.number.check(n);if(t&&t.done)return t.token}let i=n.pnt,s=n.src.substring(i.sI),o=e.value.def,a=s.match(r);if(a){let t,r=a[1],s=a[9],u=!0;if(null!=r&&(u=!e.number.exclude||!r.match(e.number.exclude))){let s=r.length;if(0<s){let a;if(e.value.lex&&void 0!==(a=o[r]))t=n.token("#VL",a.val,r,i);else{let e=l?r.replace(l,""):r,o=+e;if(isNaN(o)){let n=e[0];"-"!==n&&"+"!==n||(o=("-"===n?-1:1)*+e.substring(1))}isNaN(o)||(t=n.token("#NR",o,r,i),i.sI+=s,i.cI+=s)}}}return u&&(t=c(n,t,s)),t}}},t.makeStringMatcher=(e,n)=>{let t=n.string||{};return e.string=e.string||{},e.string=(0,i.deep)(e.string,{lex:!!(null==t?void 0:t.lex),quoteMap:(0,i.charset)(t.chars),multiChars:(0,i.charset)(t.multiChars),escMap:{...t.escape},escChar:t.escapeChar,escCharCode:null==t.escapeChar?void 0:t.escapeChar.charCodeAt(0),allowUnknown:!!t.allowUnknown,replaceCodeMap:(0,i.omap)((0,i.clean)({...t.replace}),([e,n])=>[e.charCodeAt(0),n]),hasReplace:!1,abandon:!!t.abandon}),e.string.escMap=(0,i.clean)(e.string.escMap),e.string.hasReplace=0<(0,i.keys)(e.string.replaceCodeMap).length,function(n){let t=e.string;if(!t.lex)return;if(e.string.check){let t=e.string.check(n);if(t&&t.done)return t.token}let{quoteMap:l,escMap:s,escChar:o,escCharCode:a,multiChars:c,allowUnknown:u,replaceCodeMap:p,hasReplace:d}=t,{pnt:f,src:m}=n,{sI:h,rI:g,cI:x}=f,v=m.length;if(l[m[h]]){const l=m[h],k=h,b=g,y=c[l];++h,++x;let _,S=[];for(;h<v;h++){x++;let r=m[h];if(_=void 0,l===r){h++;break}if(o===r){h++,x++;let e=s[m[h]];if(null!=e)S.push(e);else if("x"===m[h]){h++;let e=parseInt(m.substring(h,h+2),16);if(isNaN(e)){if(t.abandon)return;return h-=2,x-=2,f.sI=h,f.cI=x,n.bad(i.S.invalid_ascii,h,h+4)}let r=String.fromCharCode(e);S.push(r),h+=1,x+=2}else if("u"===m[h]){h++;let e="{"===m[h]?(h++,1):0,r=e?6:4,l=parseInt(m.substring(h,h+r),16);if(isNaN(l)){if(t.abandon)return;return h=h-2-e,x-=2,f.sI=h,f.cI=x,n.bad(i.S.invalid_unicode,h,h+r+2+2*e)}let s=String.fromCodePoint(l);S.push(s),h+=r-1+e,x+=r+e}else{if(!u){if(t.abandon)return;return f.sI=h,f.cI=x-1,n.bad(i.S.unexpected,h,h+1)}S.push(m[h])}}else if(d&&void 0!==(_=p[m.charCodeAt(h)]))S.push(_),x++;else{let r=h,s=l.charCodeAt(0),o=m.charCodeAt(h);for(;(!d||void 0===(_=p[o]))&&h<v&&32<=o&&s!==o&&a!==o;)o=m.charCodeAt(++h),x++;if(x--,void 0===_&&o<32){if(!y||!e.line.chars[m[h]]){if(t.abandon)return;return f.sI=h,f.cI=x,n.bad(i.S.unprintable,h,h+1)}e.line.rowChars[m[h]]&&(f.rI=++g),x=1,S.push(m.substring(r,h+1))}else S.push(m.substring(r,h)),h--}}if(m[h-1]!==l||f.sI===h-1){if(t.abandon)return;return f.rI=b,n.bad(i.S.unterminated_string,k,h)}const E=n.token("#ST",S.join(r.EMPTY),m.substring(f.sI,h),f);return f.sI=h,f.rI=g,f.cI=x,E}}},t.makeLineMatcher=(e,n)=>function(n){if(!e.line.lex)return;if(e.line.check){let t=e.line.check(n);if(t&&t.done)return t.token}let t,{chars:r,rowChars:i}=e.line,{pnt:l,src:s}=n,{sI:o,rI:a}=l,c=e.line.single;for(c&&(t={});r[s[o]]&&!(t&&(t[s[o]]=(t[s[o]]||0)+1,c&&1<t[s[o]]));)a+=i[s[o]]?1:0,o++;if(l.sI<o){let e=s.substring(l.sI,o);const t=n.token("#LN",void 0,e,l);return l.sI+=e.length,l.rI=a,l.cI=1,t}},t.makeSpaceMatcher=(e,n)=>function(n){if(!e.space.lex)return;if(e.space.check){let t=e.space.check(n);if(t&&t.done)return t.token}let{chars:t}=e.space,{pnt:r,src:i}=n,{sI:l,cI:s}=r;for(;t[i[l]];)l++,s++;if(r.sI<l){let e=i.substring(r.sI,l);const t=n.token("#SP",void 0,e,r);return r.sI+=e.length,r.cI=s,t}};class u{constructor(e){this.src=r.EMPTY,this.ctx={},this.cfg={},this.pnt=s(-1),this.ctx=e,this.src=e.src(),this.cfg=e.cfg,this.pnt=s(this.src.length)}token(e,n,t,r,l,s){let o,c;return"string"==typeof e?(c=e,o=(0,i.tokenize)(c,this.cfg)):(o=e,c=(0,i.tokenize)(e,this.cfg)),a(c,o,n,t,r||this.pnt,l,s)}next(e,n,t,r){let l,s,o=this.pnt,a=o.sI;if(o.end)l=o.end;else if(0<o.token.length)l=o.token.shift();else if(o.len<=o.sI)o.end=this.token("#ZZ",void 0,"",o),l=o.end;else{try{for(let n of this.cfg.lex.match)if(l=n(this,e,r)){s=n;break}}catch(c){l=l||this.token("#BD",void 0,this.src[o.sI],o,{err:c},c.code||i.S.unexpected)}l=l||this.token("#BD",void 0,this.src[o.sI],o,void 0,i.S.unexpected)}return this.ctx.log&&this.ctx.log(i.S.lex,this.ctx,e,this,o,a,s,l,n,t,r),this.ctx.sub.lex&&this.ctx.sub.lex.map(n=>n(l,e,this.ctx)),l}tokenize(e){return(0,i.tokenize)(e,this.cfg)}bad(e,n,t){return this.token("#BD",void 0,0<=n&&n<=t?this.src.substring(n,t):this.src[this.pnt.sI],void 0,void 0,e)}}t.makeLex=(...e)=>new u(...e)})),r={};Object.defineProperty(r,"__esModule",{value:!0}),r.STRING=r.INSPECT=r.EMPTY=r.AFTER=r.BEFORE=r.CLOSE=r.OPEN=void 0,r.OPEN="o",r.CLOSE="c",r.BEFORE="b",r.AFTER="a",r.EMPTY="",r.INSPECT=Symbol.for("nodejs.util.inspect.custom"),r.STRING="string";var i={};Object.defineProperty(i,"__esModule",{value:!0}),i.defaults=void 0;const l=t({}),s={safe:{key:!0},tag:"-",fixed:{lex:!0,token:{"#OB":"{","#CB":"}","#OS":"[","#CS":"]","#CL":":","#CA":","}},match:{lex:!0,token:{}},tokenSet:{IGNORE:["#SP","#LN","#CM"],VAL:["#TX","#NR","#ST","#VL"],KEY:["#TX","#NR","#ST","#VL"]},space:{lex:!0,chars:" \t"},line:{lex:!0,chars:"\r\n",rowChars:"\n",single:!1},text:{lex:!0},number:{lex:!0,hex:!0,oct:!0,bin:!0,sep:"_",exclude:void 0},comment:{lex:!0,def:{hash:{line:!0,start:"#",lex:!0,eatline:!1},slash:{line:!0,start:"//",lex:!0,eatline:!1},multi:{line:!1,start:"/*",end:"*/",lex:!0,eatline:!1}}},string:{lex:!0,chars:"'\"`",multiChars:"`",escapeChar:"\\",escape:{b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","`":"`","\\":"\\","/":"/"},allowUnknown:!0,abandon:!1},map:{extend:!0,merge:void 0},list:{property:!0},value:{lex:!0,def:{true:{val:!0},false:{val:!1},null:{val:null}}},ender:[],plugin:{},debug:{get_console:()=>console,maxlen:99,print:{config:!1,src:void 0}},error:{unknown:"unknown error: $code",unexpected:"unexpected character(s): $src",invalid_unicode:"invalid unicode escape: $src",invalid_ascii:"invalid ascii escape: $src",unprintable:"unprintable character: $src",unterminated_string:"unterminated string: $src",unterminated_comment:"unterminated comment: $src",unknown_rule:"unknown rule: $rulename"},hint:function(e=((e,n="replace")=>e[n](/[A-Z]/g,e=>" "+e.toLowerCase())[n](/[~%][a-z]/g,e=>("~"==e[0]?" ":"")+e[1].toUpperCase())),n="~sinceTheErrorIsUnknown,ThisIsProbablyABugInsideJsonic\nitself,OrAPlugin.~pleaseConsiderPostingAGithubIssue -Thanks!\n\n~code: $code,~details: \n$details|~theCharacter(s) $srcWereNotExpectedAtThisPointAsTheyDoNot\nmatchTheExpectedSyntax,EvenUnderTheRelaxedJsonicRules.~ifIt\nisNotObviouslyWrong,TheActualSyntaxErrorMayBeElsewhere.~try\ncommentingOutLargerAreasAroundThisPointUntilYouGetNoErrors,\nthenRemoveTheCommentsInSmallSectionsUntilYouFindThe\noffendingSyntax.~n%o%t%e:~alsoCheckIfAnyPluginsYouAreUsing\nexpectDifferentSyntaxInThisCase.|~theEscapeSequence $srcDoesNotEncodeAValidUnicodeCodePoint\nnumber.~youMayNeedToValidateYourStringDataManuallyUsingTest\ncodeToSeeHow~javaScriptWillInterpretIt.~alsoConsiderThatYour\ndataMayHaveBecomeCorrupted,OrTheEscapeSequenceHasNotBeen\ngeneratedCorrectly.|~theEscapeSequence $srcDoesNotEncodeAValid~a%s%c%i%iCharacter.~you\nmayNeedToValidateYourStringDataManuallyUsingTestCodeToSee\nhow~javaScriptWillInterpretIt.~alsoConsiderThatYourDataMay\nhaveBecomeCorrupted,OrTheEscapeSequenceHasNotBeenGenerated\ncorrectly.|~stringValuesCannotContainUnprintableCharacters (characterCodes\nbelow 32).~theCharacter $srcIsUnprintable.~youMayNeedToRemove\ntheseCharactersFromYourSourceData.~alsoCheckThatItHasNot\nbecomeCorrupted.|~thisStringHasNoEndQuote.|~thisCommentIsNeverClosed.|~noRuleNamed $rulenameIsDefined.~thisIsProbablyAnErrorInThe\ngrammarOfAPlugin.".split("|")){return"unknown|unexpected|invalid_unicode|invalid_ascii|unprintable|unterminated_string|unterminated_comment|unknown_rule".split("|").reduce((t,r,i)=>(t[r]=e(n[i]),t),{})},lex:{match:{match:{order:1e6,make:l.makeMatchMatcher},fixed:{order:2e6,make:l.makeFixedMatcher},space:{order:3e6,make:l.makeSpaceMatcher},line:{order:4e6,make:l.makeLineMatcher},string:{order:5e6,make:l.makeStringMatcher},comment:{order:6e6,make:l.makeCommentMatcher},number:{order:7e6,make:l.makeNumberMatcher},text:{order:8e6,make:l.makeTextMatcher}},empty:!0,emptyResult:void 0},parse:{prepare:{}},rule:{start:"val",finish:!0,maxmul:3,include:"",exclude:""},result:{fail:[]},config:{modify:{}},parser:{start:void 0}};i.defaults=s;var o={};Object.defineProperty(o,"__esModule",{value:!0}),o.makeRuleSpec=o.makeNoRule=o.makeRule=void 0;const a=n({});class c{constructor(e,n,t){this.i=-1,this.name=r.EMPTY,this.node=null,this.state=r.OPEN,this.n=Object.create(null),this.d=-1,this.use=Object.create(null),this.keep=Object.create(null),this.bo=!1,this.ao=!1,this.bc=!1,this.ac=!1,this.os=0,this.cs=0,this.need=0,this.i=n.uI++,this.name=e.name,this.spec=e,this.child=n.NORULE,this.parent=n.NORULE,this.prev=n.NORULE,this.o0=n.NOTOKEN,this.o1=n.NOTOKEN,this.c0=n.NOTOKEN,this.c1=n.NOTOKEN,this.node=t,this.d=n.rsI,this.bo=null!=e.def.bo,this.ao=null!=e.def.ao,this.bc=null!=e.def.bc,this.ac=null!=e.def.ac}process(e,n){return this.spec.process(this,e,n,this.state)}toString(){return"[Rule "+this.name+"~"+this.i+"]"}}const u=(...e)=>new c(...e);o.makeRule=u,o.makeNoRule=e=>u(g(e.cfg,{}),e);class p{constructor(){this.p=r.EMPTY,this.r=r.EMPTY,this.b=0}}const d=(...e)=>new p(...e),f=d(),m=d();class h{constructor(e,n){this.name=r.EMPTY,this.def={open:[],close:[],bo:[],bc:[],ao:[],ac:[],tcol:[]},this.cfg=e,this.def=Object.assign(this.def,n),this.def.open=(this.def.open||[]).filter(e=>null!=e),this.def.close=(this.def.close||[]).filter(e=>null!=e);for(let t of[...this.def.open,...this.def.close])x(t)}tin(e){return(0,a.tokenize)(e,this.cfg)}add(e,n,t){let r=(null==t?void 0:t.append)?"push":"unshift",i=((0,a.isarr)(n)?n:[n]).filter(e=>null!=e&&"object"==typeof e).map(e=>x(e)),l="o"===e?"open":"close",s=this.def[l];return s[r](...i),s=this.def[l]=(0,a.modlist)(s,t),(0,a.filterRules)(this,this.cfg),this.norm(),this}open(e,n){return this.add("o",e,n)}close(e,n){return this.add("c",e,n)}action(e,n,t,r){let i=this.def[n+t];return e?i.push(r):i.unshift(r),this}bo(e,n){return this.action(!n||!!e,r.BEFORE,r.OPEN,n||e)}ao(e,n){return this.action(!n||!!e,r.AFTER,r.OPEN,n||e)}bc(e,n){return this.action(!n||!!e,r.BEFORE,r.CLOSE,n||e)}ac(e,n){return this.action(!n||!!e,r.AFTER,r.CLOSE,n||e)}clear(){return this.def.open.length=0,this.def.close.length=0,this.def.bo.length=0,this.def.ao.length=0,this.def.bc.length=0,this.def.ac.length=0,this}norm(){this.def.open.map(e=>x(e)),this.def.close.map(e=>x(e));const e=[];function n(e,n,t){return t[e]=t[e]||[],[function(e,t){if(t.s&&t.s[n]){let r=[...new Set(e.concat(t.s[n]))];e.length=0,e.push(...r)}return e},t[e][n]=t[e][n]||[]]}return this.def.open.reduce(...n(0,0,e)),this.def.open.reduce(...n(0,1,e)),this.def.close.reduce(...n(1,0,e)),this.def.close.reduce(...n(1,1,e)),this.def.tcol=e,this}process(e,n,t,i){n.log&&n.log(a.S.rule,n,e,t);let l="o"===i,s=l?e:n.NORULE,o=l?"O":"C",c=this.def,p=l?c.open:c.close,d=l?e.bo?c.bo:null:e.bc?c.bc:null;if(d){let t;for(let r=0;r<d.length;r++)if(t=d[r].call(this,e,n,s,t),(null==t?void 0:t.isToken)&&(null==t?void 0:t.err))return this.bad(t,e,n,{is_open:l})}let h=0<p.length?function(e,n,t,i,l){let s=f;s.b=0,s.p=r.EMPTY,s.r=r.EMPTY,s.n=void 0,s.h=void 0,s.a=void 0,s.u=void 0,s.k=void 0,s.e=void 0;let o=null,c=0,u=!0,p=1<<l.cfg.t.AA-1,d=l.cfg.tokenSetTins.IGNORE;function m(e,n,r,i){let s;do{s=t.next(e,n,r,i),l.tC++}while(d[s.tin]);return s}let h=n.length;for(c=0;c<h;c++){o=n[c];let t=!1,r=!1;if(u=!0,o.S0){let e=(l.t0=l.NOTOKEN!==l.t0?l.t0:l.t0=m(i,o,c,0)).tin;if(t=!0,u=!!(o.S0[e/31|0]&(1<<e%31-1|p)),u&&(r=null!=o.S1,o.S1)){let e=(l.t1=l.NOTOKEN!==l.t1?l.t1:l.t1=m(i,o,c,1)).tin;r=!0,u=!!(o.S1[e/31|0]&(1<<e%31-1|p))}}if(e?(i.o0=t?l.t0:l.NOTOKEN,i.o1=r?l.t1:l.NOTOKEN,i.os=(t?1:0)+(r?1:0)):(i.c0=t?l.t0:l.NOTOKEN,i.c1=r?l.t1:l.NOTOKEN,i.cs=(t?1:0)+(r?1:0)),u&&o.c&&(u=u&&o.c(i,l,s)),u)break;o=null}u||(s.e=l.t0),o&&(s.n=null!=o.n?o.n:s.n,s.h=null!=o.h?o.h:s.h,s.a=null!=o.a?o.a:s.a,s.u=null!=o.u?o.u:s.u,s.k=null!=o.k?o.k:s.k,s.g=null!=o.g?o.g:s.g,s.e=o.e&&o.e(i,l,s)||void 0,s.p=null!=o.p&&!1!==o.p?"string"==typeof o.p?o.p:o.p(i,l,s):s.p,s.r=null!=o.r&&!1!==o.r?"string"==typeof o.r?o.r:o.r(i,l,s):s.r,s.b=null!=o.b&&!1!==o.b?"number"==typeof o.b?o.b:o.b(i,l,s):s.b);let g=c<n.length;return l.log&&l.log(a.S.parse,l,i,t,g,u,c,o,s),s}(l,p,t,e,n):m;if(h.h&&(h=h.h(e,n,h,s)||h,o+="H"),h.e)return this.bad(h.e,e,n,{is_open:l});if(h.n)for(let r in h.n)e.n[r]=0===h.n[r]?0:(null==e.n[r]?0:e.n[r])+h.n[r];if(h.u&&(e.use=Object.assign(e.use,h.u)),h.k&&(e.keep=Object.assign(e.keep,h.k)),h.a){o+="A";let t=h.a(e,n,h);if(t&&t.isToken&&t.err)return this.bad(t,e,n,{is_open:l})}if(h.p){n.rs[n.rsI++]=e;let t=n.rsm[h.p];if(!t)return this.bad(this.unknownRule(n.t0,h.p),e,n,{is_open:l});s=e.child=u(t,n,e.node),s.parent=e,s.n={...e.n},0<Object.keys(e.keep).length&&(s.keep={...e.keep}),o+="P`"+h.p+"`"}else if(h.r){let t=n.rsm[h.r];if(!t)return this.bad(this.unknownRule(n.t0,h.r),e,n,{is_open:l});s=u(t,n,e.node),s.parent=e.parent,s.prev=e,s.n={...e.n},0<Object.keys(e.keep).length&&(s.keep={...e.keep}),o+="R`"+h.r+"`"}else l||(s=n.rs[--n.rsI]||n.NORULE);let g=l?e.ao?c.ao:null:e.ac?c.ac:null;if(g){let t;for(let r=0;r<g.length;r++)if(t=g[r](e,n,s,t),(null==t?void 0:t.isToken)&&(null==t?void 0:t.err))return this.bad(t,e,n,{is_open:l})}s.why=o,n.log&&n.log(a.S.node,n,e,t,s),r.OPEN===e.state&&(e.state=r.CLOSE);let x=e[l?"os":"cs"]-(h.b||0);return 1===x?(n.v2=n.v1,n.v1=n.t0,n.t0=n.t1,n.t1=n.NOTOKEN):2==x&&(n.v2=n.t1,n.v1=n.t0,n.t0=n.NOTOKEN,n.t1=n.NOTOKEN),s}bad(e,n,t,r){throw new a.JsonicError(e.err||a.S.unexpected,{...e.use,state:r.is_open?a.S.open:a.S.close},e,n,t)}unknownRule(e,n){return e.err="unknown_rule",e.use=e.use||{},e.use.rulename=n,e}}const g=(...e)=>new h(...e);function x(e){if(null!=e.c){let n=e.c.n,t=e.c.d;null==n&&null==t||(e.c=function(e){let r=!0;if(null!=n)for(let t in n)r=r&&(null==e.n[t]||e.n[t]<=(null==n[t]?0:n[t]));return null!=t&&(r=r&&e.d<=t),r},null!=n&&(e.c.n=n),null!=t&&(e.c.d=t))}if(r.STRING===typeof e.g?e.g=e.g.split(/\s*,\s*/):null==e.g&&(e.g=[]),e.g=e.g.sort(),e.s&&0!==e.s.length){const n=e=>e.flat().filter(e=>"number"==typeof e),t=(e,n)=>e.filter(e=>31*n<=e&&e<31*(n+1)),r=(e,n)=>e.reduce((e,t)=>1<<t-(31*n+1)|e,0),i=n([e.s[0]]),l=n([e.s[1]]),s=e;s.S0=0<i.length?new Array(Math.max(...i.map(e=>1+e/31|0))).fill(null).map((e,n)=>n).map(e=>r(t(i,e),e)):null,s.S1=0<l.length?new Array(Math.max(...l.map(e=>1+e/31|0))).fill(null).map((e,n)=>n).map(e=>r(t(l,e),e)):null}else e.s=null;return e.p||(e.p=null),e.r||(e.r=null),e.b||(e.b=null),e}o.makeRuleSpec=g;var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.makeParser=v.makeRuleSpec=v.makeRule=void 0;const k=n({}),b=t({});Object.defineProperty(v,"makeRule",{enumerable:!0,get:function(){return o.makeRule}}),Object.defineProperty(v,"makeRuleSpec",{enumerable:!0,get:function(){return o.makeRuleSpec}});class y{constructor(e,n){this.rsm={},this.options=e,this.cfg=n}rule(e,n){if(null==e)return this.rsm;let t=this.rsm[e];if(null===n)delete this.rsm[e];else if(void 0!==n)return t=this.rsm[e]=this.rsm[e]||(0,o.makeRuleSpec)(this.cfg,{}),t=this.rsm[e]=n(this.rsm[e],this)||this.rsm[e],void(t.name=e);return t}start(e,n,t,i){let l,s=(0,b.makeToken)("#ZZ",(0,k.tokenize)("#ZZ",this.cfg),void 0,r.EMPTY,(0,b.makePoint)(-1)),a=(0,b.makeNoToken)(),c={uI:0,opts:this.options,cfg:this.cfg,meta:t||{},src:()=>e,root:()=>l,plgn:()=>n.internal().plugins,inst:()=>n,rule:{},sub:n.internal().sub,xs:-1,v2:s,v1:s,t0:a,t1:a,tC:-2,kI:-1,rs:[],rsI:0,rsm:this.rsm,log:void 0,F:(0,k.srcfmt)(this.cfg),use:{},NOTOKEN:a,NORULE:{}};c=(0,k.deep)(c,i);let u=(0,o.makeNoRule)(c);if(c.NORULE=u,c.rule=u,t&&k.S.function===typeof t.log&&(c.log=t.log),this.cfg.parse.prepare.forEach(e=>e(n,c,t)),""===e){if(this.cfg.lex.empty)return this.cfg.lex.emptyResult;throw new k.JsonicError(k.S.unexpected,{src:e},c.t0,u,c)}let p=(0,k.badlex)((0,b.makeLex)(c),(0,k.tokenize)("#BD",this.cfg),c),d=this.rsm[this.cfg.rule.start];if(null==d)return;let f=(0,o.makeRule)(d,c);l=f;let m=2*(0,k.keys)(this.rsm).length*p.src.length*2*c.cfg.rule.maxmul,h=0;for(;u!==f&&h<m;)c.kI=h,c.rule=f,c.log&&c.log("",c.kI+":"),c.sub.rule&&c.sub.rule.map(e=>e(f,c)),f=f.process(c,p),c.log&&c.log(k.S.stack,c,f,p),h++;if(s.tin!==p.next(f).tin)throw new k.JsonicError(k.S.unexpected,{},c.t0,u,c);const g=c.root().node;if(this.cfg.result.fail.includes(g))throw new k.JsonicError(k.S.unexpected,{},c.t0,u,c);return g}clone(e,n){let t=new y(e,n);return t.rsm=Object.keys(this.rsm).reduce((e,n)=>(e[n]=(0,k.filterRules)(this.rsm[n],this.cfg),e),{}),t.norm(),t}norm(){(0,k.values)(this.rsm).map(e=>e.norm())}}v.makeParser=(...e)=>new y(...e);var _={};function S(e){const{deep:n}=e.util,{OB:t,CB:r,OS:i,CS:l,CL:s,CA:o,TX:a,ST:c,ZZ:u}=e.token,{VAL:p,KEY:d}=e.tokenSet,f=(e,n)=>{if(!n.cfg.rule.finish)return n.t0.src="END_OF_SOURCE",n.t0},m=e=>{const n=e.o0,t=c===n.tin||a===n.tin?n.val:n.src;e.use.key=t};e.rule("val",e=>{e.bo(e=>e.node=void 0).open([{s:[t],p:"map",b:1,g:"map,json"},{s:[i],p:"list",b:1,g:"list,json"},{s:[p],g:"val,json"}]).close([{s:[u],g:"end,json"},{b:1,g:"more,json"}]).bc((e,n)=>{e.node=void 0===e.node?void 0===e.child.node?0===e.os?void 0:e.o0.resolveVal(e,n):e.child.node:e.node})}),e.rule("map",e=>{e.bo(e=>{e.node=Object.create(null)}).open([{s:[t,r],b:1,n:{pk:0},g:"map,json"},{s:[t],p:"pair",n:{pk:0},g:"map,json,pair"}]).close([{s:[r],g:"end,json"}])}),e.rule("list",e=>{e.bo(e=>{e.node=[]}).open([{s:[i,l],b:1,g:"list,json"},{s:[i],p:"elem",g:"list,elem,json"}]).close([{s:[l],g:"end,json"}])}),e.rule("pair",e=>{e.open([{s:[d,s],p:"val",u:{pair:!0},a:m,g:"map,pair,key,json"}]).bc((e,n)=>{e.use.pair&&(e.use.prev=e.node[e.use.key],e.node[e.use.key]=e.child.node)}).close([{s:[o],r:"pair",g:"map,pair,json"},{s:[r],b:1,g:"map,pair,json"}])}),e.rule("elem",e=>{e.open([{p:"val",g:"list,elem,val,json"}]).bc(e=>{!0!==e.use.done&&e.node.push(e.child.node)}).close([{s:[o],r:"elem",g:"list,elem,json"},{s:[l],b:1,g:"list,elem,json"}])});const h=(e,t)=>{let r=e.use.key,i=e.child.node;const l=e.use.prev;i=void 0===i?null:i,e.use.list&&t.cfg.safe.key&&("__proto__"===r||"constructor"===r)||(e.node[r]=null==l?i:t.cfg.map.merge?t.cfg.map.merge(l,i,e,t):t.cfg.map.extend?n(l,i):i)};e.rule("val",e=>{e.open([{s:[d,s],p:"map",b:2,n:{pk:1},g:"pair,jsonic"},{s:[p],g:"val,json"},{s:[[r,l]],b:1,c:e=>0<e.d,g:"val,imp,null,jsonic"},{s:[o],c:e=>0===e.d,p:"list",b:1,g:"list,imp,jsonic"},{s:[o],b:1,g:"list,val,imp,null,jsonic"},{s:[u],g:"jsonic"}],{append:!0,delete:[2]}).close([{s:[[r,l]],b:1,g:"val,json,close",e:(e,n)=>0===e.d?n.t0:void 0},{s:[o],c:{n:{dlist:0,dmap:0}},r:"list",u:{implist:!0},g:"list,val,imp,comma,jsonic"},{c:{n:{dlist:0,dmap:0}},r:"list",u:{implist:!0},g:"list,val,imp,space,jsonic",b:1},{s:[u],g:"jsonic"}],{append:!0,move:[1,-1]})}),e.rule("map",e=>{e.bo(e=>{e.n.dmap=1+(e.n.dmap?e.n.dmap:0)}).open([{s:[t,u],b:1,e:f,g:"end,jsonic"}]).open([{s:[d,s],p:"pair",b:2,g:"pair,list,val,imp,jsonic"}],{append:!0}).close([{s:[r],c:{n:{pk:0}},g:"end,json"},{s:[r],b:1,g:"path,jsonic"},{s:[[o,l,...p]],b:1,g:"end,path,jsonic"},{s:[u],e:f,g:"end,jsonic"}],{append:!0,delete:[0]})}),e.rule("list",e=>{e.bo(e=>{e.n.dlist=1+(e.n.dlist?e.n.dlist:0),e.prev.use.implist&&(e.node.push(e.prev.node),e.prev.node=e.node)}).open({c:e=>e.prev.use.implist,p:"elem"}).open([{s:[o],p:"elem",b:1,g:"list,elem,val,imp,jsonic"},{p:"elem",g:"list,elem.jsonic"}],{append:!0}).close([{s:[u],e:f,g:"end,jsonic"}],{append:!0})}),e.rule("pair",(e,n)=>{e.open([{s:[o],g:"map,pair,comma,jsonic"}],{append:!0}).bc((e,n)=>{e.use.pair&&h(e,n)}).close([{s:[r],c:{n:{pk:0}},b:1,g:"map,pair,json"},{s:[o,r],c:{n:{pk:0}},b:1,g:"map,pair,comma,jsonic"},{s:[o,u],g:"end,jsonic"},{s:[o],c:{n:{pk:0}},r:"pair",g:"map,pair,json"},{s:[o],c:{n:{dmap:1}},r:"pair",g:"map,pair,jsonic"},{s:[d],c:{n:{dmap:1}},r:"pair",b:1,g:"map,pair,imp,jsonic"},{s:[[r,o,l,...d]],b:1,g:"map,pair,imp,path,jsonic",c:e=>0<e.n.pk},{s:[l],e:e=>e.c0,g:"end,jsonic"},{s:[u],e:f,g:"map,pair,json"},{r:"pair",b:1,g:"map,pair,imp,jsonic"}],{append:!0,delete:[0,1]})}),e.rule("elem",(e,n)=>{e.open([{s:[o,o],b:2,u:{done:!0},a:e=>e.node.push(null),g:"list,elem,imp,null,jsonic"},{s:[o],u:{done:!0},a:e=>e.node.push(null),g:"list,elem,imp,null,jsonic"},{s:[d,s],e:n.cfg.list.property?void 0:(e,n)=>n.t0,p:"val",n:{pk:1,dmap:1},u:{done:!0,pair:!0,list:!0},a:m,g:"elem,pair,jsonic"}]).bc((e,n)=>{!0===e.use.pair&&(e.use.prev=e.node[e.use.key],h(e,n))}).close([{s:[o,[l,u]],b:1,g:"list,elem,comma,jsonic"},{s:[o],r:"elem",g:"list,elem,json"},{s:[l],b:1,g:"list,elem,json"},{s:[u],e:f,g:"list,elem,json"},{s:[r],e:e=>e.c0,g:"end,jsonic"},{r:"elem",b:1,g:"list,elem,imp,jsonic"}],{delete:[-1,-2]})})}Object.defineProperty(_,"__esModule",{value:!0}),_.makeJSON=_.grammar=void 0,_.grammar=S,_.makeJSON=function(e){let n=e.make({grammar$:!1,text:{lex:!1},number:{hex:!1,oct:!1,bin:!1,sep:null,exclude:/^00+/},string:{chars:'"',multiChars:"",allowUnknown:!1,escape:{v:null}},comment:{lex:!1},map:{extend:!1},lex:{empty:!1},rule:{finish:!1,include:"json"},result:{fail:[void 0,NaN]},tokenSet:{KEY:["#ST",null,null,null]}});return S(n),n};var E={exports:{}};Object.defineProperty(E.exports,"__esModule",{value:!0}),E.exports.root=E.exports.S=E.exports.EMPTY=E.exports.AFTER=E.exports.BEFORE=E.exports.CLOSE=E.exports.OPEN=E.exports.makeTextMatcher=E.exports.makeNumberMatcher=E.exports.makeCommentMatcher=E.exports.makeStringMatcher=E.exports.makeLineMatcher=E.exports.makeSpaceMatcher=E.exports.makeFixedMatcher=E.exports.makeParser=E.exports.makeLex=E.exports.makeRuleSpec=E.exports.makeRule=E.exports.makePoint=E.exports.makeToken=E.exports.make=E.exports.util=E.exports.JsonicError=E.exports.Jsonic=void 0,Object.defineProperty(E.exports,"OPEN",{enumerable:!0,get:function(){return r.OPEN}}),Object.defineProperty(E.exports,"CLOSE",{enumerable:!0,get:function(){return r.CLOSE}}),Object.defineProperty(E.exports,"BEFORE",{enumerable:!0,get:function(){return r.BEFORE}}),Object.defineProperty(E.exports,"AFTER",{enumerable:!0,get:function(){return r.AFTER}}),Object.defineProperty(E.exports,"EMPTY",{enumerable:!0,get:function(){return r.EMPTY}});const j=n({});Object.defineProperty(E.exports,"JsonicError",{enumerable:!0,get:function(){return j.JsonicError}}),Object.defineProperty(E.exports,"S",{enumerable:!0,get:function(){return j.S}});const O=t({});Object.defineProperty(E.exports,"makePoint",{enumerable:!0,get:function(){return O.makePoint}}),Object.defineProperty(E.exports,"makeToken",{enumerable:!0,get:function(){return O.makeToken}}),Object.defineProperty(E.exports,"makeLex",{enumerable:!0,get:function(){return O.makeLex}}),Object.defineProperty(E.exports,"makeFixedMatcher",{enumerable:!0,get:function(){return O.makeFixedMatcher}}),Object.defineProperty(E.exports,"makeSpaceMatcher",{enumerable:!0,get:function(){return O.makeSpaceMatcher}}),Object.defineProperty(E.exports,"makeLineMatcher",{enumerable:!0,get:function(){return O.makeLineMatcher}}),Object.defineProperty(E.exports,"makeStringMatcher",{enumerable:!0,get:function(){return O.makeStringMatcher}}),Object.defineProperty(E.exports,"makeCommentMatcher",{enumerable:!0,get:function(){return O.makeCommentMatcher}}),Object.defineProperty(E.exports,"makeNumberMatcher",{enumerable:!0,get:function(){return O.makeNumberMatcher}}),Object.defineProperty(E.exports,"makeTextMatcher",{enumerable:!0,get:function(){return O.makeTextMatcher}}),Object.defineProperty(E.exports,"makeRule",{enumerable:!0,get:function(){return v.makeRule}}),Object.defineProperty(E.exports,"makeRuleSpec",{enumerable:!0,get:function(){return v.makeRuleSpec}}),Object.defineProperty(E.exports,"makeParser",{enumerable:!0,get:function(){return v.makeParser}});const I={tokenize:j.tokenize,srcfmt:j.srcfmt,clone:j.clone,charset:j.charset,trimstk:j.trimstk,makelog:j.makelog,badlex:j.badlex,extract:j.extract,errinject:j.errinject,errdesc:j.errdesc,configure:j.configure,parserwrap:j.parserwrap,mesc:j.mesc,escre:j.escre,regexp:j.regexp,prop:j.prop,str:j.str,clean:j.clean,deep:j.deep,omap:j.omap,keys:j.keys,values:j.values,entries:j.entries};function T(e,n){let t=!0;if("jsonic"===e)t=!1;else if("json"===e)return(0,_.makeJSON)(M);e="string"==typeof e?{}:e;let r={parser:null,config:null,plugins:[],sub:{lex:void 0,rule:void 0},mark:Math.random()},l=(0,j.deep)({},n?{...n.options}:!1===(null==e?void 0:e.defaults$)?{}:i.defaults,e||{}),s=function(e,n,t){var r;if(j.S.string===typeof e){let i=s.internal();return((null===(r=o.parser)||void 0===r?void 0:r.start)?(0,j.parserwrap)(o.parser):i.parser).start(e,s,n,t)}return e},o=e=>{if(null!=e&&j.S.object===typeof e){(0,j.deep)(l,e),(0,j.configure)(s,r.config,l);let n=s.internal().parser;r.parser=n.clone(l,r.config)}return{...s.options}},a={token:e=>(0,j.tokenize)(e,r.config,s),tokenSet:e=>(0,j.findTokenSet)(e,r.config),fixed:e=>r.config.fixed.ref[e],options:(0,j.deep)(o,l),config:()=>(0,j.deep)(r.config),parse:s,use:function(e,n){if(j.S.function!==typeof e)throw new Error("Jsonic.use: the first argument must be a function defining a plugin. See https://jsonic.senecajs.org/plugin");const t=e.name.toLowerCase(),r=(0,j.deep)({},e.defaults||{},n||{});s.options({plugin:{[t]:r}});let i=s.options.plugin[t];return s.internal().plugins.push(e),e.options=i,e(s,i)||s},rule:(e,n)=>s.internal().parser.rule(e,n)||s,make:e=>T(e,s),empty:e=>T({defaults$:!1,standard$:!1,grammar$:!1,...e||{}}),id:"Jsonic/"+Date.now()+"/"+(""+Math.random()).substring(2,8).padEnd(6,"0")+(null==o.tag?"":"/"+o.tag),toString:()=>a.id,sub:e=>(e.lex&&(r.sub.lex=r.sub.lex||[],r.sub.lex.push(e.lex)),e.rule&&(r.sub.rule=r.sub.rule||[],r.sub.rule.push(e.rule)),s),util:I};if((0,j.defprop)(a.make,j.S.name,{value:j.S.make}),t?(0,j.assign)(s,a):(0,j.assign)(s,{empty:a.empty,parse:a.parse,sub:a.sub,id:a.id,toString:a.toString}),(0,j.defprop)(s,"internal",{value:()=>r}),n){for(let t in n)void 0===s[t]&&(s[t]=n[t]);s.parent=n;let e=n.internal();r.config=(0,j.deep)({},e.config),(0,j.configure)(s,r.config,l),(0,j.assign)(s.token,r.config.t),r.plugins=[...e.plugins],r.parser=e.parser.clone(l,r.config)}else{let e={...s,...a};r.config=(0,j.configure)(e,void 0,l),r.plugins=[],r.parser=(0,v.makeParser)(l,r.config),!1!==l.grammar$&&(0,_.grammar)(e)}return s}let M;E.exports.util=I,E.exports.make=T,E.exports.root=M;let N=E.exports.root=M=T("jsonic");return E.exports.Jsonic=N,M.Jsonic=M,M.JsonicError=j.JsonicError,M.makeLex=O.makeLex,M.makeParser=v.makeParser,M.makeToken=O.makeToken,M.makePoint=O.makePoint,M.makeRule=v.makeRule,M.makeRuleSpec=v.makeRuleSpec,M.makeFixedMatcher=O.makeFixedMatcher,M.makeSpaceMatcher=O.makeSpaceMatcher,M.makeLineMatcher=O.makeLineMatcher,M.makeStringMatcher=O.makeStringMatcher,M.makeCommentMatcher=O.makeCommentMatcher,M.makeNumberMatcher=O.makeNumberMatcher,M.makeTextMatcher=O.makeTextMatcher,M.OPEN=r.OPEN,M.CLOSE=r.CLOSE,M.BEFORE=r.BEFORE,M.AFTER=r.AFTER,M.EMPTY=r.EMPTY,M.util=I,M.make=T,M.S=j.S,E.exports.default=N,E.exports=N,E.exports}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),e=e.exports;var n={};Object.defineProperty(n,"__esModule",{value:!0}),n.testing=n.evaluate=n.Expr=void 0;const{omap:t,entries:r,values:i}=e.util,l={};let s=function(e,n){let s=e.token.bind(e),y=e.fixed.bind(e),_=n.op||{};const S=v(s,y,_,"prefix"),E=v(s,y,_,"suffix"),j=v(s,y,_,"infix"),O=v(s,y,_,"ternary"),I=function(e,n,t){return r(t).reduce((t,[r,i])=>{if(i.paren){let s=n(i.osrc)||e("#E"+i.osrc),o=e(s),a=n(i.csrc)||e("#E"+i.csrc),c=e(a);t[s]={name:r+"-paren",osrc:i.osrc,csrc:i.csrc,otkn:o,otin:s,ctkn:c,ctin:a,preval:{active:null!=i.preval&&(null==i.preval.active||i.preval.active),required:null!=i.preval&&null!=i.preval.required&&i.preval.required},use:{},paren:!0,src:i.osrc,left:Number.MIN_SAFE_INTEGER,right:Number.MAX_SAFE_INTEGER,infix:!1,prefix:!1,suffix:!1,ternary:!1,tkn:"",tin:-1,terms:1,token:{},OP_MARK:l}}return t},{})}(s,y,_),T=t(I,([e,n])=>[void 0,void 0,n.ctin,n]);let M=Object.values({...I,...T}).reduce((e,n)=>(e[n.otkn]=n.osrc,e[n.ctkn]=n.csrc,e),{}),N=Object.values({...S,...E,...j,...O}).reduce((e,n)=>(e[n.tkn]=n.src,e),{});e.options({fixed:{token:{...N,...M}},lex:{match:{comment:{order:1e5}}}});const P=i(S).map(e=>e.tin),C=i(j).map(e=>e.tin),R=i(E).map(e=>e.tin),w=i(O).filter(e=>0===e.use.ternary.opI).map(e=>e.tin),A=i(O).filter(e=>1===e.use.ternary.opI).map(e=>e.tin),L=i(I).map(e=>e.otin),Y=i(T).map(e=>e.ctin),F=0<P.length,$=0<C.length,J=0<R.length,U=0<w.length&&0<A.length,K=0<L.length&&0<Y.length,B=e.token.CA,V=e.token.CS,D=e.token.CB,G=e.token.TX,z=e.token.NR,Z=e.token.ST,q=e.token.VL,W=e.token.ZZ,X=[G,z,Z,q];e.rule("val",n=>{U&&A.includes(e.token.CL)&&(n.def.open.find(e=>e.g.includes("pair")).c=e=>!e.n.expr_ternary),n.open([F?{s:[P],b:1,n:{expr_prefix:1,expr_suffix:0},p:"expr",g:"expr,expr-prefix"}:null,K?{s:[L],b:1,p:"paren",c:(e,n)=>{let t=!0;return I[e.o0.tin].preval.required&&(t="val"===e.prev.name&&e.prev.use.paren_preval),t&&1===e.prev.i&&(n.root=()=>e),t},g:"expr,expr-paren"}:null]).close([U?{s:[w],c:e=>!e.n.expr,b:1,r:"ternary",g:"expr,expr-ternary"}:null,$?{s:[C],b:1,n:{expr_prefix:0,expr_suffix:0},r:e=>e.n.expr?"":"expr",g:"expr,expr-infix"}:null,J?{s:[R],b:1,n:{expr_prefix:0,expr_suffix:1},r:e=>e.n.expr?"":"expr",g:"expr,expr-suffix"}:null,K?{s:[Y],c:e=>!!e.n.expr_paren,b:1,g:"expr,expr-paren"}:null,K?{s:[L],b:1,r:"val",c:e=>I[e.c0.tin].preval.active,u:{paren_preval:!0},g:"expr,expr-paren,expr-paren-preval"}:null,U?{s:[A],c:e=>!!e.n.expr_ternary,b:1,g:"expr,expr-ternary"}:null,{s:[B],c:e=>1===e.d&&(1<=e.n.expr||1<=e.n.expr_ternary)||1<=e.n.expr_ternary&&1<=e.n.expr_paren,b:1,g:"expr,list,val,imp,comma,top"},{s:[X],c:e=>1===e.d&&(1<=e.n.expr||1<=e.n.expr_ternary)||1<=e.n.expr_ternary&&1<=e.n.expr_paren,b:1,g:"expr,list,val,imp,space,top"}])}),e.rule("list",e=>{e.bo(!1,e=>{e.prev.use.implist||(e.n.expr=0,e.n.expr_prefix=0,e.n.expr_suffix=0,e.n.expr_paren=0,e.n.expr_ternary=0)}).close([K&&{s:[Y],b:e=>V!==e.c0.tin||e.n.expr_paren?1:0}])}),e.rule("map",e=>{e.bo(!1,(...e)=>{e[0].n.expr=0,e[0].n.expr_prefix=0,e[0].n.expr_suffix=0,e[0].n.expr_paren=0,e[0].n.expr_ternary=0}).close([K&&{s:[Y],b:e=>D!==e.c0.tin||e.n.expr_paren?1:0}])}),e.rule("elem",e=>{e.close([K?{s:[Y],b:1,c:e=>!!e.n.expr_paren,g:"expr,expr-paren,imp,close,list"}:null,K?{s:[L],b:1,r:"elem",g:"expr,expr-paren,imp,open,list"}:null])}),e.rule("pair",e=>{e.close([K?{s:[Y],b:1,c:e=>!!e.n.expr_paren||0<e.n.pk,g:"expr,expr-paren,imp,map"}:null])}),e.rule("expr",e=>{e.open([F?{s:[P],c:e=>!!e.n.expr_prefix,n:{expr:1,dlist:1,dmap:1},p:"val",g:"expr,expr-prefix",a:e=>{const n=a(e.o0,S);e.node=x(e.parent.node)?k(e.parent.node,n):o(e,e.parent,n)}}:null,$?{s:[C],p:"val",n:{expr:1,expr_prefix:0,dlist:1,dmap:1},a:e=>{const n=e.prev,t=e.parent,r=a(e.o0,j);x(t.node)&&!g("ternary",t.node)?e.node=k(t.node,r):x(n.node)?(e.node=k(n.node,r),e.parent=n):e.node=o(e,n,r)},g:"expr,expr-infix"}:null,J?{s:[R],n:{expr:1,expr_prefix:0,dlist:1,dmap:1},a:e=>{const n=e.prev,t=a(e.o0,E);e.node=x(n.node)?k(n.node,t):o(e,n,t)},g:"expr,expr-suffix"}:null]).bc(e=>{var n;x(e.node)&&(null===(n=e.node)||void 0===n?void 0:n.length)-1<e.node[0].terms&&e.node.push(e.child.node)}).close([$?{s:[C],c:e=>!e.n.expr_prefix,b:1,r:"expr",g:"expr,expr-infix"}:null,J?{s:[R],c:e=>!e.n.expr_prefix,b:1,r:"expr",g:"expr,expr-suffix"}:null,K?{s:[Y],c:e=>!!e.n.expr_paren,b:1}:null,U?{s:[w],c:e=>!e.n.expr_prefix,b:1,r:"ternary",g:"expr,expr-ternary"}:null,{s:[B],c:{d:0},n:{expr:0},r:"elem",a:e=>e.parent.node=e.node=[e.node],g:"expr,comma,list,top"},{s:[X],c:{d:0},n:{expr:0},b:1,r:"elem",a:e=>e.parent.node=e.node=[e.node],g:"expr,space,list,top"},{s:[B],c:{n:{pk:0}},n:{expr:0},b:1,h:f,g:"expr,list,val,imp,comma"},{c:{n:{pk:0,expr_suffix:0}},n:{expr:0},h:f,g:"expr,list,val,imp,space"},{n:{expr:0},g:"expr,expr-end"}]).ac(e=>{n.evaluate&&0===e.n.expr&&(e.parent.node=b(e.parent,e.parent.node,n.evaluate))})}),e.rule("paren",e=>{e.bo(e=>{e.n.dmap=0,e.n.dlist=0,e.n.pk=0}).open([K?{s:[L,Y],b:1,g:"expr,expr-paren,empty",c:e=>I[e.o0.tin].name===T[e.o1.tin].name,a:p(I)}:null,K?{s:[L],p:"val",n:{expr_paren:1,expr:0,expr_prefix:0,expr_suffix:0},g:"expr,expr-paren,open",a:p(I)}:null]).close([K?{s:[Y],c:e=>{let n="expr_paren_depth_"+T[e.c0.tin].name;return!!e.n[n]},a:d(T),g:"expr,expr-paren,close"}:null])}),U&&e.rule("ternary",e=>{e.open([{s:[w],p:"val",n:{expr_ternary:1,expr:0,expr_prefix:0,expr_suffix:0},u:{expr_ternary_step:1},g:"expr,expr-ternary,open",a:e=>{let n=a(e.o0,O);e.use.expr_ternary_name=n.name,x(e.prev.node)?e.node=c(e.prev.node,n,u(e.prev.node)):e.node=e.prev.node=c([],n,e.prev.node),e.use.expr_ternary_paren=e.n.expr_paren||e.prev.use.expr_ternary_paren||0,e.n.expr_paren=0}},{p:"val",c:e=>2===e.prev.use.expr_ternary_step,a:e=>{e.use.expr_ternary_step=e.prev.use.expr_ternary_step,e.n.expr_paren=e.use.expr_ternary_paren=e.prev.use.expr_ternary_paren},g:"expr,expr-ternary,step"}]).close([{s:[A],c:e=>1===e.use.expr_ternary_step&&e.use.expr_ternary_name===O[e.c0.tin].name,r:"ternary",a:e=>{e.use.expr_ternary_step++,e.node.push(e.child.node)},g:"expr,expr-ternary,step"},{s:[[B,...Y]],c:m,b:(e,n)=>Y.includes(n.t0.tin)?1:0,r:(e,n)=>{var t;return Y.includes(n.t0.tin)||0!==e.d&&(!e.prev.use.expr_ternary_paren||(null===(t=e.parent.node)||void 0===t?void 0:t.length))?"":"elem"},a:h,g:"expr,expr-ternary,list,val,imp,comma"},{c:m,r:(e,n)=>{var t;return 0!==e.d&&Y.includes(n.t0.tin)&&!e.prev.use.expr_ternary_paren||(null===(t=e.parent.node)||void 0===t?void 0:t.length)||W===n.t0.tin?"":"elem"},a:h,g:"expr,expr-ternary,list,val,imp,space"},{c:e=>0<e.d&&2===e.use.expr_ternary_step,a:e=>{e.node.push(e.child.node)},g:"expr,expr-ternary,close"}])})};function o(e,n,t){let r=n.node;return x(n.node)?r=u(n.node):n.node=[],c(n.node,t),t.prefix||(n.node[1]=r),e.parent=n,n.node}function a(e,n){return{...n[e.tin],token:e,OP_MARK:l}}function c(e,n,...t){let r=e;r[0]=n;let i=0;for(;i<t.length;i++)r[i+1]=t[i];return r.length=i+1,r}function u(e){return[...e]}function p(e){return function(n){let t="expr_paren_depth_"+a(n.o0,e).name;n.use[t]=n.n[t]=1,n.node=void 0}}function d(e){return function(n){(x(n.child.node)||void 0===n.node)&&(n.node=n.child.node);const t=a(n.c0,e);let r="expr_paren_depth_"+t.name;if(n.use[r]===n.n[r]){const e=n.node;n.node=[t],void 0!==e&&(n.node[1]=e),n.parent.prev.use.paren_preval&&(g("paren",n.parent.prev.node)?n.node=c(n.parent.prev.node,n.node[0],u(n.parent.prev.node),n.node[1]):(n.node.splice(1,0,n.parent.prev.node),n.parent.prev.node=n.node))}}}function f(e,n,t){let r=null;for(let i=n.rsI-1;-1<i;i--)if("paren"===n.rs[i].name){r=n.rs[i];break}return r&&(null==r.child.node?(r.child.node=[e.node],t.r="elem",t.b=0):x(r.child.node)&&(r.child.node=[r.child.node],t.r="elem",t.b=0),e.node=r.child.node),t}function m(e){return(0===e.d||1<=e.n.expr_paren)&&!e.n.pk&&2===e.use.expr_ternary_step}function h(e,n,t){e.n.expr_paren=e.prev.use.expr_ternary_paren,e.node.push(e.child.node),"elem"===t.r&&(e.node[0]=u(e.node),e.node.length=1)}function g(e,n){return null!=n&&x(n)&&!0===n[0][e]}function x(e){return null!=e&&e[0]&&e[0].OP_MARK===l}function v(e,n,t,r){return Object.entries(t).filter(([e,n])=>n[r]).reduce((t,[i,s])=>{let o="",a=-1,c="";c="string"==typeof s.src?s.src:s.src[0],a=n(c)||e("#E"+c),o=e(a);let u=t[a]={src:c,left:s.left||Number.MIN_SAFE_INTEGER,right:s.right||Number.MAX_SAFE_INTEGER,name:i+(i.endsWith("-"+r)?"":"-"+r),infix:"infix"===r,prefix:"prefix"===r,suffix:"suffix"===r,ternary:"ternary"===r,tkn:o,tin:a,terms:"ternary"===r?3:"infix"===r?2:1,use:{},paren:!1,osrc:"",csrc:"",otkn:"",ctkn:"",otin:-1,ctin:-1,preval:{active:!1,required:!1},token:{},OP_MARK:l};if(u.ternary){let r=s.src;u.src=r[0],u.use.ternary={opI:0};let i={...u};c=s.src[1],a=n(c)||e("#E"+c),o=e(a),i.src=c,i.use={ternary:{opI:1}},i.tkn=o,i.tin=a,t[a]=i}return t},{})}function k(e,n){let t=e,r=e[0];if(n)if(n.infix)if(r.suffix||n.left<=r.right)c(e,n,u(e));else{const i=r.terms;t=x(e[i])&&e[i][0].right<n.left?k(e[i],n):e[i]=c([],n,e[i])}else if(n.prefix)t=e[r.terms]=c([],n);else if(n.suffix)if(!r.suffix&&r.right<=n.left){const t=r.terms;x(e[t])&&e[t][0].prefix&&e[t][0].right<n.left?k(e[t],n):e[t]=c([],n,e[t])}else c(e,n,u(e));return t}function b(e,n,t){return null==n?n:x(n)?t(e,n[0],n.slice(1).map(n=>b(e,n,t))):n}n.Expr=s,s.defaults={op:{positive:{prefix:!0,right:14e3,src:"+"},negative:{prefix:!0,right:14e3,src:"-"},addition:{infix:!0,left:140,right:150,src:"+"},subtraction:{infix:!0,left:140,right:150,src:"-"},multiplication:{infix:!0,left:160,right:170,src:"*"},division:{infix:!0,left:160,right:170,src:"/"},remainder:{infix:!0,left:160,right:170,src:"%"},plain:{paren:!0,osrc:"(",csrc:")"}}},n.evaluate=b;const y={prattify:k,opify:e=>(e.OP_MARK=l,e)};return n.testing=y,n})); |
10
expr.ts
@@ -150,3 +150,3 @@ /* Copyright (c) 2021 Richard Rodger, MIT License */ | ||
(a, p) => ((a[p.otkn] = p.osrc), (a[p.ctkn] = p.csrc), a), | ||
{} as any | ||
{} as any, | ||
) | ||
@@ -822,3 +822,3 @@ | ||
dupNode(r.parent.prev.node), | ||
r.node[1] | ||
r.node[1], | ||
) | ||
@@ -903,3 +903,3 @@ } else { | ||
op: { [name: string]: OpDef }, | ||
anyfix: 'prefix' | 'suffix' | 'infix' | 'ternary' | ||
anyfix: 'prefix' | 'suffix' | 'infix' | 'ternary', | ||
): OpMap { | ||
@@ -977,3 +977,3 @@ return Object.entries(op) | ||
fixed: (tkn: string) => Tin, | ||
optop: { [name: string]: OpDef } | ||
optop: { [name: string]: OpDef }, | ||
): OpMap { | ||
@@ -1145,3 +1145,3 @@ return entries(optop).reduce((a: OpMap, [name, pdef]: [string, any]) => { | ||
expr[0], | ||
expr.slice(1).map((term: any) => evaluate(rule, term, resolve)) | ||
expr.slice(1).map((term: any) => evaluate(rule, term, resolve)), | ||
) | ||
@@ -1148,0 +1148,0 @@ } |
{ | ||
"name": "@jsonic/expr", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "This plugin allows the [Jsonic](https://jsonic.senecajs.org) JSON parser to support expression syntax.", | ||
@@ -43,15 +43,15 @@ "main": "expr.js", | ||
"devDependencies": { | ||
"@types/jest": "^29.4.0", | ||
"@types/jest": "^29.5.3", | ||
"browserify": "^17.0.0", | ||
"esbuild": "^0.17.8", | ||
"esbuild": "^0.19.1", | ||
"es-jest": "^2.1.0", | ||
"jest": "^29.4.3", | ||
"prettier": "^2.8.4", | ||
"jest": "^29.6.2", | ||
"prettier": "^3.0.1", | ||
"tinyify": "^4.0.0", | ||
"typescript": "^4.9.5" | ||
"typescript": "^5.1.6" | ||
}, | ||
"peerDependencies": { | ||
"@jsonic/jsonic-next": ">=2.9.0" | ||
"@jsonic/jsonic-next": ">=2.10.0" | ||
}, | ||
"dependencies": {} | ||
} |
153956