json-6 1.1.4 → 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 +222 -21
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/import.d.mts +2 -0
- package/dist/import.d.mts.map +1 -0
- package/dist/index-esm.d.mts +3 -0
- package/dist/index-esm.d.mts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3283 -2120
- package/dist/index.min.js +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.mjs +1706 -1615
- package/dist/json6.d.ts +157 -0
- package/dist/json6.d.ts.map +1 -0
- package/dist/register.d.mts +2 -0
- package/dist/register.d.mts.map +1 -0
- package/dist/require.d.ts +3 -0
- package/dist/require.d.ts.map +1 -0
- package/lib/globals.d.ts +7 -0
- package/lib/import.mjs +30 -82
- package/lib/index-esm.mjs +3 -0
- package/lib/json6.js +665 -222
- package/lib/register.mjs +11 -0
- package/lib/require.js +6 -0
- package/package.json +53 -9
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=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,t){return e(t={exports:{}},t.exports),t.exports}var n=function(e){return e&&e.Math==Math&&e},r=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),i=function(e){try{return!!e()}catch(e){return!0}},a=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,c={f:s&&!o.call({1:2},1)?function(e){var t=s(this,e);return!!t&&t.enumerable}:o},u=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},l={}.toString,f="".split,p=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==function(e){return l.call(e).slice(8,-1)}(e)?f.call(e,""):Object(e)}:Object,g=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},h=function(e){return p(g(e))},b=function(e){return"object"==typeof e?null!==e:"function"==typeof e},y=function(e,t){if(!b(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!b(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!b(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!b(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},d={}.hasOwnProperty,v=function(e,t){return d.call(e,t)},m=r.document,k=b(m)&&b(m.createElement),w=!a&&!i((function(){return 7!=Object.defineProperty((e="div",k?m.createElement(e):{}),"a",{get:function(){return 7}}).a;var e})),_=Object.getOwnPropertyDescriptor,x={f:a?_:function(e,t){if(e=h(e),t=y(t,!0),w)try{return _(e,t)}catch(e){}if(v(e,t))return u(!c.f.call(e,t),e[t])}},S=function(e){if(!b(e))throw TypeError(String(e)+" is not an object");return e},j=Object.defineProperty,O={f:a?j:function(e,t,n){if(S(e),t=y(t,!0),S(n),w)try{return j(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},P=a?function(e,t,n){return O.f(e,t,u(1,n))}:function(e,t,n){return e[t]=n,e},E=function(e,t){try{P(r,e,t)}catch(n){r[e]=t}return t},N=r["__core-js_shared__"]||E("__core-js_shared__",{}),A=Function.toString;"function"!=typeof N.inspectSource&&(N.inspectSource=function(e){return A.call(e)});var C,I,T,$,M=N.inspectSource,F=r.WeakMap,q="function"==typeof F&&/native code/.test(M(F)),z=t((function(e){(e.exports=function(e,t){return N[e]||(N[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.4",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),L=0,J=Math.random(),D=z("keys"),W={},G=r.WeakMap;if(q){var R=new G,U=R.get,K=R.has,Q=R.set;C=function(e,t){return Q.call(R,e,t),t},I=function(e){return U.call(R,e)||{}},T=function(e){return K.call(R,e)}}else{var V=D[$="state"]||(D[$]=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++L+J).toString(36)}($));W[V]=!0,C=function(e,t){return P(e,V,t),t},I=function(e){return v(e,V)?e[V]:{}},T=function(e){return v(e,V)}}var X={set:C,get:I,has:T,enforce:function(e){return T(e)?I(e):C(e,{})},getterFor:function(e){return function(t){var n;if(!b(t)||(n=I(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},Y=t((function(e){var t=X.get,n=X.enforce,i=String(String).split("String");(e.exports=function(e,t,a,o){var s=!!o&&!!o.unsafe,c=!!o&&!!o.enumerable,u=!!o&&!!o.noTargetGet;"function"==typeof a&&("string"!=typeof t||v(a,"name")||P(a,"name",t),n(a).source=i.join("string"==typeof t?t:"")),e!==r?(s?!u&&e[t]&&(c=!0):delete e[t],c?e[t]=a:P(e,t,a)):c?e[t]=a:E(t,a)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||M(this)}))})),B=r,H=function(e){return"function"==typeof e?e:void 0},Z=Math.ceil,ee=Math.floor,te=function(e){return isNaN(e=+e)?0:(e>0?ee:Z)(e)},ne=Math.min,re=Math.max,ie=Math.min,ae=function(e,t){var n=te(e);return n<0?re(n+t,0):ie(n,t)},oe=function(e){return function(t,n,r){var i,a,o=h(t),s=(i=o.length)>0?ne(te(i),9007199254740991):0,c=ae(r,s);if(e&&n!=n){for(;s>c;)if((a=o[c++])!=a)return!0}else for(;s>c;c++)if((e||c in o)&&o[c]===n)return e||c||0;return!e&&-1}},se={includes:oe(!0),indexOf:oe(!1)}.indexOf,ce=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),ue={f:Object.getOwnPropertyNames||function(e){return function(e,t){var n,r=h(e),i=0,a=[];for(n in r)!v(W,n)&&v(r,n)&&a.push(n);for(;t.length>i;)v(r,n=t[i++])&&(~se(a,n)||a.push(n));return a}(e,ce)}},le={f:Object.getOwnPropertySymbols},fe=function(e,t){return arguments.length<2?H(B[e])||H(r[e]):B[e]&&B[e][t]||r[e]&&r[e][t]}("Reflect","ownKeys")||function(e){var t=ue.f(S(e)),n=le.f;return n?t.concat(n(e)):t},pe=function(e,t){for(var n=fe(t),r=O.f,i=x.f,a=0;a<n.length;a++){var o=n[a];v(e,o)||r(e,o,i(t,o))}},ge=/#|\.prototype\./,he=function(e,t){var n=ye[be(e)];return n==ve||n!=de&&("function"==typeof t?i(t):!!t)},be=he.normalize=function(e){return String(e).replace(ge,".").toLowerCase()},ye=he.data={},de=he.NATIVE="N",ve=he.POLYFILL="P",me=he,ke=x.f,we=function(e,t){var n,i,a,o,s,c=e.target,u=e.global,l=e.stat;if(n=u?r:l?r[c]||E(c,{}):(r[c]||{}).prototype)for(i in t){if(o=t[i],a=e.noTargetGet?(s=ke(n,i))&&s.value:n[i],!me(u?i:c+(l?".":"#")+i,e.forced)&&void 0!==a){if(typeof o==typeof a)continue;pe(o,a)}(e.sham||a&&a.sham)&&P(o,"sham",!0),Y(n,i,o,e)}},_e=function(e){return function(t,n){var r,i,a=String(g(t)),o=te(n),s=a.length;return o<0||o>=s?e?"":void 0:(r=a.charCodeAt(o))<55296||r>56319||o+1===s||(i=a.charCodeAt(o+1))<56320||i>57343?e?a.charAt(o):r:e?a.slice(o,o+2):i-56320+(r-55296<<10)+65536}},xe={codeAt:_e(!1),charAt:_e(!0)}.codeAt;we({target:"String",proto:!0},{codePointAt:function(e){return xe(this,e)}});var Se,je,Oe=function(e,t,n){if(function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function")}(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},Pe=Function.call,Ee=(Se="codePointAt",Oe(Pe,r["String"].prototype[Se],je),String.fromCharCode),Ne=String.fromCodePoint;we({target:"String",stat:!0,forced:!!Ne&&1!=Ne.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,i=0;r>i;){if(t=+arguments[i++],ae(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?Ee(t):Ee(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}});B.String.fromCodePoint;return t((function(e,t){const n=[];function r(){return n.pop()||{context:0,elements:null,element_array:null}}function i(e){n.push(e)}const a=[];function o(e){a.push(e)}const s=t;s.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},s.begin=function(e,t){const n={name:null,value_type:0,string:"",contains:null},s={line:1,col:1};let c=0,u=0,l=!0,f=!1,p=null,g=void 0,h=[],b=0,y=0,d=!1,v=!1,m=!1,k=!1,w=!1,_=null,x=!1,S=!1,j=!1,O=!1,P=!1,E=!1,N=!1,A=0,C=0,I=!1;const T={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;return(this.last=e.prior)||(this.first=null),e.next=this.saved,this.saved=e,e.node}},$={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 M(e){throw new Error(`${e} at ${c} [${s.line}:${s.col}]`)}return{finalError(){if(0!==y)switch(y){case 1:return M("Comment began at end of document");case 2:console.log("Warning: '//' comment without end of line ended document");break;case 3:return M("Open comment '/*' is missing close at end of document");case 4:return M("Incomplete '/* *' close at end of document")}x&&M("Incomplete string")},value(){this.finalError();const e=p;return p=void 0,e},reset(){u=0,l=!0,$.last&&($.last.next=$.save),$.save=$.first,$.first=$.last=null,T.last&&(T.last.next=T.save),T.save=$.first,T.first=T.last=null,h=null,g=void 0,b=0,n.value_type=0,n.name=null,n.string="",s.line=1,s.col=1,f=!1,y=0,I=!1,x=!1,j=!1,O=!1},write(n){let r;if(void 0!==n&&"string"!=typeof n&&(n=String(n)),!l)throw new Error("Parser is in an error state, please reset.");for(r=this._write(n,!1);r>0&&(this.finalError(),"function"==typeof t&&function e(n,r){const i=n[r];if(i&&"object"==typeof i)for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)){const n=e(i,t);void 0!==n?i[t]=n:delete i[t]}return t.call(n,r,i)}({"":p},""),e(p),p=void 0,!(r<2));r=this._write());r&&this.finalError()},_write(e,t){let M,F,q=0;function z(e,t){throw new Error(`${e} '${String.fromCodePoint(t)}' unexpected at ${c} (near '${F.substr(c>4?c-4:0,c>4?3:c-1)}[${String.fromCodePoint(t)}]${F.substr(c,10)}') [${s.line}:${s.col}]`)}function L(){n.value_type=0,n.string=""}function J(){switch(n.value_type){case 5:h.push((f?-1:1)*Number(n.string));break;case 4:h.push(n.string);break;case 2:h.push(!0);break;case 3:h.push(!1);break;case 8:case 9:h.push(NaN);break;case 10:h.push(-1/0);break;case 11:h.push(1/0);break;case 1:h.push(null);break;case-1:h.push(void 0);break;case 13:h.push(void 0),delete h[h.length-1];break;case 6:case 7:h.push(n.contains)}}function D(){switch(n.value_type){case 5:g[n.name]=(f?-1:1)*Number(n.string);break;case 4:g[n.name]=n.string;break;case 2:g[n.name]=!0;break;case 3:g[n.name]=!1;break;case 8:case 9:g[n.name]=NaN;break;case 10:g[n.name]=-1/0;break;case 11:g[n.name]=1/0;break;case 1:g[n.name]=null;break;case-1:g[n.name]=void 0;break;case 6:case 7:g[n.name]=n.contains}}function W(e){let t=0;for(;0==t&&c<F.length;){let r=F.charAt(c);const i=F.codePointAt(c++);if(i>=65536&&(r+=F.charAt(c),c++),s.col++,i==e)j?(N?z("Incomplete hexidecimal sequence",i):P?z("Incomplete long unicode sequence",i):E&&z("Incomplete unicode sequence",i),O?(O=!1,t=1):n.string+=r,j=!1):t=1;else if(j){if(P){if(125==i){n.string+=String.fromCodePoint(A),P=!1,E=!1,j=!1;continue}A*=16,i>=48&&i<=57?A+=i-48:i>=65&&i<=70?A+=i-65+10:i>=97&&i<=102?A+=i-97+10:z("(escaped character, parsing hex of \\u)",i);continue}if(N||E){if(0===C&&123===i){P=!0;continue}A*=16,i>=48&&i<=57?A+=i-48:i>=65&&i<=70?A+=i-65+10:i>=97&&i<=102?A+=i-97+10:z(E?"(escaped character, parsing hex of \\u)":"(escaped character, parsing hex of \\x)",i),C++,E?4==C&&(n.string+=String.fromCodePoint(A),E=!1,j=!1):2==C&&(n.string+=String.fromCodePoint(A),N=!1,j=!1);continue}switch(i){case 13:O=!0,s.col=1;continue;case 8232:case 8233:s.col=1;case 10:O?O=!1:s.col=1,s.line++;break;case 116:n.string+="\t";break;case 98:n.string+="\b";break;case 48:n.string+="\0";break;case 110:n.string+="\n";break;case 114:n.string+="\r";break;case 102:n.string+="\f";break;case 118:n.string+="\v";break;case 120:N=!0,C=0,A=0;continue;case 117:E=!0,C=0,A=0;continue;default:n.string+=r}j=!1}else 92===i?j=!0:(O&&(O=!1,s.line++,s.col=2),n.string+=r)}return t}function G(){let e;for(;(e=c)<F.length;){const r=F.charAt(e),i=F.codePointAt(c++);if(i>=65536&&z("fault while parsing number;",i),95!=i)if(s.col++,i>=48&&i<=57)m&&(w=!0),n.string+=r;else if(45==i||43==i)0==n.string.length||m&&!k&&!w?(n.string+=r,k=!0):(l=!1,z("fault while parsing number;",i));else if(46==i)v||d||m?(l=!1,z("fault while parsing number;",i)):(n.string+=r,v=!0);else if(d&&(i>=95&&i<=102||i>=65&&i<=70))n.string+=r;else if(120==i||98==i||111==i||88==i||66==i||79==i)d||"0"!=n.string?(l=!1,z("fault while parsing number;",i)):(d=!0,n.string+=r);else{if(101!=i&&69!=i){if(32==i||160==i||13==i||10==i||9==i||65279==i||44==i||125==i||93==i||58==i)break;t&&(l=!1,z("fault while parsing number;",i));break}m?(l=!1,z("fault while parsing number;",i)):(n.string+=r,m=!0)}}c=e,t||c!=F.length?(S=!1,n.value_type=5,0==b&&(I=!0)):S=!0}if(!l)return-1;if(e&&e.length)M=function(){let e=a.pop();return e?e.n=0:e={buf:null,n:0},e}(),M.buf=e,$.push(M);else if(S){if(S=!1,n.value_type=5,0!=b)throw new Error("context stack is not empty at flush");I=!0,q=1}for(;l&&(M=$.shift());){if(c=M.n,F=M.buf,x){W(_)>0&&(x=!1,n.value_type=4)}for(S&&G();!I&&l&&c<F.length;){let e=F.charAt(c);const t=F.codePointAt(c++);if(t>=65536&&(e+=F.charAt(c),c++),s.col++,y)1==y?42==t?y=3:47!=t?z("fault while parsing;",t):y=2:2==y?10!=t&&13!=t||(y=0):3==y?42==t&&(y=4):y=47==t?0:3;else{switch(t){case 47:y=1;break;case 123:(29==u||30==u||3==b&&0==u)&&z("fault while parsing; getting field name unexpected ",t);{const e=r();n.value_type=6;const t={};0==b&&(p=g=t),e.context=b,e.elements=g,e.element_array=h,e.name=n.name,g=t,T.push(e),L(),b=3}break;case 91:if(3!=b&&29!=u&&30!=u||z("Fault while parsing; while getting field name unexpected",t),0==n.value_type||-1==n.value_type){const e=r();n.value_type=7;const t=[];0==b?p=h=t:4==b&&(g[n.name]=t),e.context=b,e.elements=g,e.element_array=h,e.name=n.name,h=t,T.push(e),L(),b=1}else z("Unexpected array open after previous value",t);break;case 58:3==b?(u=0,n.name=n.string,n.string="",b=4,n.value_type=0):z(1==b?"(in array, got colon out of string):parsing fault;":"(outside any object, got colon out of string):parsing fault;",t);break;case 125:if(31==u&&(u=0),3==b){n.value_type=6,n.contains=g;const e=T.pop();n.name=e.name,b=e.context,g=e.elements,h=e.element_array,i(e),0==b&&(I=!0)}else if(4==b){0!=n.value_type?D():z("Fault while parsing field value, close with no value",t),n.value_type=6,n.contains=g;const e=T.pop();n.name=e.name,b=e.context,g=e.elements,h=e.element_array,i(e),0==b&&(I=!0)}else z("Fault while parsing; unexpected",t);f=!1;break;case 93:if(31==u&&(u=0),1==b){0!=n.value_type&&J(),n.value_type=7,n.contains=h;{const e=T.pop();n.name=e.name,b=e.context,g=e.elements,h=e.element_array,i(e)}0==b&&(I=!0)}else z(`bad context ${b}; fault while parsing`,t);f=!1;break;case 44:31==u&&(u=0),1==b?(0==n.value_type&&(n.value_type=13),J(),L()):4==b?(b=3,0!=n.value_type?(D(),L()):z("Unexpected comma after object field name",t)):(l=!1,z("bad context; excessive commas while parsing;",t)),f=!1;break;default:if(3==b)switch(t){case 96:case 34:case 39:if(0==u){0!=n.value_type&&z("String begin after previous value",t),W(t)?n.value_type=4:(_=t,x=!0)}else z("fault while parsing; quote not at start of field name",t);break;case 10:s.line++,s.col=1;case 13:case 32:case 160:case 9:case 65279:31==u?u=0:29==u&&(u=30);break;default:30==u&&(l=!1,z("fault while parsing; character unexpected",t)),0==u&&(u=29),n.string+=e}else switch(t){case 96:case 34:case 39:if(0===n.value_type){W(t)?(n.value_type=4,u=31):(_=t,x=!0)}else z("String unexpected",t);break;case 10:s.line++,s.col=1;case 32:case 160:case 9:case 13:case 65279:if(31==u){u=0,0==b&&(I=!0);break}0!==u&&(l=!1,z("fault parsing whitespace",t));break;case 116:0==u?u=1:27==u?u=28:(l=!1,z("fault parsing",t));break;case 114:1==u?u=2:(l=!1,z("fault parsing",t));break;case 117:2==u?u=3:9==u?u=10:0==u?u=12:(l=!1,z("fault parsing",t));break;case 101:3==u?(n.value_type=2,u=31):8==u?(n.value_type=3,u=31):14==u?u=15:18==u?u=19:(l=!1,z("fault parsing",t));break;case 110:0==u?u=9:12==u?u=13:17==u?u=18:22==u?u=23:25==u?u=26:(l=!1,z("fault parsing",t));break;case 100:13==u?u=14:19==u?(n.value_type=-1,u=31):(l=!1,z("fault parsing",t));break;case 105:16==u?u=17:24==u?u=25:26==u?u=27:(l=!1,z("fault parsing",t));break;case 108:10==u?u=11:11==u?(n.value_type=1,u=31):6==u?u=7:(l=!1,z("fault parsing",t));break;case 102:0==u?u=5:15==u?u=16:23==u?u=24:(l=!1,z("fault parsing",t));break;case 97:5==u?u=6:20==u?u=21:(l=!1,z("fault parsing",t));break;case 115:7==u?u=8:(l=!1,z("fault parsing",t));break;case 73:0==u?u=22:(l=!1,z("fault parsing",t));break;case 78:0==u?u=20:21==u?(n.value_type=f?8:9,f=!1,u=31):(l=!1,z("fault parsing",t));break;case 121:28==u?(n.value_type=f?10:11,f=!1,u=31):(l=!1,z("fault parsing",t));break;case 45:0==u?f=!f:(l=!1,z("fault parsing",t));break;case 43:0!==u&&(l=!1,z("fault parsing",t));break;default:t>=48&&t<=57||43==t||46==t||45==t?(d=!1,m=!1,k=!1,w=!1,v=!1,n.string=e,M.n=c,G()):(l=!1,z("fault parsing",t))}}if(I){31==u&&(u=0);break}}}if(c==F.length?(o(M),x||S||3==b?q=0:0!=b||0==n.value_type&&!p||(I=!0,q=1)):(M.n=c,$.unshift(M),q=2),I)break}if(I&&0!=n.value_type){switch(n.value_type){case 5:p=(f?-1:1)*Number(n.string);break;case 4:p=n.string;break;case 2:p=!0;break;case 3:p=!1;break;case 1:p=null;break;case-1:p=void 0;break;case 9:case 8:p=NaN;break;case 11:p=1/0;break;case 10:p=-1/0;break;case 6:case 7:p=n.contains}f=!1,n.string="",n.value_type=0}return I=!1,q}}};const c=[Object.freeze(s.begin())];let u=0;s.parse=function(e,t){const n=u++;c.length<=n&&c.push(Object.freeze(s.begin()));const r=c[n];if("string"!=typeof e&&(e=String(e)),r.reset(),r._write(e,!0)>0){const e=r.value();return"function"==typeof t&&function e(n,r){const i=n[r];if(i&&"object"==typeof i)for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)){const n=e(i,t);void 0!==n?i[t]=n:delete i[t]}return t.call(n,r,i)}({"":e},""),u--,e}r.finalError()},s.stringify=JSON.stringify,s.stringifierActive=null,s.stringifier=function(){const e={true:!0,false:!1,null:null,NaN:NaN,Infinity:1/0,undefined:void 0};let t='"',n=!1;return{stringify(e,t,i,a){return function(e,t,i,a,o){if(void 0===t)return"undefined";if(null===t)return"null";let c,u,l;const f=typeof a,p=typeof i;c="",u="";const g=s.stringifierActive;s.stringifierActive=e,o||(o="");if("number"===f)for(l=0;l<a;l+=1)u+=" ";else"string"===f&&(u=a);const h=i;if(i&&"function"!==p&&("object"!==p||"number"!=typeof i.length))throw new Error("JSON6.stringify unknown replacer type.");const b=function e(t,i){let a,o,s,l;const f=c;let p,g=i[t];"string"==typeof g&&(g=r(g));null!=g&&"object"==typeof g&&"function"==typeof toJSOX&&(c+=u,c=f);"function"==typeof h&&(g=h.call(i,t,g));switch(typeof g){case"string":return g;case"number":return""+g;case"boolean":return String(g);case"object":if(!g)return"null";if(c+=u,p=[],h&&"object"==typeof h)for(l=h.length,a=0;a<l;a+=1)"string"==typeof h[a]&&(o=h[a],s=e(o,g),s&&p.push(r(o)+(c?": ":":")+s));else{const t=[];for(o in g)if((!n||Object.prototype.propertyIsEnumerable.call(g,o))&&Object.prototype.hasOwnProperty.call(g,o)){let e;for(e=0;e<t.length;e++)if(t[e]>o){t.splice(e,0,o);break}e===t.length&&t.push(o)}for(let n=0;n<t.length;n++)o=t[n],Object.prototype.hasOwnProperty.call(g,o)&&(s=e(o,g),s&&p.push(r(o)+(c?": ":":")+s))}return s=0===p.length?"{}":c?"{\n"+c+p.join(",\n"+c)+"\n"+f+"}":"{"+p.join(",")+"}",c=f,s}}(o,{[o]:t});return s.stringifierActive=g,b}(this,e,t,i,a)},setQuote(e){t=e},get ignoreNonEnumerable(){return n},set ignoreNonEnumerable(e){n=e}};function r(n){return"number"!=typeof n||isNaN(n)?n.length?n in e||/([0-9-])/.test(n[0])||/((\n|\r|\t)|[ #{}()<>!+\-*/.:,])/.test(n)?t+s.escape(n)+t:n:t+t:["'",n.toString(),"'"].join()}},s.stringify=function(e,t,n){return s.stringifier().stringify(e,t,n)},s.version="1.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.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
|
-
var e,t=(function(e,t){const n=[];function a(){return n.pop()||{context:0,elements:null,element_array:null}}function s(e){n.push(e)}const r=[];function i(e){r.push(e)}const l=t;l.escape=function(e){let t="";if(!e)return e;for(let n=0;n<e.length;n++){const a=e[n];'"'!=a&&"\\"!=a&&"`"!=a&&"'"!=a||(t+="\\"),t+=a}return t},l.begin=function(e,t){const n={name:null,value_type:0,string:"",contains:null},l={line:1,col:1};let c=0,o=0,u=!0,f=!1,p=null,g=void 0,h=[],b=0,d=0,m=!1,v=!1,y=!1,k=!1,w=!1,_=null,x=!1,N=!1,j=!1,O=!1,S=!1,E=!1,P=!1,$=0,A=0,I=!1;const C={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;return(this.last=e.prior)||(this.first=null),e.next=this.saved,this.saved=e,e.node}},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.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 F(e){throw new Error(`${e} at ${c} [${l.line}:${l.col}]`)}return{finalError(){if(0!==d)switch(d){case 1:return F("Comment began at end of document");case 2:console.log("Warning: '//' comment without end of line ended document");break;case 3:return F("Open comment '/*' is missing close at end of document");case 4:return F("Incomplete '/* *' close at end of document")}x&&F("Incomplete string")},value(){this.finalError();const e=p;return p=void 0,e},reset(){o=0,u=!0,q.last&&(q.last.next=q.save),q.save=q.first,q.first=q.last=null,C.last&&(C.last.next=C.save),C.save=q.first,C.first=C.last=null,h=null,g=void 0,b=0,n.value_type=0,n.name=null,n.string="",l.line=1,l.col=1,f=!1,d=0,I=!1,x=!1,j=!1,O=!1},write(n){let a;if(void 0!==n&&"string"!=typeof n&&(n=String(n)),!u)throw new Error("Parser is in an error state, please reset.");for(a=this._write(n,!1);a>0&&(this.finalError(),"function"==typeof t&&function e(n,a){const s=n[a];if(s&&"object"==typeof s)for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)){const n=e(s,t);void 0!==n?s[t]=n:delete s[t]}return t.call(n,a,s)}({"":p},""),e(p),p=void 0,!(a<2));a=this._write());a&&this.finalError()},_write(e,t){let F,J,z=0;function U(e,t){throw new Error(`${e} '${String.fromCodePoint(t)}' unexpected at ${c} (near '${J.substr(c>4?c-4:0,c>4?3:c-1)}[${String.fromCodePoint(t)}]${J.substr(c,10)}') [${l.line}:${l.col}]`)}function Q(){n.value_type=0,n.string=""}function W(){switch(n.value_type){case 5:h.push((f?-1:1)*Number(n.string));break;case 4:h.push(n.string);break;case 2:h.push(!0);break;case 3:h.push(!1);break;case 8:case 9:h.push(NaN);break;case 10:h.push(-1/0);break;case 11:h.push(1/0);break;case 1:h.push(null);break;case-1:h.push(void 0);break;case 13:h.push(void 0),delete h[h.length-1];break;case 6:case 7:h.push(n.contains)}}function X(){switch(n.value_type){case 5:g[n.name]=(f?-1:1)*Number(n.string);break;case 4:g[n.name]=n.string;break;case 2:g[n.name]=!0;break;case 3:g[n.name]=!1;break;case 8:case 9:g[n.name]=NaN;break;case 10:g[n.name]=-1/0;break;case 11:g[n.name]=1/0;break;case 1:g[n.name]=null;break;case-1:g[n.name]=void 0;break;case 6:case 7:g[n.name]=n.contains}}function B(e){let t=0;for(;0==t&&c<J.length;){let a=J.charAt(c);const s=J.codePointAt(c++);if(s>=65536&&(a+=J.charAt(c),c++),l.col++,s==e)j?(P?U("Incomplete hexidecimal sequence",s):S?U("Incomplete long unicode sequence",s):E&&U("Incomplete unicode sequence",s),O?(O=!1,t=1):n.string+=a,j=!1):t=1;else if(j){if(S){if(125==s){n.string+=String.fromCodePoint($),S=!1,E=!1,j=!1;continue}$*=16,s>=48&&s<=57?$+=s-48:s>=65&&s<=70?$+=s-65+10:s>=97&&s<=102?$+=s-97+10:U("(escaped character, parsing hex of \\u)",s);continue}if(P||E){if(0===A&&123===s){S=!0;continue}$*=16,s>=48&&s<=57?$+=s-48:s>=65&&s<=70?$+=s-65+10:s>=97&&s<=102?$+=s-97+10:U(E?"(escaped character, parsing hex of \\u)":"(escaped character, parsing hex of \\x)",s),A++,E?4==A&&(n.string+=String.fromCodePoint($),E=!1,j=!1):2==A&&(n.string+=String.fromCodePoint($),P=!1,j=!1);continue}switch(s){case 13:O=!0,l.col=1;continue;case 8232:case 8233:l.col=1;case 10:O?O=!1:l.col=1,l.line++;break;case 116:n.string+="\t";break;case 98:n.string+="\b";break;case 48:n.string+="\0";break;case 110:n.string+="\n";break;case 114:n.string+="\r";break;case 102:n.string+="\f";break;case 118:n.string+="\v";break;case 120:P=!0,A=0,$=0;continue;case 117:E=!0,A=0,$=0;continue;default:n.string+=a}j=!1}else 92===s?j=!0:(O&&(O=!1,l.line++,l.col=2),n.string+=a)}return t}function D(){let e;for(;(e=c)<J.length;){const a=J.charAt(e),s=J.codePointAt(c++);if(s>=65536&&U("fault while parsing number;",s),95!=s)if(l.col++,s>=48&&s<=57)y&&(w=!0),n.string+=a;else if(45==s||43==s)0==n.string.length||y&&!k&&!w?(n.string+=a,k=!0):(u=!1,U("fault while parsing number;",s));else if(46==s)v||m||y?(u=!1,U("fault while parsing number;",s)):(n.string+=a,v=!0);else if(m&&(s>=95&&s<=102||s>=65&&s<=70))n.string+=a;else if(120==s||98==s||111==s||88==s||66==s||79==s)m||"0"!=n.string?(u=!1,U("fault while parsing number;",s)):(m=!0,n.string+=a);else{if(101!=s&&69!=s){if(32==s||160==s||13==s||10==s||9==s||65279==s||44==s||125==s||93==s||58==s)break;t&&(u=!1,U("fault while parsing number;",s));break}y?(u=!1,U("fault while parsing number;",s)):(n.string+=a,y=!0)}}c=e,t||c!=J.length?(N=!1,n.value_type=5,0==b&&(I=!0)):N=!0}if(!u)return-1;if(e&&e.length)F=function(){let e=r.pop();return e?e.n=0:e={buf:null,n:0},e}(),F.buf=e,q.push(F);else if(N){if(N=!1,n.value_type=5,0!=b)throw new Error("context stack is not empty at flush");I=!0,z=1}for(;u&&(F=q.shift());){for(c=F.n,J=F.buf,x&&B(_)>0&&(x=!1,n.value_type=4),N&&D();!I&&u&&c<J.length;){let e=J.charAt(c);const t=J.codePointAt(c++);if(t>=65536&&(e+=J.charAt(c),c++),l.col++,d)1==d?42==t?d=3:47!=t?U("fault while parsing;",t):d=2:2==d?10!=t&&13!=t||(d=0):3==d?42==t&&(d=4):d=47==t?0:3;else{switch(t){case 47:d=1;break;case 123:(29==o||30==o||3==b&&0==o)&&U("fault while parsing; getting field name unexpected ",t);{const e=a();n.value_type=6;const t={};0==b&&(p=g=t),e.context=b,e.elements=g,e.element_array=h,e.name=n.name,g=t,C.push(e),Q(),b=3}break;case 91:if(3!=b&&29!=o&&30!=o||U("Fault while parsing; while getting field name unexpected",t),0==n.value_type||-1==n.value_type){const e=a();n.value_type=7;const t=[];0==b?p=h=t:4==b&&(g[n.name]=t),e.context=b,e.elements=g,e.element_array=h,e.name=n.name,h=t,C.push(e),Q(),b=1}else U("Unexpected array open after previous value",t);break;case 58:3==b?(o=0,n.name=n.string,n.string="",b=4,n.value_type=0):U(1==b?"(in array, got colon out of string):parsing fault;":"(outside any object, got colon out of string):parsing fault;",t);break;case 125:if(31==o&&(o=0),3==b){n.value_type=6,n.contains=g;const e=C.pop();n.name=e.name,b=e.context,g=e.elements,h=e.element_array,s(e),0==b&&(I=!0)}else if(4==b){0!=n.value_type?X():U("Fault while parsing field value, close with no value",t),n.value_type=6,n.contains=g;const e=C.pop();n.name=e.name,b=e.context,g=e.elements,h=e.element_array,s(e),0==b&&(I=!0)}else U("Fault while parsing; unexpected",t);f=!1;break;case 93:if(31==o&&(o=0),1==b){0!=n.value_type&&W(),n.value_type=7,n.contains=h;{const e=C.pop();n.name=e.name,b=e.context,g=e.elements,h=e.element_array,s(e)}0==b&&(I=!0)}else U(`bad context ${b}; fault while parsing`,t);f=!1;break;case 44:31==o&&(o=0),1==b?(0==n.value_type&&(n.value_type=13),W(),Q()):4==b?(b=3,0!=n.value_type?(X(),Q()):U("Unexpected comma after object field name",t)):(u=!1,U("bad context; excessive commas while parsing;",t)),f=!1;break;default:if(3==b)switch(t){case 96:case 34:case 39:0==o?(0!=n.value_type&&U("String begin after previous value",t),B(t)?n.value_type=4:(_=t,x=!0)):U("fault while parsing; quote not at start of field name",t);break;case 10:l.line++,l.col=1;case 13:case 32:case 160:case 9:case 65279:31==o?o=0:29==o&&(o=30);break;default:30==o&&(u=!1,U("fault while parsing; character unexpected",t)),0==o&&(o=29),n.string+=e}else switch(t){case 96:case 34:case 39:0===n.value_type?B(t)?(n.value_type=4,o=31):(_=t,x=!0):U("String unexpected",t);break;case 10:l.line++,l.col=1;case 32:case 160:case 9:case 13:case 65279:if(31==o){o=0,0==b&&(I=!0);break}0!==o&&(u=!1,U("fault parsing whitespace",t));break;case 116:0==o?o=1:27==o?o=28:(u=!1,U("fault parsing",t));break;case 114:1==o?o=2:(u=!1,U("fault parsing",t));break;case 117:2==o?o=3:9==o?o=10:0==o?o=12:(u=!1,U("fault parsing",t));break;case 101:3==o?(n.value_type=2,o=31):8==o?(n.value_type=3,o=31):14==o?o=15:18==o?o=19:(u=!1,U("fault parsing",t));break;case 110:0==o?o=9:12==o?o=13:17==o?o=18:22==o?o=23:25==o?o=26:(u=!1,U("fault parsing",t));break;case 100:13==o?o=14:19==o?(n.value_type=-1,o=31):(u=!1,U("fault parsing",t));break;case 105:16==o?o=17:24==o?o=25:26==o?o=27:(u=!1,U("fault parsing",t));break;case 108:10==o?o=11:11==o?(n.value_type=1,o=31):6==o?o=7:(u=!1,U("fault parsing",t));break;case 102:0==o?o=5:15==o?o=16:23==o?o=24:(u=!1,U("fault parsing",t));break;case 97:5==o?o=6:20==o?o=21:(u=!1,U("fault parsing",t));break;case 115:7==o?o=8:(u=!1,U("fault parsing",t));break;case 73:0==o?o=22:(u=!1,U("fault parsing",t));break;case 78:0==o?o=20:21==o?(n.value_type=f?8:9,f=!1,o=31):(u=!1,U("fault parsing",t));break;case 121:28==o?(n.value_type=f?10:11,f=!1,o=31):(u=!1,U("fault parsing",t));break;case 45:0==o?f=!f:(u=!1,U("fault parsing",t));break;case 43:0!==o&&(u=!1,U("fault parsing",t));break;default:t>=48&&t<=57||43==t||46==t||45==t?(m=!1,y=!1,k=!1,w=!1,v=!1,n.string=e,F.n=c,D()):(u=!1,U("fault parsing",t))}}if(I){31==o&&(o=0);break}}}if(c==J.length?(i(F),x||N||3==b?z=0:0!=b||0==n.value_type&&!p||(I=!0,z=1)):(F.n=c,q.unshift(F),z=2),I)break}if(I&&0!=n.value_type){switch(n.value_type){case 5:p=(f?-1:1)*Number(n.string);break;case 4:p=n.string;break;case 2:p=!0;break;case 3:p=!1;break;case 1:p=null;break;case-1:p=void 0;break;case 9:case 8:p=NaN;break;case 11:p=1/0;break;case 10:p=-1/0;break;case 6:case 7:p=n.contains}f=!1,n.string="",n.value_type=0}return I=!1,z}}};const c=[Object.freeze(l.begin())];let o=0;l.parse=function(e,t){const n=o++;c.length<=n&&c.push(Object.freeze(l.begin()));const a=c[n];if("string"!=typeof e&&(e=String(e)),a.reset(),a._write(e,!0)>0){const e=a.value();return"function"==typeof t&&function e(n,a){const s=n[a];if(s&&"object"==typeof s)for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)){const n=e(s,t);void 0!==n?s[t]=n:delete s[t]}return t.call(n,a,s)}({"":e},""),o--,e}a.finalError()},l.stringify=JSON.stringify,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;return{stringify(e,t,s,r){return function(e,t,s,r,i){if(void 0===t)return"undefined";if(null===t)return"null";let c,o,u;const f=typeof r,p=typeof s;c="",o="";const g=l.stringifierActive;if(l.stringifierActive=e,i||(i=""),"number"===f)for(u=0;u<r;u+=1)o+=" ";else"string"===f&&(o=r);const h=s;if(s&&"function"!==p&&("object"!==p||"number"!=typeof s.length))throw new Error("JSON6.stringify unknown replacer type.");const b=function e(t,s){let r,i,l,u;const f=c;let p,g=s[t];switch("string"==typeof g&&(g=a(g)),null!=g&&"object"==typeof g&&"function"==typeof toJSOX&&(c+=o,c=f),"function"==typeof h&&(g=h.call(s,t,g)),typeof g){case"string":return g;case"number":return""+g;case"boolean":return String(g);case"object":if(!g)return"null";if(c+=o,p=[],h&&"object"==typeof h)for(u=h.length,r=0;r<u;r+=1)"string"==typeof h[r]&&(i=h[r],l=e(i,g),l&&p.push(a(i)+(c?": ":":")+l));else{const t=[];for(i in g)if((!n||Object.prototype.propertyIsEnumerable.call(g,i))&&Object.prototype.hasOwnProperty.call(g,i)){let e;for(e=0;e<t.length;e++)if(t[e]>i){t.splice(e,0,i);break}e===t.length&&t.push(i)}for(let n=0;n<t.length;n++)i=t[n],Object.prototype.hasOwnProperty.call(g,i)&&(l=e(i,g),l&&p.push(a(i)+(c?": ":":")+l))}return l=0===p.length?"{}":c?"{\n"+c+p.join(",\n"+c)+"\n"+f+"}":"{"+p.join(",")+"}",c=f,l}}(i,{[i]:t});return l.stringifierActive=g,b}(this,e,t,s,r)},setQuote(e){t=e},get ignoreNonEnumerable(){return n},set ignoreNonEnumerable(e){n=e}};function a(n){return"number"!=typeof n||isNaN(n)?n.length?n in e||/([0-9-])/.test(n[0])||/((\n|\r|\t)|[ #{}()<>!+\-*/.:,])/.test(n)?t+l.escape(n)+t:n:t+t:["'",n.toString(),"'"].join()}},l.stringify=function(e,t,n){return l.stringifier().stringify(e,t,n)},l.version="1.1.1"}(e={exports:{}},e.exports),e.exports);export default t;
|
|
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};
|