index.mjs 51 KB

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