django-vue3-admin-web/node_modules/jsonrepair/lib/umd/jsonrepair.min.js
2025-10-20 21:21:14 +08:00

1 line
7.7 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).JSONRepair={})}(this,function(t){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function u(r){var n=i();return function(){var t,e=a(r),e=(t=n?(t=a(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function e(t){var r="function"==typeof Map?new Map:void 0;return function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return n(t,arguments,a(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),f(e,t)}(t)}function n(t,e,r){return(n=i()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);e=new(Function.bind.apply(t,n));return r&&f(e,r.prototype),e}).apply(null,arguments)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var C=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t);var r,n,o=u(i);function i(t,e){if(this instanceof i)return(t=o.call(this,t+" at position "+e)).position=e,t;throw new TypeError("Cannot call a class as a function")}return e=i,r&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(e(Error)),r=32,A=10,v=9,g=13,w=8,O=12,m=34,l=39,j=48,S=49,x=57,h=65,d=97,s=70,p=102,P=160,B=8192,M=8202,U=8239,D=8287,q=12288,b=8220,y=8221,z=8216,G=8217,H=96,K=180;function R(t){return j<=t&&t<=x||h<=t&&t<=s||d<=t&&t<=p}function E(t){return j<=t&&t<=x}var L=/^[,:[\]{}()\n]$/;function T(t){return Q.test(t)||t&&N(t.charCodeAt(0))}var Q=/^[[{\w-]$/;function _(t){return t===r||t===A||t===v||t===g}function N(t){return J(t)||I(t)}function J(t){return t===m||t===b||t===y}function k(t){return t===m}function I(t){return t===l||t===z||t===G||t===H||t===K}function F(t,e,r){r=2<arguments.length&&void 0!==r&&r,e=t.lastIndexOf(e);return-1!==e?t.substring(0,e)+(r?"":t.substring(e+1)):t}function $(t,e){var r=t.length;if(!_(t.charCodeAt(r-1)))return t+e;for(;_(t.charCodeAt(r-1));)r--;return t.substring(0,r)+e+t.substring(r)}var V={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},W={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};t.JSONRepairError=C,t.jsonrepair=function(u){var f=0,a="";if(!n())throw new C("Unexpected end of json string",u.length);var t=i(44);if(t&&l(),T(u[f])&&/[,\n][ \t\r]*$/.test(a)){t||(a=$(a,","));for(var e=!0,r=!0;r;)e?e=!1:i(44)||(a=$(a,",")),r=n();r||(a=F(a,",")),a="[\n".concat(a,"\n]")}else t&&(a=F(a,","));if(f>=u.length)return a;throw new C("Unexpected character "+JSON.stringify(u[f]),f);function n(){l();var t=function(){if(123!==u.charCodeAt(f))return!1;a+="{",f++,l();var t=!0;for(;f<u.length&&125!==u.charCodeAt(f);){if(t?t=!!0:(i(44)||(a=$(a,",")),l()),!(d()||s())){125===u.charCodeAt(f)||123===u.charCodeAt(f)||93===u.charCodeAt(f)||91===u.charCodeAt(f)||void 0===u[f]?a=F(a,","):function(){throw new C("Object key expected",f)}();break}l();var e=i(58);e||(T(u[f])?a=$(a,":"):y()),n()||(e?function(){throw new C("Object value expected",f)}:y)()}125===u.charCodeAt(f)?(a+="}",f++):a=$(a,"}");return!0}()||function(){if(91!==u.charCodeAt(f))return!1;a+="[",f++,l();var t=!0;for(;f<u.length&&93!==u.charCodeAt(f);)if(t?t=!1:i(44)||(a=$(a,",")),!n()){a=F(a,",");break}93===u.charCodeAt(f)?(a+="]",f++):a=$(a,"]");return!0}()||d()||function(){var t=f;if(45===u.charCodeAt(f)&&(f++,b(t)))return!0;if(u.charCodeAt(f)===j)f++;else if(function(t){return S<=t&&t<=x}(u.charCodeAt(f)))for(f++;E(u.charCodeAt(f));)f++;if(46===u.charCodeAt(f)){if(f++,b(t))return!0;for(;E(u.charCodeAt(f));)f++}if(101===u.charCodeAt(f)||69===u.charCodeAt(f)){if(f++,45!==u.charCodeAt(f)&&43!==u.charCodeAt(f)||f++,b(t))return!0;for(;E(u.charCodeAt(f));)f++}if(t<f)return a+=u.slice(t,f),!0;return!1}()||c("true","true")||c("false","false")||c("null","null")||c("True","true")||c("False","false")||c("None","null")||s();return l(),t}function l(){for(o();function(){if(47===u.charCodeAt(f)&&42===u.charCodeAt(f+1)){for(;f<u.length&&!function(t,e){return"*"===t[e]&&"/"===t[e+1]}(u,f);)f++;f+=2}else{if(47!==u.charCodeAt(f)||47!==u.charCodeAt(f+1))return!1;for(;f<u.length&&u.charCodeAt(f)!==A;)f++}return!0}()&&o(););}function o(){for(var t,e,r="";(t=_(u.charCodeAt(f)))||(e=u.charCodeAt(f))===P||B<=e&&e<=M||e===U||e===D||e===q;)r+=t?u[f]:" ",f++;return 0<r.length&&(a+=r,!0)}function i(t){return u.charCodeAt(f)===t&&(a+=u[f],f++,!0)}function h(){92===u.charCodeAt(f)&&f++}function d(){var t,e=92===u.charCodeAt(f);if(e&&(f++,e=!0),N(u.charCodeAt(f))){var r=I(u.charCodeAt(f))?I:k(u.charCodeAt(f))?k:J;for(a+='"',f++;f<u.length&&!r(u.charCodeAt(f));){if(92===u.charCodeAt(f)){var n=u[f+1];if(void 0!==W[n])a+=u.slice(f,f+2),f+=2;else if("u"===n){if(!(R(u.charCodeAt(f+2))&&R(u.charCodeAt(f+3))&&R(u.charCodeAt(f+4))&&R(u.charCodeAt(f+5)))){i=o=void 0;for(var o=f,i=o+2;/\w/.test(u[i]);)i++;throw o=u.slice(o,i),new C('Invalid unicode character "'.concat(o,'"'),f)}a+=u.slice(f,f+6),f+=6}else a+=n,f+=2}else{o=u[f],n=u.charCodeAt(f);if(n===m&&92!==u.charCodeAt(f-1))a+="\\"+o;else if((t=n)===A||t===g||t===v||t===w||t===O)a+=V[o];else{if(!(32<=(t=n)&&t<=1114111))throw new C("Invalid character "+JSON.stringify(o),f);a+=o}f++}e&&h()}N(u.charCodeAt(f))?(u.charCodeAt(f),a+='"',f++):a+='"';for(l();43===u.charCodeAt(f);){f++,l();var c=(a=F(a,'"',!0)).length;d(),a=function(t,e,r){return t.substring(0,e)+t.substring(e+r)}(a,c,1)}return!0}return!1}function c(t,e){return u.slice(f,f+t.length)===t&&(a+=e,f+=t.length,!0)}function s(){for(var t,e=f;f<u.length&&(t=u[f],!(L.test(t)||t&&N(t.charCodeAt(0))));)f++;if(e<f){if(40===u.charCodeAt(f))f++,n(),41===u.charCodeAt(f)&&(f++,59===u.charCodeAt(f))&&f++;else{for(;_(u.charCodeAt(f-1))&&0<f;)f--;e=u.slice(e,f);a+=JSON.stringify(e)}return!0}}function p(t){if(!E(u.charCodeAt(f)))throw t=u.slice(t,f),new C("Invalid number '".concat(t,"', expecting a digit ").concat(u[f]?"but got '".concat(u[f],"'"):"but reached end of input"),2)}function b(t){if(f>=u.length)return a+=u.slice(t,f)+"0",1;p(t)}function y(){throw new C("Colon expected",f)}}});