index.js 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591
  1. "use strict";
  2. var __create = Object.create;
  3. var __defProp = Object.defineProperty;
  4. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5. var __getOwnPropNames = Object.getOwnPropertyNames;
  6. var __getProtoOf = Object.getPrototypeOf;
  7. var __hasOwnProp = Object.prototype.hasOwnProperty;
  8. var __commonJS = (cb, mod) => function __require() {
  9. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  10. };
  11. var __export = (target, all) => {
  12. for (var name2 in all)
  13. __defProp(target, name2, { get: all[name2], enumerable: true });
  14. };
  15. var __copyProps = (to, from, except, desc) => {
  16. if (from && typeof from === "object" || typeof from === "function") {
  17. for (let key2 of __getOwnPropNames(from))
  18. if (!__hasOwnProp.call(to, key2) && key2 !== except)
  19. __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
  20. }
  21. return to;
  22. };
  23. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  24. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  25. mod
  26. ));
  27. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  28. // node_modules/has-symbols/shams.js
  29. var require_shams = __commonJS({
  30. "node_modules/has-symbols/shams.js"(exports, module2) {
  31. "use strict";
  32. module2.exports = function hasSymbols() {
  33. if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
  34. return false;
  35. }
  36. if (typeof Symbol.iterator === "symbol") {
  37. return true;
  38. }
  39. var obj = {};
  40. var sym = Symbol("test");
  41. var symObj = Object(sym);
  42. if (typeof sym === "string") {
  43. return false;
  44. }
  45. if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
  46. return false;
  47. }
  48. if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
  49. return false;
  50. }
  51. var symVal = 42;
  52. obj[sym] = symVal;
  53. for (sym in obj) {
  54. return false;
  55. }
  56. if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
  57. return false;
  58. }
  59. if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
  60. return false;
  61. }
  62. var syms = Object.getOwnPropertySymbols(obj);
  63. if (syms.length !== 1 || syms[0] !== sym) {
  64. return false;
  65. }
  66. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
  67. return false;
  68. }
  69. if (typeof Object.getOwnPropertyDescriptor === "function") {
  70. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  71. if (descriptor.value !== symVal || descriptor.enumerable !== true) {
  72. return false;
  73. }
  74. }
  75. return true;
  76. };
  77. }
  78. });
  79. // node_modules/has-symbols/index.js
  80. var require_has_symbols = __commonJS({
  81. "node_modules/has-symbols/index.js"(exports, module2) {
  82. "use strict";
  83. var origSymbol = typeof Symbol !== "undefined" && Symbol;
  84. var hasSymbolSham = require_shams();
  85. module2.exports = function hasNativeSymbols() {
  86. if (typeof origSymbol !== "function") {
  87. return false;
  88. }
  89. if (typeof Symbol !== "function") {
  90. return false;
  91. }
  92. if (typeof origSymbol("foo") !== "symbol") {
  93. return false;
  94. }
  95. if (typeof Symbol("bar") !== "symbol") {
  96. return false;
  97. }
  98. return hasSymbolSham();
  99. };
  100. }
  101. });
  102. // node_modules/function-bind/implementation.js
  103. var require_implementation = __commonJS({
  104. "node_modules/function-bind/implementation.js"(exports, module2) {
  105. "use strict";
  106. var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
  107. var slice = Array.prototype.slice;
  108. var toStr = Object.prototype.toString;
  109. var funcType = "[object Function]";
  110. module2.exports = function bind(that) {
  111. var target = this;
  112. if (typeof target !== "function" || toStr.call(target) !== funcType) {
  113. throw new TypeError(ERROR_MESSAGE + target);
  114. }
  115. var args2 = slice.call(arguments, 1);
  116. var bound;
  117. var binder = function() {
  118. if (this instanceof bound) {
  119. var result2 = target.apply(
  120. this,
  121. args2.concat(slice.call(arguments))
  122. );
  123. if (Object(result2) === result2) {
  124. return result2;
  125. }
  126. return this;
  127. } else {
  128. return target.apply(
  129. that,
  130. args2.concat(slice.call(arguments))
  131. );
  132. }
  133. };
  134. var boundLength = Math.max(0, target.length - args2.length);
  135. var boundArgs = [];
  136. for (var i = 0; i < boundLength; i++) {
  137. boundArgs.push("$" + i);
  138. }
  139. bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
  140. if (target.prototype) {
  141. var Empty = function Empty2() {
  142. };
  143. Empty.prototype = target.prototype;
  144. bound.prototype = new Empty();
  145. Empty.prototype = null;
  146. }
  147. return bound;
  148. };
  149. }
  150. });
  151. // node_modules/function-bind/index.js
  152. var require_function_bind = __commonJS({
  153. "node_modules/function-bind/index.js"(exports, module2) {
  154. "use strict";
  155. var implementation = require_implementation();
  156. module2.exports = Function.prototype.bind || implementation;
  157. }
  158. });
  159. // node_modules/has/src/index.js
  160. var require_src = __commonJS({
  161. "node_modules/has/src/index.js"(exports, module2) {
  162. "use strict";
  163. var bind = require_function_bind();
  164. module2.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  165. }
  166. });
  167. // node_modules/get-intrinsic/index.js
  168. var require_get_intrinsic = __commonJS({
  169. "node_modules/get-intrinsic/index.js"(exports, module2) {
  170. "use strict";
  171. var undefined2;
  172. var $SyntaxError = SyntaxError;
  173. var $Function = Function;
  174. var $TypeError = TypeError;
  175. var getEvalledConstructor = function(expressionSyntax) {
  176. try {
  177. return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
  178. } catch (e) {
  179. }
  180. };
  181. var $gOPD = Object.getOwnPropertyDescriptor;
  182. if ($gOPD) {
  183. try {
  184. $gOPD({}, "");
  185. } catch (e) {
  186. $gOPD = null;
  187. }
  188. }
  189. var throwTypeError = function() {
  190. throw new $TypeError();
  191. };
  192. var ThrowTypeError = $gOPD ? function() {
  193. try {
  194. arguments.callee;
  195. return throwTypeError;
  196. } catch (calleeThrows) {
  197. try {
  198. return $gOPD(arguments, "callee").get;
  199. } catch (gOPDthrows) {
  200. return throwTypeError;
  201. }
  202. }
  203. }() : throwTypeError;
  204. var hasSymbols = require_has_symbols()();
  205. var getProto = Object.getPrototypeOf || function(x) {
  206. return x.__proto__;
  207. };
  208. var needsEval = {};
  209. var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array);
  210. var INTRINSICS = {
  211. "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
  212. "%Array%": Array,
  213. "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
  214. "%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2,
  215. "%AsyncFromSyncIteratorPrototype%": undefined2,
  216. "%AsyncFunction%": needsEval,
  217. "%AsyncGenerator%": needsEval,
  218. "%AsyncGeneratorFunction%": needsEval,
  219. "%AsyncIteratorPrototype%": needsEval,
  220. "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics,
  221. "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt,
  222. "%Boolean%": Boolean,
  223. "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView,
  224. "%Date%": Date,
  225. "%decodeURI%": decodeURI,
  226. "%decodeURIComponent%": decodeURIComponent,
  227. "%encodeURI%": encodeURI,
  228. "%encodeURIComponent%": encodeURIComponent,
  229. "%Error%": Error,
  230. "%eval%": eval,
  231. "%EvalError%": EvalError,
  232. "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
  233. "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
  234. "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
  235. "%Function%": $Function,
  236. "%GeneratorFunction%": needsEval,
  237. "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
  238. "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
  239. "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array,
  240. "%isFinite%": isFinite,
  241. "%isNaN%": isNaN,
  242. "%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2,
  243. "%JSON%": typeof JSON === "object" ? JSON : undefined2,
  244. "%Map%": typeof Map === "undefined" ? undefined2 : Map,
  245. "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
  246. "%Math%": Math,
  247. "%Number%": Number,
  248. "%Object%": Object,
  249. "%parseFloat%": parseFloat,
  250. "%parseInt%": parseInt,
  251. "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
  252. "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
  253. "%RangeError%": RangeError,
  254. "%ReferenceError%": ReferenceError,
  255. "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
  256. "%RegExp%": RegExp,
  257. "%Set%": typeof Set === "undefined" ? undefined2 : Set,
  258. "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
  259. "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer,
  260. "%String%": String,
  261. "%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2,
  262. "%Symbol%": hasSymbols ? Symbol : undefined2,
  263. "%SyntaxError%": $SyntaxError,
  264. "%ThrowTypeError%": ThrowTypeError,
  265. "%TypedArray%": TypedArray,
  266. "%TypeError%": $TypeError,
  267. "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array,
  268. "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray,
  269. "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array,
  270. "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array,
  271. "%URIError%": URIError,
  272. "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap,
  273. "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef,
  274. "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet
  275. };
  276. var doEval = function doEval2(name2) {
  277. var value2;
  278. if (name2 === "%AsyncFunction%") {
  279. value2 = getEvalledConstructor("async function () {}");
  280. } else if (name2 === "%GeneratorFunction%") {
  281. value2 = getEvalledConstructor("function* () {}");
  282. } else if (name2 === "%AsyncGeneratorFunction%") {
  283. value2 = getEvalledConstructor("async function* () {}");
  284. } else if (name2 === "%AsyncGenerator%") {
  285. var fn = doEval2("%AsyncGeneratorFunction%");
  286. if (fn) {
  287. value2 = fn.prototype;
  288. }
  289. } else if (name2 === "%AsyncIteratorPrototype%") {
  290. var gen = doEval2("%AsyncGenerator%");
  291. if (gen) {
  292. value2 = getProto(gen.prototype);
  293. }
  294. }
  295. INTRINSICS[name2] = value2;
  296. return value2;
  297. };
  298. var LEGACY_ALIASES = {
  299. "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
  300. "%ArrayPrototype%": ["Array", "prototype"],
  301. "%ArrayProto_entries%": ["Array", "prototype", "entries"],
  302. "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
  303. "%ArrayProto_keys%": ["Array", "prototype", "keys"],
  304. "%ArrayProto_values%": ["Array", "prototype", "values"],
  305. "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
  306. "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
  307. "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
  308. "%BooleanPrototype%": ["Boolean", "prototype"],
  309. "%DataViewPrototype%": ["DataView", "prototype"],
  310. "%DatePrototype%": ["Date", "prototype"],
  311. "%ErrorPrototype%": ["Error", "prototype"],
  312. "%EvalErrorPrototype%": ["EvalError", "prototype"],
  313. "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
  314. "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
  315. "%FunctionPrototype%": ["Function", "prototype"],
  316. "%Generator%": ["GeneratorFunction", "prototype"],
  317. "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
  318. "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
  319. "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
  320. "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
  321. "%JSONParse%": ["JSON", "parse"],
  322. "%JSONStringify%": ["JSON", "stringify"],
  323. "%MapPrototype%": ["Map", "prototype"],
  324. "%NumberPrototype%": ["Number", "prototype"],
  325. "%ObjectPrototype%": ["Object", "prototype"],
  326. "%ObjProto_toString%": ["Object", "prototype", "toString"],
  327. "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
  328. "%PromisePrototype%": ["Promise", "prototype"],
  329. "%PromiseProto_then%": ["Promise", "prototype", "then"],
  330. "%Promise_all%": ["Promise", "all"],
  331. "%Promise_reject%": ["Promise", "reject"],
  332. "%Promise_resolve%": ["Promise", "resolve"],
  333. "%RangeErrorPrototype%": ["RangeError", "prototype"],
  334. "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
  335. "%RegExpPrototype%": ["RegExp", "prototype"],
  336. "%SetPrototype%": ["Set", "prototype"],
  337. "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
  338. "%StringPrototype%": ["String", "prototype"],
  339. "%SymbolPrototype%": ["Symbol", "prototype"],
  340. "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
  341. "%TypedArrayPrototype%": ["TypedArray", "prototype"],
  342. "%TypeErrorPrototype%": ["TypeError", "prototype"],
  343. "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
  344. "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
  345. "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
  346. "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
  347. "%URIErrorPrototype%": ["URIError", "prototype"],
  348. "%WeakMapPrototype%": ["WeakMap", "prototype"],
  349. "%WeakSetPrototype%": ["WeakSet", "prototype"]
  350. };
  351. var bind = require_function_bind();
  352. var hasOwn = require_src();
  353. var $concat = bind.call(Function.call, Array.prototype.concat);
  354. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  355. var $replace = bind.call(Function.call, String.prototype.replace);
  356. var $strSlice = bind.call(Function.call, String.prototype.slice);
  357. var $exec = bind.call(Function.call, RegExp.prototype.exec);
  358. var rePropName2 = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  359. var reEscapeChar2 = /\\(\\)?/g;
  360. var stringToPath2 = function stringToPath3(string) {
  361. var first = $strSlice(string, 0, 1);
  362. var last = $strSlice(string, -1);
  363. if (first === "%" && last !== "%") {
  364. throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
  365. } else if (last === "%" && first !== "%") {
  366. throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
  367. }
  368. var result2 = [];
  369. $replace(string, rePropName2, function(match, number, quote, subString) {
  370. result2[result2.length] = quote ? $replace(subString, reEscapeChar2, "$1") : number || match;
  371. });
  372. return result2;
  373. };
  374. var getBaseIntrinsic = function getBaseIntrinsic2(name2, allowMissing) {
  375. var intrinsicName = name2;
  376. var alias;
  377. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  378. alias = LEGACY_ALIASES[intrinsicName];
  379. intrinsicName = "%" + alias[0] + "%";
  380. }
  381. if (hasOwn(INTRINSICS, intrinsicName)) {
  382. var value2 = INTRINSICS[intrinsicName];
  383. if (value2 === needsEval) {
  384. value2 = doEval(intrinsicName);
  385. }
  386. if (typeof value2 === "undefined" && !allowMissing) {
  387. throw new $TypeError("intrinsic " + name2 + " exists, but is not available. Please file an issue!");
  388. }
  389. return {
  390. alias,
  391. name: intrinsicName,
  392. value: value2
  393. };
  394. }
  395. throw new $SyntaxError("intrinsic " + name2 + " does not exist!");
  396. };
  397. module2.exports = function GetIntrinsic(name2, allowMissing) {
  398. if (typeof name2 !== "string" || name2.length === 0) {
  399. throw new $TypeError("intrinsic name must be a non-empty string");
  400. }
  401. if (arguments.length > 1 && typeof allowMissing !== "boolean") {
  402. throw new $TypeError('"allowMissing" argument must be a boolean');
  403. }
  404. if ($exec(/^%?[^%]*%?$/, name2) === null) {
  405. throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
  406. }
  407. var parts = stringToPath2(name2);
  408. var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
  409. var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
  410. var intrinsicRealName = intrinsic.name;
  411. var value2 = intrinsic.value;
  412. var skipFurtherCaching = false;
  413. var alias = intrinsic.alias;
  414. if (alias) {
  415. intrinsicBaseName = alias[0];
  416. $spliceApply(parts, $concat([0, 1], alias));
  417. }
  418. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  419. var part = parts[i];
  420. var first = $strSlice(part, 0, 1);
  421. var last = $strSlice(part, -1);
  422. if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
  423. throw new $SyntaxError("property names with quotes must have matching quotes");
  424. }
  425. if (part === "constructor" || !isOwn) {
  426. skipFurtherCaching = true;
  427. }
  428. intrinsicBaseName += "." + part;
  429. intrinsicRealName = "%" + intrinsicBaseName + "%";
  430. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  431. value2 = INTRINSICS[intrinsicRealName];
  432. } else if (value2 != null) {
  433. if (!(part in value2)) {
  434. if (!allowMissing) {
  435. throw new $TypeError("base intrinsic for " + name2 + " exists, but the property is not available.");
  436. }
  437. return void 0;
  438. }
  439. if ($gOPD && i + 1 >= parts.length) {
  440. var desc = $gOPD(value2, part);
  441. isOwn = !!desc;
  442. if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
  443. value2 = desc.get;
  444. } else {
  445. value2 = value2[part];
  446. }
  447. } else {
  448. isOwn = hasOwn(value2, part);
  449. value2 = value2[part];
  450. }
  451. if (isOwn && !skipFurtherCaching) {
  452. INTRINSICS[intrinsicRealName] = value2;
  453. }
  454. }
  455. }
  456. return value2;
  457. };
  458. }
  459. });
  460. // node_modules/call-bind/index.js
  461. var require_call_bind = __commonJS({
  462. "node_modules/call-bind/index.js"(exports, module2) {
  463. "use strict";
  464. var bind = require_function_bind();
  465. var GetIntrinsic = require_get_intrinsic();
  466. var $apply = GetIntrinsic("%Function.prototype.apply%");
  467. var $call = GetIntrinsic("%Function.prototype.call%");
  468. var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
  469. var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
  470. var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
  471. var $max = GetIntrinsic("%Math.max%");
  472. if ($defineProperty) {
  473. try {
  474. $defineProperty({}, "a", { value: 1 });
  475. } catch (e) {
  476. $defineProperty = null;
  477. }
  478. }
  479. module2.exports = function callBind(originalFunction) {
  480. var func = $reflectApply(bind, $call, arguments);
  481. if ($gOPD && $defineProperty) {
  482. var desc = $gOPD(func, "length");
  483. if (desc.configurable) {
  484. $defineProperty(
  485. func,
  486. "length",
  487. { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
  488. );
  489. }
  490. }
  491. return func;
  492. };
  493. var applyBind = function applyBind2() {
  494. return $reflectApply(bind, $apply, arguments);
  495. };
  496. if ($defineProperty) {
  497. $defineProperty(module2.exports, "apply", { value: applyBind });
  498. } else {
  499. module2.exports.apply = applyBind;
  500. }
  501. }
  502. });
  503. // node_modules/call-bind/callBound.js
  504. var require_callBound = __commonJS({
  505. "node_modules/call-bind/callBound.js"(exports, module2) {
  506. "use strict";
  507. var GetIntrinsic = require_get_intrinsic();
  508. var callBind = require_call_bind();
  509. var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf"));
  510. module2.exports = function callBoundIntrinsic(name2, allowMissing) {
  511. var intrinsic = GetIntrinsic(name2, !!allowMissing);
  512. if (typeof intrinsic === "function" && $indexOf(name2, ".prototype.") > -1) {
  513. return callBind(intrinsic);
  514. }
  515. return intrinsic;
  516. };
  517. }
  518. });
  519. // node_modules/has-tostringtag/shams.js
  520. var require_shams2 = __commonJS({
  521. "node_modules/has-tostringtag/shams.js"(exports, module2) {
  522. "use strict";
  523. var hasSymbols = require_shams();
  524. module2.exports = function hasToStringTagShams() {
  525. return hasSymbols() && !!Symbol.toStringTag;
  526. };
  527. }
  528. });
  529. // node_modules/is-regex/index.js
  530. var require_is_regex = __commonJS({
  531. "node_modules/is-regex/index.js"(exports, module2) {
  532. "use strict";
  533. var callBound = require_callBound();
  534. var hasToStringTag = require_shams2()();
  535. var has;
  536. var $exec;
  537. var isRegexMarker;
  538. var badStringifier;
  539. if (hasToStringTag) {
  540. has = callBound("Object.prototype.hasOwnProperty");
  541. $exec = callBound("RegExp.prototype.exec");
  542. isRegexMarker = {};
  543. throwRegexMarker = function() {
  544. throw isRegexMarker;
  545. };
  546. badStringifier = {
  547. toString: throwRegexMarker,
  548. valueOf: throwRegexMarker
  549. };
  550. if (typeof Symbol.toPrimitive === "symbol") {
  551. badStringifier[Symbol.toPrimitive] = throwRegexMarker;
  552. }
  553. }
  554. var throwRegexMarker;
  555. var $toString = callBound("Object.prototype.toString");
  556. var gOPD = Object.getOwnPropertyDescriptor;
  557. var regexClass = "[object RegExp]";
  558. module2.exports = hasToStringTag ? function isRegex(value2) {
  559. if (!value2 || typeof value2 !== "object") {
  560. return false;
  561. }
  562. var descriptor = gOPD(value2, "lastIndex");
  563. var hasLastIndexDataProperty = descriptor && has(descriptor, "value");
  564. if (!hasLastIndexDataProperty) {
  565. return false;
  566. }
  567. try {
  568. $exec(value2, badStringifier);
  569. } catch (e) {
  570. return e === isRegexMarker;
  571. }
  572. } : function isRegex(value2) {
  573. if (!value2 || typeof value2 !== "object" && typeof value2 !== "function") {
  574. return false;
  575. }
  576. return $toString(value2) === regexClass;
  577. };
  578. }
  579. });
  580. // node_modules/is-function/index.js
  581. var require_is_function = __commonJS({
  582. "node_modules/is-function/index.js"(exports, module2) {
  583. module2.exports = isFunction3;
  584. var toString2 = Object.prototype.toString;
  585. function isFunction3(fn) {
  586. if (!fn) {
  587. return false;
  588. }
  589. var string = toString2.call(fn);
  590. return string === "[object Function]" || typeof fn === "function" && string !== "[object RegExp]" || typeof window !== "undefined" && (fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt);
  591. }
  592. }
  593. });
  594. // node_modules/is-symbol/index.js
  595. var require_is_symbol = __commonJS({
  596. "node_modules/is-symbol/index.js"(exports, module2) {
  597. "use strict";
  598. var toStr = Object.prototype.toString;
  599. var hasSymbols = require_has_symbols()();
  600. if (hasSymbols) {
  601. symToStr = Symbol.prototype.toString;
  602. symStringRegex = /^Symbol\(.*\)$/;
  603. isSymbolObject = function isRealSymbolObject(value2) {
  604. if (typeof value2.valueOf() !== "symbol") {
  605. return false;
  606. }
  607. return symStringRegex.test(symToStr.call(value2));
  608. };
  609. module2.exports = function isSymbol3(value2) {
  610. if (typeof value2 === "symbol") {
  611. return true;
  612. }
  613. if (toStr.call(value2) !== "[object Symbol]") {
  614. return false;
  615. }
  616. try {
  617. return isSymbolObject(value2);
  618. } catch (e) {
  619. return false;
  620. }
  621. };
  622. } else {
  623. module2.exports = function isSymbol3(value2) {
  624. return false;
  625. };
  626. }
  627. var symToStr;
  628. var symStringRegex;
  629. var isSymbolObject;
  630. }
  631. });
  632. // src/index.ts
  633. var src_exports = {};
  634. __export(src_exports, {
  635. isJSON: () => isJSON,
  636. parse: () => parse,
  637. replacer: () => replacer,
  638. reviver: () => reviver2,
  639. stringify: () => stringify
  640. });
  641. module.exports = __toCommonJS(src_exports);
  642. var import_is_regex = __toESM(require_is_regex());
  643. var import_is_function = __toESM(require_is_function());
  644. var import_is_symbol = __toESM(require_is_symbol());
  645. // node_modules/isobject/index.js
  646. function isObject(val) {
  647. return val != null && typeof val === "object" && Array.isArray(val) === false;
  648. }
  649. // node_modules/lodash-es/_freeGlobal.js
  650. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  651. var freeGlobal_default = freeGlobal;
  652. // node_modules/lodash-es/_root.js
  653. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  654. var root2 = freeGlobal_default || freeSelf || Function("return this")();
  655. var root_default = root2;
  656. // node_modules/lodash-es/_Symbol.js
  657. var Symbol2 = root_default.Symbol;
  658. var Symbol_default = Symbol2;
  659. // node_modules/lodash-es/_getRawTag.js
  660. var objectProto = Object.prototype;
  661. var hasOwnProperty = objectProto.hasOwnProperty;
  662. var nativeObjectToString = objectProto.toString;
  663. var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
  664. function getRawTag(value2) {
  665. var isOwn = hasOwnProperty.call(value2, symToStringTag), tag = value2[symToStringTag];
  666. try {
  667. value2[symToStringTag] = void 0;
  668. var unmasked = true;
  669. } catch (e) {
  670. }
  671. var result2 = nativeObjectToString.call(value2);
  672. if (unmasked) {
  673. if (isOwn) {
  674. value2[symToStringTag] = tag;
  675. } else {
  676. delete value2[symToStringTag];
  677. }
  678. }
  679. return result2;
  680. }
  681. var getRawTag_default = getRawTag;
  682. // node_modules/lodash-es/_objectToString.js
  683. var objectProto2 = Object.prototype;
  684. var nativeObjectToString2 = objectProto2.toString;
  685. function objectToString(value2) {
  686. return nativeObjectToString2.call(value2);
  687. }
  688. var objectToString_default = objectToString;
  689. // node_modules/lodash-es/_baseGetTag.js
  690. var nullTag = "[object Null]";
  691. var undefinedTag = "[object Undefined]";
  692. var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
  693. function baseGetTag(value2) {
  694. if (value2 == null) {
  695. return value2 === void 0 ? undefinedTag : nullTag;
  696. }
  697. return symToStringTag2 && symToStringTag2 in Object(value2) ? getRawTag_default(value2) : objectToString_default(value2);
  698. }
  699. var baseGetTag_default = baseGetTag;
  700. // node_modules/lodash-es/isObjectLike.js
  701. function isObjectLike(value2) {
  702. return value2 != null && typeof value2 == "object";
  703. }
  704. var isObjectLike_default = isObjectLike;
  705. // node_modules/lodash-es/isSymbol.js
  706. var symbolTag = "[object Symbol]";
  707. function isSymbol(value2) {
  708. return typeof value2 == "symbol" || isObjectLike_default(value2) && baseGetTag_default(value2) == symbolTag;
  709. }
  710. var isSymbol_default = isSymbol;
  711. // node_modules/lodash-es/_arrayMap.js
  712. function arrayMap(array, iteratee) {
  713. var index = -1, length = array == null ? 0 : array.length, result2 = Array(length);
  714. while (++index < length) {
  715. result2[index] = iteratee(array[index], index, array);
  716. }
  717. return result2;
  718. }
  719. var arrayMap_default = arrayMap;
  720. // node_modules/lodash-es/isArray.js
  721. var isArray = Array.isArray;
  722. var isArray_default = isArray;
  723. // node_modules/lodash-es/_baseToString.js
  724. var INFINITY = 1 / 0;
  725. var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
  726. var symbolToString = symbolProto ? symbolProto.toString : void 0;
  727. function baseToString(value2) {
  728. if (typeof value2 == "string") {
  729. return value2;
  730. }
  731. if (isArray_default(value2)) {
  732. return arrayMap_default(value2, baseToString) + "";
  733. }
  734. if (isSymbol_default(value2)) {
  735. return symbolToString ? symbolToString.call(value2) : "";
  736. }
  737. var result2 = value2 + "";
  738. return result2 == "0" && 1 / value2 == -INFINITY ? "-0" : result2;
  739. }
  740. var baseToString_default = baseToString;
  741. // node_modules/lodash-es/isObject.js
  742. function isObject2(value2) {
  743. var type = typeof value2;
  744. return value2 != null && (type == "object" || type == "function");
  745. }
  746. var isObject_default = isObject2;
  747. // node_modules/lodash-es/isFunction.js
  748. var asyncTag = "[object AsyncFunction]";
  749. var funcTag = "[object Function]";
  750. var genTag = "[object GeneratorFunction]";
  751. var proxyTag = "[object Proxy]";
  752. function isFunction(value2) {
  753. if (!isObject_default(value2)) {
  754. return false;
  755. }
  756. var tag = baseGetTag_default(value2);
  757. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  758. }
  759. var isFunction_default = isFunction;
  760. // node_modules/lodash-es/_coreJsData.js
  761. var coreJsData = root_default["__core-js_shared__"];
  762. var coreJsData_default = coreJsData;
  763. // node_modules/lodash-es/_isMasked.js
  764. var maskSrcKey = function() {
  765. var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
  766. return uid ? "Symbol(src)_1." + uid : "";
  767. }();
  768. function isMasked(func) {
  769. return !!maskSrcKey && maskSrcKey in func;
  770. }
  771. var isMasked_default = isMasked;
  772. // node_modules/lodash-es/_toSource.js
  773. var funcProto = Function.prototype;
  774. var funcToString = funcProto.toString;
  775. function toSource(func) {
  776. if (func != null) {
  777. try {
  778. return funcToString.call(func);
  779. } catch (e) {
  780. }
  781. try {
  782. return func + "";
  783. } catch (e) {
  784. }
  785. }
  786. return "";
  787. }
  788. var toSource_default = toSource;
  789. // node_modules/lodash-es/_baseIsNative.js
  790. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  791. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  792. var funcProto2 = Function.prototype;
  793. var objectProto3 = Object.prototype;
  794. var funcToString2 = funcProto2.toString;
  795. var hasOwnProperty2 = objectProto3.hasOwnProperty;
  796. var reIsNative = RegExp(
  797. "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  798. );
  799. function baseIsNative(value2) {
  800. if (!isObject_default(value2) || isMasked_default(value2)) {
  801. return false;
  802. }
  803. var pattern = isFunction_default(value2) ? reIsNative : reIsHostCtor;
  804. return pattern.test(toSource_default(value2));
  805. }
  806. var baseIsNative_default = baseIsNative;
  807. // node_modules/lodash-es/_getValue.js
  808. function getValue(object, key2) {
  809. return object == null ? void 0 : object[key2];
  810. }
  811. var getValue_default = getValue;
  812. // node_modules/lodash-es/_getNative.js
  813. function getNative(object, key2) {
  814. var value2 = getValue_default(object, key2);
  815. return baseIsNative_default(value2) ? value2 : void 0;
  816. }
  817. var getNative_default = getNative;
  818. // node_modules/lodash-es/eq.js
  819. function eq(value2, other) {
  820. return value2 === other || value2 !== value2 && other !== other;
  821. }
  822. var eq_default = eq;
  823. // node_modules/lodash-es/_isKey.js
  824. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  825. var reIsPlainProp = /^\w*$/;
  826. function isKey(value2, object) {
  827. if (isArray_default(value2)) {
  828. return false;
  829. }
  830. var type = typeof value2;
  831. if (type == "number" || type == "symbol" || type == "boolean" || value2 == null || isSymbol_default(value2)) {
  832. return true;
  833. }
  834. return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object != null && value2 in Object(object);
  835. }
  836. var isKey_default = isKey;
  837. // node_modules/lodash-es/_nativeCreate.js
  838. var nativeCreate = getNative_default(Object, "create");
  839. var nativeCreate_default = nativeCreate;
  840. // node_modules/lodash-es/_hashClear.js
  841. function hashClear() {
  842. this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
  843. this.size = 0;
  844. }
  845. var hashClear_default = hashClear;
  846. // node_modules/lodash-es/_hashDelete.js
  847. function hashDelete(key2) {
  848. var result2 = this.has(key2) && delete this.__data__[key2];
  849. this.size -= result2 ? 1 : 0;
  850. return result2;
  851. }
  852. var hashDelete_default = hashDelete;
  853. // node_modules/lodash-es/_hashGet.js
  854. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  855. var objectProto4 = Object.prototype;
  856. var hasOwnProperty3 = objectProto4.hasOwnProperty;
  857. function hashGet(key2) {
  858. var data = this.__data__;
  859. if (nativeCreate_default) {
  860. var result2 = data[key2];
  861. return result2 === HASH_UNDEFINED ? void 0 : result2;
  862. }
  863. return hasOwnProperty3.call(data, key2) ? data[key2] : void 0;
  864. }
  865. var hashGet_default = hashGet;
  866. // node_modules/lodash-es/_hashHas.js
  867. var objectProto5 = Object.prototype;
  868. var hasOwnProperty4 = objectProto5.hasOwnProperty;
  869. function hashHas(key2) {
  870. var data = this.__data__;
  871. return nativeCreate_default ? data[key2] !== void 0 : hasOwnProperty4.call(data, key2);
  872. }
  873. var hashHas_default = hashHas;
  874. // node_modules/lodash-es/_hashSet.js
  875. var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
  876. function hashSet(key2, value2) {
  877. var data = this.__data__;
  878. this.size += this.has(key2) ? 0 : 1;
  879. data[key2] = nativeCreate_default && value2 === void 0 ? HASH_UNDEFINED2 : value2;
  880. return this;
  881. }
  882. var hashSet_default = hashSet;
  883. // node_modules/lodash-es/_Hash.js
  884. function Hash(entries) {
  885. var index = -1, length = entries == null ? 0 : entries.length;
  886. this.clear();
  887. while (++index < length) {
  888. var entry = entries[index];
  889. this.set(entry[0], entry[1]);
  890. }
  891. }
  892. Hash.prototype.clear = hashClear_default;
  893. Hash.prototype["delete"] = hashDelete_default;
  894. Hash.prototype.get = hashGet_default;
  895. Hash.prototype.has = hashHas_default;
  896. Hash.prototype.set = hashSet_default;
  897. var Hash_default = Hash;
  898. // node_modules/lodash-es/_listCacheClear.js
  899. function listCacheClear() {
  900. this.__data__ = [];
  901. this.size = 0;
  902. }
  903. var listCacheClear_default = listCacheClear;
  904. // node_modules/lodash-es/_assocIndexOf.js
  905. function assocIndexOf(array, key2) {
  906. var length = array.length;
  907. while (length--) {
  908. if (eq_default(array[length][0], key2)) {
  909. return length;
  910. }
  911. }
  912. return -1;
  913. }
  914. var assocIndexOf_default = assocIndexOf;
  915. // node_modules/lodash-es/_listCacheDelete.js
  916. var arrayProto = Array.prototype;
  917. var splice = arrayProto.splice;
  918. function listCacheDelete(key2) {
  919. var data = this.__data__, index = assocIndexOf_default(data, key2);
  920. if (index < 0) {
  921. return false;
  922. }
  923. var lastIndex = data.length - 1;
  924. if (index == lastIndex) {
  925. data.pop();
  926. } else {
  927. splice.call(data, index, 1);
  928. }
  929. --this.size;
  930. return true;
  931. }
  932. var listCacheDelete_default = listCacheDelete;
  933. // node_modules/lodash-es/_listCacheGet.js
  934. function listCacheGet(key2) {
  935. var data = this.__data__, index = assocIndexOf_default(data, key2);
  936. return index < 0 ? void 0 : data[index][1];
  937. }
  938. var listCacheGet_default = listCacheGet;
  939. // node_modules/lodash-es/_listCacheHas.js
  940. function listCacheHas(key2) {
  941. return assocIndexOf_default(this.__data__, key2) > -1;
  942. }
  943. var listCacheHas_default = listCacheHas;
  944. // node_modules/lodash-es/_listCacheSet.js
  945. function listCacheSet(key2, value2) {
  946. var data = this.__data__, index = assocIndexOf_default(data, key2);
  947. if (index < 0) {
  948. ++this.size;
  949. data.push([key2, value2]);
  950. } else {
  951. data[index][1] = value2;
  952. }
  953. return this;
  954. }
  955. var listCacheSet_default = listCacheSet;
  956. // node_modules/lodash-es/_ListCache.js
  957. function ListCache(entries) {
  958. var index = -1, length = entries == null ? 0 : entries.length;
  959. this.clear();
  960. while (++index < length) {
  961. var entry = entries[index];
  962. this.set(entry[0], entry[1]);
  963. }
  964. }
  965. ListCache.prototype.clear = listCacheClear_default;
  966. ListCache.prototype["delete"] = listCacheDelete_default;
  967. ListCache.prototype.get = listCacheGet_default;
  968. ListCache.prototype.has = listCacheHas_default;
  969. ListCache.prototype.set = listCacheSet_default;
  970. var ListCache_default = ListCache;
  971. // node_modules/lodash-es/_Map.js
  972. var Map2 = getNative_default(root_default, "Map");
  973. var Map_default = Map2;
  974. // node_modules/lodash-es/_mapCacheClear.js
  975. function mapCacheClear() {
  976. this.size = 0;
  977. this.__data__ = {
  978. "hash": new Hash_default(),
  979. "map": new (Map_default || ListCache_default)(),
  980. "string": new Hash_default()
  981. };
  982. }
  983. var mapCacheClear_default = mapCacheClear;
  984. // node_modules/lodash-es/_isKeyable.js
  985. function isKeyable(value2) {
  986. var type = typeof value2;
  987. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value2 !== "__proto__" : value2 === null;
  988. }
  989. var isKeyable_default = isKeyable;
  990. // node_modules/lodash-es/_getMapData.js
  991. function getMapData(map, key2) {
  992. var data = map.__data__;
  993. return isKeyable_default(key2) ? data[typeof key2 == "string" ? "string" : "hash"] : data.map;
  994. }
  995. var getMapData_default = getMapData;
  996. // node_modules/lodash-es/_mapCacheDelete.js
  997. function mapCacheDelete(key2) {
  998. var result2 = getMapData_default(this, key2)["delete"](key2);
  999. this.size -= result2 ? 1 : 0;
  1000. return result2;
  1001. }
  1002. var mapCacheDelete_default = mapCacheDelete;
  1003. // node_modules/lodash-es/_mapCacheGet.js
  1004. function mapCacheGet(key2) {
  1005. return getMapData_default(this, key2).get(key2);
  1006. }
  1007. var mapCacheGet_default = mapCacheGet;
  1008. // node_modules/lodash-es/_mapCacheHas.js
  1009. function mapCacheHas(key2) {
  1010. return getMapData_default(this, key2).has(key2);
  1011. }
  1012. var mapCacheHas_default = mapCacheHas;
  1013. // node_modules/lodash-es/_mapCacheSet.js
  1014. function mapCacheSet(key2, value2) {
  1015. var data = getMapData_default(this, key2), size = data.size;
  1016. data.set(key2, value2);
  1017. this.size += data.size == size ? 0 : 1;
  1018. return this;
  1019. }
  1020. var mapCacheSet_default = mapCacheSet;
  1021. // node_modules/lodash-es/_MapCache.js
  1022. function MapCache(entries) {
  1023. var index = -1, length = entries == null ? 0 : entries.length;
  1024. this.clear();
  1025. while (++index < length) {
  1026. var entry = entries[index];
  1027. this.set(entry[0], entry[1]);
  1028. }
  1029. }
  1030. MapCache.prototype.clear = mapCacheClear_default;
  1031. MapCache.prototype["delete"] = mapCacheDelete_default;
  1032. MapCache.prototype.get = mapCacheGet_default;
  1033. MapCache.prototype.has = mapCacheHas_default;
  1034. MapCache.prototype.set = mapCacheSet_default;
  1035. var MapCache_default = MapCache;
  1036. // node_modules/lodash-es/memoize.js
  1037. var FUNC_ERROR_TEXT = "Expected a function";
  1038. function memoize(func, resolver) {
  1039. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1040. throw new TypeError(FUNC_ERROR_TEXT);
  1041. }
  1042. var memoized = function() {
  1043. var args2 = arguments, key2 = resolver ? resolver.apply(this, args2) : args2[0], cache = memoized.cache;
  1044. if (cache.has(key2)) {
  1045. return cache.get(key2);
  1046. }
  1047. var result2 = func.apply(this, args2);
  1048. memoized.cache = cache.set(key2, result2) || cache;
  1049. return result2;
  1050. };
  1051. memoized.cache = new (memoize.Cache || MapCache_default)();
  1052. return memoized;
  1053. }
  1054. memoize.Cache = MapCache_default;
  1055. var memoize_default = memoize;
  1056. // node_modules/lodash-es/_memoizeCapped.js
  1057. var MAX_MEMOIZE_SIZE = 500;
  1058. function memoizeCapped(func) {
  1059. var result2 = memoize_default(func, function(key2) {
  1060. if (cache.size === MAX_MEMOIZE_SIZE) {
  1061. cache.clear();
  1062. }
  1063. return key2;
  1064. });
  1065. var cache = result2.cache;
  1066. return result2;
  1067. }
  1068. var memoizeCapped_default = memoizeCapped;
  1069. // node_modules/lodash-es/_stringToPath.js
  1070. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1071. var reEscapeChar = /\\(\\)?/g;
  1072. var stringToPath = memoizeCapped_default(function(string) {
  1073. var result2 = [];
  1074. if (string.charCodeAt(0) === 46) {
  1075. result2.push("");
  1076. }
  1077. string.replace(rePropName, function(match, number, quote, subString) {
  1078. result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  1079. });
  1080. return result2;
  1081. });
  1082. var stringToPath_default = stringToPath;
  1083. // node_modules/lodash-es/toString.js
  1084. function toString(value2) {
  1085. return value2 == null ? "" : baseToString_default(value2);
  1086. }
  1087. var toString_default = toString;
  1088. // node_modules/lodash-es/_castPath.js
  1089. function castPath(value2, object) {
  1090. if (isArray_default(value2)) {
  1091. return value2;
  1092. }
  1093. return isKey_default(value2, object) ? [value2] : stringToPath_default(toString_default(value2));
  1094. }
  1095. var castPath_default = castPath;
  1096. // node_modules/lodash-es/_toKey.js
  1097. var INFINITY2 = 1 / 0;
  1098. function toKey(value2) {
  1099. if (typeof value2 == "string" || isSymbol_default(value2)) {
  1100. return value2;
  1101. }
  1102. var result2 = value2 + "";
  1103. return result2 == "0" && 1 / value2 == -INFINITY2 ? "-0" : result2;
  1104. }
  1105. var toKey_default = toKey;
  1106. // node_modules/lodash-es/_baseGet.js
  1107. function baseGet(object, path) {
  1108. path = castPath_default(path, object);
  1109. var index = 0, length = path.length;
  1110. while (object != null && index < length) {
  1111. object = object[toKey_default(path[index++])];
  1112. }
  1113. return index && index == length ? object : void 0;
  1114. }
  1115. var baseGet_default = baseGet;
  1116. // node_modules/lodash-es/get.js
  1117. function get(object, path, defaultValue) {
  1118. var result2 = object == null ? void 0 : baseGet_default(object, path);
  1119. return result2 === void 0 ? defaultValue : result2;
  1120. }
  1121. var get_default = get;
  1122. // src/index.ts
  1123. var import_memoizerific = __toESM(require("memoizerific"));
  1124. // src/dom-event.ts
  1125. var eventProperties = [
  1126. "bubbles",
  1127. "cancelBubble",
  1128. "cancelable",
  1129. "composed",
  1130. "currentTarget",
  1131. "defaultPrevented",
  1132. "eventPhase",
  1133. "isTrusted",
  1134. "returnValue",
  1135. "srcElement",
  1136. "target",
  1137. "timeStamp",
  1138. "type"
  1139. ];
  1140. var customEventSpecificProperties = ["detail"];
  1141. function extractEventHiddenProperties(event) {
  1142. const rebuildEvent = eventProperties.filter((value2) => event[value2] !== void 0).reduce((acc, value2) => {
  1143. return { ...acc, [value2]: event[value2] };
  1144. }, {});
  1145. if (event instanceof CustomEvent) {
  1146. customEventSpecificProperties.filter((value2) => event[value2] !== void 0).forEach((value2) => {
  1147. rebuildEvent[value2] = event[value2];
  1148. });
  1149. }
  1150. return rebuildEvent;
  1151. }
  1152. // src/index.ts
  1153. var isObject3 = isObject;
  1154. var removeCodeComments = (code) => {
  1155. let inQuoteChar = null;
  1156. let inBlockComment = false;
  1157. let inLineComment = false;
  1158. let inRegexLiteral = false;
  1159. let newCode = "";
  1160. if (code.indexOf("//") >= 0 || code.indexOf("/*") >= 0) {
  1161. for (let i = 0; i < code.length; i += 1) {
  1162. if (!inQuoteChar && !inBlockComment && !inLineComment && !inRegexLiteral) {
  1163. if (code[i] === '"' || code[i] === "'" || code[i] === "`") {
  1164. inQuoteChar = code[i];
  1165. } else if (code[i] === "/" && code[i + 1] === "*") {
  1166. inBlockComment = true;
  1167. } else if (code[i] === "/" && code[i + 1] === "/") {
  1168. inLineComment = true;
  1169. } else if (code[i] === "/" && code[i + 1] !== "/") {
  1170. inRegexLiteral = true;
  1171. }
  1172. } else {
  1173. if (inQuoteChar && (code[i] === inQuoteChar && code[i - 1] !== "\\" || code[i] === "\n" && inQuoteChar !== "`")) {
  1174. inQuoteChar = null;
  1175. }
  1176. if (inRegexLiteral && (code[i] === "/" && code[i - 1] !== "\\" || code[i] === "\n")) {
  1177. inRegexLiteral = false;
  1178. }
  1179. if (inBlockComment && code[i - 1] === "/" && code[i - 2] === "*") {
  1180. inBlockComment = false;
  1181. }
  1182. if (inLineComment && code[i] === "\n") {
  1183. inLineComment = false;
  1184. }
  1185. }
  1186. if (!inBlockComment && !inLineComment) {
  1187. newCode += code[i];
  1188. }
  1189. }
  1190. } else {
  1191. newCode = code;
  1192. }
  1193. return newCode;
  1194. };
  1195. var cleanCode = (0, import_memoizerific.default)(1e4)(
  1196. (code) => removeCodeComments(code).replace(/\n\s*/g, "").trim()
  1197. );
  1198. var convertShorthandMethods = function convertShorthandMethods2(key2, stringified) {
  1199. const fnHead = stringified.slice(0, stringified.indexOf("{"));
  1200. const fnBody = stringified.slice(stringified.indexOf("{"));
  1201. if (fnHead.includes("=>")) {
  1202. return stringified;
  1203. }
  1204. if (fnHead.includes("function")) {
  1205. return stringified;
  1206. }
  1207. let modifiedHead = fnHead;
  1208. modifiedHead = modifiedHead.replace(key2, "function");
  1209. return modifiedHead + fnBody;
  1210. };
  1211. var dateFormat = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/;
  1212. var isJSON = (input) => input.match(/^[\[\{\"\}].*[\]\}\"]$/);
  1213. function convertUnconventionalData(data) {
  1214. if (!isObject3(data)) {
  1215. return data;
  1216. }
  1217. let result2 = data;
  1218. let wasMutated = false;
  1219. if (typeof Event !== "undefined" && data instanceof Event) {
  1220. result2 = extractEventHiddenProperties(result2);
  1221. wasMutated = true;
  1222. }
  1223. result2 = Object.keys(result2).reduce((acc, key2) => {
  1224. try {
  1225. if (result2[key2]) {
  1226. result2[key2].toJSON;
  1227. }
  1228. acc[key2] = result2[key2];
  1229. } catch (err) {
  1230. wasMutated = true;
  1231. }
  1232. return acc;
  1233. }, {});
  1234. return wasMutated ? result2 : data;
  1235. }
  1236. var replacer = function replacer2(options2) {
  1237. let objects;
  1238. let map;
  1239. let stack;
  1240. let keys;
  1241. return function replace(key2, value2) {
  1242. try {
  1243. if (key2 === "") {
  1244. keys = [];
  1245. objects = /* @__PURE__ */ new Map([[value2, "[]"]]);
  1246. map = /* @__PURE__ */ new Map();
  1247. stack = [];
  1248. return value2;
  1249. }
  1250. const origin = map.get(this) || this;
  1251. while (stack.length && origin !== stack[0]) {
  1252. stack.shift();
  1253. keys.pop();
  1254. }
  1255. if (typeof value2 === "boolean") {
  1256. return value2;
  1257. }
  1258. if (value2 === void 0) {
  1259. if (!options2.allowUndefined) {
  1260. return void 0;
  1261. }
  1262. return "_undefined_";
  1263. }
  1264. if (value2 === null) {
  1265. return null;
  1266. }
  1267. if (typeof value2 === "number") {
  1268. if (value2 === -Infinity) {
  1269. return "_-Infinity_";
  1270. }
  1271. if (value2 === Infinity) {
  1272. return "_Infinity_";
  1273. }
  1274. if (Number.isNaN(value2)) {
  1275. return "_NaN_";
  1276. }
  1277. return value2;
  1278. }
  1279. if (typeof value2 === "bigint") {
  1280. return `_bigint_${value2.toString()}`;
  1281. }
  1282. if (typeof value2 === "string") {
  1283. if (dateFormat.test(value2)) {
  1284. if (!options2.allowDate) {
  1285. return void 0;
  1286. }
  1287. return `_date_${value2}`;
  1288. }
  1289. return value2;
  1290. }
  1291. if ((0, import_is_regex.default)(value2)) {
  1292. if (!options2.allowRegExp) {
  1293. return void 0;
  1294. }
  1295. return `_regexp_${value2.flags}|${value2.source}`;
  1296. }
  1297. if ((0, import_is_function.default)(value2)) {
  1298. if (!options2.allowFunction) {
  1299. return void 0;
  1300. }
  1301. const { name: name2 } = value2;
  1302. const stringified = value2.toString();
  1303. if (!stringified.match(
  1304. /(\[native code\]|WEBPACK_IMPORTED_MODULE|__webpack_exports__|__webpack_require__)/
  1305. )) {
  1306. return `_function_${name2}|${cleanCode(convertShorthandMethods(key2, stringified))}`;
  1307. }
  1308. return `_function_${name2}|${(() => {
  1309. }).toString()}`;
  1310. }
  1311. if ((0, import_is_symbol.default)(value2)) {
  1312. if (!options2.allowSymbol) {
  1313. return void 0;
  1314. }
  1315. const globalRegistryKey = Symbol.keyFor(value2);
  1316. if (globalRegistryKey !== void 0) {
  1317. return `_gsymbol_${globalRegistryKey}`;
  1318. }
  1319. return `_symbol_${value2.toString().slice(7, -1)}`;
  1320. }
  1321. if (stack.length >= options2.maxDepth) {
  1322. if (Array.isArray(value2)) {
  1323. return `[Array(${value2.length})]`;
  1324. }
  1325. return "[Object]";
  1326. }
  1327. if (value2 === this) {
  1328. return `_duplicate_${JSON.stringify(keys)}`;
  1329. }
  1330. if (value2 instanceof Error && options2.allowError) {
  1331. return {
  1332. __isConvertedError__: true,
  1333. errorProperties: {
  1334. ...value2.cause ? { cause: value2.cause } : {},
  1335. ...value2,
  1336. name: value2.name,
  1337. message: value2.message,
  1338. stack: value2.stack,
  1339. "_constructor-name_": value2.constructor.name
  1340. }
  1341. };
  1342. }
  1343. if (value2.constructor && value2.constructor.name && value2.constructor.name !== "Object" && !Array.isArray(value2) && !options2.allowClass) {
  1344. return void 0;
  1345. }
  1346. const found = objects.get(value2);
  1347. if (!found) {
  1348. const converted = Array.isArray(value2) ? value2 : convertUnconventionalData(value2);
  1349. if (value2.constructor && value2.constructor.name && value2.constructor.name !== "Object" && !Array.isArray(value2) && options2.allowClass) {
  1350. try {
  1351. Object.assign(converted, { "_constructor-name_": value2.constructor.name });
  1352. } catch (e) {
  1353. }
  1354. }
  1355. keys.push(key2);
  1356. stack.unshift(converted);
  1357. objects.set(value2, JSON.stringify(keys));
  1358. if (value2 !== converted) {
  1359. map.set(value2, converted);
  1360. }
  1361. return converted;
  1362. }
  1363. return `_duplicate_${found}`;
  1364. } catch (e) {
  1365. return void 0;
  1366. }
  1367. };
  1368. };
  1369. var reviver2 = function reviver(options) {
  1370. const refs = [];
  1371. let root;
  1372. return function revive(key, value) {
  1373. if (key === "") {
  1374. root = value;
  1375. refs.forEach(({ target, container, replacement }) => {
  1376. const replacementArr = isJSON(replacement) ? JSON.parse(replacement) : replacement.split(".");
  1377. if (replacementArr.length === 0) {
  1378. container[target] = root;
  1379. } else {
  1380. container[target] = get_default(root, replacementArr);
  1381. }
  1382. });
  1383. }
  1384. if (key === "_constructor-name_") {
  1385. return value;
  1386. }
  1387. if (isObject3(value) && value.__isConvertedError__) {
  1388. const { message, ...properties } = value.errorProperties;
  1389. const error = new Error(message);
  1390. Object.assign(error, properties);
  1391. return error;
  1392. }
  1393. if (isObject3(value) && value["_constructor-name_"] && options.allowFunction) {
  1394. const name2 = value["_constructor-name_"];
  1395. if (name2 !== "Object") {
  1396. const Fn = new Function(`return function ${name2.replace(/[^a-zA-Z0-9$_]+/g, "")}(){}`)();
  1397. Object.setPrototypeOf(value, new Fn());
  1398. }
  1399. delete value["_constructor-name_"];
  1400. return value;
  1401. }
  1402. if (typeof value === "string" && value.startsWith("_function_") && options.allowFunction) {
  1403. const [, name, source] = value.match(/_function_([^|]*)\|(.*)/) || [];
  1404. const sourceSanitized = source.replace(/[(\(\))|\\| |\]|`]*$/, "");
  1405. if (!options.lazyEval) {
  1406. return eval(`(${sourceSanitized})`);
  1407. }
  1408. const result = (...args) => {
  1409. const f = eval(`(${sourceSanitized})`);
  1410. return f(...args);
  1411. };
  1412. Object.defineProperty(result, "toString", {
  1413. value: () => sourceSanitized
  1414. });
  1415. Object.defineProperty(result, "name", {
  1416. value: name
  1417. });
  1418. return result;
  1419. }
  1420. if (typeof value === "string" && value.startsWith("_regexp_") && options.allowRegExp) {
  1421. const [, flags, source2] = value.match(/_regexp_([^|]*)\|(.*)/) || [];
  1422. return new RegExp(source2, flags);
  1423. }
  1424. if (typeof value === "string" && value.startsWith("_date_") && options.allowDate) {
  1425. return new Date(value.replace("_date_", ""));
  1426. }
  1427. if (typeof value === "string" && value.startsWith("_duplicate_")) {
  1428. refs.push({ target: key, container: this, replacement: value.replace(/^_duplicate_/, "") });
  1429. return null;
  1430. }
  1431. if (typeof value === "string" && value.startsWith("_symbol_") && options.allowSymbol) {
  1432. return Symbol(value.replace("_symbol_", ""));
  1433. }
  1434. if (typeof value === "string" && value.startsWith("_gsymbol_") && options.allowSymbol) {
  1435. return Symbol.for(value.replace("_gsymbol_", ""));
  1436. }
  1437. if (typeof value === "string" && value === "_-Infinity_") {
  1438. return -Infinity;
  1439. }
  1440. if (typeof value === "string" && value === "_Infinity_") {
  1441. return Infinity;
  1442. }
  1443. if (typeof value === "string" && value === "_NaN_") {
  1444. return NaN;
  1445. }
  1446. if (typeof value === "string" && value.startsWith("_bigint_") && typeof BigInt === "function") {
  1447. return BigInt(value.replace("_bigint_", ""));
  1448. }
  1449. return value;
  1450. };
  1451. };
  1452. var defaultOptions = {
  1453. maxDepth: 10,
  1454. space: void 0,
  1455. allowFunction: true,
  1456. allowRegExp: true,
  1457. allowDate: true,
  1458. allowClass: true,
  1459. allowError: true,
  1460. allowUndefined: true,
  1461. allowSymbol: true,
  1462. lazyEval: true
  1463. };
  1464. var stringify = (data, options2 = {}) => {
  1465. const mergedOptions = { ...defaultOptions, ...options2 };
  1466. return JSON.stringify(convertUnconventionalData(data), replacer(mergedOptions), options2.space);
  1467. };
  1468. var mutator = () => {
  1469. const mutated = /* @__PURE__ */ new Map();
  1470. return function mutateUndefined(value2) {
  1471. if (isObject3(value2)) {
  1472. Object.entries(value2).forEach(([k, v]) => {
  1473. if (v === "_undefined_") {
  1474. value2[k] = void 0;
  1475. } else if (!mutated.get(v)) {
  1476. mutated.set(v, true);
  1477. mutateUndefined(v);
  1478. }
  1479. });
  1480. }
  1481. if (Array.isArray(value2)) {
  1482. value2.forEach((v, index) => {
  1483. if (v === "_undefined_") {
  1484. mutated.set(v, true);
  1485. value2[index] = void 0;
  1486. } else if (!mutated.get(v)) {
  1487. mutated.set(v, true);
  1488. mutateUndefined(v);
  1489. }
  1490. });
  1491. }
  1492. };
  1493. };
  1494. var parse = (data, options2 = {}) => {
  1495. const mergedOptions = { ...defaultOptions, ...options2 };
  1496. const result2 = JSON.parse(data, reviver2(mergedOptions));
  1497. mutator()(result2);
  1498. return result2;
  1499. };
  1500. // Annotate the CommonJS export names for ESM import in node:
  1501. 0 && (module.exports = {
  1502. isJSON,
  1503. parse,
  1504. replacer,
  1505. reviver,
  1506. stringify
  1507. });
  1508. /*!
  1509. * isobject <https://github.com/jonschlinkert/isobject>
  1510. *
  1511. * Copyright (c) 2014-2017, Jon Schlinkert.
  1512. * Released under the MIT License.
  1513. */
  1514. /**
  1515. * @license
  1516. * Lodash (Custom Build) <https://lodash.com/>
  1517. * Build: `lodash modularize exports="es" -o ./`
  1518. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  1519. * Released under MIT license <https://lodash.com/license>
  1520. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1521. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1522. */