storybook 10.1.0-alpha.10 → 10.1.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
  2. package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
  3. package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
  4. package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
  5. package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
  6. package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
  7. package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
  8. package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
  9. package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-74YHFU5B.js} +44 -109
  10. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  11. package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
  12. package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
  13. package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
  14. package/dist/_browser-chunks/chunk-BE2DAXKJ.js +2966 -0
  15. package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
  16. package/dist/_browser-chunks/chunk-EBHB6RPS.js +61 -0
  17. package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
  18. package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
  19. package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
  20. package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
  21. package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
  22. package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
  23. package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
  24. package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
  25. package/dist/_browser-chunks/{chunk-QMY4G4R2.js → chunk-L4RMQ7D7.js} +17 -64
  26. package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
  27. package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
  28. package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
  29. package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
  30. package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
  31. package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
  32. package/dist/_browser-chunks/chunk-WXP2XJ3O.js +950 -0
  33. package/dist/_browser-chunks/chunk-X3DUQ5RA.js +47 -0
  34. package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
  35. package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
  36. package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
  37. package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
  38. package/dist/_browser-chunks/{syntaxhighlighter-RJZASWHL.js → syntaxhighlighter-WKBQ5RC7.js} +704 -1848
  39. package/dist/_node-chunks/{builder-manager-HA7CYFCK.js → builder-manager-PMPHOSM2.js} +475 -1013
  40. package/dist/_node-chunks/camelcase-K3IOOFQW.js +18 -0
  41. package/dist/_node-chunks/{chunk-X4XU27M6.js → chunk-32NE3UE3.js} +15 -24
  42. package/dist/_node-chunks/chunk-4GZCFQFG.js +58 -0
  43. package/dist/_node-chunks/chunk-5QK5MSOI.js +943 -0
  44. package/dist/_node-chunks/{chunk-VPR5IBMG.js → chunk-6ZOLETQK.js} +8 -10
  45. package/dist/_node-chunks/chunk-7I22Y76Z.js +1047 -0
  46. package/dist/_node-chunks/chunk-AKTRSR3O.js +72 -0
  47. package/dist/_node-chunks/chunk-BBOP3XCK.js +119 -0
  48. package/dist/_node-chunks/chunk-C2GQVDWI.js +34 -0
  49. package/dist/_node-chunks/{chunk-ZHSCUGNP.js → chunk-GG2WQZSG.js} +3799 -7849
  50. package/dist/_node-chunks/chunk-GQJOWVVR.js +3214 -0
  51. package/dist/_node-chunks/chunk-JCRM2YVK.js +3009 -0
  52. package/dist/_node-chunks/chunk-KK4AT5F3.js +1029 -0
  53. package/dist/_node-chunks/chunk-L7MYXJUM.js +1114 -0
  54. package/dist/_node-chunks/{chunk-F3XOPI6H.js → chunk-LCZO45L7.js} +469 -983
  55. package/dist/_node-chunks/chunk-LR3QITDI.js +209 -0
  56. package/dist/_node-chunks/chunk-LXG4DK35.js +3171 -0
  57. package/dist/_node-chunks/chunk-MJ3WOS6F.js +37 -0
  58. package/dist/_node-chunks/chunk-PHOZWZZO.js +61 -0
  59. package/dist/_node-chunks/chunk-QECOQWRJ.js +936 -0
  60. package/dist/_node-chunks/chunk-QH4V5YDB.js +20 -0
  61. package/dist/_node-chunks/chunk-R6HWGZWD.js +26 -0
  62. package/dist/_node-chunks/chunk-SPQXMU2Q.js +759 -0
  63. package/dist/_node-chunks/chunk-TXZY6V6O.js +1564 -0
  64. package/dist/_node-chunks/chunk-UGDPX5LE.js +756 -0
  65. package/dist/_node-chunks/chunk-UY26MQLT.js +603 -0
  66. package/dist/_node-chunks/chunk-WK3EMYK6.js +61 -0
  67. package/dist/_node-chunks/{chunk-OVXB5GGT.js → chunk-WLHMN7AP.js} +292 -688
  68. package/dist/_node-chunks/chunk-XGVLB4UJ.js +54 -0
  69. package/dist/_node-chunks/{chunk-RMHAL25C.js → chunk-YHRFI6BE.js} +87 -227
  70. package/dist/_node-chunks/chunk-YK4KVMFW.js +18 -0
  71. package/dist/_node-chunks/chunk-ZZALGOA6.js +4523 -0
  72. package/dist/_node-chunks/chunk-ZZPBSYA5.js +301 -0
  73. package/dist/_node-chunks/chunk-ZZSRFAC6.js +45571 -0
  74. package/dist/_node-chunks/dist-4DWOCZUD.js +121 -0
  75. package/dist/_node-chunks/globby-AAARUKEU.js +3452 -0
  76. package/dist/_node-chunks/lib-HEUKGL62.js +366 -0
  77. package/dist/_node-chunks/mdx-N42X6CFJ-DCVRPS6N.js +14329 -0
  78. package/dist/_node-chunks/p-limit-F5ZKJ6WZ.js +116 -0
  79. package/dist/_node-chunks/plugin-7YY7JXCH.js +123 -0
  80. package/dist/_node-chunks/{plugin-6ZPCS4LI.js → plugin-SZP3CW6W.js} +36 -56
  81. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +46623 -0
  82. package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +92 -0
  83. package/dist/actions/decorator.js +21 -42
  84. package/dist/actions/index.js +3 -3
  85. package/dist/babel/index.d.ts +671 -335
  86. package/dist/babel/index.js +11 -11
  87. package/dist/bin/core.js +592 -1546
  88. package/dist/bin/dispatcher.js +26 -37
  89. package/dist/bin/loader.js +23 -34
  90. package/dist/channels/index.js +98 -234
  91. package/dist/cli/index.js +1951 -5308
  92. package/dist/client-logger/index.js +31 -61
  93. package/dist/common/index.js +20 -20
  94. package/dist/components/index.js +4211 -8586
  95. package/dist/core-events/index.js +2 -66
  96. package/dist/core-server/index.js +3054 -7290
  97. package/dist/core-server/presets/common-manager.css +2 -2
  98. package/dist/core-server/presets/common-manager.js +1806 -3427
  99. package/dist/core-server/presets/common-override-preset.js +31 -60
  100. package/dist/core-server/presets/common-preset.js +434 -924
  101. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +15 -19
  102. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +12 -17
  103. package/dist/csf/index.js +534 -1179
  104. package/dist/csf-tools/index.js +9 -9
  105. package/dist/docs-tools/index.js +6 -6
  106. package/dist/highlight/index.js +2 -2
  107. package/dist/instrumenter/index.js +199 -415
  108. package/dist/manager/globals-runtime.js +24150 -47364
  109. package/dist/manager/globals.js +2 -3
  110. package/dist/manager/runtime.js +3961 -8373
  111. package/dist/manager-api/index.js +1231 -2425
  112. package/dist/manager-errors.d.ts +3 -0
  113. package/dist/manager-errors.js +3 -3
  114. package/dist/node-logger/index.js +1253 -2601
  115. package/dist/preview/globals.js +2 -3
  116. package/dist/preview/runtime.js +10364 -21990
  117. package/dist/preview-api/index.d.ts +67 -68
  118. package/dist/preview-api/index.js +13 -13
  119. package/dist/preview-errors.d.ts +3 -0
  120. package/dist/preview-errors.js +4 -4
  121. package/dist/router/index.js +347 -899
  122. package/dist/server-errors.d.ts +3 -0
  123. package/dist/server-errors.js +10 -10
  124. package/dist/telemetry/index.js +24 -24
  125. package/dist/test/index.js +5860 -11645
  126. package/dist/theming/create.js +4 -4
  127. package/dist/theming/index.d.ts +3363 -2597
  128. package/dist/theming/index.js +490 -1086
  129. package/dist/types/index.js +2 -11
  130. package/dist/viewport/index.js +3 -3
  131. package/package.json +5 -5
  132. package/dist/_browser-chunks/Color-FQNEU7YS.js +0 -1695
  133. package/dist/_browser-chunks/WithTooltip-6NHN2GXF.js +0 -2343
  134. package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
  135. package/dist/_browser-chunks/chunk-AW46NMGV.js +0 -1308
  136. package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
  137. package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
  138. package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
  139. package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
  140. package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
  141. package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
  142. package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
  143. package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
  144. package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
  145. package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
  146. package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
  147. package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
  148. package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
  149. package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
  150. package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
  151. package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
  152. package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
  153. package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
  154. package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
  155. package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
  156. package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
  157. package/dist/_node-chunks/camelcase-QALD4XFE.js +0 -18
  158. package/dist/_node-chunks/chunk-2XY53ALL.js +0 -420
  159. package/dist/_node-chunks/chunk-3CBQMG2A.js +0 -6712
  160. package/dist/_node-chunks/chunk-3WDAPZYQ.js +0 -28
  161. package/dist/_node-chunks/chunk-4ZB555EJ.js +0 -697
  162. package/dist/_node-chunks/chunk-52DXKXY3.js +0 -4272
  163. package/dist/_node-chunks/chunk-5OVB4A6F.js +0 -69
  164. package/dist/_node-chunks/chunk-AGHGNXGH.js +0 -18
  165. package/dist/_node-chunks/chunk-B23X5ZCK.js +0 -1531
  166. package/dist/_node-chunks/chunk-B2DAHWJK.js +0 -220
  167. package/dist/_node-chunks/chunk-CC4PW5MJ.js +0 -34
  168. package/dist/_node-chunks/chunk-D7NIZELR.js +0 -2256
  169. package/dist/_node-chunks/chunk-DO5Q3H4L.js +0 -1250
  170. package/dist/_node-chunks/chunk-ECK7WVFX.js +0 -304
  171. package/dist/_node-chunks/chunk-EUH3NHXA.js +0 -79
  172. package/dist/_node-chunks/chunk-FOQHPHCV.js +0 -1657
  173. package/dist/_node-chunks/chunk-G6EL47NS.js +0 -111
  174. package/dist/_node-chunks/chunk-GFLS4TJB.js +0 -90
  175. package/dist/_node-chunks/chunk-J3XZKWHE.js +0 -1586
  176. package/dist/_node-chunks/chunk-LE63EHJ5.js +0 -1518
  177. package/dist/_node-chunks/chunk-M47XA42S.js +0 -4741
  178. package/dist/_node-chunks/chunk-OOI74AL3.js +0 -61
  179. package/dist/_node-chunks/chunk-PRJHT3GJ.js +0 -61
  180. package/dist/_node-chunks/chunk-Q52PVUSU.js +0 -101
  181. package/dist/_node-chunks/chunk-SDCF5RNN.js +0 -1198
  182. package/dist/_node-chunks/chunk-UJ5SJ23M.js +0 -5029
  183. package/dist/_node-chunks/chunk-UPHK4ETU.js +0 -64658
  184. package/dist/_node-chunks/chunk-V7VURIPB.js +0 -1544
  185. package/dist/_node-chunks/dist-6TXHNR5C.js +0 -175
  186. package/dist/_node-chunks/globby-PBTV6PX6.js +0 -5222
  187. package/dist/_node-chunks/lib-4RTDZVGX.js +0 -518
  188. package/dist/_node-chunks/mdx-N42X6CFJ-COWEH7KR.js +0 -22017
  189. package/dist/_node-chunks/p-limit-PBVZQOFY.js +0 -168
  190. package/dist/_node-chunks/plugin-EOZKYZAG.js +0 -159
  191. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-35HMSMR5.js +0 -69102
  192. package/dist/_node-chunks/webpack-mock-plugin-GT3MA5E2.js +0 -124
@@ -1,76 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-MM7DTO55.js";
4
-
5
- // src/storybook-error.ts
6
- function parseErrorCode({
7
- code,
8
- category
9
- }) {
10
- const paddedCode = String(code).padStart(4, "0");
11
- return `SB_${category}_${paddedCode}`;
12
- }
13
- __name(parseErrorCode, "parseErrorCode");
14
- function appendErrorRef(url) {
15
- if (/^(?!.*storybook\.js\.org)|[?&]ref=error\b/.test(url)) {
16
- return url;
17
- }
18
- try {
19
- const urlObj = new URL(url);
20
- urlObj.searchParams.set("ref", "error");
21
- return urlObj.toString();
22
- } catch {
23
- return url;
24
- }
25
- }
26
- __name(appendErrorRef, "appendErrorRef");
27
- var _StorybookError = class _StorybookError extends Error {
28
- constructor(props) {
29
- super(_StorybookError.getFullMessage(props));
30
- /**
31
- * Data associated with the error. Used to provide additional information in the error message or
32
- * to be passed to telemetry.
33
- */
34
- this.data = {};
35
- /** Flag used to easily determine if the error originates from Storybook. */
36
- this.fromStorybook = true;
37
- this.category = props.category;
38
- this.documentation = props.documentation ?? false;
39
- this.code = props.code;
40
- }
41
- get fullErrorCode() {
42
- return parseErrorCode({ code: this.code, category: this.category });
43
- }
44
- /** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
45
- get name() {
46
- const errorName = this.constructor.name;
47
- return `${this.fullErrorCode} (${errorName})`;
48
- }
49
- /** Generates the error message along with additional documentation link (if applicable). */
50
- static getFullMessage({
51
- documentation,
52
- code,
53
- category,
54
- message
55
- }) {
56
- let page;
57
- if (documentation === true) {
58
- page = `https://storybook.js.org/error/${parseErrorCode({ code, category })}?ref=error`;
59
- } else if (typeof documentation === "string") {
60
- page = appendErrorRef(documentation);
61
- } else if (Array.isArray(documentation)) {
62
- page = `
63
- ${documentation.map((doc) => ` - ${appendErrorRef(doc)}`).join("\n")}`;
64
- }
65
- return `${message}${page != null ? `
66
-
67
- More info: ${page}
68
- ` : ""}`;
69
- }
70
- };
71
- __name(_StorybookError, "StorybookError");
72
- var StorybookError = _StorybookError;
73
-
74
- export {
75
- StorybookError
76
- };
@@ -1,101 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-MM7DTO55.js";
4
-
5
- // src/preview-api/modules/preview-web/render/animation-utils.ts
6
- var ANIMATION_TIMEOUT = 5e3;
7
- function isTestEnvironment() {
8
- try {
9
- return (
10
- // @ts-expect-error This property exists in Vitest browser mode
11
- !!globalThis.__vitest_browser__ || !!globalThis.window?.navigator?.userAgent?.match(/StorybookTestRunner/)
12
- );
13
- } catch {
14
- return false;
15
- }
16
- }
17
- __name(isTestEnvironment, "isTestEnvironment");
18
- function pauseAnimations(atEnd = true) {
19
- if (!("document" in globalThis && "createElement" in globalThis.document)) {
20
- return () => {
21
- };
22
- }
23
- const disableStyle = document.createElement("style");
24
- disableStyle.textContent = `*, *:before, *:after {
25
- animation: none !important;
26
- }`;
27
- document.head.appendChild(disableStyle);
28
- const pauseStyle = document.createElement("style");
29
- pauseStyle.textContent = `*, *:before, *:after {
30
- animation-delay: 0s !important;
31
- animation-direction: ${atEnd ? "reverse" : "normal"} !important;
32
- animation-play-state: paused !important;
33
- transition: none !important;
34
- }`;
35
- document.head.appendChild(pauseStyle);
36
- document.body.clientHeight;
37
- document.head.removeChild(disableStyle);
38
- return () => {
39
- pauseStyle.parentNode?.removeChild(pauseStyle);
40
- };
41
- }
42
- __name(pauseAnimations, "pauseAnimations");
43
- async function waitForAnimations(signal) {
44
- if (!("document" in globalThis && "getAnimations" in globalThis.document && "querySelectorAll" in globalThis.document)) {
45
- return;
46
- }
47
- let timedOut = false;
48
- await Promise.race([
49
- // After 50ms, retrieve any running animations and wait for them to finish
50
- // If new animations are created while waiting, we'll wait for them too
51
- new Promise((resolve) => {
52
- setTimeout(() => {
53
- const animationRoots = [globalThis.document, ...getShadowRoots(globalThis.document)];
54
- const checkAnimationsFinished = /* @__PURE__ */ __name(async () => {
55
- if (timedOut || signal?.aborted) {
56
- return;
57
- }
58
- const runningAnimations = animationRoots.flatMap((el) => el?.getAnimations?.() || []).filter((a) => a.playState === "running" && !isInfiniteAnimation(a));
59
- if (runningAnimations.length > 0) {
60
- await Promise.all(runningAnimations.map((a) => a.finished));
61
- await checkAnimationsFinished();
62
- }
63
- }, "checkAnimationsFinished");
64
- checkAnimationsFinished().then(resolve);
65
- }, 100);
66
- }),
67
- // If animations don't finish within the timeout, continue without waiting
68
- new Promise(
69
- (resolve) => setTimeout(() => {
70
- timedOut = true;
71
- resolve(void 0);
72
- }, ANIMATION_TIMEOUT)
73
- )
74
- ]);
75
- }
76
- __name(waitForAnimations, "waitForAnimations");
77
- function getShadowRoots(doc) {
78
- return [doc, ...doc.querySelectorAll("*")].reduce((acc, el) => {
79
- if ("shadowRoot" in el && el.shadowRoot) {
80
- acc.push(el.shadowRoot, ...getShadowRoots(el.shadowRoot));
81
- }
82
- return acc;
83
- }, []);
84
- }
85
- __name(getShadowRoots, "getShadowRoots");
86
- function isInfiniteAnimation(anim) {
87
- if (anim instanceof CSSAnimation && anim.effect instanceof KeyframeEffect && anim.effect.target) {
88
- const style = getComputedStyle(anim.effect.target, anim.effect.pseudoElement);
89
- const index = style.animationName?.split(", ").indexOf(anim.animationName);
90
- const iterations = style.animationIterationCount.split(", ")[index];
91
- return iterations === "infinite";
92
- }
93
- return false;
94
- }
95
- __name(isInfiniteAnimation, "isInfiniteAnimation");
96
-
97
- export {
98
- isTestEnvironment,
99
- pauseAnimations,
100
- waitForAnimations
101
- };
@@ -1,243 +0,0 @@
1
- import {
2
- __commonJS,
3
- __name,
4
- __require
5
- } from "./chunk-MM7DTO55.js";
6
-
7
- // ../node_modules/memoizerific/memoizerific.js
8
- var require_memoizerific = __commonJS({
9
- "../node_modules/memoizerific/memoizerific.js"(exports, module) {
10
- (function(f) {
11
- if (typeof exports === "object" && typeof module !== "undefined") {
12
- module.exports = f();
13
- } else if (typeof define === "function" && define.amd) {
14
- define([], f);
15
- } else {
16
- var g;
17
- if (typeof window !== "undefined") {
18
- g = window;
19
- } else if (typeof global !== "undefined") {
20
- g = global;
21
- } else if (typeof self !== "undefined") {
22
- g = self;
23
- } else {
24
- g = this;
25
- }
26
- g.memoizerific = f();
27
- }
28
- })(function() {
29
- var define2, module2, exports2;
30
- return (/* @__PURE__ */ __name(function e(t, n, r) {
31
- function s(o2, u) {
32
- if (!n[o2]) {
33
- if (!t[o2]) {
34
- var a = typeof __require == "function" && __require;
35
- if (!u && a) return a(o2, true);
36
- if (i) return i(o2, true);
37
- var f = new Error("Cannot find module '" + o2 + "'");
38
- throw f.code = "MODULE_NOT_FOUND", f;
39
- }
40
- var l = n[o2] = { exports: {} };
41
- t[o2][0].call(l.exports, function(e2) {
42
- var n2 = t[o2][1][e2];
43
- return s(n2 ? n2 : e2);
44
- }, l, l.exports, e, t, n, r);
45
- }
46
- return n[o2].exports;
47
- }
48
- __name(s, "s");
49
- var i = typeof __require == "function" && __require;
50
- for (var o = 0; o < r.length; o++) s(r[o]);
51
- return s;
52
- }, "e"))({ 1: [function(_dereq_, module3, exports3) {
53
- module3.exports = function(forceSimilar) {
54
- if (typeof Map !== "function" || forceSimilar) {
55
- var Similar = _dereq_("./similar");
56
- return new Similar();
57
- } else {
58
- return /* @__PURE__ */ new Map();
59
- }
60
- };
61
- }, { "./similar": 2 }], 2: [function(_dereq_, module3, exports3) {
62
- function Similar() {
63
- this.list = [];
64
- this.lastItem = void 0;
65
- this.size = 0;
66
- return this;
67
- }
68
- __name(Similar, "Similar");
69
- Similar.prototype.get = function(key) {
70
- var index;
71
- if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
72
- return this.lastItem.val;
73
- }
74
- index = this.indexOf(key);
75
- if (index >= 0) {
76
- this.lastItem = this.list[index];
77
- return this.list[index].val;
78
- }
79
- return void 0;
80
- };
81
- Similar.prototype.set = function(key, val) {
82
- var index;
83
- if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
84
- this.lastItem.val = val;
85
- return this;
86
- }
87
- index = this.indexOf(key);
88
- if (index >= 0) {
89
- this.lastItem = this.list[index];
90
- this.list[index].val = val;
91
- return this;
92
- }
93
- this.lastItem = { key, val };
94
- this.list.push(this.lastItem);
95
- this.size++;
96
- return this;
97
- };
98
- Similar.prototype.delete = function(key) {
99
- var index;
100
- if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
101
- this.lastItem = void 0;
102
- }
103
- index = this.indexOf(key);
104
- if (index >= 0) {
105
- this.size--;
106
- return this.list.splice(index, 1)[0];
107
- }
108
- return void 0;
109
- };
110
- Similar.prototype.has = function(key) {
111
- var index;
112
- if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
113
- return true;
114
- }
115
- index = this.indexOf(key);
116
- if (index >= 0) {
117
- this.lastItem = this.list[index];
118
- return true;
119
- }
120
- return false;
121
- };
122
- Similar.prototype.forEach = function(callback, thisArg) {
123
- var i;
124
- for (i = 0; i < this.size; i++) {
125
- callback.call(thisArg || this, this.list[i].val, this.list[i].key, this);
126
- }
127
- };
128
- Similar.prototype.indexOf = function(key) {
129
- var i;
130
- for (i = 0; i < this.size; i++) {
131
- if (this.isEqual(this.list[i].key, key)) {
132
- return i;
133
- }
134
- }
135
- return -1;
136
- };
137
- Similar.prototype.isEqual = function(val1, val2) {
138
- return val1 === val2 || val1 !== val1 && val2 !== val2;
139
- };
140
- module3.exports = Similar;
141
- }, {}], 3: [function(_dereq_, module3, exports3) {
142
- var MapOrSimilar = _dereq_("map-or-similar");
143
- module3.exports = function(limit) {
144
- var cache = new MapOrSimilar(false), lru = [];
145
- return function(fn) {
146
- var memoizerific = /* @__PURE__ */ __name(function() {
147
- var currentCache = cache, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = true, i;
148
- if ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1) {
149
- throw new Error("Memoizerific functions should always be called with the same number of arguments");
150
- }
151
- for (i = 0; i < argsLengthMinusOne; i++) {
152
- lruPath[i] = {
153
- cacheItem: currentCache,
154
- arg: arguments[i]
155
- };
156
- if (currentCache.has(arguments[i])) {
157
- currentCache = currentCache.get(arguments[i]);
158
- continue;
159
- }
160
- isMemoized = false;
161
- newMap = new MapOrSimilar(false);
162
- currentCache.set(arguments[i], newMap);
163
- currentCache = newMap;
164
- }
165
- if (isMemoized) {
166
- if (currentCache.has(arguments[argsLengthMinusOne])) {
167
- fnResult = currentCache.get(arguments[argsLengthMinusOne]);
168
- } else {
169
- isMemoized = false;
170
- }
171
- }
172
- if (!isMemoized) {
173
- fnResult = fn.apply(null, arguments);
174
- currentCache.set(arguments[argsLengthMinusOne], fnResult);
175
- }
176
- if (limit > 0) {
177
- lruPath[argsLengthMinusOne] = {
178
- cacheItem: currentCache,
179
- arg: arguments[argsLengthMinusOne]
180
- };
181
- if (isMemoized) {
182
- moveToMostRecentLru(lru, lruPath);
183
- } else {
184
- lru.push(lruPath);
185
- }
186
- if (lru.length > limit) {
187
- removeCachedResult(lru.shift());
188
- }
189
- }
190
- memoizerific.wasMemoized = isMemoized;
191
- memoizerific.numArgs = argsLengthMinusOne + 1;
192
- return fnResult;
193
- }, "memoizerific");
194
- memoizerific.limit = limit;
195
- memoizerific.wasMemoized = false;
196
- memoizerific.cache = cache;
197
- memoizerific.lru = lru;
198
- return memoizerific;
199
- };
200
- };
201
- function moveToMostRecentLru(lru, lruPath) {
202
- var lruLen = lru.length, lruPathLen = lruPath.length, isMatch, i, ii;
203
- for (i = 0; i < lruLen; i++) {
204
- isMatch = true;
205
- for (ii = 0; ii < lruPathLen; ii++) {
206
- if (!isEqual(lru[i][ii].arg, lruPath[ii].arg)) {
207
- isMatch = false;
208
- break;
209
- }
210
- }
211
- if (isMatch) {
212
- break;
213
- }
214
- }
215
- lru.push(lru.splice(i, 1)[0]);
216
- }
217
- __name(moveToMostRecentLru, "moveToMostRecentLru");
218
- function removeCachedResult(removedLru) {
219
- var removedLruLen = removedLru.length, currentLru = removedLru[removedLruLen - 1], tmp, i;
220
- currentLru.cacheItem.delete(currentLru.arg);
221
- for (i = removedLruLen - 2; i >= 0; i--) {
222
- currentLru = removedLru[i];
223
- tmp = currentLru.cacheItem.get(currentLru.arg);
224
- if (!tmp || !tmp.size) {
225
- currentLru.cacheItem.delete(currentLru.arg);
226
- } else {
227
- break;
228
- }
229
- }
230
- }
231
- __name(removeCachedResult, "removeCachedResult");
232
- function isEqual(val1, val2) {
233
- return val1 === val2 || val1 !== val1 && val2 !== val2;
234
- }
235
- __name(isEqual, "isEqual");
236
- }, { "map-or-similar": 1 }] }, {}, [3])(3);
237
- });
238
- }
239
- });
240
-
241
- export {
242
- require_memoizerific
243
- };