json-6 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/index.js +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/json6.d.ts +90 -88
- package/lib/json6.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# JSON6 – JSON for Humans
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.com/d3x0r/JSON6)
|
|
4
|
-
|
|
5
|
-
[](https://gitter.im/sack-vfs/json6?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
6
3
|
|
|
7
4
|
*Documentation base cloned from JSON5 project https://github.com/json5/json5*
|
|
8
5
|
|
|
@@ -572,7 +569,10 @@ other extensions. [JSOX](https://github.com/d3x0r/JSOX) takes the same stance.
|
|
|
572
569
|
JavaScript-subset guarantee can turn on [`esStrictCompatible`](#options).
|
|
573
570
|
|
|
574
571
|
## Changelog
|
|
575
|
-
- 1.1.
|
|
572
|
+
- 1.1.7(pre)
|
|
573
|
+
- 1.1.6
|
|
574
|
+
- Fix the shipped `dist/json6.d.ts`: tsc emitted `export =` next to `export type` lines, which TypeScript 5.x rejects (TS2309) for any consumer compiling without `skipLibCheck`. The types now live in a namespace merged with the export (#60).
|
|
575
|
+
- `normalizeNumericKeys` parse option: an unquoted numeric key becomes `String(Number(key))`, so `{1e3:1}` gives key `"1000"` as a JS object literal would (#59).
|
|
576
576
|
- Error positions are now right: the column no longer starts one too high, numbers no longer count their terminator twice, `_` digit separators are counted, and lines are counted inside comments and strings and for CR, LS and PS as well as LF.
|
|
577
577
|
- `stringify` emits arrays as arrays; they used to go through the object path and come out as `{"0":..,"1":..}`. Holes stay holes (`[1,,3]`), `undefined` stays `undefined`, and a trailing hole keeps its comma so it survives a round trip.
|
|
578
578
|
- `stringify` always quotes string values (#57); only object keys use the bare-identifier rule.
|
package/dist/index.js
CHANGED
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).JSON5=t()}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r,i={};function o(){if(r)return n;r=1;var t=function(e){return e&&e.Math===Math&&e};return n=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||t("object"==typeof n&&n)||function(){return this}()||Function("return this")()}var u,a,s,c,f,l,p,g,h={};function v(){return a?u:(a=1,u=function(e){try{return!!e()}catch(e){return!0}})}function b(){if(c)return s;c=1;var e=v();return s=!e(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function d(){if(l)return f;l=1;var e=v();return f=!e(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})}function y(){if(g)return p;g=1;var e=d(),t=Function.prototype.call;return p=e?t.bind(t):function(){return t.apply(t,arguments)},p}var m,w,k,S,O,j,_,x,P,C,E,N,A,$,T,I,L,M,z,F,U,q,D,W,K,R,J,B,G,X,Q,V,Y,H,Z,ee,te,ne,re,ie,oe,ue={};function ae(){return k?w:(k=1,w=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function se(){if(O)return S;O=1;var e=d(),t=Function.prototype,n=t.call,r=e&&t.bind.bind(n,n);return S=e?r:function(e){return function(){return n.apply(e,arguments)}},S}function ce(){if(_)return j;_=1;var e=se(),t=e({}.toString),n=e("".slice);return j=function(e){return n(t(e),8,-1)}}function fe(){return E?C:(E=1,C=function(e){return null==e})}function le(){if(A)return N;A=1;var e=fe(),t=TypeError;return N=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function pe(){if(T)return $;T=1;var e=function(){if(P)return x;P=1;var e=se(),t=v(),n=ce(),r=Object,i=e("".split);return x=t(function(){return!r("z").propertyIsEnumerable(0)})?function(e){return"String"===n(e)?i(e,""):r(e)}:r}(),t=le();return $=function(n){return e(t(n))}}function ge(){if(L)return I;L=1;var e="object"==typeof document&&document.all;return I=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function he(){if(z)return M;z=1;var e=ge();return M=function(t){return"object"==typeof t?null!==t:e(t)}}function ve(){if(U)return F;U=1;var e=o(),t=ge();return F=function(n,r){return arguments.length<2?(i=e[n],t(i)?i:void 0):e[n]&&e[n][r];var i},F}function be(){if(J)return R;J=1;var e,t,n=o(),r=function(){if(K)return W;K=1;var e=o().navigator,t=e&&e.userAgent;return W=t?String(t):""}(),i=n.process,u=n.Deno,a=i&&i.versions||u&&u.version,s=a&&a.v8;return s&&(t=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&r&&(!(e=r.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=r.match(/Chrome\/(\d+)/))&&(t=+e[1]),R=t}function de(){if(G)return B;G=1;var e=be(),t=v(),n=o().String;return B=!!Object.getOwnPropertySymbols&&!t(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41})}function ye(){if(Q)return X;Q=1;var e=de();return X=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function me(){if(Y)return V;Y=1;var e=ve(),t=ge(),n=function(){if(D)return q;D=1;var e=se();return q=e({}.isPrototypeOf)}(),r=ye(),i=Object;return V=r?function(e){return"symbol"==typeof e}:function(r){var o=e("Symbol");return t(o)&&n(o.prototype,i(r))}}function we(){if(Z)return H;Z=1;var e=String;return H=function(t){try{return e(t)}catch(e){return"Object"}}}function ke(){if(te)return ee;te=1;var e=ge(),t=we(),n=TypeError;return ee=function(r){if(e(r))return r;throw new n(t(r)+" is not a function")}}function Se(){if(re)return ne;re=1;var e=ke(),t=fe();return ne=function(n,r){var i=n[r];return t(i)?void 0:e(i)}}function Oe(){if(oe)return ie;oe=1;var e=y(),t=ge(),n=he(),r=TypeError;return ie=function(i,o){var u,a;if("string"===o&&t(u=i.toString)&&!n(a=e(u,i)))return a;if(t(u=i.valueOf)&&!n(a=e(u,i)))return a;if("string"!==o&&t(u=i.toString)&&!n(a=e(u,i)))return a;throw new r("Can't convert object to primitive value")}}var je,_e,xe,Pe,Ce,Ee,Ne,Ae,$e,Te,Ie,Le,Me,ze,Fe,Ue,qe,De,We,Ke,Re,Je,Be,Ge,Xe={exports:{}};function Qe(){if(Pe)return xe;Pe=1;var e=o(),t=Object.defineProperty;return xe=function(n,r){try{t(e,n,{value:r,configurable:!0,writable:!0})}catch(t){e[n]=r}return r}}function Ve(){if(Ce)return Xe.exports;Ce=1;var e=_e?je:(_e=1,je=!1),t=o(),n=Qe(),r="__core-js_shared__",i=Xe.exports=t[r]||n(r,{});return(i.versions||(i.versions=[])).push({version:"3.50.0",mode:e?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"}),Xe.exports}function Ye(){if(Ne)return Ee;Ne=1;var e=Ve(),t=Object.create||Object;return Ee=function(n,r){return e[n]||(e[n]=r||t(null))}}function He(){if($e)return Ae;$e=1;var e=le(),t=Object;return Ae=function(n){return t(e(n))}}function Ze(){if(Ie)return Te;Ie=1;var e=se(),t=He(),n=e({}.hasOwnProperty);return Te=Object.hasOwn||function(e,r){return n(t(e),r)}}function et(){if(Me)return Le;Me=1;var e=se(),t=0,n=Math.random(),r=e(1.1.toString);return Le=function(e){return"Symbol("+(void 0===e?"":e)+")_"+r(++t+n,36)}}function tt(){if(Fe)return ze;Fe=1;var e=o(),t=Ye(),n=Ze(),r=et(),i=de(),u=ye(),a=e.Symbol,s=t("wks"),c=u?a.for||a:a&&a.withoutSetter||r;return ze=function(e){return n(s,e)||(s[e]=i&&n(a,e)?a[e]:c("Symbol."+e)),s[e]}}function nt(){if(qe)return Ue;qe=1;var e=y(),t=he(),n=me(),r=Se(),i=Oe(),o=tt(),u=TypeError,a=o("toPrimitive");return Ue=function(o,s){if(!t(o)||n(o))return o;var c,f=r(o,a);if(f){if(void 0===s&&(s="default"),c=e(f,o,s),!t(c)||n(c))return c;throw new u("Can't convert object to primitive value")}return void 0===s&&(s="number"),i(o,s)}}function rt(){if(We)return De;We=1;var e=nt(),t=me();return De=function(n){var r=e(n,"string");return t(r)?r:r+""}}function it(){if(Be)return Je;Be=1;var e=b(),t=v(),n=function(){if(Re)return Ke;Re=1;var e=o(),t=he(),n=e.document,r=t(n)&&t(n.createElement);return Ke=function(e){return r?n.createElement(e):{}}}();return Je=!e&&!t(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})}function ot(){if(Ge)return h;Ge=1;var e=b(),t=y(),n=function(){if(m)return ue;m=1;var e={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,n=t&&!e.call({1:2},1);return ue.f=n?function(e){var n=t(this,e);return!!n&&n.enumerable}:e,ue}(),r=ae(),i=pe(),o=rt(),u=Ze(),a=it(),s=Object.getOwnPropertyDescriptor;return h.f=e?s:function(e,c){if(e=i(e),c=o(c),a)try{return s(e,c)}catch(e){}if(u(e,c))return r(!t(n.f,e,c),e[c])},h}var ut,at,st,ct,ft,lt,pt,gt={};function ht(){if(ct)return st;ct=1;var e=he(),t=String,n=TypeError;return st=function(r){if(e(r))return r;throw new n(t(r)+" is not an object")}}function vt(){if(ft)return gt;ft=1;var e=b(),t=it(),n=function(){if(at)return ut;at=1;var e=b(),t=v();return ut=e&&t(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}(),r=ht(),i=rt(),o=TypeError,u=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s="enumerable",c="configurable",f="writable";return gt.f=e?n?function(e,t,n){if(r(e),t=i(t),r(n),"function"==typeof e&&"prototype"===t&&"value"in n&&f in n&&!n[f]){var o=a(e,t);o&&o[f]&&(e[t]=n.value,n={configurable:c in n?n[c]:o[c],enumerable:s in n?n[s]:o[s],writable:!1})}return u(e,t,n)}:u:function(e,n,a){if(r(e),n=i(n),r(a),t)try{return u(e,n,a)}catch(e){}if("get"in a||"set"in a)throw new o("Accessors not supported");return"value"in a&&(e[n]=a.value),e},gt}function bt(){if(pt)return lt;pt=1;var e=b(),t=vt(),n=ae();return lt=e?function(e,r,i){return t.f(e,r,n(1,i))}:function(e,t,n){return e[t]=n,e}}var dt,yt,mt,wt,kt,St,Ot,jt,_t,xt,Pt,Ct,Et,Nt,At,$t={exports:{}};function Tt(){if(wt)return mt;wt=1;var e=se(),t=ge(),n=Ve(),r=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return r(e)}),mt=n.inspectSource}function It(){if(jt)return Ot;jt=1;var e=Ye(),t=et(),n=e("keys");return Ot=function(e){return n[e]||(n[e]=t(e))}}function Lt(){return xt?_t:(xt=1,_t={})}function Mt(){if(Ct)return Pt;Ct=1;var e,t,n,r=function(){if(St)return kt;St=1;var e=o(),t=ge(),n=e.WeakMap;return kt=t(n)&&/native code/.test(String(n))}(),i=o(),u=he(),a=bt(),s=Ze(),c=Ve(),f=It(),l=Lt(),p="Object already initialized",g=i.TypeError,h=i.WeakMap;if(r||c.state){var v=c.state||(c.state=new h);v.get=v.get,v.has=v.has,v.set=v.set,e=function(e,t){if(v.has(e))throw new g(p);return t.facade=e,v.set(e,t),t},t=function(e){return v.get(e)||{}},n=function(e){return v.has(e)}}else{var b=f("state");l[b]=!0,e=function(e,t){if(s(e,b))throw new g(p);return t.facade=e,a(e,b,t),t},t=function(e){return s(e,b)?e[b]:{}},n=function(e){return s(e,b)}}return Pt={set:e,get:t,has:n,enforce:function(r){return n(r)?t(r):e(r,{})},getterFor:function(e){return function(n){var r;if(!u(n)||(r=t(n)).type!==e)throw new g("Incompatible receiver, "+e+" required");return r}}}}function zt(){if(Et)return $t.exports;Et=1;var e=se(),t=v(),n=ge(),r=Ze(),i=b(),o=function(){if(yt)return dt;yt=1;var e=b(),t=Ze(),n=Function.prototype,r=e&&Object.getOwnPropertyDescriptor,i=t(n,"name"),o=i&&"something"===function(){}.name,u=i&&(!e||e&&r(n,"name").configurable);return dt={EXISTS:i,PROPER:o,CONFIGURABLE:u}}().CONFIGURABLE,u=Tt(),a=Mt(),s=a.enforce,c=a.get,f=String,l=Object.defineProperty,p=e("".slice),g=e("".replace),h=e([].join),d=i&&!t(function(){return 8!==l(function(){},"length",{value:8}).length}),y=String(String).split("String"),m=$t.exports=function(e,t,n){"Symbol("===p(f(t),0,7)&&(t="["+g(f(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!r(e,"name")||o&&e.name!==t)&&(i?l(e,"name",{value:t,configurable:!0}):e.name=t),d&&n&&r(n,"arity")&&e.length!==n.arity&&l(e,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?i&&l(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var u=s(e);return r(u,"source")||(u.source=h(y,"string"==typeof t?t:"")),e};return Function.prototype.toString=m(function(){return n(this)&&c(this).source||u(this)},"toString"),$t.exports}function Ft(){if(At)return Nt;At=1;var e=ge(),t=vt(),n=zt(),r=Qe();return Nt=function(i,o,u,a){a||(a={});var s=a.enumerable,c=void 0!==a.name?a.name:o;if(e(u)&&n(u,c,a),a.global)s?i[o]=u:r(o,u);else{try{a.unsafe?i[o]&&(s=!0):delete i[o]}catch(e){}s?i[o]=u:t.f(i,o,{value:u,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return i}}var Ut,qt,Dt,Wt,Kt,Rt,Jt,Bt,Gt,Xt,Qt,Vt,Yt,Ht,Zt,en,tn,nn={};function rn(){if(Wt)return Dt;Wt=1;var e=function(){if(qt)return Ut;qt=1;var e=Math.ceil,t=Math.floor;return Ut=Math.trunc||function(n){var r=+n;return(r>0?t:e)(r)}}();return Dt=function(t){var n=+t;return n!=n||0===n?0:e(n)}}function on(){if(Rt)return Kt;Rt=1;var e=rn(),t=Math.max,n=Math.min;return Kt=function(r,i){var o=e(r);return o<0?t(o+i,0):n(o,i)}}function un(){if(Bt)return Jt;Bt=1;var e=rn(),t=Math.min;return Jt=function(n){var r=e(n);return r>0?t(r,9007199254740991):0}}function an(){if(Xt)return Gt;Xt=1;var e=un();return Gt=function(t){return e(t.length)}}function sn(){if(Ht)return Yt;Ht=1;var e=se(),t=Ze(),n=pe(),r=function(){if(Vt)return Qt;Vt=1;var e=pe(),t=on(),n=an(),r=function(r){return function(i,o,u){var a=e(i),s=n(a);if(0===s)return!r&&-1;var c,f=t(u,s);if(r&&o!=o){for(;s>f;)if((c=a[f++])!=c)return!0}else for(;s>f;f++)if((r||f in a)&&a[f]===o)return r||f||0;return!r&&-1}};return Qt={includes:r(!0),indexOf:r(!1)}}().indexOf,i=Lt(),o=e([].push);return Yt=function(e,u){var a,s=n(e),c=0,f=[];for(a in s)!t(i,a)&&t(s,a)&&o(f,a);for(;u.length>c;)t(s,a=u[c++])&&(~r(f,a)||o(f,a));return f}}var cn,fn,ln,pn,gn,hn,vn,bn,dn,yn,mn,wn,kn,Sn,On,jn,_n,xn,Pn,Cn,En,Nn,An,$n,Tn,In,Ln,Mn,zn,Fn={};function Un(){if(ln)return fn;ln=1;var e=ve(),t=se(),n=function(){if(tn)return nn;tn=1;var e=sn(),t=(en?Zt:(en=1,Zt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])).concat("length","prototype");return nn.f=Object.getOwnPropertyNames||function(n){return e(n,t)},nn}(),r=(cn||(cn=1,Fn.f=Object.getOwnPropertySymbols),Fn),i=ht(),o=t([].concat);return fn=e("Reflect","ownKeys")||function(e){var t=n.f(i(e)),u=r.f;return u?o(t,u(e)):t}}function qn(){if(gn)return pn;gn=1;var e=Ze(),t=Un(),n=ot(),r=vt();return pn=function(i,o,u){for(var a=t(o),s=r.f,c=n.f,f=0;f<a.length;f++){var l=a[f];e(i,l)||u&&e(u,l)||s(i,l,c(o,l))}}}function Dn(){if(dn)return bn;dn=1;var e=o(),t=ot().f,n=bt(),r=Ft(),i=Qe(),u=qn(),a=function(){if(vn)return hn;vn=1;var e=v(),t=ge(),n=/#|\.prototype\./,r=function(n,r){var s=o[i(n)];return s===a||s!==u&&(t(r)?e(r):!!r)},i=r.normalize=function(e){return String(e).replace(n,".").toLowerCase()},o=r.data={},u=r.NATIVE="N",a=r.POLYFILL="P";return hn=r}();return bn=function(o,s){var c,f,l,p,g,h=o.target,v=o.global,b=o.stat;if(c=v?e:b?e[h]||i(h,{}):e[h]&&e[h].prototype)for(f in s){if(p=s[f],l=o.dontCallGetSet?(g=t(c,f))&&g.value:c[f],!a(v?f:h+(b?".":"#")+f,o.forced)&&void 0!==l){if(typeof p==typeof l)continue;u(p,l)}(o.sham||l&&l.sham)&&n(p,"sham",!0),r(c,f,p,o)}}}function Wn(){if(kn)return wn;kn=1;var e=function(){if(mn)return yn;mn=1;var e={};return e[tt()("toStringTag")]="z",yn="[object z]"===String(e)}(),t=ge(),n=ce(),r=tt()("toStringTag"),i=Object,o="Arguments"===n(function(){return arguments}());return wn=e?n:function(e){var u,a,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(a=function(e,t){try{return e[t]}catch(e){}}(u=i(e),r))?a:o?n(u):"Object"===(s=n(u))&&t(u.callee)?"Arguments":s}}function Kn(){if(On)return Sn;On=1;var e=Wn(),t=String;return Sn=function(n){if("Symbol"===e(n))throw new TypeError("Cannot convert a Symbol value to a string");return t(n)}}function Rn(){if(xn)return i;xn=1;var e=Dn(),t=function(){if(_n)return jn;_n=1;var e=se(),t=rn(),n=Kn(),r=le(),i=e("".charAt),o=e("".charCodeAt),u=e("".slice),a=function(e){return function(a,s){var c,f,l=n(r(a)),p=t(s),g=l.length;return p<0||p>=g?e?"":void 0:(c=o(l,p))<55296||c>56319||p+1===g||(f=o(l,p+1))<56320||f>57343?e?i(l,p):c:e?u(l,p,p+2):f-56320+(c-55296<<10)+65536}};return jn={codeAt:a(!1),charAt:a(!0)}}().codeAt;return e({target:"String",proto:!0},{codePointAt:function(e){return t(this,e)}}),i}function Jn(){if(Cn)return Pn;Cn=1;var e=o(),t=se();return Pn=function(n,r){return t(e[n].prototype[r])}}function Bn(){if($n)return An;$n=1;var e=function(){if(Nn)return En;Nn=1,Rn();var e=Jn();return En=e("String","codePointAt")}();return An=e}function Gn(){if(Mn)return Ln;Mn=1;var e=function(){if(In)return Tn;In=1;var e=Bn();return Tn=e}();return Ln=e}var Xn,Qn,Vn,Yn,Hn,Zn,er,tr,nr,rr,ir,or,ur,ar={};function sr(){if(Vn)return Qn;Vn=1;var e=o();return Qn=e}function cr(){if(Hn)return Yn;Hn=1,function(){if(Xn)return ar;Xn=1;var e=Dn(),t=se(),n=on(),r=RangeError,i=String.fromCharCode,o=String.fromCodePoint,u=t([].join);e({target:"String",stat:!0,arity:1,forced:!!o&&1!==o.length},{fromCodePoint:function(e){for(var t,o=[],a=arguments.length,s=0;a>s;){if(n(t=+arguments[s],1114111)!==t)throw new r(t+" is not a valid code point");o[s++]=t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320)}return u(o,"")}})}();var e=sr();return Yn=e.String.fromCodePoint}function fr(){if(nr)return tr;nr=1;var e=function(){if(er)return Zn;er=1;var e=cr();return Zn=e}();return tr=e}function lr(){return ur?or:(ur=1,or=function(){if(ir)return rr;ir=1;var e=fr();return rr=e}())}var pr,gr,hr,vr,br,dr={exports:{}};function yr(){return pr||(pr=1,function(e){const t=29,n=31,r=/^[$_\p{ID_Start}][$_\p{ID_Continue}]*$/u,i=/(\d)_(?=\d)/g,o=[];function u(){return o.pop()||{context:0,elements:null,element_array:null,name:null}}function a(e){o.push(e)}const s=[];function c(e){s.push(e)}function f(e,t){if(void 0===e)throw new Error(t||"Unexpected undefined value");return e}const l={escape:function(e){let t="";if(!e)return e;for(let n=0;n<e.length;n++){const r=e[n];'"'!=r&&"\\"!=r&&"`"!=r&&"'"!=r||(t+="\\"),t+=r}return t}};l.begin=function(e,o,l){const p=l;let g=!(!p||!p.esStrictCompatible),h=!(!p||!p.forbidTemplateSubstitution),v=!(!p||!p.warnWithCommentWithoutEOL),b=!(!p||!p.normalizeNumericKeys);const d={name:null,value_type:0,string:"",contains:null},y={line:1,col:0};let m,w=0,k=0,S=!0,O=!1,j=null,_=[],x=0,P=0,C=!1,E=!1,N=!1,A=!1,$=!1,T=null,I=!1,L=!1,M=!1,z=!1,F=!1,U=!1,q=!1,D=!1,W=0,K=0,R=!1,J=!1;const B={first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last||(this.first=t),this.last=t},pop(){const e=this.last;if(!e)throw new Error("context stack underflow");return(this.last=e.prior)||(this.first=null),e.next=this.saved,this.saved=e,e.node}},G={save:void 0,first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last?this.last.next=t:this.first=t,this.last=t},shift(){const e=this.first;return e?(this.first=e.next,this.first||(this.last=null),e.next=this.saved,this.saved=e,e.node):null},unshift(e){const t=this.saved;this.saved=t.next,t.node=e,t.next=this.first,t.prior=null,this.first||(this.last=t),this.first=t}};function X(e){throw new Error(`${e} at ${w} [${y.line}:${y.col}]`)}return{finalError(){if(0!==P)switch(P){case 1:return X("Comment began at end of document");case 2:v&&console.log("Warning: '//' comment without end of line ended document");break;case 3:return X("Open comment '/*' is missing close at end of document");case 4:return X("Incomplete '/* *' close at end of document")}I&&X("Incomplete string")},value(){this.finalError();const e=j;return j=void 0,e},reset(e){const t=void 0===e?p:e;g=!(!t||!t.esStrictCompatible),h=!(!t||!t.forbidTemplateSubstitution),v=!(!t||!t.warnWithCommentWithoutEOL),b=!(!t||!t.normalizeNumericKeys),k=0,S=!0,G.last&&(G.last.next=G.save),G.save=G.first,G.first=G.last=null,B.last&&(B.last.next=B.saved),B.saved=G.first,B.first=B.last=null,_=null,m=void 0,x=0,d.value_type=0,d.name=null,d.string="",y.line=1,y.col=0,O=!1,M=!1,P=0,R=!1,M=!1,J=!1,T=null,I=!1,z=!1,F=!1,U=!1,q=!1,D=!1,W=0,K=0},write(t){let n;if(!e)throw new Error("Callback function must be passed to begin, or you can't get values from the stream.");if(void 0!==t&&"string"!=typeof t&&(t=String(t)),!S)throw new Error("Parser is in an error state, please reset.");for(n=this._write(t,!1);n>0&&(this.finalError(),"function"==typeof o&&function e(t,n){const r=t[n];if(r&&"object"==typeof r){const t=r;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const r=e(t,n);void 0!==r?t[n]=r:delete t[n]}}return o.call(t,n,r)}({"":j},""),e(j),j=void 0,!(n<2));n=this._write());n&&this.finalError()},_write(e,o){let l,p="",v=0;function Q(e,t){throw new Error(`${e} '${String.fromCodePoint(t)}' unexpected at ${w} (near '${p.substr(w>4?w-4:0,w>4?3:w-1)}[${String.fromCodePoint(t)}]${p.substr(w,10)}') [${y.line}:${y.col}]`)}function V(e){if(13===e){if(w<p.length&&10===p.charCodeAt(w))return}else if(10!==e&&8232!==e&&8233!==e)return;y.line++,y.col=0}function Y(){d.value_type=0,d.string="",M=!1}function H(e){k>0&&k<t&&(void 0===e?X("Incomplete keyword"):Q("Incomplete keyword",e)),M&&0==d.value_type&&(void 0===e?X("Sign with no number following"):Q("Sign with no number following",e))}function Z(e){0!=d.value_type&&Q("Two values with no separator between them",e)}function ee(){if(Number.isNaN(Number(d.string)))throw S=!1,new Error(`Invalid number '${d.string}' at ${w} [${y.line}:${y.col}]`)}function te(){const e=_;switch(d.value_type){case 5:e.push((O?-1:1)*Number(d.string));break;case 4:e.push(d.string);break;case 2:e.push(!0);break;case 3:e.push(!1);break;case 8:case 9:e.push(NaN);break;case 10:e.push(-1/0);break;case 11:e.push(1/0);break;case 1:e.push(null);break;case-1:e.push(void 0);break;case 13:e.push(void 0),delete e[e.length-1];break;case 6:case 7:e.push(d.contains)}}function ne(){const e=m,t=d.name;switch(d.value_type){case 5:e[t]=(O?-1:1)*Number(d.string);break;case 4:e[t]=d.string;break;case 2:e[t]=!0;break;case 3:e[t]=!1;break;case 8:case 9:e[t]=NaN;break;case 10:e[t]=-1/0;break;case 11:e[t]=1/0;break;case 1:e[t]=null;break;case-1:e[t]=void 0;break;case 6:case 7:e[t]=d.contains}}function re(e){let t=0;const n=g&&96!==e,r=96===e&&h;for(;0==t&&w<p.length;){let i=p.charAt(w);const o=f(p.codePointAt(w++),"Unexpected end of string");if(o>=65536&&(i+=p.charAt(w),w++),y.col++,o==e)z?(D?Q("Incomplete hexidecimal sequence",o):U?Q("Incomplete long unicode sequence",o):q&&Q("Incomplete unicode sequence",o),F?(F=!1,t=1):d.string+=i,z=!1):t=1;else if(z){if(U){if(125==o){d.string+=String.fromCodePoint(W),U=!1,q=!1,z=!1;continue}W*=16,o>=48&&o<=57?W+=o-48:o>=65&&o<=70?W+=o-65+10:o>=97&&o<=102?W+=o-97+10:Q("(escaped character, parsing hex of \\u)",o);continue}if(D||q){if(0===K&&123===o){U=!0;continue}W*=16,o>=48&&o<=57?W+=o-48:o>=65&&o<=70?W+=o-65+10:o>=97&&o<=102?W+=o-97+10:Q(q?"(escaped character, parsing hex of \\u)":"(escaped character, parsing hex of \\x)",o),K++,q?4==K&&(d.string+=String.fromCodePoint(W),q=!1,z=!1):2==K&&(d.string+=String.fromCodePoint(W),D=!1,z=!1);continue}switch(o){case 13:F=!0,V(o);continue;case 8232:case 8233:case 10:F=!1,V(o);break;case 116:d.string+="\t";break;case 98:d.string+="\b";break;case 48:g&&p.charCodeAt(w)>=48&&p.charCodeAt(w)<=57&&Q("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",p.charCodeAt(w)),d.string+="\0";break;case 110:d.string+="\n";break;case 114:d.string+="\r";break;case 102:d.string+="\f";break;case 118:d.string+="\v";break;case 120:D=!0,K=0,W=0;continue;case 117:q=!0,K=0,W=0;continue;default:g&&o>=49&&o<=57&&Q("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",o),d.string+=i}z=!1}else 92===o?(z=!0,J=!1):(!n||10!==o&&13!==o||Q("Literal line terminators inside single- or double-quoted strings require the 'esStrictCompatible' option to be off",o),r&&(J&&123===o&&Q("Template substitution ${ } is not allowed when the 'forbidTemplateSubstitution' option is set",o),J=36===o),F=!1,V(o),d.string+=i)}return t}function ie(){let e;for(;(e=w)<p.length;){const t=p.charAt(e),n=f(p.codePointAt(w++),"Unexpected end of number");if(n>=65536&&Q("fault while parsing number;",n),y.col++,95!=n)if(n>=48&&n<=57)g&&"0"===d.string&&Q("Legacy octal / leading-zero numbers are not allowed when the 'esStrictCompatible' option is set",n),N&&($=!0),d.string+=t;else if(45==n||43==n)0==d.string.length||N&&!A&&!$?(d.string+=t,A=!0):(S=!1,Q("fault while parsing number;",n));else if(46==n)E||C||N?(S=!1,Q("fault while parsing number;",n)):(d.string+=t,E=!0);else if(C&&(n>=95&&n<=102||n>=65&&n<=70))d.string+=t;else if(120==n||98==n||111==n||88==n||66==n||79==n)C||"0"!=d.string?(S=!1,Q("fault while parsing number;",n)):(C=!0,d.string+=t);else{if(101!=n&&69!=n){if(32==n||160==n||13==n||10==n||9==n||11==n||12==n||8232==n||8233==n||65279==n||44==n||125==n||93==n||58==n)break;o&&(S=!1,Q("fault while parsing number;",n));break}N?(S=!1,Q("fault while parsing number;",n)):(d.string+=t,N=!0)}}w>e&&y.col--,w=e,o||w!=p.length?(L=!1,ee(),d.value_type=5,0==x&&(R=!0)):L=!0}if(!S)return-1;if(e&&e.length)l=function(){let e=s.pop();return e?e.n=0:e={buf:null,n:0},e}(),l.buf=e,G.push(l);else if(L){if(L=!1,ee(),d.value_type=5,0!=x)throw new Error("context stack is not empty at flush");R=!0,v=1}for(;S&&(l=G.shift());){if(w=l.n,p=l.buf,I){if(null===T)throw new Error("Parser string start was unset");re(T)>0&&(I=!1,d.value_type=4)}for(L&&ie();!R&&S&&w<p.length;){let e=p.charAt(w);const o=f(p.codePointAt(w++),"Unexpected end of input while parsing");if(o>=65536&&(e+=p.charAt(w),w++),y.col++,P)V(o),1==P?42==o?P=3:47!=o?Q("fault while parsing;",o):P=2:2==P?10!=o&&13!=o&&8232!=o&&8233!=o||(P=0):3==P?42==o&&(P=4):P=47==o?0:3;else{switch(o){case 47:P=1;break;case 123:(k==t||30==k||3==x&&0==k)&&Q("fault while parsing; getting field name unexpected ",o),Z(o);{const e=u();d.value_type=6;const t={};0==x&&(j=m=t),e.context=x,e.elements=m,e.element_array=_,e.name=d.name,m=t,B.push(e),Y(),x=3}break;case 91:if(3!=x&&k!=t&&30!=k||Q("Fault while parsing; while getting field name unexpected",o),0==d.value_type||-1==d.value_type){const e=u();d.value_type=7;const t=[];0==x?j=_=t:4==x&&(m[d.name]=t),e.context=x,e.elements=m,e.element_array=_,e.name=d.name,_=t,B.push(e),Y(),x=1}else Q("Unexpected array open after previous value",o);break;case 58:if(3==x){if(k=0,g&&4!==d.value_type&&!r.test(d.string)&&Number.isNaN(Number(d.string.replace(i,"$1")))&&Q("Unquoted keys must be valid identifiers when the 'esStrictCompatible' option is set",o),b&&4!==d.value_type&&""!==d.string){const e=Number(d.string.replace(i,"$1"));Number.isNaN(e)||(d.string=String(e))}d.name=d.string,d.string="",x=4,d.value_type=0}else Q(1==x?"(in array, got colon out of string):parsing fault;":"(outside any object, got colon out of string):parsing fault;",o);break;case 125:if(k==n&&(k=0),H(o),3==x){k!=t&&30!=k&&4!=d.value_type||Q("Object field name with no value",o),d.value_type=6,d.contains=m;const e=B.pop();d.name=e.name,x=e.context,m=e.elements,_=e.element_array,a(e),0==x&&(R=!0)}else if(4==x){0!=d.value_type?ne():Q("Fault while parsing field value, close with no value",o),d.value_type=6,d.contains=m;const e=B.pop();d.name=e.name,x=e.context,m=e.elements,_=e.element_array,a(e),0==x&&(R=!0)}else Q("Fault while parsing; unexpected",o);O=!1,M=!1;break;case 93:if(k==n&&(k=0),H(o),1==x){0!=d.value_type&&te(),d.value_type=7,d.contains=_;{const e=B.pop();d.name=e.name,x=e.context,m=e.elements,_=e.element_array,a(e)}0==x&&(R=!0)}else Q(`bad context ${x}; fault while parsing`,o);O=!1,M=!1;break;case 44:k==n&&(k=0),H(o),1==x?(0==d.value_type&&(d.value_type=13),te(),Y()):4==x?(x=3,0!=d.value_type?(ne(),Y()):Q("Unexpected comma after object field name",o)):(S=!1,Q("bad context; excessive commas while parsing;",o)),O=!1,M=!1;break;default:if(3==x)switch(o){case 96:g&&Q("Backtick-quoted keys are not allowed when the 'esStrictCompatible' option is set",o);case 34:case 39:if(0==k){0!=d.value_type&&Q("String begin after previous value",o);re(o)?d.value_type=4:(T=o,I=!0)}else Q("fault while parsing; quote not at start of field name",o);break;case 10:case 13:case 32:case 160:case 9:case 11:case 12:case 8232:case 8233:case 65279:V(o),k==n?k=0:k==t&&(k=30);break;default:30==k&&(S=!1,Q("fault while parsing; character unexpected",o)),0==k&&(k=t),d.string+=e}else switch(o){case 96:case 34:case 39:if(0===d.value_type){re(o)?(d.value_type=4,k=n):(T=o,I=!0)}else Q("String unexpected",o);break;case 10:case 32:case 160:case 9:case 13:case 11:case 12:case 8232:case 8233:case 65279:if(V(o),k==n){k=0,M=!1,0==x&&(R=!0);break}0!==k&&(S=!1,Q("fault parsing whitespace",o));break;case 116:0==k?(Z(o),k=1):27==k?k=28:(S=!1,Q("fault parsing",o));break;case 114:1==k?k=2:(S=!1,Q("fault parsing",o));break;case 117:2==k?k=3:9==k?k=10:0==k?(Z(o),k=12):(S=!1,Q("fault parsing",o));break;case 101:3==k?(d.value_type=2,k=n):8==k?(d.value_type=3,k=n):14==k?k=15:18==k?k=19:(S=!1,Q("fault parsing",o));break;case 110:0==k?(Z(o),k=9):12==k?k=13:17==k?k=18:22==k?k=23:25==k?k=26:(S=!1,Q("fault parsing",o));break;case 100:13==k?k=14:19==k?(d.value_type=-1,k=n):(S=!1,Q("fault parsing",o));break;case 105:16==k?k=17:24==k?k=25:26==k?k=27:(S=!1,Q("fault parsing",o));break;case 108:10==k?k=11:11==k?(d.value_type=1,k=n):6==k?k=7:(S=!1,Q("fault parsing",o));break;case 102:0==k?(Z(o),k=5):15==k?k=16:23==k?k=24:(S=!1,Q("fault parsing",o));break;case 97:5==k?k=6:20==k?k=21:(S=!1,Q("fault parsing",o));break;case 115:7==k?k=8:(S=!1,Q("fault parsing",o));break;case 73:0==k?(Z(o),k=22):(S=!1,Q("fault parsing",o));break;case 78:0==k?(Z(o),k=20):21==k?(d.value_type=O?8:9,O=!1,k=n):(S=!1,Q("fault parsing",o));break;case 121:28==k?(d.value_type=O?10:11,O=!1,k=n):(S=!1,Q("fault parsing",o));break;case 45:0==k?(Z(o),g&&M&&Q("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",o),M=!0,O=!O):(S=!1,Q("fault parsing",o));break;case 43:0!==k?(S=!1,Q("fault parsing",o)):(Z(o),g&&M&&Q("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",o),M=!0);break;default:o>=48&&o<=57||43==o||46==o||45==o?(Z(o),C=!1,N=!1,A=!1,$=!1,E=!1,M=!1,d.string=e,l.n=w,ie()):(S=!1,Q("fault parsing",o))}}if(R){k==n&&(k=0);break}}}if(w==p.length?(c(l),o&&H(),I||L||3==x?v=0:0!=x||0==d.value_type&&!j||(R=!0,v=1)):(l.n=w,G.unshift(l),v=2),R)break}if(R&&0!=d.value_type){switch(d.value_type){case 5:j=(O?-1:1)*Number(d.string);break;case 4:j=d.string;break;case 2:j=!0;break;case 3:j=!1;break;case 1:j=null;break;case-1:j=void 0;break;case 9:case 8:j=NaN;break;case 11:j=1/0;break;case 10:j=-1/0;break;case 6:case 7:j=d.contains}O=!1,d.string="",d.value_type=0}return R=!1,v}}};const p=[Object.freeze(l.begin())];let g=0;l.parse=function(e,t,n){const r=g++;p.length<=r&&p.push(Object.freeze(l.begin()));const i=p[r];"string"!=typeof e&&(e=String(e)),i.reset(n);try{if(i._write(e,!0)<=0)throw i.finalError(),new Error("No value found in document");const n=i.value();return"function"==typeof t&&function e(n,r){const i=n[r];if(i&&"object"==typeof i){const t=i;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const r=e(t,n);void 0!==r?t[n]=r:delete t[n]}}return t.call(n,r,i)}({"":n},""),n}finally{g--}},l.stringifierActive=null,l.stringifier=function(){const e={true:!0,false:!1,null:null,NaN:NaN,Infinity:1/0,undefined:void 0};let t='"',n=!1,r=!0;return{stringify(e,o,u,a){return function(e,o,u,a,s){if(void 0===o)return"undefined";if(null===o)return"null";let c="",f="";const p=l.stringifierActive;l.stringifierActive=e,s||(s="");if("number"==typeof a)for(let e=0;e<a;e+=1)f+=" ";else"string"==typeof a&&(f=a);const g=u;if(u&&"function"!=typeof u&&("object"!=typeof u||"number"!=typeof u.length))throw new Error("JSON6.stringify unknown replacer type.");const h=v(s,{[s]:o});return l.stringifierActive=p,h;function v(e,o){const u=c;let a=o[e];switch("string"==typeof a&&(a=t+l.escape(a)+t),null!=a&&"object"==typeof a&&"function"==typeof toJSOX&&(c+=f,c=u),"function"==typeof g&&(a=g.call(o,e,a)),typeof a){case"string":return a;case"number":return""+a;case"boolean":return String(a);case"object":{if(!a)return"null";if(Array.isArray(a)){const e=a,t=e;c+=f;const n=[];for(let r=0;r<e.length;r++){if(!(r in e)){n.push("");continue}const i=v(String(r),t);n.push(void 0===i?"undefined":i)}const r=e.length>0&&!(e.length-1 in e),i=0===n.length?"[]":c?"[\n"+c+n.join(",\n"+c)+(r?",":"")+"\n"+u+"]":"["+n.join(",")+(r?",":"")+"]";return c=u,i}const e=a;c+=f;const t=[];if(g&&"object"==typeof g){const n=g.length;for(let r=0;r<n;r+=1)if("string"==typeof g[r]){const n=g[r],o=v(n,e);o&&t.push(i(n)+(c?": ":":")+o)}}else{const o=[];for(const t in e)if((!n||Object.prototype.propertyIsEnumerable.call(e,t))&&Object.prototype.hasOwnProperty.call(e,t))if(r){let e;for(e=0;e<o.length;e++)if(o[e]>t){o.splice(e,0,t);break}e===o.length&&o.push(t)}else o.push(t);for(let n=0;n<o.length;n++){const r=o[n];if(Object.prototype.hasOwnProperty.call(e,r)){const n=v(r,e);n&&t.push(i(r)+(c?": ":":")+n)}}}const o=0===t.length?"{}":c?"{\n"+c+t.join(",\n"+c)+"\n"+u+"}":"{"+t.join(",")+"}";return c=u,o}}}}(this,e,o,u,a)},setQuote(e){t=e},get ignoreNonEnumerable(){return n},set ignoreNonEnumerable(e){n=e},get sortKeys(){return r},set sortKeys(e){r=e}};function i(n){return n.length?n in e||/([0-9-])/.test(n[0])||/((\n|\r|\t)|[ #{}()<>!+\-*/.:,])/.test(n)?t+l.escape(n)+t:n:t+t}},l.stringify=function(e,t,n,r){const i=l.stringifier();return r&&!1===r.sortKeys&&(i.sortKeys=!1),i.stringify(e,t,n)},l.version="1.1.5",e&&e.exports&&(e.exports=l)}(dr)),dr.exports}return t(function(){if(br)return vr;br=1,zn||(zn=1,Gn()),lr();const e=hr?gr:(hr=1,gr=yr());return vr=e}())});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).JSON5=t()}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r,i={};function o(){if(r)return n;r=1;var t=function(e){return e&&e.Math===Math&&e};return n=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||t("object"==typeof n&&n)||function(){return this}()||Function("return this")()}var u,a,s,c,f,l,p,g,h={};function v(){return a?u:(a=1,u=function(e){try{return!!e()}catch(e){return!0}})}function b(){if(c)return s;c=1;var e=v();return s=!e(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function d(){if(l)return f;l=1;var e=v();return f=!e(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})}function y(){if(g)return p;g=1;var e=d(),t=Function.prototype.call;return p=e?t.bind(t):function(){return t.apply(t,arguments)},p}var m,w,k,S,O,j,_,x,P,C,E,N,A,$,T,I,L,M,z,F,U,q,D,W,K,R,J,B,G,X,Q,V,Y,H,Z,ee,te,ne,re,ie,oe,ue={};function ae(){return k?w:(k=1,w=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function se(){if(O)return S;O=1;var e=d(),t=Function.prototype,n=t.call,r=e&&t.bind.bind(n,n);return S=e?r:function(e){return function(){return n.apply(e,arguments)}},S}function ce(){if(_)return j;_=1;var e=se(),t=e({}.toString),n=e("".slice);return j=function(e){return n(t(e),8,-1)}}function fe(){return E?C:(E=1,C=function(e){return null==e})}function le(){if(A)return N;A=1;var e=fe(),t=TypeError;return N=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function pe(){if(T)return $;T=1;var e=function(){if(P)return x;P=1;var e=se(),t=v(),n=ce(),r=Object,i=e("".split);return x=t(function(){return!r("z").propertyIsEnumerable(0)})?function(e){return"String"===n(e)?i(e,""):r(e)}:r}(),t=le();return $=function(n){return e(t(n))}}function ge(){if(L)return I;L=1;var e="object"==typeof document&&document.all;return I=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function he(){if(z)return M;z=1;var e=ge();return M=function(t){return"object"==typeof t?null!==t:e(t)}}function ve(){if(U)return F;U=1;var e=o(),t=ge();return F=function(n,r){return arguments.length<2?(i=e[n],t(i)?i:void 0):e[n]&&e[n][r];var i},F}function be(){if(J)return R;J=1;var e,t,n=o(),r=function(){if(K)return W;K=1;var e=o().navigator,t=e&&e.userAgent;return W=t?String(t):""}(),i=n.process,u=n.Deno,a=i&&i.versions||u&&u.version,s=a&&a.v8;return s&&(t=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&r&&(!(e=r.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=r.match(/Chrome\/(\d+)/))&&(t=+e[1]),R=t}function de(){if(G)return B;G=1;var e=be(),t=v(),n=o().String;return B=!!Object.getOwnPropertySymbols&&!t(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41})}function ye(){if(Q)return X;Q=1;var e=de();return X=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function me(){if(Y)return V;Y=1;var e=ve(),t=ge(),n=function(){if(D)return q;D=1;var e=se();return q=e({}.isPrototypeOf)}(),r=ye(),i=Object;return V=r?function(e){return"symbol"==typeof e}:function(r){var o=e("Symbol");return t(o)&&n(o.prototype,i(r))}}function we(){if(Z)return H;Z=1;var e=String;return H=function(t){try{return e(t)}catch(e){return"Object"}}}function ke(){if(te)return ee;te=1;var e=ge(),t=we(),n=TypeError;return ee=function(r){if(e(r))return r;throw new n(t(r)+" is not a function")}}function Se(){if(re)return ne;re=1;var e=ke(),t=fe();return ne=function(n,r){var i=n[r];return t(i)?void 0:e(i)}}function Oe(){if(oe)return ie;oe=1;var e=y(),t=ge(),n=he(),r=TypeError;return ie=function(i,o){var u,a;if("string"===o&&t(u=i.toString)&&!n(a=e(u,i)))return a;if(t(u=i.valueOf)&&!n(a=e(u,i)))return a;if("string"!==o&&t(u=i.toString)&&!n(a=e(u,i)))return a;throw new r("Can't convert object to primitive value")}}var je,_e,xe,Pe,Ce,Ee,Ne,Ae,$e,Te,Ie,Le,Me,ze,Fe,Ue,qe,De,We,Ke,Re,Je,Be,Ge,Xe={exports:{}};function Qe(){if(Pe)return xe;Pe=1;var e=o(),t=Object.defineProperty;return xe=function(n,r){try{t(e,n,{value:r,configurable:!0,writable:!0})}catch(t){e[n]=r}return r}}function Ve(){if(Ce)return Xe.exports;Ce=1;var e=_e?je:(_e=1,je=!1),t=o(),n=Qe(),r="__core-js_shared__",i=Xe.exports=t[r]||n(r,{});return(i.versions||(i.versions=[])).push({version:"3.50.0",mode:e?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"}),Xe.exports}function Ye(){if(Ne)return Ee;Ne=1;var e=Ve(),t=Object.create||Object;return Ee=function(n,r){return e[n]||(e[n]=r||t(null))}}function He(){if($e)return Ae;$e=1;var e=le(),t=Object;return Ae=function(n){return t(e(n))}}function Ze(){if(Ie)return Te;Ie=1;var e=se(),t=He(),n=e({}.hasOwnProperty);return Te=Object.hasOwn||function(e,r){return n(t(e),r)}}function et(){if(Me)return Le;Me=1;var e=se(),t=0,n=Math.random(),r=e(1.1.toString);return Le=function(e){return"Symbol("+(void 0===e?"":e)+")_"+r(++t+n,36)}}function tt(){if(Fe)return ze;Fe=1;var e=o(),t=Ye(),n=Ze(),r=et(),i=de(),u=ye(),a=e.Symbol,s=t("wks"),c=u?a.for||a:a&&a.withoutSetter||r;return ze=function(e){return n(s,e)||(s[e]=i&&n(a,e)?a[e]:c("Symbol."+e)),s[e]}}function nt(){if(qe)return Ue;qe=1;var e=y(),t=he(),n=me(),r=Se(),i=Oe(),o=tt(),u=TypeError,a=o("toPrimitive");return Ue=function(o,s){if(!t(o)||n(o))return o;var c,f=r(o,a);if(f){if(void 0===s&&(s="default"),c=e(f,o,s),!t(c)||n(c))return c;throw new u("Can't convert object to primitive value")}return void 0===s&&(s="number"),i(o,s)}}function rt(){if(We)return De;We=1;var e=nt(),t=me();return De=function(n){var r=e(n,"string");return t(r)?r:r+""}}function it(){if(Be)return Je;Be=1;var e=b(),t=v(),n=function(){if(Re)return Ke;Re=1;var e=o(),t=he(),n=e.document,r=t(n)&&t(n.createElement);return Ke=function(e){return r?n.createElement(e):{}}}();return Je=!e&&!t(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})}function ot(){if(Ge)return h;Ge=1;var e=b(),t=y(),n=function(){if(m)return ue;m=1;var e={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,n=t&&!e.call({1:2},1);return ue.f=n?function(e){var n=t(this,e);return!!n&&n.enumerable}:e,ue}(),r=ae(),i=pe(),o=rt(),u=Ze(),a=it(),s=Object.getOwnPropertyDescriptor;return h.f=e?s:function(e,c){if(e=i(e),c=o(c),a)try{return s(e,c)}catch(e){}if(u(e,c))return r(!t(n.f,e,c),e[c])},h}var ut,at,st,ct,ft,lt,pt,gt={};function ht(){if(ct)return st;ct=1;var e=he(),t=String,n=TypeError;return st=function(r){if(e(r))return r;throw new n(t(r)+" is not an object")}}function vt(){if(ft)return gt;ft=1;var e=b(),t=it(),n=function(){if(at)return ut;at=1;var e=b(),t=v();return ut=e&&t(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}(),r=ht(),i=rt(),o=TypeError,u=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s="enumerable",c="configurable",f="writable";return gt.f=e?n?function(e,t,n){if(r(e),t=i(t),r(n),"function"==typeof e&&"prototype"===t&&"value"in n&&f in n&&!n[f]){var o=a(e,t);o&&o[f]&&(e[t]=n.value,n={configurable:c in n?n[c]:o[c],enumerable:s in n?n[s]:o[s],writable:!1})}return u(e,t,n)}:u:function(e,n,a){if(r(e),n=i(n),r(a),t)try{return u(e,n,a)}catch(e){}if("get"in a||"set"in a)throw new o("Accessors not supported");return"value"in a&&(e[n]=a.value),e},gt}function bt(){if(pt)return lt;pt=1;var e=b(),t=vt(),n=ae();return lt=e?function(e,r,i){return t.f(e,r,n(1,i))}:function(e,t,n){return e[t]=n,e}}var dt,yt,mt,wt,kt,St,Ot,jt,_t,xt,Pt,Ct,Et,Nt,At,$t={exports:{}};function Tt(){if(wt)return mt;wt=1;var e=se(),t=ge(),n=Ve(),r=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return r(e)}),mt=n.inspectSource}function It(){if(jt)return Ot;jt=1;var e=Ye(),t=et(),n=e("keys");return Ot=function(e){return n[e]||(n[e]=t(e))}}function Lt(){return xt?_t:(xt=1,_t={})}function Mt(){if(Ct)return Pt;Ct=1;var e,t,n,r=function(){if(St)return kt;St=1;var e=o(),t=ge(),n=e.WeakMap;return kt=t(n)&&/native code/.test(String(n))}(),i=o(),u=he(),a=bt(),s=Ze(),c=Ve(),f=It(),l=Lt(),p="Object already initialized",g=i.TypeError,h=i.WeakMap;if(r||c.state){var v=c.state||(c.state=new h);v.get=v.get,v.has=v.has,v.set=v.set,e=function(e,t){if(v.has(e))throw new g(p);return t.facade=e,v.set(e,t),t},t=function(e){return v.get(e)||{}},n=function(e){return v.has(e)}}else{var b=f("state");l[b]=!0,e=function(e,t){if(s(e,b))throw new g(p);return t.facade=e,a(e,b,t),t},t=function(e){return s(e,b)?e[b]:{}},n=function(e){return s(e,b)}}return Pt={set:e,get:t,has:n,enforce:function(r){return n(r)?t(r):e(r,{})},getterFor:function(e){return function(n){var r;if(!u(n)||(r=t(n)).type!==e)throw new g("Incompatible receiver, "+e+" required");return r}}}}function zt(){if(Et)return $t.exports;Et=1;var e=se(),t=v(),n=ge(),r=Ze(),i=b(),o=function(){if(yt)return dt;yt=1;var e=b(),t=Ze(),n=Function.prototype,r=e&&Object.getOwnPropertyDescriptor,i=t(n,"name"),o=i&&"something"===function(){}.name,u=i&&(!e||e&&r(n,"name").configurable);return dt={EXISTS:i,PROPER:o,CONFIGURABLE:u}}().CONFIGURABLE,u=Tt(),a=Mt(),s=a.enforce,c=a.get,f=String,l=Object.defineProperty,p=e("".slice),g=e("".replace),h=e([].join),d=i&&!t(function(){return 8!==l(function(){},"length",{value:8}).length}),y=String(String).split("String"),m=$t.exports=function(e,t,n){"Symbol("===p(f(t),0,7)&&(t="["+g(f(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!r(e,"name")||o&&e.name!==t)&&(i?l(e,"name",{value:t,configurable:!0}):e.name=t),d&&n&&r(n,"arity")&&e.length!==n.arity&&l(e,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?i&&l(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var u=s(e);return r(u,"source")||(u.source=h(y,"string"==typeof t?t:"")),e};return Function.prototype.toString=m(function(){return n(this)&&c(this).source||u(this)},"toString"),$t.exports}function Ft(){if(At)return Nt;At=1;var e=ge(),t=vt(),n=zt(),r=Qe();return Nt=function(i,o,u,a){a||(a={});var s=a.enumerable,c=void 0!==a.name?a.name:o;if(e(u)&&n(u,c,a),a.global)s?i[o]=u:r(o,u);else{try{a.unsafe?i[o]&&(s=!0):delete i[o]}catch(e){}s?i[o]=u:t.f(i,o,{value:u,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return i}}var Ut,qt,Dt,Wt,Kt,Rt,Jt,Bt,Gt,Xt,Qt,Vt,Yt,Ht,Zt,en,tn,nn={};function rn(){if(Wt)return Dt;Wt=1;var e=function(){if(qt)return Ut;qt=1;var e=Math.ceil,t=Math.floor;return Ut=Math.trunc||function(n){var r=+n;return(r>0?t:e)(r)}}();return Dt=function(t){var n=+t;return n!=n||0===n?0:e(n)}}function on(){if(Rt)return Kt;Rt=1;var e=rn(),t=Math.max,n=Math.min;return Kt=function(r,i){var o=e(r);return o<0?t(o+i,0):n(o,i)}}function un(){if(Bt)return Jt;Bt=1;var e=rn(),t=Math.min;return Jt=function(n){var r=e(n);return r>0?t(r,9007199254740991):0}}function an(){if(Xt)return Gt;Xt=1;var e=un();return Gt=function(t){return e(t.length)}}function sn(){if(Ht)return Yt;Ht=1;var e=se(),t=Ze(),n=pe(),r=function(){if(Vt)return Qt;Vt=1;var e=pe(),t=on(),n=an(),r=function(r){return function(i,o,u){var a=e(i),s=n(a);if(0===s)return!r&&-1;var c,f=t(u,s);if(r&&o!=o){for(;s>f;)if((c=a[f++])!=c)return!0}else for(;s>f;f++)if((r||f in a)&&a[f]===o)return r||f||0;return!r&&-1}};return Qt={includes:r(!0),indexOf:r(!1)}}().indexOf,i=Lt(),o=e([].push);return Yt=function(e,u){var a,s=n(e),c=0,f=[];for(a in s)!t(i,a)&&t(s,a)&&o(f,a);for(;u.length>c;)t(s,a=u[c++])&&(~r(f,a)||o(f,a));return f}}var cn,fn,ln,pn,gn,hn,vn,bn,dn,yn,mn,wn,kn,Sn,On,jn,_n,xn,Pn,Cn,En,Nn,An,$n,Tn,In,Ln,Mn,zn,Fn={};function Un(){if(ln)return fn;ln=1;var e=ve(),t=se(),n=function(){if(tn)return nn;tn=1;var e=sn(),t=(en?Zt:(en=1,Zt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])).concat("length","prototype");return nn.f=Object.getOwnPropertyNames||function(n){return e(n,t)},nn}(),r=(cn||(cn=1,Fn.f=Object.getOwnPropertySymbols),Fn),i=ht(),o=t([].concat);return fn=e("Reflect","ownKeys")||function(e){var t=n.f(i(e)),u=r.f;return u?o(t,u(e)):t}}function qn(){if(gn)return pn;gn=1;var e=Ze(),t=Un(),n=ot(),r=vt();return pn=function(i,o,u){for(var a=t(o),s=r.f,c=n.f,f=0;f<a.length;f++){var l=a[f];e(i,l)||u&&e(u,l)||s(i,l,c(o,l))}}}function Dn(){if(dn)return bn;dn=1;var e=o(),t=ot().f,n=bt(),r=Ft(),i=Qe(),u=qn(),a=function(){if(vn)return hn;vn=1;var e=v(),t=ge(),n=/#|\.prototype\./,r=function(n,r){var s=o[i(n)];return s===a||s!==u&&(t(r)?e(r):!!r)},i=r.normalize=function(e){return String(e).replace(n,".").toLowerCase()},o=r.data={},u=r.NATIVE="N",a=r.POLYFILL="P";return hn=r}();return bn=function(o,s){var c,f,l,p,g,h=o.target,v=o.global,b=o.stat;if(c=v?e:b?e[h]||i(h,{}):e[h]&&e[h].prototype)for(f in s){if(p=s[f],l=o.dontCallGetSet?(g=t(c,f))&&g.value:c[f],!a(v?f:h+(b?".":"#")+f,o.forced)&&void 0!==l){if(typeof p==typeof l)continue;u(p,l)}(o.sham||l&&l.sham)&&n(p,"sham",!0),r(c,f,p,o)}}}function Wn(){if(kn)return wn;kn=1;var e=function(){if(mn)return yn;mn=1;var e={};return e[tt()("toStringTag")]="z",yn="[object z]"===String(e)}(),t=ge(),n=ce(),r=tt()("toStringTag"),i=Object,o="Arguments"===n(function(){return arguments}());return wn=e?n:function(e){var u,a,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(a=function(e,t){try{return e[t]}catch(e){}}(u=i(e),r))?a:o?n(u):"Object"===(s=n(u))&&t(u.callee)?"Arguments":s}}function Kn(){if(On)return Sn;On=1;var e=Wn(),t=String;return Sn=function(n){if("Symbol"===e(n))throw new TypeError("Cannot convert a Symbol value to a string");return t(n)}}function Rn(){if(xn)return i;xn=1;var e=Dn(),t=function(){if(_n)return jn;_n=1;var e=se(),t=rn(),n=Kn(),r=le(),i=e("".charAt),o=e("".charCodeAt),u=e("".slice),a=function(e){return function(a,s){var c,f,l=n(r(a)),p=t(s),g=l.length;return p<0||p>=g?e?"":void 0:(c=o(l,p))<55296||c>56319||p+1===g||(f=o(l,p+1))<56320||f>57343?e?i(l,p):c:e?u(l,p,p+2):f-56320+(c-55296<<10)+65536}};return jn={codeAt:a(!1),charAt:a(!0)}}().codeAt;return e({target:"String",proto:!0},{codePointAt:function(e){return t(this,e)}}),i}function Jn(){if(Cn)return Pn;Cn=1;var e=o(),t=se();return Pn=function(n,r){return t(e[n].prototype[r])}}function Bn(){if($n)return An;$n=1;var e=function(){if(Nn)return En;Nn=1,Rn();var e=Jn();return En=e("String","codePointAt")}();return An=e}function Gn(){if(Mn)return Ln;Mn=1;var e=function(){if(In)return Tn;In=1;var e=Bn();return Tn=e}();return Ln=e}var Xn,Qn,Vn,Yn,Hn,Zn,er,tr,nr,rr,ir,or,ur,ar={};function sr(){if(Vn)return Qn;Vn=1;var e=o();return Qn=e}function cr(){if(Hn)return Yn;Hn=1,function(){if(Xn)return ar;Xn=1;var e=Dn(),t=se(),n=on(),r=RangeError,i=String.fromCharCode,o=String.fromCodePoint,u=t([].join);e({target:"String",stat:!0,arity:1,forced:!!o&&1!==o.length},{fromCodePoint:function(e){for(var t,o=[],a=arguments.length,s=0;a>s;){if(n(t=+arguments[s],1114111)!==t)throw new r(t+" is not a valid code point");o[s++]=t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320)}return u(o,"")}})}();var e=sr();return Yn=e.String.fromCodePoint}function fr(){if(nr)return tr;nr=1;var e=function(){if(er)return Zn;er=1;var e=cr();return Zn=e}();return tr=e}function lr(){return ur?or:(ur=1,or=function(){if(ir)return rr;ir=1;var e=fr();return rr=e}())}var pr,gr,hr,vr,br,dr={exports:{}};function yr(){return pr||(pr=1,function(e){const t=29,n=31,r=/^[$_\p{ID_Start}][$_\p{ID_Continue}]*$/u,i=/(\d)_(?=\d)/g,o=[];function u(){return o.pop()||{context:0,elements:null,element_array:null,name:null}}function a(e){o.push(e)}const s=[];function c(e){s.push(e)}function f(e,t){if(void 0===e)throw new Error(t||"Unexpected undefined value");return e}const l={escape:function(e){let t="";if(!e)return e;for(let n=0;n<e.length;n++){const r=e[n];'"'!=r&&"\\"!=r&&"`"!=r&&"'"!=r||(t+="\\"),t+=r}return t}};l.begin=function(e,o,l){const p=l;let g=!(!p||!p.esStrictCompatible),h=!(!p||!p.forbidTemplateSubstitution),v=!(!p||!p.warnWithCommentWithoutEOL),b=!(!p||!p.normalizeNumericKeys);const d={name:null,value_type:0,string:"",contains:null},y={line:1,col:0};let m,w=0,k=0,S=!0,O=!1,j=null,_=[],x=0,P=0,C=!1,E=!1,N=!1,A=!1,$=!1,T=null,I=!1,L=!1,M=!1,z=!1,F=!1,U=!1,q=!1,D=!1,W=0,K=0,R=!1,J=!1;const B={first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last||(this.first=t),this.last=t},pop(){const e=this.last;if(!e)throw new Error("context stack underflow");return(this.last=e.prior)||(this.first=null),e.next=this.saved,this.saved=e,e.node}},G={save:void 0,first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last?this.last.next=t:this.first=t,this.last=t},shift(){const e=this.first;return e?(this.first=e.next,this.first||(this.last=null),e.next=this.saved,this.saved=e,e.node):null},unshift(e){const t=this.saved;this.saved=t.next,t.node=e,t.next=this.first,t.prior=null,this.first||(this.last=t),this.first=t}};function X(e){throw new Error(`${e} at ${w} [${y.line}:${y.col}]`)}return{finalError(){if(0!==P)switch(P){case 1:return X("Comment began at end of document");case 2:v&&console.log("Warning: '//' comment without end of line ended document");break;case 3:return X("Open comment '/*' is missing close at end of document");case 4:return X("Incomplete '/* *' close at end of document")}I&&X("Incomplete string")},value(){this.finalError();const e=j;return j=void 0,e},reset(e){const t=void 0===e?p:e;g=!(!t||!t.esStrictCompatible),h=!(!t||!t.forbidTemplateSubstitution),v=!(!t||!t.warnWithCommentWithoutEOL),b=!(!t||!t.normalizeNumericKeys),k=0,S=!0,G.last&&(G.last.next=G.save),G.save=G.first,G.first=G.last=null,B.last&&(B.last.next=B.saved),B.saved=G.first,B.first=B.last=null,_=null,m=void 0,x=0,d.value_type=0,d.name=null,d.string="",y.line=1,y.col=0,O=!1,M=!1,P=0,R=!1,M=!1,J=!1,T=null,I=!1,z=!1,F=!1,U=!1,q=!1,D=!1,W=0,K=0},write(t){let n;if(!e)throw new Error("Callback function must be passed to begin, or you can't get values from the stream.");if(void 0!==t&&"string"!=typeof t&&(t=String(t)),!S)throw new Error("Parser is in an error state, please reset.");for(n=this._write(t,!1);n>0&&(this.finalError(),"function"==typeof o&&function e(t,n){const r=t[n];if(r&&"object"==typeof r){const t=r;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const r=e(t,n);void 0!==r?t[n]=r:delete t[n]}}return o.call(t,n,r)}({"":j},""),e(j),j=void 0,!(n<2));n=this._write());n&&this.finalError()},_write(e,o){let l,p="",v=0;function Q(e,t){throw new Error(`${e} '${String.fromCodePoint(t)}' unexpected at ${w} (near '${p.substr(w>4?w-4:0,w>4?3:w-1)}[${String.fromCodePoint(t)}]${p.substr(w,10)}') [${y.line}:${y.col}]`)}function V(e){if(13===e){if(w<p.length&&10===p.charCodeAt(w))return}else if(10!==e&&8232!==e&&8233!==e)return;y.line++,y.col=0}function Y(){d.value_type=0,d.string="",M=!1}function H(e){k>0&&k<t&&(void 0===e?X("Incomplete keyword"):Q("Incomplete keyword",e)),M&&0==d.value_type&&(void 0===e?X("Sign with no number following"):Q("Sign with no number following",e))}function Z(e){0!=d.value_type&&Q("Two values with no separator between them",e)}function ee(){if(Number.isNaN(Number(d.string)))throw S=!1,new Error(`Invalid number '${d.string}' at ${w} [${y.line}:${y.col}]`)}function te(){const e=_;switch(d.value_type){case 5:e.push((O?-1:1)*Number(d.string));break;case 4:e.push(d.string);break;case 2:e.push(!0);break;case 3:e.push(!1);break;case 8:case 9:e.push(NaN);break;case 10:e.push(-1/0);break;case 11:e.push(1/0);break;case 1:e.push(null);break;case-1:e.push(void 0);break;case 13:e.push(void 0),delete e[e.length-1];break;case 6:case 7:e.push(d.contains)}}function ne(){const e=m,t=d.name;switch(d.value_type){case 5:e[t]=(O?-1:1)*Number(d.string);break;case 4:e[t]=d.string;break;case 2:e[t]=!0;break;case 3:e[t]=!1;break;case 8:case 9:e[t]=NaN;break;case 10:e[t]=-1/0;break;case 11:e[t]=1/0;break;case 1:e[t]=null;break;case-1:e[t]=void 0;break;case 6:case 7:e[t]=d.contains}}function re(e){let t=0;const n=g&&96!==e,r=96===e&&h;for(;0==t&&w<p.length;){let i=p.charAt(w);const o=f(p.codePointAt(w++),"Unexpected end of string");if(o>=65536&&(i+=p.charAt(w),w++),y.col++,o==e)z?(D?Q("Incomplete hexidecimal sequence",o):U?Q("Incomplete long unicode sequence",o):q&&Q("Incomplete unicode sequence",o),F?(F=!1,t=1):d.string+=i,z=!1):t=1;else if(z){if(U){if(125==o){d.string+=String.fromCodePoint(W),U=!1,q=!1,z=!1;continue}W*=16,o>=48&&o<=57?W+=o-48:o>=65&&o<=70?W+=o-65+10:o>=97&&o<=102?W+=o-97+10:Q("(escaped character, parsing hex of \\u)",o);continue}if(D||q){if(0===K&&123===o){U=!0;continue}W*=16,o>=48&&o<=57?W+=o-48:o>=65&&o<=70?W+=o-65+10:o>=97&&o<=102?W+=o-97+10:Q(q?"(escaped character, parsing hex of \\u)":"(escaped character, parsing hex of \\x)",o),K++,q?4==K&&(d.string+=String.fromCodePoint(W),q=!1,z=!1):2==K&&(d.string+=String.fromCodePoint(W),D=!1,z=!1);continue}switch(o){case 13:F=!0,V(o);continue;case 8232:case 8233:case 10:F=!1,V(o);break;case 116:d.string+="\t";break;case 98:d.string+="\b";break;case 48:g&&p.charCodeAt(w)>=48&&p.charCodeAt(w)<=57&&Q("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",p.charCodeAt(w)),d.string+="\0";break;case 110:d.string+="\n";break;case 114:d.string+="\r";break;case 102:d.string+="\f";break;case 118:d.string+="\v";break;case 120:D=!0,K=0,W=0;continue;case 117:q=!0,K=0,W=0;continue;default:g&&o>=49&&o<=57&&Q("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",o),d.string+=i}z=!1}else 92===o?(z=!0,J=!1):(!n||10!==o&&13!==o||Q("Literal line terminators inside single- or double-quoted strings require the 'esStrictCompatible' option to be off",o),r&&(J&&123===o&&Q("Template substitution ${ } is not allowed when the 'forbidTemplateSubstitution' option is set",o),J=36===o),F=!1,V(o),d.string+=i)}return t}function ie(){let e;for(;(e=w)<p.length;){const t=p.charAt(e),n=f(p.codePointAt(w++),"Unexpected end of number");if(n>=65536&&Q("fault while parsing number;",n),y.col++,95!=n)if(n>=48&&n<=57)g&&"0"===d.string&&Q("Legacy octal / leading-zero numbers are not allowed when the 'esStrictCompatible' option is set",n),N&&($=!0),d.string+=t;else if(45==n||43==n)0==d.string.length||N&&!A&&!$?(d.string+=t,A=!0):(S=!1,Q("fault while parsing number;",n));else if(46==n)E||C||N?(S=!1,Q("fault while parsing number;",n)):(d.string+=t,E=!0);else if(C&&(n>=95&&n<=102||n>=65&&n<=70))d.string+=t;else if(120==n||98==n||111==n||88==n||66==n||79==n)C||"0"!=d.string?(S=!1,Q("fault while parsing number;",n)):(C=!0,d.string+=t);else{if(101!=n&&69!=n){if(32==n||160==n||13==n||10==n||9==n||11==n||12==n||8232==n||8233==n||65279==n||44==n||125==n||93==n||58==n)break;o&&(S=!1,Q("fault while parsing number;",n));break}N?(S=!1,Q("fault while parsing number;",n)):(d.string+=t,N=!0)}}w>e&&y.col--,w=e,o||w!=p.length?(L=!1,ee(),d.value_type=5,0==x&&(R=!0)):L=!0}if(!S)return-1;if(e&&e.length)l=function(){let e=s.pop();return e?e.n=0:e={buf:null,n:0},e}(),l.buf=e,G.push(l);else if(L){if(L=!1,ee(),d.value_type=5,0!=x)throw new Error("context stack is not empty at flush");R=!0,v=1}for(;S&&(l=G.shift());){if(w=l.n,p=l.buf,I){if(null===T)throw new Error("Parser string start was unset");re(T)>0&&(I=!1,d.value_type=4)}for(L&&ie();!R&&S&&w<p.length;){let e=p.charAt(w);const o=f(p.codePointAt(w++),"Unexpected end of input while parsing");if(o>=65536&&(e+=p.charAt(w),w++),y.col++,P)V(o),1==P?42==o?P=3:47!=o?Q("fault while parsing;",o):P=2:2==P?10!=o&&13!=o&&8232!=o&&8233!=o||(P=0):3==P?42==o&&(P=4):P=47==o?0:3;else{switch(o){case 47:P=1;break;case 123:(k==t||30==k||3==x&&0==k)&&Q("fault while parsing; getting field name unexpected ",o),Z(o);{const e=u();d.value_type=6;const t={};0==x&&(j=m=t),e.context=x,e.elements=m,e.element_array=_,e.name=d.name,m=t,B.push(e),Y(),x=3}break;case 91:if(3!=x&&k!=t&&30!=k||Q("Fault while parsing; while getting field name unexpected",o),0==d.value_type||-1==d.value_type){const e=u();d.value_type=7;const t=[];0==x?j=_=t:4==x&&(m[d.name]=t),e.context=x,e.elements=m,e.element_array=_,e.name=d.name,_=t,B.push(e),Y(),x=1}else Q("Unexpected array open after previous value",o);break;case 58:if(3==x){if(k=0,g&&4!==d.value_type&&!r.test(d.string)&&Number.isNaN(Number(d.string.replace(i,"$1")))&&Q("Unquoted keys must be valid identifiers when the 'esStrictCompatible' option is set",o),b&&4!==d.value_type&&""!==d.string){const e=Number(d.string.replace(i,"$1"));Number.isNaN(e)||(d.string=String(e))}d.name=d.string,d.string="",x=4,d.value_type=0}else Q(1==x?"(in array, got colon out of string):parsing fault;":"(outside any object, got colon out of string):parsing fault;",o);break;case 125:if(k==n&&(k=0),H(o),3==x){k!=t&&30!=k&&4!=d.value_type||Q("Object field name with no value",o),d.value_type=6,d.contains=m;const e=B.pop();d.name=e.name,x=e.context,m=e.elements,_=e.element_array,a(e),0==x&&(R=!0)}else if(4==x){0!=d.value_type?ne():Q("Fault while parsing field value, close with no value",o),d.value_type=6,d.contains=m;const e=B.pop();d.name=e.name,x=e.context,m=e.elements,_=e.element_array,a(e),0==x&&(R=!0)}else Q("Fault while parsing; unexpected",o);O=!1,M=!1;break;case 93:if(k==n&&(k=0),H(o),1==x){0!=d.value_type&&te(),d.value_type=7,d.contains=_;{const e=B.pop();d.name=e.name,x=e.context,m=e.elements,_=e.element_array,a(e)}0==x&&(R=!0)}else Q(`bad context ${x}; fault while parsing`,o);O=!1,M=!1;break;case 44:k==n&&(k=0),H(o),1==x?(0==d.value_type&&(d.value_type=13),te(),Y()):4==x?(x=3,0!=d.value_type?(ne(),Y()):Q("Unexpected comma after object field name",o)):(S=!1,Q("bad context; excessive commas while parsing;",o)),O=!1,M=!1;break;default:if(3==x)switch(o){case 96:g&&Q("Backtick-quoted keys are not allowed when the 'esStrictCompatible' option is set",o);case 34:case 39:if(0==k){0!=d.value_type&&Q("String begin after previous value",o);re(o)?d.value_type=4:(T=o,I=!0)}else Q("fault while parsing; quote not at start of field name",o);break;case 10:case 13:case 32:case 160:case 9:case 11:case 12:case 8232:case 8233:case 65279:V(o),k==n?k=0:k==t&&(k=30);break;default:30==k&&(S=!1,Q("fault while parsing; character unexpected",o)),0==k&&(k=t),d.string+=e}else switch(o){case 96:case 34:case 39:if(0===d.value_type){re(o)?(d.value_type=4,k=n):(T=o,I=!0)}else Q("String unexpected",o);break;case 10:case 32:case 160:case 9:case 13:case 11:case 12:case 8232:case 8233:case 65279:if(V(o),k==n){k=0,M=!1,0==x&&(R=!0);break}0!==k&&(S=!1,Q("fault parsing whitespace",o));break;case 116:0==k?(Z(o),k=1):27==k?k=28:(S=!1,Q("fault parsing",o));break;case 114:1==k?k=2:(S=!1,Q("fault parsing",o));break;case 117:2==k?k=3:9==k?k=10:0==k?(Z(o),k=12):(S=!1,Q("fault parsing",o));break;case 101:3==k?(d.value_type=2,k=n):8==k?(d.value_type=3,k=n):14==k?k=15:18==k?k=19:(S=!1,Q("fault parsing",o));break;case 110:0==k?(Z(o),k=9):12==k?k=13:17==k?k=18:22==k?k=23:25==k?k=26:(S=!1,Q("fault parsing",o));break;case 100:13==k?k=14:19==k?(d.value_type=-1,k=n):(S=!1,Q("fault parsing",o));break;case 105:16==k?k=17:24==k?k=25:26==k?k=27:(S=!1,Q("fault parsing",o));break;case 108:10==k?k=11:11==k?(d.value_type=1,k=n):6==k?k=7:(S=!1,Q("fault parsing",o));break;case 102:0==k?(Z(o),k=5):15==k?k=16:23==k?k=24:(S=!1,Q("fault parsing",o));break;case 97:5==k?k=6:20==k?k=21:(S=!1,Q("fault parsing",o));break;case 115:7==k?k=8:(S=!1,Q("fault parsing",o));break;case 73:0==k?(Z(o),k=22):(S=!1,Q("fault parsing",o));break;case 78:0==k?(Z(o),k=20):21==k?(d.value_type=O?8:9,O=!1,k=n):(S=!1,Q("fault parsing",o));break;case 121:28==k?(d.value_type=O?10:11,O=!1,k=n):(S=!1,Q("fault parsing",o));break;case 45:0==k?(Z(o),g&&M&&Q("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",o),M=!0,O=!O):(S=!1,Q("fault parsing",o));break;case 43:0!==k?(S=!1,Q("fault parsing",o)):(Z(o),g&&M&&Q("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",o),M=!0);break;default:o>=48&&o<=57||43==o||46==o||45==o?(Z(o),C=!1,N=!1,A=!1,$=!1,E=!1,M=!1,d.string=e,l.n=w,ie()):(S=!1,Q("fault parsing",o))}}if(R){k==n&&(k=0);break}}}if(w==p.length?(c(l),o&&H(),I||L||3==x?v=0:0!=x||0==d.value_type&&!j||(R=!0,v=1)):(l.n=w,G.unshift(l),v=2),R)break}if(R&&0!=d.value_type){switch(d.value_type){case 5:j=(O?-1:1)*Number(d.string);break;case 4:j=d.string;break;case 2:j=!0;break;case 3:j=!1;break;case 1:j=null;break;case-1:j=void 0;break;case 9:case 8:j=NaN;break;case 11:j=1/0;break;case 10:j=-1/0;break;case 6:case 7:j=d.contains}O=!1,d.string="",d.value_type=0}return R=!1,v}}};const p=[Object.freeze(l.begin())];let g=0;l.parse=function(e,t,n){const r=g++;p.length<=r&&p.push(Object.freeze(l.begin()));const i=p[r];"string"!=typeof e&&(e=String(e)),i.reset(n);try{if(i._write(e,!0)<=0)throw i.finalError(),new Error("No value found in document");const n=i.value();return"function"==typeof t&&function e(n,r){const i=n[r];if(i&&"object"==typeof i){const t=i;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const r=e(t,n);void 0!==r?t[n]=r:delete t[n]}}return t.call(n,r,i)}({"":n},""),n}finally{g--}},l.stringifierActive=null,l.stringifier=function(){const e={true:!0,false:!1,null:null,NaN:NaN,Infinity:1/0,undefined:void 0};let t='"',n=!1,r=!0;return{stringify(e,o,u,a){return function(e,o,u,a,s){if(void 0===o)return"undefined";if(null===o)return"null";let c="",f="";const p=l.stringifierActive;l.stringifierActive=e,s||(s="");if("number"==typeof a)for(let e=0;e<a;e+=1)f+=" ";else"string"==typeof a&&(f=a);const g=u;if(u&&"function"!=typeof u&&("object"!=typeof u||"number"!=typeof u.length))throw new Error("JSON6.stringify unknown replacer type.");const h=v(s,{[s]:o});return l.stringifierActive=p,h;function v(e,o){const u=c;let a=o[e];switch("string"==typeof a&&(a=t+l.escape(a)+t),null!=a&&"object"==typeof a&&"function"==typeof toJSOX&&(c+=f,c=u),"function"==typeof g&&(a=g.call(o,e,a)),typeof a){case"string":return a;case"number":return""+a;case"boolean":return String(a);case"object":{if(!a)return"null";if(Array.isArray(a)){const e=a,t=e;c+=f;const n=[];for(let r=0;r<e.length;r++){if(!(r in e)){n.push("");continue}const i=v(String(r),t);n.push(void 0===i?"undefined":i)}const r=e.length>0&&!(e.length-1 in e),i=0===n.length?"[]":c?"[\n"+c+n.join(",\n"+c)+(r?",":"")+"\n"+u+"]":"["+n.join(",")+(r?",":"")+"]";return c=u,i}const e=a;c+=f;const t=[];if(g&&"object"==typeof g){const n=g.length;for(let r=0;r<n;r+=1)if("string"==typeof g[r]){const n=g[r],o=v(n,e);o&&t.push(i(n)+(c?": ":":")+o)}}else{const o=[];for(const t in e)if((!n||Object.prototype.propertyIsEnumerable.call(e,t))&&Object.prototype.hasOwnProperty.call(e,t))if(r){let e;for(e=0;e<o.length;e++)if(o[e]>t){o.splice(e,0,t);break}e===o.length&&o.push(t)}else o.push(t);for(let n=0;n<o.length;n++){const r=o[n];if(Object.prototype.hasOwnProperty.call(e,r)){const n=v(r,e);n&&t.push(i(r)+(c?": ":":")+n)}}}const o=0===t.length?"{}":c?"{\n"+c+t.join(",\n"+c)+"\n"+u+"}":"{"+t.join(",")+"}";return c=u,o}}}}(this,e,o,u,a)},setQuote(e){t=e},get ignoreNonEnumerable(){return n},set ignoreNonEnumerable(e){n=e},get sortKeys(){return r},set sortKeys(e){r=e}};function i(n){return n.length?n in e||/([0-9-])/.test(n[0])||/((\n|\r|\t)|[ #{}()<>!+\-*/.:,])/.test(n)?t+l.escape(n)+t:n:t+t}},l.stringify=function(e,t,n,r){const i=l.stringifier();return r&&!1===r.sortKeys&&(i.sortKeys=!1),i.stringify(e,t,n)},l.version="1.1.6",e&&e.exports&&(e.exports=l)}(dr)),dr.exports}return t(function(){if(br)return vr;br=1,zn||(zn=1,Gn()),lr();const e=hr?gr:(hr=1,gr=yr());return vr=e}())});
|
package/dist/index.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n,s,r={exports:{}};function a(){return t||(t=1,function(e){const t=29,n=31,s=/^[$_\p{ID_Start}][$_\p{ID_Continue}]*$/u,r=/(\d)_(?=\d)/g,a=[];function i(){return a.pop()||{context:0,elements:null,element_array:null,name:null}}function o(e){a.push(e)}const l=[];function c(e){l.push(e)}function u(e,t){if(void 0===e)throw new Error(t||"Unexpected undefined value");return e}const f={escape:function(e){let t="";if(!e)return e;for(let n=0;n<e.length;n++){const s=e[n];'"'!=s&&"\\"!=s&&"`"!=s&&"'"!=s||(t+="\\"),t+=s}return t}};f.begin=function(e,a,f){const p=f;let h=!(!p||!p.esStrictCompatible),g=!(!p||!p.forbidTemplateSubstitution),b=!(!p||!p.warnWithCommentWithoutEOL),d=!(!p||!p.normalizeNumericKeys);const m={name:null,value_type:0,string:"",contains:null},y={line:1,col:0};let v,w=0,k=0,_=!0,x=!1,N=null,S=[],C=0,$=0,j=!1,E=!1,O=!1,A=!1,P=!1,I=null,q=!1,U=!1,K=!1,L=!1,z=!1,T=!1,W=!1,F=!1,M=0,D=0,J=!1,B=!1;const Q={first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last||(this.first=t),this.last=t},pop(){const e=this.last;if(!e)throw new Error("context stack underflow");return(this.last=e.prior)||(this.first=null),e.next=this.saved,this.saved=e,e.node}},X={save:void 0,first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last?this.last.next=t:this.first=t,this.last=t},shift(){const e=this.first;return e?(this.first=e.next,this.first||(this.last=null),e.next=this.saved,this.saved=e,e.node):null},unshift(e){const t=this.saved;this.saved=t.next,t.node=e,t.next=this.first,t.prior=null,this.first||(this.last=t),this.first=t}};function G(e){throw new Error(`${e} at ${w} [${y.line}:${y.col}]`)}return{finalError(){if(0!==$)switch($){case 1:return G("Comment began at end of document");case 2:b&&console.log("Warning: '//' comment without end of line ended document");break;case 3:return G("Open comment '/*' is missing close at end of document");case 4:return G("Incomplete '/* *' close at end of document")}q&&G("Incomplete string")},value(){this.finalError();const e=N;return N=void 0,e},reset(e){const t=void 0===e?p:e;h=!(!t||!t.esStrictCompatible),g=!(!t||!t.forbidTemplateSubstitution),b=!(!t||!t.warnWithCommentWithoutEOL),d=!(!t||!t.normalizeNumericKeys),k=0,_=!0,X.last&&(X.last.next=X.save),X.save=X.first,X.first=X.last=null,Q.last&&(Q.last.next=Q.saved),Q.saved=X.first,Q.first=Q.last=null,S=null,v=void 0,C=0,m.value_type=0,m.name=null,m.string="",y.line=1,y.col=0,x=!1,K=!1,$=0,J=!1,K=!1,B=!1,I=null,q=!1,L=!1,z=!1,T=!1,W=!1,F=!1,M=0,D=0},write(t){let n;if(!e)throw new Error("Callback function must be passed to begin, or you can't get values from the stream.");if(void 0!==t&&"string"!=typeof t&&(t=String(t)),!_)throw new Error("Parser is in an error state, please reset.");for(n=this._write(t,!1);n>0&&(this.finalError(),"function"==typeof a&&function e(t,n){const s=t[n];if(s&&"object"==typeof s){const t=s;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=e(t,n);void 0!==s?t[n]=s:delete t[n]}}return a.call(t,n,s)}({"":N},""),e(N),N=void 0,!(n<2));n=this._write());n&&this.finalError()},_write(e,a){let f,p="",b=0;function H(e,t){throw new Error(`${e} '${String.fromCodePoint(t)}' unexpected at ${w} (near '${p.substr(w>4?w-4:0,w>4?3:w-1)}[${String.fromCodePoint(t)}]${p.substr(w,10)}') [${y.line}:${y.col}]`)}function R(e){if(13===e){if(w<p.length&&10===p.charCodeAt(w))return}else if(10!==e&&8232!==e&&8233!==e)return;y.line++,y.col=0}function V(){m.value_type=0,m.string="",K=!1}function Y(e){k>0&&k<t&&(void 0===e?G("Incomplete keyword"):H("Incomplete keyword",e)),K&&0==m.value_type&&(void 0===e?G("Sign with no number following"):H("Sign with no number following",e))}function Z(e){0!=m.value_type&&H("Two values with no separator between them",e)}function ee(){if(Number.isNaN(Number(m.string)))throw _=!1,new Error(`Invalid number '${m.string}' at ${w} [${y.line}:${y.col}]`)}function te(){const e=S;switch(m.value_type){case 5:e.push((x?-1:1)*Number(m.string));break;case 4:e.push(m.string);break;case 2:e.push(!0);break;case 3:e.push(!1);break;case 8:case 9:e.push(NaN);break;case 10:e.push(-1/0);break;case 11:e.push(1/0);break;case 1:e.push(null);break;case-1:e.push(void 0);break;case 13:e.push(void 0),delete e[e.length-1];break;case 6:case 7:e.push(m.contains)}}function ne(){const e=v,t=m.name;switch(m.value_type){case 5:e[t]=(x?-1:1)*Number(m.string);break;case 4:e[t]=m.string;break;case 2:e[t]=!0;break;case 3:e[t]=!1;break;case 8:case 9:e[t]=NaN;break;case 10:e[t]=-1/0;break;case 11:e[t]=1/0;break;case 1:e[t]=null;break;case-1:e[t]=void 0;break;case 6:case 7:e[t]=m.contains}}function se(e){let t=0;const n=h&&96!==e,s=96===e&&g;for(;0==t&&w<p.length;){let r=p.charAt(w);const a=u(p.codePointAt(w++),"Unexpected end of string");if(a>=65536&&(r+=p.charAt(w),w++),y.col++,a==e)L?(F?H("Incomplete hexidecimal sequence",a):T?H("Incomplete long unicode sequence",a):W&&H("Incomplete unicode sequence",a),z?(z=!1,t=1):m.string+=r,L=!1):t=1;else if(L){if(T){if(125==a){m.string+=String.fromCodePoint(M),T=!1,W=!1,L=!1;continue}M*=16,a>=48&&a<=57?M+=a-48:a>=65&&a<=70?M+=a-65+10:a>=97&&a<=102?M+=a-97+10:H("(escaped character, parsing hex of \\u)",a);continue}if(F||W){if(0===D&&123===a){T=!0;continue}M*=16,a>=48&&a<=57?M+=a-48:a>=65&&a<=70?M+=a-65+10:a>=97&&a<=102?M+=a-97+10:H(W?"(escaped character, parsing hex of \\u)":"(escaped character, parsing hex of \\x)",a),D++,W?4==D&&(m.string+=String.fromCodePoint(M),W=!1,L=!1):2==D&&(m.string+=String.fromCodePoint(M),F=!1,L=!1);continue}switch(a){case 13:z=!0,R(a);continue;case 8232:case 8233:case 10:z=!1,R(a);break;case 116:m.string+="\t";break;case 98:m.string+="\b";break;case 48:h&&p.charCodeAt(w)>=48&&p.charCodeAt(w)<=57&&H("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",p.charCodeAt(w)),m.string+="\0";break;case 110:m.string+="\n";break;case 114:m.string+="\r";break;case 102:m.string+="\f";break;case 118:m.string+="\v";break;case 120:F=!0,D=0,M=0;continue;case 117:W=!0,D=0,M=0;continue;default:h&&a>=49&&a<=57&&H("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",a),m.string+=r}L=!1}else 92===a?(L=!0,B=!1):(!n||10!==a&&13!==a||H("Literal line terminators inside single- or double-quoted strings require the 'esStrictCompatible' option to be off",a),s&&(B&&123===a&&H("Template substitution ${ } is not allowed when the 'forbidTemplateSubstitution' option is set",a),B=36===a),z=!1,R(a),m.string+=r)}return t}function re(){let e;for(;(e=w)<p.length;){const t=p.charAt(e),n=u(p.codePointAt(w++),"Unexpected end of number");if(n>=65536&&H("fault while parsing number;",n),y.col++,95!=n)if(n>=48&&n<=57)h&&"0"===m.string&&H("Legacy octal / leading-zero numbers are not allowed when the 'esStrictCompatible' option is set",n),O&&(P=!0),m.string+=t;else if(45==n||43==n)0==m.string.length||O&&!A&&!P?(m.string+=t,A=!0):(_=!1,H("fault while parsing number;",n));else if(46==n)E||j||O?(_=!1,H("fault while parsing number;",n)):(m.string+=t,E=!0);else if(j&&(n>=95&&n<=102||n>=65&&n<=70))m.string+=t;else if(120==n||98==n||111==n||88==n||66==n||79==n)j||"0"!=m.string?(_=!1,H("fault while parsing number;",n)):(j=!0,m.string+=t);else{if(101!=n&&69!=n){if(32==n||160==n||13==n||10==n||9==n||11==n||12==n||8232==n||8233==n||65279==n||44==n||125==n||93==n||58==n)break;a&&(_=!1,H("fault while parsing number;",n));break}O?(_=!1,H("fault while parsing number;",n)):(m.string+=t,O=!0)}}w>e&&y.col--,w=e,a||w!=p.length?(U=!1,ee(),m.value_type=5,0==C&&(J=!0)):U=!0}if(!_)return-1;if(e&&e.length)f=function(){let e=l.pop();return e?e.n=0:e={buf:null,n:0},e}(),f.buf=e,X.push(f);else if(U){if(U=!1,ee(),m.value_type=5,0!=C)throw new Error("context stack is not empty at flush");J=!0,b=1}for(;_&&(f=X.shift());){if(w=f.n,p=f.buf,q){if(null===I)throw new Error("Parser string start was unset");se(I)>0&&(q=!1,m.value_type=4)}for(U&&re();!J&&_&&w<p.length;){let e=p.charAt(w);const a=u(p.codePointAt(w++),"Unexpected end of input while parsing");if(a>=65536&&(e+=p.charAt(w),w++),y.col++,$)R(a),1==$?42==a?$=3:47!=a?H("fault while parsing;",a):$=2:2==$?10!=a&&13!=a&&8232!=a&&8233!=a||($=0):3==$?42==a&&($=4):$=47==a?0:3;else{switch(a){case 47:$=1;break;case 123:(k==t||30==k||3==C&&0==k)&&H("fault while parsing; getting field name unexpected ",a),Z(a);{const e=i();m.value_type=6;const t={};0==C&&(N=v=t),e.context=C,e.elements=v,e.element_array=S,e.name=m.name,v=t,Q.push(e),V(),C=3}break;case 91:if(3!=C&&k!=t&&30!=k||H("Fault while parsing; while getting field name unexpected",a),0==m.value_type||-1==m.value_type){const e=i();m.value_type=7;const t=[];0==C?N=S=t:4==C&&(v[m.name]=t),e.context=C,e.elements=v,e.element_array=S,e.name=m.name,S=t,Q.push(e),V(),C=1}else H("Unexpected array open after previous value",a);break;case 58:if(3==C){if(k=0,h&&4!==m.value_type&&!s.test(m.string)&&Number.isNaN(Number(m.string.replace(r,"$1")))&&H("Unquoted keys must be valid identifiers when the 'esStrictCompatible' option is set",a),d&&4!==m.value_type&&""!==m.string){const e=Number(m.string.replace(r,"$1"));Number.isNaN(e)||(m.string=String(e))}m.name=m.string,m.string="",C=4,m.value_type=0}else H(1==C?"(in array, got colon out of string):parsing fault;":"(outside any object, got colon out of string):parsing fault;",a);break;case 125:if(k==n&&(k=0),Y(a),3==C){k!=t&&30!=k&&4!=m.value_type||H("Object field name with no value",a),m.value_type=6,m.contains=v;const e=Q.pop();m.name=e.name,C=e.context,v=e.elements,S=e.element_array,o(e),0==C&&(J=!0)}else if(4==C){0!=m.value_type?ne():H("Fault while parsing field value, close with no value",a),m.value_type=6,m.contains=v;const e=Q.pop();m.name=e.name,C=e.context,v=e.elements,S=e.element_array,o(e),0==C&&(J=!0)}else H("Fault while parsing; unexpected",a);x=!1,K=!1;break;case 93:if(k==n&&(k=0),Y(a),1==C){0!=m.value_type&&te(),m.value_type=7,m.contains=S;{const e=Q.pop();m.name=e.name,C=e.context,v=e.elements,S=e.element_array,o(e)}0==C&&(J=!0)}else H(`bad context ${C}; fault while parsing`,a);x=!1,K=!1;break;case 44:k==n&&(k=0),Y(a),1==C?(0==m.value_type&&(m.value_type=13),te(),V()):4==C?(C=3,0!=m.value_type?(ne(),V()):H("Unexpected comma after object field name",a)):(_=!1,H("bad context; excessive commas while parsing;",a)),x=!1,K=!1;break;default:if(3==C)switch(a){case 96:h&&H("Backtick-quoted keys are not allowed when the 'esStrictCompatible' option is set",a);case 34:case 39:if(0==k){0!=m.value_type&&H("String begin after previous value",a);se(a)?m.value_type=4:(I=a,q=!0)}else H("fault while parsing; quote not at start of field name",a);break;case 10:case 13:case 32:case 160:case 9:case 11:case 12:case 8232:case 8233:case 65279:R(a),k==n?k=0:k==t&&(k=30);break;default:30==k&&(_=!1,H("fault while parsing; character unexpected",a)),0==k&&(k=t),m.string+=e}else switch(a){case 96:case 34:case 39:if(0===m.value_type){se(a)?(m.value_type=4,k=n):(I=a,q=!0)}else H("String unexpected",a);break;case 10:case 32:case 160:case 9:case 13:case 11:case 12:case 8232:case 8233:case 65279:if(R(a),k==n){k=0,K=!1,0==C&&(J=!0);break}0!==k&&(_=!1,H("fault parsing whitespace",a));break;case 116:0==k?(Z(a),k=1):27==k?k=28:(_=!1,H("fault parsing",a));break;case 114:1==k?k=2:(_=!1,H("fault parsing",a));break;case 117:2==k?k=3:9==k?k=10:0==k?(Z(a),k=12):(_=!1,H("fault parsing",a));break;case 101:3==k?(m.value_type=2,k=n):8==k?(m.value_type=3,k=n):14==k?k=15:18==k?k=19:(_=!1,H("fault parsing",a));break;case 110:0==k?(Z(a),k=9):12==k?k=13:17==k?k=18:22==k?k=23:25==k?k=26:(_=!1,H("fault parsing",a));break;case 100:13==k?k=14:19==k?(m.value_type=-1,k=n):(_=!1,H("fault parsing",a));break;case 105:16==k?k=17:24==k?k=25:26==k?k=27:(_=!1,H("fault parsing",a));break;case 108:10==k?k=11:11==k?(m.value_type=1,k=n):6==k?k=7:(_=!1,H("fault parsing",a));break;case 102:0==k?(Z(a),k=5):15==k?k=16:23==k?k=24:(_=!1,H("fault parsing",a));break;case 97:5==k?k=6:20==k?k=21:(_=!1,H("fault parsing",a));break;case 115:7==k?k=8:(_=!1,H("fault parsing",a));break;case 73:0==k?(Z(a),k=22):(_=!1,H("fault parsing",a));break;case 78:0==k?(Z(a),k=20):21==k?(m.value_type=x?8:9,x=!1,k=n):(_=!1,H("fault parsing",a));break;case 121:28==k?(m.value_type=x?10:11,x=!1,k=n):(_=!1,H("fault parsing",a));break;case 45:0==k?(Z(a),h&&K&&H("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",a),K=!0,x=!x):(_=!1,H("fault parsing",a));break;case 43:0!==k?(_=!1,H("fault parsing",a)):(Z(a),h&&K&&H("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",a),K=!0);break;default:a>=48&&a<=57||43==a||46==a||45==a?(Z(a),j=!1,O=!1,A=!1,P=!1,E=!1,K=!1,m.string=e,f.n=w,re()):(_=!1,H("fault parsing",a))}}if(J){k==n&&(k=0);break}}}if(w==p.length?(c(f),a&&Y(),q||U||3==C?b=0:0!=C||0==m.value_type&&!N||(J=!0,b=1)):(f.n=w,X.unshift(f),b=2),J)break}if(J&&0!=m.value_type){switch(m.value_type){case 5:N=(x?-1:1)*Number(m.string);break;case 4:N=m.string;break;case 2:N=!0;break;case 3:N=!1;break;case 1:N=null;break;case-1:N=void 0;break;case 9:case 8:N=NaN;break;case 11:N=1/0;break;case 10:N=-1/0;break;case 6:case 7:N=m.contains}x=!1,m.string="",m.value_type=0}return J=!1,b}}};const p=[Object.freeze(f.begin())];let h=0;f.parse=function(e,t,n){const s=h++;p.length<=s&&p.push(Object.freeze(f.begin()));const r=p[s];"string"!=typeof e&&(e=String(e)),r.reset(n);try{if(r._write(e,!0)<=0)throw r.finalError(),new Error("No value found in document");const n=r.value();return"function"==typeof t&&function e(n,s){const r=n[s];if(r&&"object"==typeof r){const t=r;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=e(t,n);void 0!==s?t[n]=s:delete t[n]}}return t.call(n,s,r)}({"":n},""),n}finally{h--}},f.stringifierActive=null,f.stringifier=function(){const e={true:!0,false:!1,null:null,NaN:NaN,Infinity:1/0,undefined:void 0};let t='"',n=!1,s=!0;return{stringify(e,a,i,o){return function(e,a,i,o,l){if(void 0===a)return"undefined";if(null===a)return"null";let c="",u="";const p=f.stringifierActive;f.stringifierActive=e,l||(l="");if("number"==typeof o)for(let e=0;e<o;e+=1)u+=" ";else"string"==typeof o&&(u=o);const h=i;if(i&&"function"!=typeof i&&("object"!=typeof i||"number"!=typeof i.length))throw new Error("JSON6.stringify unknown replacer type.");const g=b(l,{[l]:a});return f.stringifierActive=p,g;function b(e,a){const i=c;let o=a[e];switch("string"==typeof o&&(o=t+f.escape(o)+t),null!=o&&"object"==typeof o&&"function"==typeof toJSOX&&(c+=u,c=i),"function"==typeof h&&(o=h.call(a,e,o)),typeof o){case"string":return o;case"number":return""+o;case"boolean":return String(o);case"object":{if(!o)return"null";if(Array.isArray(o)){const e=o,t=e;c+=u;const n=[];for(let s=0;s<e.length;s++){if(!(s in e)){n.push("");continue}const r=b(String(s),t);n.push(void 0===r?"undefined":r)}const s=e.length>0&&!(e.length-1 in e),r=0===n.length?"[]":c?"[\n"+c+n.join(",\n"+c)+(s?",":"")+"\n"+i+"]":"["+n.join(",")+(s?",":"")+"]";return c=i,r}const e=o;c+=u;const t=[];if(h&&"object"==typeof h){const n=h.length;for(let s=0;s<n;s+=1)if("string"==typeof h[s]){const n=h[s],a=b(n,e);a&&t.push(r(n)+(c?": ":":")+a)}}else{const a=[];for(const t in e)if((!n||Object.prototype.propertyIsEnumerable.call(e,t))&&Object.prototype.hasOwnProperty.call(e,t))if(s){let e;for(e=0;e<a.length;e++)if(a[e]>t){a.splice(e,0,t);break}e===a.length&&a.push(t)}else a.push(t);for(let n=0;n<a.length;n++){const s=a[n];if(Object.prototype.hasOwnProperty.call(e,s)){const n=b(s,e);n&&t.push(r(s)+(c?": ":":")+n)}}}const a=0===t.length?"{}":c?"{\n"+c+t.join(",\n"+c)+"\n"+i+"}":"{"+t.join(",")+"}";return c=i,a}}}}(this,e,a,i,o)},setQuote(e){t=e},get ignoreNonEnumerable(){return n},set ignoreNonEnumerable(e){n=e},get sortKeys(){return s},set sortKeys(e){s=e}};function r(n){return n.length?n in e||/([0-9-])/.test(n[0])||/((\n|\r|\t)|[ #{}()<>!+\-*/.:,])/.test(n)?t+f.escape(n)+t:n:t+t}},f.stringify=function(e,t,n,s){const r=f.stringifier();return s&&!1===s.sortKeys&&(r.sortKeys=!1),r.stringify(e,t,n)},f.version="1.1.5",e&&e.exports&&(e.exports=f)}(r)),r.exports}var i=e(s?n:(s=1,n=a()));export{i as default};
|
|
1
|
+
function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n,s,r={exports:{}};function a(){return t||(t=1,function(e){const t=29,n=31,s=/^[$_\p{ID_Start}][$_\p{ID_Continue}]*$/u,r=/(\d)_(?=\d)/g,a=[];function i(){return a.pop()||{context:0,elements:null,element_array:null,name:null}}function o(e){a.push(e)}const l=[];function c(e){l.push(e)}function u(e,t){if(void 0===e)throw new Error(t||"Unexpected undefined value");return e}const f={escape:function(e){let t="";if(!e)return e;for(let n=0;n<e.length;n++){const s=e[n];'"'!=s&&"\\"!=s&&"`"!=s&&"'"!=s||(t+="\\"),t+=s}return t}};f.begin=function(e,a,f){const p=f;let h=!(!p||!p.esStrictCompatible),g=!(!p||!p.forbidTemplateSubstitution),b=!(!p||!p.warnWithCommentWithoutEOL),d=!(!p||!p.normalizeNumericKeys);const m={name:null,value_type:0,string:"",contains:null},y={line:1,col:0};let v,w=0,k=0,_=!0,x=!1,N=null,S=[],C=0,$=0,j=!1,E=!1,O=!1,A=!1,P=!1,I=null,q=!1,U=!1,K=!1,L=!1,z=!1,T=!1,W=!1,F=!1,M=0,D=0,J=!1,B=!1;const Q={first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last||(this.first=t),this.last=t},pop(){const e=this.last;if(!e)throw new Error("context stack underflow");return(this.last=e.prior)||(this.first=null),e.next=this.saved,this.saved=e,e.node}},X={save:void 0,first:null,last:null,saved:null,push(e){let t=this.saved;t?(this.saved=t.next,t.node=e,t.next=null,t.prior=this.last):t={node:e,next:null,prior:this.last},this.last?this.last.next=t:this.first=t,this.last=t},shift(){const e=this.first;return e?(this.first=e.next,this.first||(this.last=null),e.next=this.saved,this.saved=e,e.node):null},unshift(e){const t=this.saved;this.saved=t.next,t.node=e,t.next=this.first,t.prior=null,this.first||(this.last=t),this.first=t}};function G(e){throw new Error(`${e} at ${w} [${y.line}:${y.col}]`)}return{finalError(){if(0!==$)switch($){case 1:return G("Comment began at end of document");case 2:b&&console.log("Warning: '//' comment without end of line ended document");break;case 3:return G("Open comment '/*' is missing close at end of document");case 4:return G("Incomplete '/* *' close at end of document")}q&&G("Incomplete string")},value(){this.finalError();const e=N;return N=void 0,e},reset(e){const t=void 0===e?p:e;h=!(!t||!t.esStrictCompatible),g=!(!t||!t.forbidTemplateSubstitution),b=!(!t||!t.warnWithCommentWithoutEOL),d=!(!t||!t.normalizeNumericKeys),k=0,_=!0,X.last&&(X.last.next=X.save),X.save=X.first,X.first=X.last=null,Q.last&&(Q.last.next=Q.saved),Q.saved=X.first,Q.first=Q.last=null,S=null,v=void 0,C=0,m.value_type=0,m.name=null,m.string="",y.line=1,y.col=0,x=!1,K=!1,$=0,J=!1,K=!1,B=!1,I=null,q=!1,L=!1,z=!1,T=!1,W=!1,F=!1,M=0,D=0},write(t){let n;if(!e)throw new Error("Callback function must be passed to begin, or you can't get values from the stream.");if(void 0!==t&&"string"!=typeof t&&(t=String(t)),!_)throw new Error("Parser is in an error state, please reset.");for(n=this._write(t,!1);n>0&&(this.finalError(),"function"==typeof a&&function e(t,n){const s=t[n];if(s&&"object"==typeof s){const t=s;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=e(t,n);void 0!==s?t[n]=s:delete t[n]}}return a.call(t,n,s)}({"":N},""),e(N),N=void 0,!(n<2));n=this._write());n&&this.finalError()},_write(e,a){let f,p="",b=0;function H(e,t){throw new Error(`${e} '${String.fromCodePoint(t)}' unexpected at ${w} (near '${p.substr(w>4?w-4:0,w>4?3:w-1)}[${String.fromCodePoint(t)}]${p.substr(w,10)}') [${y.line}:${y.col}]`)}function R(e){if(13===e){if(w<p.length&&10===p.charCodeAt(w))return}else if(10!==e&&8232!==e&&8233!==e)return;y.line++,y.col=0}function V(){m.value_type=0,m.string="",K=!1}function Y(e){k>0&&k<t&&(void 0===e?G("Incomplete keyword"):H("Incomplete keyword",e)),K&&0==m.value_type&&(void 0===e?G("Sign with no number following"):H("Sign with no number following",e))}function Z(e){0!=m.value_type&&H("Two values with no separator between them",e)}function ee(){if(Number.isNaN(Number(m.string)))throw _=!1,new Error(`Invalid number '${m.string}' at ${w} [${y.line}:${y.col}]`)}function te(){const e=S;switch(m.value_type){case 5:e.push((x?-1:1)*Number(m.string));break;case 4:e.push(m.string);break;case 2:e.push(!0);break;case 3:e.push(!1);break;case 8:case 9:e.push(NaN);break;case 10:e.push(-1/0);break;case 11:e.push(1/0);break;case 1:e.push(null);break;case-1:e.push(void 0);break;case 13:e.push(void 0),delete e[e.length-1];break;case 6:case 7:e.push(m.contains)}}function ne(){const e=v,t=m.name;switch(m.value_type){case 5:e[t]=(x?-1:1)*Number(m.string);break;case 4:e[t]=m.string;break;case 2:e[t]=!0;break;case 3:e[t]=!1;break;case 8:case 9:e[t]=NaN;break;case 10:e[t]=-1/0;break;case 11:e[t]=1/0;break;case 1:e[t]=null;break;case-1:e[t]=void 0;break;case 6:case 7:e[t]=m.contains}}function se(e){let t=0;const n=h&&96!==e,s=96===e&&g;for(;0==t&&w<p.length;){let r=p.charAt(w);const a=u(p.codePointAt(w++),"Unexpected end of string");if(a>=65536&&(r+=p.charAt(w),w++),y.col++,a==e)L?(F?H("Incomplete hexidecimal sequence",a):T?H("Incomplete long unicode sequence",a):W&&H("Incomplete unicode sequence",a),z?(z=!1,t=1):m.string+=r,L=!1):t=1;else if(L){if(T){if(125==a){m.string+=String.fromCodePoint(M),T=!1,W=!1,L=!1;continue}M*=16,a>=48&&a<=57?M+=a-48:a>=65&&a<=70?M+=a-65+10:a>=97&&a<=102?M+=a-97+10:H("(escaped character, parsing hex of \\u)",a);continue}if(F||W){if(0===D&&123===a){T=!0;continue}M*=16,a>=48&&a<=57?M+=a-48:a>=65&&a<=70?M+=a-65+10:a>=97&&a<=102?M+=a-97+10:H(W?"(escaped character, parsing hex of \\u)":"(escaped character, parsing hex of \\x)",a),D++,W?4==D&&(m.string+=String.fromCodePoint(M),W=!1,L=!1):2==D&&(m.string+=String.fromCodePoint(M),F=!1,L=!1);continue}switch(a){case 13:z=!0,R(a);continue;case 8232:case 8233:case 10:z=!1,R(a);break;case 116:m.string+="\t";break;case 98:m.string+="\b";break;case 48:h&&p.charCodeAt(w)>=48&&p.charCodeAt(w)<=57&&H("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",p.charCodeAt(w)),m.string+="\0";break;case 110:m.string+="\n";break;case 114:m.string+="\r";break;case 102:m.string+="\f";break;case 118:m.string+="\v";break;case 120:F=!0,D=0,M=0;continue;case 117:W=!0,D=0,M=0;continue;default:h&&a>=49&&a<=57&&H("Legacy octal string escapes are not allowed when the 'esStrictCompatible' option is set",a),m.string+=r}L=!1}else 92===a?(L=!0,B=!1):(!n||10!==a&&13!==a||H("Literal line terminators inside single- or double-quoted strings require the 'esStrictCompatible' option to be off",a),s&&(B&&123===a&&H("Template substitution ${ } is not allowed when the 'forbidTemplateSubstitution' option is set",a),B=36===a),z=!1,R(a),m.string+=r)}return t}function re(){let e;for(;(e=w)<p.length;){const t=p.charAt(e),n=u(p.codePointAt(w++),"Unexpected end of number");if(n>=65536&&H("fault while parsing number;",n),y.col++,95!=n)if(n>=48&&n<=57)h&&"0"===m.string&&H("Legacy octal / leading-zero numbers are not allowed when the 'esStrictCompatible' option is set",n),O&&(P=!0),m.string+=t;else if(45==n||43==n)0==m.string.length||O&&!A&&!P?(m.string+=t,A=!0):(_=!1,H("fault while parsing number;",n));else if(46==n)E||j||O?(_=!1,H("fault while parsing number;",n)):(m.string+=t,E=!0);else if(j&&(n>=95&&n<=102||n>=65&&n<=70))m.string+=t;else if(120==n||98==n||111==n||88==n||66==n||79==n)j||"0"!=m.string?(_=!1,H("fault while parsing number;",n)):(j=!0,m.string+=t);else{if(101!=n&&69!=n){if(32==n||160==n||13==n||10==n||9==n||11==n||12==n||8232==n||8233==n||65279==n||44==n||125==n||93==n||58==n)break;a&&(_=!1,H("fault while parsing number;",n));break}O?(_=!1,H("fault while parsing number;",n)):(m.string+=t,O=!0)}}w>e&&y.col--,w=e,a||w!=p.length?(U=!1,ee(),m.value_type=5,0==C&&(J=!0)):U=!0}if(!_)return-1;if(e&&e.length)f=function(){let e=l.pop();return e?e.n=0:e={buf:null,n:0},e}(),f.buf=e,X.push(f);else if(U){if(U=!1,ee(),m.value_type=5,0!=C)throw new Error("context stack is not empty at flush");J=!0,b=1}for(;_&&(f=X.shift());){if(w=f.n,p=f.buf,q){if(null===I)throw new Error("Parser string start was unset");se(I)>0&&(q=!1,m.value_type=4)}for(U&&re();!J&&_&&w<p.length;){let e=p.charAt(w);const a=u(p.codePointAt(w++),"Unexpected end of input while parsing");if(a>=65536&&(e+=p.charAt(w),w++),y.col++,$)R(a),1==$?42==a?$=3:47!=a?H("fault while parsing;",a):$=2:2==$?10!=a&&13!=a&&8232!=a&&8233!=a||($=0):3==$?42==a&&($=4):$=47==a?0:3;else{switch(a){case 47:$=1;break;case 123:(k==t||30==k||3==C&&0==k)&&H("fault while parsing; getting field name unexpected ",a),Z(a);{const e=i();m.value_type=6;const t={};0==C&&(N=v=t),e.context=C,e.elements=v,e.element_array=S,e.name=m.name,v=t,Q.push(e),V(),C=3}break;case 91:if(3!=C&&k!=t&&30!=k||H("Fault while parsing; while getting field name unexpected",a),0==m.value_type||-1==m.value_type){const e=i();m.value_type=7;const t=[];0==C?N=S=t:4==C&&(v[m.name]=t),e.context=C,e.elements=v,e.element_array=S,e.name=m.name,S=t,Q.push(e),V(),C=1}else H("Unexpected array open after previous value",a);break;case 58:if(3==C){if(k=0,h&&4!==m.value_type&&!s.test(m.string)&&Number.isNaN(Number(m.string.replace(r,"$1")))&&H("Unquoted keys must be valid identifiers when the 'esStrictCompatible' option is set",a),d&&4!==m.value_type&&""!==m.string){const e=Number(m.string.replace(r,"$1"));Number.isNaN(e)||(m.string=String(e))}m.name=m.string,m.string="",C=4,m.value_type=0}else H(1==C?"(in array, got colon out of string):parsing fault;":"(outside any object, got colon out of string):parsing fault;",a);break;case 125:if(k==n&&(k=0),Y(a),3==C){k!=t&&30!=k&&4!=m.value_type||H("Object field name with no value",a),m.value_type=6,m.contains=v;const e=Q.pop();m.name=e.name,C=e.context,v=e.elements,S=e.element_array,o(e),0==C&&(J=!0)}else if(4==C){0!=m.value_type?ne():H("Fault while parsing field value, close with no value",a),m.value_type=6,m.contains=v;const e=Q.pop();m.name=e.name,C=e.context,v=e.elements,S=e.element_array,o(e),0==C&&(J=!0)}else H("Fault while parsing; unexpected",a);x=!1,K=!1;break;case 93:if(k==n&&(k=0),Y(a),1==C){0!=m.value_type&&te(),m.value_type=7,m.contains=S;{const e=Q.pop();m.name=e.name,C=e.context,v=e.elements,S=e.element_array,o(e)}0==C&&(J=!0)}else H(`bad context ${C}; fault while parsing`,a);x=!1,K=!1;break;case 44:k==n&&(k=0),Y(a),1==C?(0==m.value_type&&(m.value_type=13),te(),V()):4==C?(C=3,0!=m.value_type?(ne(),V()):H("Unexpected comma after object field name",a)):(_=!1,H("bad context; excessive commas while parsing;",a)),x=!1,K=!1;break;default:if(3==C)switch(a){case 96:h&&H("Backtick-quoted keys are not allowed when the 'esStrictCompatible' option is set",a);case 34:case 39:if(0==k){0!=m.value_type&&H("String begin after previous value",a);se(a)?m.value_type=4:(I=a,q=!0)}else H("fault while parsing; quote not at start of field name",a);break;case 10:case 13:case 32:case 160:case 9:case 11:case 12:case 8232:case 8233:case 65279:R(a),k==n?k=0:k==t&&(k=30);break;default:30==k&&(_=!1,H("fault while parsing; character unexpected",a)),0==k&&(k=t),m.string+=e}else switch(a){case 96:case 34:case 39:if(0===m.value_type){se(a)?(m.value_type=4,k=n):(I=a,q=!0)}else H("String unexpected",a);break;case 10:case 32:case 160:case 9:case 13:case 11:case 12:case 8232:case 8233:case 65279:if(R(a),k==n){k=0,K=!1,0==C&&(J=!0);break}0!==k&&(_=!1,H("fault parsing whitespace",a));break;case 116:0==k?(Z(a),k=1):27==k?k=28:(_=!1,H("fault parsing",a));break;case 114:1==k?k=2:(_=!1,H("fault parsing",a));break;case 117:2==k?k=3:9==k?k=10:0==k?(Z(a),k=12):(_=!1,H("fault parsing",a));break;case 101:3==k?(m.value_type=2,k=n):8==k?(m.value_type=3,k=n):14==k?k=15:18==k?k=19:(_=!1,H("fault parsing",a));break;case 110:0==k?(Z(a),k=9):12==k?k=13:17==k?k=18:22==k?k=23:25==k?k=26:(_=!1,H("fault parsing",a));break;case 100:13==k?k=14:19==k?(m.value_type=-1,k=n):(_=!1,H("fault parsing",a));break;case 105:16==k?k=17:24==k?k=25:26==k?k=27:(_=!1,H("fault parsing",a));break;case 108:10==k?k=11:11==k?(m.value_type=1,k=n):6==k?k=7:(_=!1,H("fault parsing",a));break;case 102:0==k?(Z(a),k=5):15==k?k=16:23==k?k=24:(_=!1,H("fault parsing",a));break;case 97:5==k?k=6:20==k?k=21:(_=!1,H("fault parsing",a));break;case 115:7==k?k=8:(_=!1,H("fault parsing",a));break;case 73:0==k?(Z(a),k=22):(_=!1,H("fault parsing",a));break;case 78:0==k?(Z(a),k=20):21==k?(m.value_type=x?8:9,x=!1,k=n):(_=!1,H("fault parsing",a));break;case 121:28==k?(m.value_type=x?10:11,x=!1,k=n):(_=!1,H("fault parsing",a));break;case 45:0==k?(Z(a),h&&K&&H("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",a),K=!0,x=!x):(_=!1,H("fault parsing",a));break;case 43:0!==k?(_=!1,H("fault parsing",a)):(Z(a),h&&K&&H("Multiple consecutive signs are not allowed when the 'esStrictCompatible' option is set",a),K=!0);break;default:a>=48&&a<=57||43==a||46==a||45==a?(Z(a),j=!1,O=!1,A=!1,P=!1,E=!1,K=!1,m.string=e,f.n=w,re()):(_=!1,H("fault parsing",a))}}if(J){k==n&&(k=0);break}}}if(w==p.length?(c(f),a&&Y(),q||U||3==C?b=0:0!=C||0==m.value_type&&!N||(J=!0,b=1)):(f.n=w,X.unshift(f),b=2),J)break}if(J&&0!=m.value_type){switch(m.value_type){case 5:N=(x?-1:1)*Number(m.string);break;case 4:N=m.string;break;case 2:N=!0;break;case 3:N=!1;break;case 1:N=null;break;case-1:N=void 0;break;case 9:case 8:N=NaN;break;case 11:N=1/0;break;case 10:N=-1/0;break;case 6:case 7:N=m.contains}x=!1,m.string="",m.value_type=0}return J=!1,b}}};const p=[Object.freeze(f.begin())];let h=0;f.parse=function(e,t,n){const s=h++;p.length<=s&&p.push(Object.freeze(f.begin()));const r=p[s];"string"!=typeof e&&(e=String(e)),r.reset(n);try{if(r._write(e,!0)<=0)throw r.finalError(),new Error("No value found in document");const n=r.value();return"function"==typeof t&&function e(n,s){const r=n[s];if(r&&"object"==typeof r){const t=r;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=e(t,n);void 0!==s?t[n]=s:delete t[n]}}return t.call(n,s,r)}({"":n},""),n}finally{h--}},f.stringifierActive=null,f.stringifier=function(){const e={true:!0,false:!1,null:null,NaN:NaN,Infinity:1/0,undefined:void 0};let t='"',n=!1,s=!0;return{stringify(e,a,i,o){return function(e,a,i,o,l){if(void 0===a)return"undefined";if(null===a)return"null";let c="",u="";const p=f.stringifierActive;f.stringifierActive=e,l||(l="");if("number"==typeof o)for(let e=0;e<o;e+=1)u+=" ";else"string"==typeof o&&(u=o);const h=i;if(i&&"function"!=typeof i&&("object"!=typeof i||"number"!=typeof i.length))throw new Error("JSON6.stringify unknown replacer type.");const g=b(l,{[l]:a});return f.stringifierActive=p,g;function b(e,a){const i=c;let o=a[e];switch("string"==typeof o&&(o=t+f.escape(o)+t),null!=o&&"object"==typeof o&&"function"==typeof toJSOX&&(c+=u,c=i),"function"==typeof h&&(o=h.call(a,e,o)),typeof o){case"string":return o;case"number":return""+o;case"boolean":return String(o);case"object":{if(!o)return"null";if(Array.isArray(o)){const e=o,t=e;c+=u;const n=[];for(let s=0;s<e.length;s++){if(!(s in e)){n.push("");continue}const r=b(String(s),t);n.push(void 0===r?"undefined":r)}const s=e.length>0&&!(e.length-1 in e),r=0===n.length?"[]":c?"[\n"+c+n.join(",\n"+c)+(s?",":"")+"\n"+i+"]":"["+n.join(",")+(s?",":"")+"]";return c=i,r}const e=o;c+=u;const t=[];if(h&&"object"==typeof h){const n=h.length;for(let s=0;s<n;s+=1)if("string"==typeof h[s]){const n=h[s],a=b(n,e);a&&t.push(r(n)+(c?": ":":")+a)}}else{const a=[];for(const t in e)if((!n||Object.prototype.propertyIsEnumerable.call(e,t))&&Object.prototype.hasOwnProperty.call(e,t))if(s){let e;for(e=0;e<a.length;e++)if(a[e]>t){a.splice(e,0,t);break}e===a.length&&a.push(t)}else a.push(t);for(let n=0;n<a.length;n++){const s=a[n];if(Object.prototype.hasOwnProperty.call(e,s)){const n=b(s,e);n&&t.push(r(s)+(c?": ":":")+n)}}}const a=0===t.length?"{}":c?"{\n"+c+t.join(",\n"+c)+"\n"+i+"}":"{"+t.join(",")+"}";return c=i,a}}}}(this,e,a,i,o)},setQuote(e){t=e},get ignoreNonEnumerable(){return n},set ignoreNonEnumerable(e){n=e},get sortKeys(){return s},set sortKeys(e){s=e}};function r(n){return n.length?n in e||/([0-9-])/.test(n[0])||/((\n|\r|\t)|[ #{}()<>!+\-*/.:,])/.test(n)?t+f.escape(n)+t:n:t+t}},f.stringify=function(e,t,n,s){const r=f.stringifier();return s&&!1===s.sortKeys&&(r.sortKeys=!1),r.stringify(e,t,n)},f.version="1.1.6",e&&e.exports&&(e.exports=f)}(r)),r.exports}var i=e(s?n:(s=1,n=a()));export{i as default};
|
package/dist/index.mjs
CHANGED
package/dist/json6.d.ts
CHANGED
|
@@ -5,25 +5,25 @@ declare const JSON6_1: {
|
|
|
5
5
|
*/
|
|
6
6
|
escape: (string: string) => string;
|
|
7
7
|
/**
|
|
8
|
-
* @callback Json6Reviver
|
|
8
|
+
* @callback JSON6_1.Json6Reviver
|
|
9
9
|
* @param {string} key
|
|
10
10
|
* @param {unknown} value
|
|
11
11
|
* @returns {unknown}
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
14
|
* @param {(value: unknown) => void} [cb]
|
|
15
|
-
* @param {Json6Reviver|undefined} [reviver]
|
|
16
|
-
* @param {Json6ParseOptions} [options]
|
|
15
|
+
* @param {JSON6_1.Json6Reviver|undefined} [reviver]
|
|
16
|
+
* @param {JSON6_1.Json6ParseOptions} [options]
|
|
17
17
|
*/
|
|
18
|
-
begin: (cb?: (value: unknown) => void, reviver?: Json6Reviver | undefined, options?: Json6ParseOptions) => {
|
|
18
|
+
begin: (cb?: (value: unknown) => void, reviver?: JSON6_1.Json6Reviver | undefined, options?: JSON6_1.Json6ParseOptions) => {
|
|
19
19
|
finalError(): void;
|
|
20
20
|
value(): unknown;
|
|
21
21
|
/**
|
|
22
|
-
* @param {Json6ParseOptions} [resetOptions] Options for the next parse.
|
|
22
|
+
* @param {JSON6_1.Json6ParseOptions} [resetOptions] Options for the next parse.
|
|
23
23
|
* When omitted, the options passed to `begin()` (if any) stay in
|
|
24
24
|
* effect.
|
|
25
25
|
*/
|
|
26
|
-
reset(resetOptions?: Json6ParseOptions): void;
|
|
26
|
+
reset(resetOptions?: JSON6_1.Json6ParseOptions): void;
|
|
27
27
|
/**
|
|
28
28
|
* @param {unknown} [msg]
|
|
29
29
|
*/
|
|
@@ -36,31 +36,31 @@ declare const JSON6_1: {
|
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
38
|
* @param {unknown} msg
|
|
39
|
-
* @param {Json6Reviver} [reviver]
|
|
40
|
-
* @param {Json6ParseOptions} [options]
|
|
39
|
+
* @param {JSON6_1.Json6Reviver} [reviver]
|
|
40
|
+
* @param {JSON6_1.Json6ParseOptions} [options]
|
|
41
41
|
*/
|
|
42
|
-
parse: (msg: unknown, reviver?: Json6Reviver, options?: Json6ParseOptions) => unknown;
|
|
42
|
+
parse: (msg: unknown, reviver?: JSON6_1.Json6Reviver, options?: JSON6_1.Json6ParseOptions) => unknown;
|
|
43
43
|
/**
|
|
44
|
-
* @typedef {((key: string, value: unknown) => unknown) | Array<string|number> | null} Json6Replacer
|
|
44
|
+
* @typedef {((key: string, value: unknown) => unknown) | Array<string|number> | null} JSON6_1.Json6Replacer
|
|
45
45
|
*/
|
|
46
46
|
/**
|
|
47
|
-
* @typedef {object} Json6Stringifier
|
|
48
|
-
* @property {(o?: unknown, r?: Json6Replacer, s?: string|number|null, as?: string) => string|undefined} stringify
|
|
47
|
+
* @typedef {object} JSON6_1.Json6Stringifier
|
|
48
|
+
* @property {(o?: unknown, r?: JSON6_1.Json6Replacer, s?: string|number|null, as?: string) => string|undefined} stringify
|
|
49
49
|
* @property {(q: string) => void} setQuote
|
|
50
50
|
* @property {boolean} ignoreNonEnumerable
|
|
51
51
|
* @property {boolean} sortKeys
|
|
52
52
|
*/
|
|
53
|
-
/** @type {Json6Stringifier|null} */
|
|
54
|
-
stringifierActive: Json6Stringifier | null;
|
|
53
|
+
/** @type {JSON6_1.Json6Stringifier|null} */
|
|
54
|
+
stringifierActive: JSON6_1.Json6Stringifier | null;
|
|
55
55
|
stringifier: () => {
|
|
56
56
|
/**
|
|
57
57
|
* @param {unknown} [o]
|
|
58
|
-
* @param {Json6Replacer} [r]
|
|
58
|
+
* @param {JSON6_1.Json6Replacer} [r]
|
|
59
59
|
* @param {string|number|null} [s]
|
|
60
60
|
* @param {string} [as]
|
|
61
61
|
* @returns {string|undefined}
|
|
62
62
|
*/
|
|
63
|
-
stringify(o?: unknown, r?: Json6Replacer, s?: string | number | null, as?: string): string | undefined;
|
|
63
|
+
stringify(o?: unknown, r?: JSON6_1.Json6Replacer, s?: string | number | null, as?: string): string | undefined;
|
|
64
64
|
/**
|
|
65
65
|
* @param {string} q
|
|
66
66
|
*/
|
|
@@ -69,87 +69,89 @@ declare const JSON6_1: {
|
|
|
69
69
|
sortKeys: boolean;
|
|
70
70
|
};
|
|
71
71
|
/**
|
|
72
|
-
* @typedef {object} Json6StringifyOptions
|
|
72
|
+
* @typedef {object} JSON6_1.Json6StringifyOptions
|
|
73
73
|
* @property {boolean} [sortKeys] When `false`, object keys are emitted in their
|
|
74
74
|
* own enumeration order instead of sorted. Defaults to `true`.
|
|
75
75
|
*/
|
|
76
76
|
/**
|
|
77
77
|
* @param {unknown} object
|
|
78
|
-
* @param {Json6Replacer} [replacer]
|
|
78
|
+
* @param {JSON6_1.Json6Replacer} [replacer]
|
|
79
79
|
* @param {string|number} [space]
|
|
80
|
-
* @param {Json6StringifyOptions} [options]
|
|
80
|
+
* @param {JSON6_1.Json6StringifyOptions} [options]
|
|
81
81
|
* @returns {string|undefined}
|
|
82
82
|
*/
|
|
83
|
-
stringify: (object: unknown, replacer?: Json6Replacer, space?: string | number, options?: Json6StringifyOptions) => string | undefined;
|
|
83
|
+
stringify: (object: unknown, replacer?: JSON6_1.Json6Replacer, space?: string | number, options?: JSON6_1.Json6StringifyOptions) => string | undefined;
|
|
84
84
|
version: string;
|
|
85
85
|
};
|
|
86
86
|
export = JSON6_1;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
87
|
+
declare namespace JSON6_1 {
|
|
88
|
+
type Json6Node = {
|
|
89
|
+
n: number;
|
|
90
|
+
buf: null | string;
|
|
91
|
+
};
|
|
92
|
+
type Json6ParseOptions = {
|
|
93
|
+
/**
|
|
94
|
+
* When `true`, reject the JSON6
|
|
95
|
+
* extensions that are not valid in ECMAScript strict mode, so accepted
|
|
96
|
+
* input can be pasted into a module or `eval`'d unchanged: legacy-octal /
|
|
97
|
+
* leading-zero numbers (`0123`); legacy octal string escapes (`"\012"`,
|
|
98
|
+
* `"\1"`..`"\9"`); literal line terminators inside `'`/`"` strings
|
|
99
|
+
* (backtick strings still allow them); backtick-quoted object keys;
|
|
100
|
+
* unquoted object keys that are neither identifiers nor numbers; and two or
|
|
101
|
+
* more consecutive unary `+`/`-` signs. Defaults to `false`.
|
|
102
|
+
*/
|
|
103
|
+
esStrictCompatible?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* When `true`, reject an
|
|
106
|
+
* unescaped `${` inside a backtick-quoted string, so a document cannot
|
|
107
|
+
* silently turn into a template-literal substitution if later evaluated as
|
|
108
|
+
* JavaScript. Independent of `esStrictCompatible`. Defaults to `false`.
|
|
109
|
+
*/
|
|
110
|
+
forbidTemplateSubstitution?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* When `true`, a `//` comment
|
|
113
|
+
* that reaches the end of the document with no terminating line break logs
|
|
114
|
+
* a console warning. The input is accepted either way. Defaults to `false`.
|
|
115
|
+
*/
|
|
116
|
+
warnWithCommentWithoutEOL?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* When `true`, an unquoted object
|
|
119
|
+
* key that parses as a number is replaced with `String(Number(key))`, so
|
|
120
|
+
* `{1e3: true}` gets the key `"1000"` instead of the source text `"1e3"` --
|
|
121
|
+
* matching what a real JS object literal would produce. Independent of
|
|
122
|
+
* `esStrictCompatible` (does not require it). Note: `Number()` parses a
|
|
123
|
+
* leading-zero digit string like `"0123"` as decimal (123), while a real JS
|
|
124
|
+
* numeric literal `0123` is legacy octal (83) in sloppy mode; combine with
|
|
125
|
+
* `esStrictCompatible` (which forbids leading-zero numbers outright) for a
|
|
126
|
+
* guaranteed match. Defaults to `false`.
|
|
127
|
+
*/
|
|
128
|
+
normalizeNumericKeys?: boolean;
|
|
129
|
+
};
|
|
130
|
+
type NodeInfo<T> = {
|
|
131
|
+
node: T;
|
|
132
|
+
next: NodeInfo<T> | null | undefined;
|
|
133
|
+
prior: NodeInfo<T> | null;
|
|
134
|
+
};
|
|
135
|
+
type Context = {
|
|
136
|
+
context: 0 | 1 | 3 | 4;
|
|
137
|
+
elements: Record<string, unknown> | null | undefined;
|
|
138
|
+
element_array: unknown[] | null;
|
|
139
|
+
name: string | null;
|
|
140
|
+
};
|
|
141
|
+
type Json6Reviver = (key: string, value: unknown) => unknown;
|
|
142
|
+
type Json6Replacer = ((key: string, value: unknown) => unknown) | Array<string | number> | null;
|
|
143
|
+
type Json6Stringifier = {
|
|
144
|
+
stringify: (o?: unknown, r?: Json6Replacer, s?: string | number | null, as?: string) => string | undefined;
|
|
145
|
+
setQuote: (q: string) => void;
|
|
146
|
+
ignoreNonEnumerable: boolean;
|
|
147
|
+
sortKeys: boolean;
|
|
148
|
+
};
|
|
149
|
+
type Json6StringifyOptions = {
|
|
150
|
+
/**
|
|
151
|
+
* When `false`, object keys are emitted in their
|
|
152
|
+
* own enumeration order instead of sorted. Defaults to `true`.
|
|
153
|
+
*/
|
|
154
|
+
sortKeys?: boolean;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
155
157
|
//# sourceMappingURL=json6.d.ts.map
|
package/lib/json6.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-6",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "JSON for the ES6 era.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"json",
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
"scripts": {
|
|
88
88
|
"attw": "attw --profile node16 --pack .",
|
|
89
89
|
"tsc": "tsc",
|
|
90
|
-
"tsc-prod": "tsc -p tsconfig-prod.json",
|
|
90
|
+
"tsc-prod": "tsc -p tsconfig-prod.json && node build/fix-dts.js",
|
|
91
91
|
"prepack": "npm run test-lite",
|
|
92
92
|
"lint": "eslint --cache .",
|
|
93
|
-
"build": "node build/src-to-lib.js && node ./lib/cli.js -c package.json6 && rollup -c && tsc -p tsconfig-prod.json",
|
|
93
|
+
"build": "node build/src-to-lib.js && node ./lib/cli.js -c package.json6 && rollup -c && tsc -p tsconfig-prod.json && node build/fix-dts.js",
|
|
94
94
|
"mocha-lite": "mocha --require ./lib/require.js \"test/**/*.js\"",
|
|
95
95
|
"mocha": "node --import ./lib/register.mjs ./node_modules/mocha/lib/cli/cli.js --require ./lib/require.js --recursive",
|
|
96
96
|
"nyc-lite": "nyc npm run mocha-lite",
|