storybook 9.1.0-alpha.0 → 9.1.0-alpha.10

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 (112) hide show
  1. package/assets/browser/favicon-wrapper.svg +46 -0
  2. package/assets/browser/favicon.svg +1 -1
  3. package/dist/actions/index.cjs +16 -16
  4. package/dist/actions/index.d.ts +1 -38
  5. package/dist/actions/index.js +12 -12
  6. package/dist/bin/index.cjs +62 -69
  7. package/dist/bin/index.js +43 -50
  8. package/dist/builder-manager/index.cjs +379 -378
  9. package/dist/builder-manager/index.d.ts +567 -2
  10. package/dist/builder-manager/index.js +280 -279
  11. package/dist/cli/bin/index.cjs +945 -945
  12. package/dist/cli/bin/index.js +673 -672
  13. package/dist/cli/index.cjs +14965 -14973
  14. package/dist/cli/index.d.ts +713 -15
  15. package/dist/cli/index.js +13488 -13495
  16. package/dist/common/index.cjs +11211 -11103
  17. package/dist/common/index.d.ts +351 -72
  18. package/dist/common/index.js +18491 -18379
  19. package/dist/components/index.cjs +4606 -4425
  20. package/dist/components/index.d.ts +11 -12
  21. package/dist/components/index.js +3020 -2834
  22. package/dist/controls/index.cjs +16 -16
  23. package/dist/controls/index.d.ts +1 -36
  24. package/dist/core-server/index.cjs +6690 -6624
  25. package/dist/core-server/index.d.ts +14 -2
  26. package/dist/core-server/index.js +6088 -6023
  27. package/dist/core-server/presets/common-manager.js +3582 -3475
  28. package/dist/core-server/presets/common-preset.cjs +85015 -5213
  29. package/dist/core-server/presets/common-preset.js +85107 -5291
  30. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.cjs +28728 -0
  31. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +28729 -0
  32. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.cjs +29339 -0
  33. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +29340 -0
  34. package/dist/csf/index.cjs +3019 -104
  35. package/dist/csf/index.d.ts +301 -18
  36. package/dist/csf/index.js +3031 -98
  37. package/dist/csf-tools/index.cjs +489 -488
  38. package/dist/csf-tools/index.js +311 -309
  39. package/dist/highlight/index.cjs +15 -15
  40. package/dist/highlight/index.d.ts +1 -12
  41. package/dist/highlight/index.js +4 -4
  42. package/dist/instrumenter/index.cjs +1308 -1239
  43. package/dist/instrumenter/index.d.ts +25 -3
  44. package/dist/instrumenter/index.js +1345 -1280
  45. package/dist/manager/globals-module-info.cjs +1 -1
  46. package/dist/manager/globals-module-info.js +1 -1
  47. package/dist/manager/globals-runtime.js +42257 -44665
  48. package/dist/manager/runtime.js +3715 -3536
  49. package/dist/manager-api/index.cjs +74 -74
  50. package/dist/manager-api/index.d.ts +4 -1
  51. package/dist/manager-api/index.js +142 -142
  52. package/dist/node-logger/index.cjs +8520 -994
  53. package/dist/node-logger/index.d.ts +395 -2
  54. package/dist/node-logger/index.js +8535 -995
  55. package/dist/preview/runtime.js +13701 -16331
  56. package/dist/preview-api/index.cjs +1434 -1458
  57. package/dist/preview-api/index.d.ts +13 -10
  58. package/dist/preview-api/index.js +950 -976
  59. package/dist/server-errors.cjs +201 -242
  60. package/dist/server-errors.d.ts +1 -12
  61. package/dist/server-errors.js +182 -223
  62. package/dist/telemetry/index.cjs +1919 -1638
  63. package/dist/telemetry/index.d.ts +4 -2
  64. package/dist/telemetry/index.js +1972 -1690
  65. package/dist/test/index.cjs +9184 -9816
  66. package/dist/test/index.d.ts +8 -1
  67. package/dist/test/index.js +8390 -9029
  68. package/dist/types/index.d.ts +19 -17
  69. package/dist/viewport/index.cjs +17 -24
  70. package/dist/viewport/index.d.ts +9 -532
  71. package/dist/viewport/index.js +9 -16
  72. package/package.json +18 -187
  73. package/templates/mocker-runtime.template.js +89 -0
  74. package/dist/actions/preview.cjs +0 -159
  75. package/dist/actions/preview.d.ts +0 -555
  76. package/dist/actions/preview.js +0 -149
  77. package/dist/backgrounds/index.cjs +0 -148
  78. package/dist/backgrounds/index.d.ts +0 -592
  79. package/dist/backgrounds/index.js +0 -130
  80. package/dist/backgrounds/preview.cjs +0 -143
  81. package/dist/backgrounds/preview.d.ts +0 -555
  82. package/dist/backgrounds/preview.js +0 -127
  83. package/dist/component-testing/index.cjs +0 -23
  84. package/dist/component-testing/index.d.ts +0 -3
  85. package/dist/component-testing/index.js +0 -5
  86. package/dist/component-testing/preview.cjs +0 -40
  87. package/dist/component-testing/preview.d.ts +0 -5
  88. package/dist/component-testing/preview.js +0 -25
  89. package/dist/controls/preview.cjs +0 -26
  90. package/dist/controls/preview.d.ts +0 -555
  91. package/dist/controls/preview.js +0 -9
  92. package/dist/highlight/preview.cjs +0 -590
  93. package/dist/highlight/preview.d.ts +0 -555
  94. package/dist/highlight/preview.js +0 -574
  95. package/dist/measure/index.cjs +0 -476
  96. package/dist/measure/index.d.ts +0 -567
  97. package/dist/measure/index.js +0 -464
  98. package/dist/measure/preview.cjs +0 -466
  99. package/dist/measure/preview.d.ts +0 -560
  100. package/dist/measure/preview.js +0 -450
  101. package/dist/outline/index.cjs +0 -528
  102. package/dist/outline/index.d.ts +0 -567
  103. package/dist/outline/index.js +0 -500
  104. package/dist/outline/preview.cjs +0 -518
  105. package/dist/outline/preview.d.ts +0 -560
  106. package/dist/outline/preview.js +0 -486
  107. package/dist/test/preview.cjs +0 -73
  108. package/dist/test/preview.d.ts +0 -555
  109. package/dist/test/preview.js +0 -66
  110. package/dist/viewport/preview.cjs +0 -35
  111. package/dist/viewport/preview.d.ts +0 -569
  112. package/dist/viewport/preview.js +0 -19
package/dist/csf/index.js CHANGED
@@ -1,62 +1,64 @@
1
- var h = Object.create;
2
- var f = Object.defineProperty;
3
- var O = Object.getOwnPropertyDescriptor;
4
- var $ = Object.getOwnPropertyNames;
5
- var v = Object.getPrototypeOf, j = Object.prototype.hasOwnProperty;
6
- var a = (e, r) => f(e, "name", { value: r, configurable: !0 });
7
- var _ = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports);
8
- var C = (e, r, t, n) => {
9
- if (r && typeof r == "object" || typeof r == "function")
10
- for (let s of $(r))
11
- !j.call(e, s) && s !== t && f(e, s, { get: () => r[s], enumerable: !(n = O(r, s)) || n.enumerable });
1
+ var Br = Object.create;
2
+ var ce = Object.defineProperty;
3
+ var zr = Object.getOwnPropertyDescriptor;
4
+ var Ur = Object.getOwnPropertyNames;
5
+ var Gr = Object.getPrototypeOf, Wr = Object.prototype.hasOwnProperty;
6
+ var n = (e, t) => ce(e, "name", { value: t, configurable: !0 });
7
+ var Yr = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), xt = (e, t) => {
8
+ for (var r in t)
9
+ ce(e, r, { get: t[r], enumerable: !0 });
10
+ }, Vr = (e, t, r, o) => {
11
+ if (t && typeof t == "object" || typeof t == "function")
12
+ for (let i of Ur(t))
13
+ !Wr.call(e, i) && i !== r && ce(e, i, { get: () => t[i], enumerable: !(o = zr(t, i)) || o.enumerable });
12
14
  return e;
13
15
  };
14
- var E = (e, r, t) => (t = e != null ? h(v(e)) : {}, C(
16
+ var Kr = (e, t, r) => (r = e != null ? Br(Gr(e)) : {}, Vr(
15
17
  // If the importer is in node compatibility mode or this is not an ESM
16
18
  // file that has been converted to a CommonJS file using a Babel-
17
19
  // compatible transform (i.e. "__esModule" has not been set), then set
18
20
  // "default" to the CommonJS "module.exports" for node compatibility.
19
- r || !e || !e.__esModule ? f(t, "default", { value: e, enumerable: !0 }) : t,
21
+ t || !e || !e.__esModule ? ce(r, "default", { value: e, enumerable: !0 }) : r,
20
22
  e
21
23
  ));
22
24
 
23
25
  // ../node_modules/@ngard/tiny-isequal/index.js
24
- var S = _((g) => {
25
- Object.defineProperty(g, "__esModule", { value: !0 }), g.isEqual = /* @__PURE__ */ function() {
26
- var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(n) {
27
- return Object.keys(n).concat(Object.getOwnPropertySymbols(n));
26
+ var Tt = Yr((Ee) => {
27
+ Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.isEqual = /* @__PURE__ */ function() {
28
+ var e = Object.prototype.toString, t = Object.getPrototypeOf, r = Object.getOwnPropertySymbols ? function(o) {
29
+ return Object.keys(o).concat(Object.getOwnPropertySymbols(o));
28
30
  } : Object.keys;
29
- return function(n, s) {
30
- return (/* @__PURE__ */ a(function l(o, i, p) {
31
- var c, d, u, A = e.call(o), b = e.call(i);
32
- if (o === i) return !0;
33
- if (o == null || i == null) return !1;
34
- if (p.indexOf(o) > -1 && p.indexOf(i) > -1) return !0;
35
- if (p.push(o, i), A != b || (c = t(o), d = t(i), c.length != d.length || c.some(function(m) {
36
- return !l(o[m], i[m], p);
31
+ return function(o, i) {
32
+ return (/* @__PURE__ */ n(function s(a, p, c) {
33
+ var l, y, u, h = e.call(a), T = e.call(p);
34
+ if (a === p) return !0;
35
+ if (a == null || p == null) return !1;
36
+ if (c.indexOf(a) > -1 && c.indexOf(p) > -1) return !0;
37
+ if (c.push(a, p), h != T || (l = r(a), y = r(p), l.length != y.length || l.some(function(R) {
38
+ return !s(a[R], p[R], c);
37
39
  }))) return !1;
38
- switch (A.slice(8, -1)) {
40
+ switch (h.slice(8, -1)) {
39
41
  case "Symbol":
40
- return o.valueOf() == i.valueOf();
42
+ return a.valueOf() == p.valueOf();
41
43
  case "Date":
42
44
  case "Number":
43
- return +o == +i || +o != +o && +i != +i;
45
+ return +a == +p || +a != +a && +p != +p;
44
46
  case "RegExp":
45
47
  case "Function":
46
48
  case "String":
47
49
  case "Boolean":
48
- return "" + o == "" + i;
50
+ return "" + a == "" + p;
49
51
  case "Set":
50
52
  case "Map":
51
- c = o.entries(), d = i.entries();
53
+ l = a.entries(), y = p.entries();
52
54
  do
53
- if (!l((u = c.next()).value, d.next().value, p)) return !1;
55
+ if (!s((u = l.next()).value, y.next().value, c)) return !1;
54
56
  while (!u.done);
55
57
  return !0;
56
58
  case "ArrayBuffer":
57
- o = new Uint8Array(o), i = new Uint8Array(i);
59
+ a = new Uint8Array(a), p = new Uint8Array(p);
58
60
  case "DataView":
59
- o = new Uint8Array(o.buffer), i = new Uint8Array(i.buffer);
61
+ a = new Uint8Array(a.buffer), p = new Uint8Array(p.buffer);
60
62
  case "Float32Array":
61
63
  case "Float64Array":
62
64
  case "Int8Array":
@@ -68,105 +70,3036 @@ var S = _((g) => {
68
70
  case "Uint8ClampedArray":
69
71
  case "Arguments":
70
72
  case "Array":
71
- if (o.length != i.length) return !1;
72
- for (u = 0; u < o.length; u++) if ((u in o || u in i) && (u in o != u in i || !l(o[u], i[u], p))) return !1;
73
+ if (a.length != p.length) return !1;
74
+ for (u = 0; u < a.length; u++) if ((u in a || u in p) && (u in a != u in p || !s(a[u], p[u], c))) return !1;
73
75
  return !0;
74
76
  case "Object":
75
- return l(r(o), r(i), p);
77
+ return s(t(a), t(p), c);
76
78
  default:
77
79
  return !1;
78
80
  }
79
- }, "n"))(n, s, []);
81
+ }, "n"))(o, i, []);
80
82
  };
81
83
  }();
82
84
  });
83
85
 
84
86
  // src/csf/toStartCaseStr.ts
85
- function x(e) {
86
- return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t, n, s) => `${t} ${n}${s}`).replace(
87
- /([a-z])([A-Z])/g, (r, t, n) => `${t} ${n}`).replace(/([a-z])([0-9])/gi, (r, t, n) => `${t} ${n}`).replace(/([0-9])([a-z])/gi, (r, t, n) => `${t}\
88
- ${n}`).replace(/(\s|^)(\w)/g, (r, t, n) => `${t}${n.toUpperCase()}`).replace(/ +/g, " ").trim();
87
+ function bt(e) {
88
+ return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (t, r, o, i) => `${r} ${o}${i}`).replace(
89
+ /([a-z])([A-Z])/g, (t, r, o) => `${r} ${o}`).replace(/([a-z])([0-9])/gi, (t, r, o) => `${r} ${o}`).replace(/([0-9])([a-z])/gi, (t, r, o) => `${r}\
90
+ ${o}`).replace(/(\s|^)(\w)/g, (t, r, o) => `${r}${o.toUpperCase()}`).replace(/ +/g, " ").trim();
89
91
  }
90
- a(x, "toStartCaseStr");
92
+ n(bt, "toStartCaseStr");
91
93
 
92
94
  // src/csf/includeConditionalArg.ts
93
- var y = E(S(), 1);
94
- var w = /* @__PURE__ */ a((e) => e.map((r) => typeof r < "u").filter(Boolean).length, "count"), P = /* @__PURE__ */ a((e, r) => {
95
- let { exists: t, eq: n, neq: s, truthy: l } = e;
96
- if (w([t, n, s, l]) > 1)
97
- throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq: n, neq: s })}`);
98
- if (typeof n < "u")
99
- return (0, y.isEqual)(r, n);
100
- if (typeof s < "u")
101
- return !(0, y.isEqual)(r, s);
102
- if (typeof t < "u") {
103
- let i = typeof r < "u";
104
- return t ? i : !i;
105
- }
106
- return (typeof l > "u" ? !0 : l) ? !!r : !r;
107
- }, "testValue"), z = /* @__PURE__ */ a((e, r, t) => {
95
+ var Ce = Kr(Tt(), 1);
96
+ var St = /* @__PURE__ */ n((e) => e.map((t) => typeof t < "u").filter(Boolean).length, "count"), qr = /* @__PURE__ */ n((e, t) => {
97
+ let { exists: r, eq: o, neq: i, truthy: s } = e;
98
+ if (St([r, o, i, s]) > 1)
99
+ throw new Error(`Invalid conditional test ${JSON.stringify({ exists: r, eq: o, neq: i })}`);
100
+ if (typeof o < "u")
101
+ return (0, Ce.isEqual)(t, o);
102
+ if (typeof i < "u")
103
+ return !(0, Ce.isEqual)(t, i);
104
+ if (typeof r < "u") {
105
+ let p = typeof t < "u";
106
+ return r ? p : !p;
107
+ }
108
+ return (typeof s > "u" ? !0 : s) ? !!t : !t;
109
+ }, "testValue"), Xr = /* @__PURE__ */ n((e, t, r) => {
108
110
  if (!e.if)
109
111
  return !0;
110
- let { arg: n, global: s } = e.if;
111
- if (w([n, s]) !== 1)
112
- throw new Error(`Invalid conditional value ${JSON.stringify({ arg: n, global: s })}`);
113
- let l = n ? r[n] : t[s];
114
- return P(e.if, l);
112
+ let { arg: o, global: i } = e.if;
113
+ if (St([o, i]) !== 1)
114
+ throw new Error(`Invalid conditional value ${JSON.stringify({ arg: o, global: i })}`);
115
+ let s = o ? t[o] : r[i];
116
+ return qr(e.if, s);
115
117
  }, "includeConditionalArg");
116
118
 
117
119
  // src/csf/csf-factories.ts
118
- function F(e) {
120
+ import { combineTags as Hn } from "storybook/internal/csf";
121
+
122
+ // src/preview-api/modules/addons/main.ts
123
+ import { global as ve } from "@storybook/global";
124
+
125
+ // src/preview-api/modules/addons/storybook-channel-mock.ts
126
+ import { Channel as Zr } from "storybook/internal/channels";
127
+ function At() {
128
+ let e = {
129
+ setHandler: /* @__PURE__ */ n(() => {
130
+ }, "setHandler"),
131
+ send: /* @__PURE__ */ n(() => {
132
+ }, "send")
133
+ };
134
+ return new Zr({ transport: e });
135
+ }
136
+ n(At, "mockChannel");
137
+
138
+ // src/preview-api/modules/addons/main.ts
139
+ var Me = class Me {
140
+ constructor() {
141
+ this.getChannel = /* @__PURE__ */ n(() => {
142
+ if (!this.channel) {
143
+ let t = At();
144
+ return this.setChannel(t), t;
145
+ }
146
+ return this.channel;
147
+ }, "getChannel");
148
+ this.ready = /* @__PURE__ */ n(() => this.promise, "ready");
149
+ this.hasChannel = /* @__PURE__ */ n(() => !!this.channel, "hasChannel");
150
+ this.setChannel = /* @__PURE__ */ n((t) => {
151
+ this.channel = t, this.resolve();
152
+ }, "setChannel");
153
+ this.promise = new Promise((t) => {
154
+ this.resolve = () => t(this.getChannel());
155
+ });
156
+ }
157
+ };
158
+ n(Me, "AddonStore");
159
+ var Pe = Me, ke = "__STORYBOOK_ADDONS_PREVIEW";
160
+ function Jr() {
161
+ return ve[ke] || (ve[ke] = new Pe()), ve[ke];
162
+ }
163
+ n(Jr, "getAddonsStore");
164
+ var Oe = Jr();
165
+
166
+ // src/preview-api/modules/addons/hooks.ts
167
+ import { logger as ri } from "storybook/internal/client-logger";
168
+ import {
169
+ FORCE_RE_RENDER as ni,
170
+ RESET_STORY_ARGS as ii,
171
+ STORY_RENDERED as Rt,
172
+ UPDATE_GLOBALS as si,
173
+ UPDATE_STORY_ARGS as ai
174
+ } from "storybook/internal/core-events";
175
+ import { global as $e } from "@storybook/global";
176
+ var Ie = class Ie {
177
+ constructor() {
178
+ this.hookListsMap = void 0;
179
+ this.mountedDecorators = void 0;
180
+ this.prevMountedDecorators = void 0;
181
+ this.currentHooks = void 0;
182
+ this.nextHookIndex = void 0;
183
+ this.currentPhase = void 0;
184
+ this.currentEffects = void 0;
185
+ this.prevEffects = void 0;
186
+ this.currentDecoratorName = void 0;
187
+ this.hasUpdates = void 0;
188
+ this.currentContext = void 0;
189
+ this.renderListener = /* @__PURE__ */ n((t) => {
190
+ t === this.currentContext?.id && (this.triggerEffects(), this.currentContext = null, this.removeRenderListeners());
191
+ }, "renderListener");
192
+ this.init();
193
+ }
194
+ init() {
195
+ this.hookListsMap = /* @__PURE__ */ new WeakMap(), this.mountedDecorators = /* @__PURE__ */ new Set(), this.prevMountedDecorators = /* @__PURE__ */ new Set(),
196
+ this.currentHooks = [], this.nextHookIndex = 0, this.currentPhase = "NONE", this.currentEffects = [], this.prevEffects = [], this.currentDecoratorName =
197
+ null, this.hasUpdates = !1, this.currentContext = null;
198
+ }
199
+ clean() {
200
+ this.prevEffects.forEach((t) => {
201
+ t.destroy && t.destroy();
202
+ }), this.init(), this.removeRenderListeners();
203
+ }
204
+ getNextHook() {
205
+ let t = this.currentHooks[this.nextHookIndex];
206
+ return this.nextHookIndex += 1, t;
207
+ }
208
+ triggerEffects() {
209
+ this.prevEffects.forEach((t) => {
210
+ !this.currentEffects.includes(t) && t.destroy && t.destroy();
211
+ }), this.currentEffects.forEach((t) => {
212
+ this.prevEffects.includes(t) || (t.destroy = t.create());
213
+ }), this.prevEffects = this.currentEffects, this.currentEffects = [];
214
+ }
215
+ addRenderListeners() {
216
+ this.removeRenderListeners(), Oe.getChannel().on(Rt, this.renderListener);
217
+ }
218
+ removeRenderListeners() {
219
+ Oe.getChannel().removeListener(Rt, this.renderListener);
220
+ }
221
+ };
222
+ n(Ie, "HooksContext");
223
+ var de = Ie;
224
+ function wt(e) {
225
+ let t = /* @__PURE__ */ n((...r) => {
226
+ let { hooks: o } = typeof r[0] == "function" ? r[1] : r[0], i = o.currentPhase, s = o.currentHooks, a = o.nextHookIndex, p = o.currentDecoratorName;
227
+ o.currentDecoratorName = e.name, o.prevMountedDecorators.has(e) ? (o.currentPhase = "UPDATE", o.currentHooks = o.hookListsMap.get(e) || []) :
228
+ (o.currentPhase = "MOUNT", o.currentHooks = [], o.hookListsMap.set(e, o.currentHooks), o.prevMountedDecorators.add(e)), o.nextHookIndex =
229
+ 0;
230
+ let c = $e.STORYBOOK_HOOKS_CONTEXT;
231
+ $e.STORYBOOK_HOOKS_CONTEXT = o;
232
+ let l = e(...r);
233
+ if ($e.STORYBOOK_HOOKS_CONTEXT = c, o.currentPhase === "UPDATE" && o.getNextHook() != null)
234
+ throw new Error(
235
+ "Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
236
+ );
237
+ return o.currentPhase = i, o.currentHooks = s, o.nextHookIndex = a, o.currentDecoratorName = p, l;
238
+ }, "hookified");
239
+ return t.originalFn = e, t;
240
+ }
241
+ n(wt, "hookify");
242
+ var Fe = 0, Qr = 25, Et = /* @__PURE__ */ n((e) => (t, r) => {
243
+ let o = e(
244
+ wt(t),
245
+ r.map((i) => wt(i))
246
+ );
247
+ return (i) => {
248
+ let { hooks: s } = i;
249
+ s.prevMountedDecorators ??= /* @__PURE__ */ new Set(), s.mountedDecorators = /* @__PURE__ */ new Set([t, ...r]), s.currentContext = i, s.
250
+ hasUpdates = !1;
251
+ let a = o(i);
252
+ for (Fe = 1; s.hasUpdates; )
253
+ if (s.hasUpdates = !1, s.currentEffects = [], a = o(i), Fe += 1, Fe > Qr)
254
+ throw new Error(
255
+ "Too many re-renders. Storybook limits the number of renders to prevent an infinite loop."
256
+ );
257
+ return s.addRenderListeners(), a;
258
+ };
259
+ }, "applyHooks");
260
+
261
+ // ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
262
+ function ee(e) {
263
+ if (!e || typeof e != "object")
264
+ return !1;
265
+ let t = Object.getPrototypeOf(e);
266
+ return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null ? Object.prototype.toString.call(e) === "[object Object]" :
267
+ !1;
268
+ }
269
+ n(ee, "isPlainObject");
270
+
271
+ // ../node_modules/es-toolkit/dist/object/mapValues.mjs
272
+ function U(e, t) {
273
+ let r = {}, o = Object.keys(e);
274
+ for (let i = 0; i < o.length; i++) {
275
+ let s = o[i], a = e[s];
276
+ r[s] = t(a, s, e);
277
+ }
278
+ return r;
279
+ }
280
+ n(U, "mapValues");
281
+
282
+ // ../node_modules/es-toolkit/dist/object/pickBy.mjs
283
+ function Le(e, t) {
284
+ let r = {}, o = Object.keys(e);
285
+ for (let i = 0; i < o.length; i++) {
286
+ let s = o[i], a = e[s];
287
+ t(a, s) && (r[s] = a);
288
+ }
289
+ return r;
290
+ }
291
+ n(Le, "pickBy");
292
+
293
+ // src/preview-api/modules/store/args.ts
294
+ import { once as Ei } from "storybook/internal/client-logger";
295
+
296
+ // ../node_modules/ts-dedent/esm/index.js
297
+ function W(e) {
298
+ for (var t = [], r = 1; r < arguments.length; r++)
299
+ t[r - 1] = arguments[r];
300
+ var o = Array.from(typeof e == "string" ? [e] : e);
301
+ o[o.length - 1] = o[o.length - 1].replace(/\r?\n([\t ]*)$/, "");
302
+ var i = o.reduce(function(p, c) {
303
+ var l = c.match(/\n([\t ]+|(?!\s).)/g);
304
+ return l ? p.concat(l.map(function(y) {
305
+ var u, h;
306
+ return (h = (u = y.match(/[\t ]/g)) === null || u === void 0 ? void 0 : u.length) !== null && h !== void 0 ? h : 0;
307
+ })) : p;
308
+ }, []);
309
+ if (i.length) {
310
+ var s = new RegExp(`
311
+ [ ]{` + Math.min.apply(Math, i) + "}", "g");
312
+ o = o.map(function(p) {
313
+ return p.replace(s, `
314
+ `);
315
+ });
316
+ }
317
+ o[0] = o[0].replace(/^\r?\n/, "");
318
+ var a = o[0];
319
+ return t.forEach(function(p, c) {
320
+ var l = a.match(/(?:^|\n)( *)$/), y = l ? l[1] : "", u = p;
321
+ typeof p == "string" && p.includes(`
322
+ `) && (u = String(p).split(`
323
+ `).map(function(h, T) {
324
+ return T === 0 ? h : "" + y + h;
325
+ }).join(`
326
+ `)), a += u + o[c + 1];
327
+ }), a;
328
+ }
329
+ n(W, "dedent");
330
+
331
+ // src/preview-api/modules/store/args.ts
332
+ var vi = Symbol("incompatible");
333
+ var ki = Symbol("Deeply equal");
334
+ var De = "UNTARGETED";
335
+ function Ct({
336
+ args: e,
337
+ argTypes: t
338
+ }) {
339
+ let r = {};
340
+ return Object.entries(e).forEach(([o, i]) => {
341
+ let { target: s = De } = t[o] || {};
342
+ r[s] = r[s] || {}, r[s][o] = i;
343
+ }), r;
344
+ }
345
+ n(Ct, "groupArgsByTarget");
346
+
347
+ // src/preview-api/modules/store/csf/getValuesFromArgTypes.ts
348
+ var vt = /* @__PURE__ */ n((e = {}) => Object.entries(e).reduce((t, [r, { defaultValue: o }]) => (typeof o < "u" && (t[r] = o), t), {}), "ge\
349
+ tValuesFromArgTypes");
350
+
351
+ // src/preview-api/modules/store/csf/normalizeInputTypes.ts
352
+ var eo = /* @__PURE__ */ n((e) => typeof e == "string" ? { name: e } : e, "normalizeType"), to = /* @__PURE__ */ n((e) => typeof e == "strin\
353
+ g" ? { type: e } : e, "normalizeControl"), ro = /* @__PURE__ */ n((e, t) => {
354
+ let { type: r, control: o, ...i } = e, s = {
355
+ name: t,
356
+ ...i
357
+ };
358
+ return r && (s.type = eo(r)), o ? s.control = to(o) : o === !1 && (s.control = { disable: !0 }), s;
359
+ }, "normalizeInputType"), K = /* @__PURE__ */ n((e) => U(e, ro), "normalizeInputTypes");
360
+
361
+ // src/preview-api/modules/store/csf/normalizeStory.ts
362
+ import { deprecate as oo, logger as no } from "storybook/internal/client-logger";
363
+ import { storyNameFromExport as io, toId as so } from "storybook/internal/csf";
364
+
365
+ // src/preview-api/modules/store/csf/normalizeArrays.ts
366
+ var b = /* @__PURE__ */ n((e) => Array.isArray(e) ? e : e ? [e] : [], "normalizeArrays");
367
+
368
+ // src/preview-api/modules/store/csf/normalizeStory.ts
369
+ var ao = W`
370
+ CSF .story annotations deprecated; annotate story functions directly:
371
+ - StoryFn.story.name => StoryFn.storyName
372
+ - StoryFn.story.(parameters|decorators) => StoryFn.(parameters|decorators)
373
+ See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#hoisted-csf-annotations for details and codemod.
374
+ `;
375
+ function _e(e, t, r) {
376
+ let o = t, i = typeof t == "function" ? t : null, { story: s } = o;
377
+ s && (no.debug("deprecated story", s), oo(ao));
378
+ let a = io(e), p = typeof o != "function" && o.name || o.storyName || s?.name || a, c = [
379
+ ...b(o.decorators),
380
+ ...b(s?.decorators)
381
+ ], l = { ...s?.parameters, ...o.parameters }, y = { ...s?.args, ...o.args }, u = { ...s?.argTypes, ...o.argTypes }, h = [...b(o.loaders), ...b(
382
+ s?.loaders)], T = [
383
+ ...b(o.beforeEach),
384
+ ...b(s?.beforeEach)
385
+ ], R = [
386
+ ...b(o.afterEach),
387
+ ...b(s?.afterEach)
388
+ ], { render: P, play: L, tags: O = [], globals: F = {} } = o, A = l.__id || so(r.id, a);
389
+ return {
390
+ moduleExport: t,
391
+ id: A,
392
+ name: p,
393
+ tags: O,
394
+ decorators: c,
395
+ parameters: l,
396
+ args: y,
397
+ argTypes: K(u),
398
+ loaders: h,
399
+ beforeEach: T,
400
+ afterEach: R,
401
+ globals: F,
402
+ ...P && { render: P },
403
+ ...i && { userStoryFn: i },
404
+ ...L && { play: L }
405
+ };
406
+ }
407
+ n(_e, "normalizeStory");
408
+
409
+ // src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts
410
+ import { sanitize as po } from "storybook/internal/csf";
411
+ function kt(e, t = e.title, r) {
412
+ let { id: o, argTypes: i } = e;
413
+ return {
414
+ id: po(o || t),
415
+ ...e,
416
+ title: t,
417
+ ...i && { argTypes: K(i) },
418
+ parameters: {
419
+ fileName: r,
420
+ ...e.parameters
421
+ }
422
+ };
423
+ }
424
+ n(kt, "normalizeComponentAnnotations");
425
+
426
+ // src/preview-api/modules/store/csf/prepareStory.ts
427
+ import { combineTags as co, includeConditionalArg as mo } from "storybook/internal/csf";
428
+ import { NoRenderFunctionError as uo } from "storybook/internal/preview-errors";
429
+ import { global as fo } from "@storybook/global";
430
+ import { global as yo } from "@storybook/global";
431
+
432
+ // src/preview-api/modules/preview-web/render/mount-utils.ts
433
+ function Ot(e) {
434
+ return e != null && lo(e).includes("mount");
435
+ }
436
+ n(Ot, "mountDestructured");
437
+ function lo(e) {
438
+ let t = e.toString().match(/[^(]*\(([^)]*)/);
439
+ if (!t)
440
+ return [];
441
+ let r = Pt(t[1]);
442
+ if (!r.length)
443
+ return [];
444
+ let o = r[0];
445
+ return o.startsWith("{") && o.endsWith("}") ? Pt(o.slice(1, -1).replace(/\s/g, "")).map((s) => s.replace(/:.*|=.*/g, "")) : [];
446
+ }
447
+ n(lo, "getUsedProps");
448
+ function Pt(e) {
449
+ let t = [], r = [], o = 0;
450
+ for (let s = 0; s < e.length; s++)
451
+ if (e[s] === "{" || e[s] === "[")
452
+ r.push(e[s] === "{" ? "}" : "]");
453
+ else if (e[s] === r[r.length - 1])
454
+ r.pop();
455
+ else if (!r.length && e[s] === ",") {
456
+ let a = e.substring(o, s).trim();
457
+ a && t.push(a), o = s + 1;
458
+ }
459
+ let i = e.substring(o).trim();
460
+ return i && t.push(i), t;
461
+ }
462
+ n(Pt, "splitByComma");
463
+
464
+ // src/preview-api/modules/store/decorators.ts
465
+ function Mt(e, t, r) {
466
+ let o = r(e);
467
+ return (i) => t(o, i);
468
+ }
469
+ n(Mt, "decorateStory");
470
+ function $t({
471
+ componentId: e,
472
+ title: t,
473
+ kind: r,
474
+ id: o,
475
+ name: i,
476
+ story: s,
477
+ parameters: a,
478
+ initialArgs: p,
479
+ argTypes: c,
480
+ ...l
481
+ } = {}) {
482
+ return l;
483
+ }
484
+ n($t, "sanitizeStoryContextUpdate");
485
+ function He(e, t) {
486
+ let r = {}, o = /* @__PURE__ */ n((s) => (a) => {
487
+ if (!r.value)
488
+ throw new Error("Decorated function called without init");
489
+ return r.value = {
490
+ ...r.value,
491
+ ...$t(a)
492
+ }, s(r.value);
493
+ }, "bindWithContext"), i = t.reduce(
494
+ (s, a) => Mt(s, a, o),
495
+ e
496
+ );
497
+ return (s) => (r.value = s, i(s));
498
+ }
499
+ n(He, "defaultDecorateStory");
500
+
501
+ // src/preview-api/modules/store/parameters.ts
502
+ var D = /* @__PURE__ */ n((...e) => {
503
+ let t = {}, r = e.filter(Boolean), o = r.reduce((i, s) => (Object.entries(s).forEach(([a, p]) => {
504
+ let c = i[a];
505
+ Array.isArray(p) || typeof c > "u" ? i[a] = p : ee(p) && ee(c) ? t[a] = !0 : typeof p < "u" && (i[a] = p);
506
+ }), i), {});
507
+ return Object.keys(t).forEach((i) => {
508
+ let s = r.filter(Boolean).map((a) => a[i]).filter((a) => typeof a < "u");
509
+ s.every((a) => ee(a)) ? o[i] = D(...s) : o[i] = s[s.length - 1];
510
+ }), o;
511
+ }, "combineParameters");
512
+
513
+ // src/preview-api/modules/store/csf/prepareStory.ts
514
+ function Ne(e, t, r) {
515
+ let { moduleExport: o, id: i, name: s } = e || {}, a = go(
516
+ e,
517
+ t,
518
+ r
519
+ ), p = /* @__PURE__ */ n(async (w) => {
520
+ let d = {};
521
+ for (let m of [
522
+ b(r.loaders),
523
+ b(t.loaders),
524
+ b(e.loaders)
525
+ ]) {
526
+ if (w.abortSignal.aborted)
527
+ return d;
528
+ let f = await Promise.all(m.map((x) => x(w)));
529
+ Object.assign(d, ...f);
530
+ }
531
+ return d;
532
+ }, "applyLoaders"), c = /* @__PURE__ */ n(async (w) => {
533
+ let d = new Array();
534
+ for (let m of [
535
+ ...b(r.beforeEach),
536
+ ...b(t.beforeEach),
537
+ ...b(e.beforeEach)
538
+ ]) {
539
+ if (w.abortSignal.aborted)
540
+ return d;
541
+ let f = await m(w);
542
+ f && d.push(f);
543
+ }
544
+ return d;
545
+ }, "applyBeforeEach"), l = /* @__PURE__ */ n(async (w) => {
546
+ let d = [
547
+ ...b(r.afterEach),
548
+ ...b(t.afterEach),
549
+ ...b(e.afterEach)
550
+ ].reverse();
551
+ for (let m of d) {
552
+ if (w.abortSignal.aborted)
553
+ return;
554
+ await m(w);
555
+ }
556
+ }, "applyAfterEach"), y = /* @__PURE__ */ n((w) => w.originalStoryFn(w.args, w), "undecoratedStoryFn"), { applyDecorators: u = He, runStep: h } = r,
557
+ T = [
558
+ ...b(e?.decorators),
559
+ ...b(t?.decorators),
560
+ ...b(r?.decorators)
561
+ ], R = e?.userStoryFn || e?.render || t.render || r.render, P = Et(u)(y, T), L = /* @__PURE__ */ n((w) => P(w), "unboundStoryFn"), O = e?.
562
+ play ?? t?.play, F = Ot(O);
563
+ if (!R && !F)
564
+ throw new uo({ id: i });
565
+ let A = /* @__PURE__ */ n((w) => async () => (await w.renderToCanvas(), w.canvas), "defaultMount"), S = e.mount ?? t.mount ?? r.mount ?? A,
566
+ v = r.testingLibraryRender;
567
+ return {
568
+ storyGlobals: {},
569
+ ...a,
570
+ moduleExport: o,
571
+ id: i,
572
+ name: s,
573
+ story: s,
574
+ originalStoryFn: R,
575
+ undecoratedStoryFn: y,
576
+ unboundStoryFn: L,
577
+ applyLoaders: p,
578
+ applyBeforeEach: c,
579
+ applyAfterEach: l,
580
+ playFunction: O,
581
+ runStep: h,
582
+ mount: S,
583
+ testingLibraryRender: v,
584
+ renderToCanvas: r.renderToCanvas,
585
+ usesMount: F
586
+ };
587
+ }
588
+ n(Ne, "prepareStory");
589
+ function go(e, t, r) {
590
+ let o = ["dev", "test"], i = yo.DOCS_OPTIONS?.autodocs === !0 ? ["autodocs"] : [], s = co(
591
+ ...o,
592
+ ...i,
593
+ ...r.tags ?? [],
594
+ ...t.tags ?? [],
595
+ ...e?.tags ?? []
596
+ ), a = D(
597
+ r.parameters,
598
+ t.parameters,
599
+ e?.parameters
600
+ ), { argTypesEnhancers: p = [], argsEnhancers: c = [] } = r, l = D(
601
+ r.argTypes,
602
+ t.argTypes,
603
+ e?.argTypes
604
+ );
605
+ if (e) {
606
+ let O = e?.userStoryFn || e?.render || t.render || r.render;
607
+ a.__isArgsStory = O && O.length > 0;
608
+ }
609
+ let y = {
610
+ ...r.args,
611
+ ...t.args,
612
+ ...e?.args
613
+ }, u = {
614
+ ...t.globals,
615
+ ...e?.globals
616
+ }, h = {
617
+ componentId: t.id,
618
+ title: t.title,
619
+ kind: t.title,
620
+ // Back compat
621
+ id: e?.id || t.id,
622
+ // if there's no story name, we create a fake one since enhancers expect a name
623
+ name: e?.name || "__meta",
624
+ story: e?.name || "__meta",
625
+ // Back compat
626
+ component: t.component,
627
+ subcomponents: t.subcomponents,
628
+ tags: s,
629
+ parameters: a,
630
+ initialArgs: y,
631
+ argTypes: l,
632
+ storyGlobals: u
633
+ };
634
+ h.argTypes = p.reduce(
635
+ (O, F) => F({ ...h, argTypes: O }),
636
+ h.argTypes
637
+ );
638
+ let T = { ...y };
639
+ h.initialArgs = [...c].reduce(
640
+ (O, F) => ({
641
+ ...O,
642
+ ...F({
643
+ ...h,
644
+ initialArgs: O
645
+ })
646
+ }),
647
+ T
648
+ );
649
+ let { name: R, story: P, ...L } = h;
650
+ return L;
651
+ }
652
+ n(go, "preparePartialAnnotations");
653
+ function Ft(e) {
654
+ let { args: t } = e, r = {
655
+ ...e,
656
+ allArgs: void 0,
657
+ argsByTarget: void 0
658
+ };
659
+ if (fo.FEATURES?.argTypeTargetsV7) {
660
+ let s = Ct(e);
661
+ r = {
662
+ ...e,
663
+ allArgs: e.args,
664
+ argsByTarget: s,
665
+ args: s[De] || {}
666
+ };
667
+ }
668
+ let o = Object.entries(r.args).reduce((s, [a, p]) => {
669
+ if (!r.argTypes[a]?.mapping)
670
+ return s[a] = p, s;
671
+ let c = /* @__PURE__ */ n((l) => {
672
+ let y = r.argTypes[a].mapping;
673
+ return y && l in y ? y[l] : l;
674
+ }, "mappingFn");
675
+ return s[a] = Array.isArray(p) ? p.map(c) : c(p), s;
676
+ }, {}), i = Object.entries(o).reduce((s, [a, p]) => {
677
+ let c = r.argTypes[a] || {};
678
+ return mo(c, o, r.globals) && (s[a] = p), s;
679
+ }, {});
680
+ return { ...r, unmappedArgs: t, args: i };
681
+ }
682
+ n(Ft, "prepareContext");
683
+
684
+ // src/preview-api/modules/store/inferArgTypes.ts
685
+ import { logger as ho } from "storybook/internal/client-logger";
686
+ var je = /* @__PURE__ */ n((e, t, r) => {
687
+ let o = typeof e;
688
+ switch (o) {
689
+ case "boolean":
690
+ case "string":
691
+ case "number":
692
+ case "function":
693
+ case "symbol":
694
+ return { name: o };
695
+ default:
696
+ break;
697
+ }
698
+ return e ? r.has(e) ? (ho.warn(W`
699
+ We've detected a cycle in arg '${t}'. Args should be JSON-serializable.
700
+
701
+ Consider using the mapping feature or fully custom args:
702
+ - Mapping: https://storybook.js.org/docs/writing-stories/args#mapping-to-complex-arg-values
703
+ - Custom args: https://storybook.js.org/docs/essentials/controls#fully-custom-args
704
+ `), { name: "other", value: "cyclic object" }) : (r.add(e), Array.isArray(e) ? { name: "array", value: e.length > 0 ? je(e[0], t, new Set(
705
+ r)) : { name: "other", value: "unknown" } } : { name: "object", value: U(e, (s) => je(s, t, new Set(r))) }) : { name: "object", value: {} };
706
+ }, "inferType"), Be = /* @__PURE__ */ n((e) => {
707
+ let { id: t, argTypes: r = {}, initialArgs: o = {} } = e, i = U(o, (a, p) => ({
708
+ name: p,
709
+ type: je(a, `${t}.${p}`, /* @__PURE__ */ new Set())
710
+ })), s = U(r, (a, p) => ({
711
+ name: p
712
+ }));
713
+ return D(i, s, r);
714
+ }, "inferArgTypes");
715
+ Be.secondPass = !0;
716
+
717
+ // src/preview-api/modules/store/inferControls.ts
718
+ import { logger as xo } from "storybook/internal/client-logger";
719
+
720
+ // src/preview-api/modules/store/filterArgTypes.ts
721
+ var It = /* @__PURE__ */ n((e, t) => Array.isArray(t) ? t.includes(e) : e.match(t), "matches"), ze = /* @__PURE__ */ n((e, t, r) => !t && !r ?
722
+ e : e && Le(e, (o, i) => {
723
+ let s = o.name || i.toString();
724
+ return !!(!t || It(s, t)) && (!r || !It(s, r));
725
+ }), "filterArgTypes");
726
+
727
+ // src/preview-api/modules/store/inferControls.ts
728
+ var bo = /* @__PURE__ */ n((e, t, r) => {
729
+ let { type: o, options: i } = e;
730
+ if (o) {
731
+ if (r.color && r.color.test(t)) {
732
+ let s = o.name;
733
+ if (s === "string")
734
+ return { control: { type: "color" } };
735
+ s !== "enum" && xo.warn(
736
+ `Addon controls: Control of type color only supports string, received "${s}" instead`
737
+ );
738
+ }
739
+ if (r.date && r.date.test(t))
740
+ return { control: { type: "date" } };
741
+ switch (o.name) {
742
+ case "array":
743
+ return { control: { type: "object" } };
744
+ case "boolean":
745
+ return { control: { type: "boolean" } };
746
+ case "string":
747
+ return { control: { type: "text" } };
748
+ case "number":
749
+ return { control: { type: "number" } };
750
+ case "enum": {
751
+ let { value: s } = o;
752
+ return { control: { type: s?.length <= 5 ? "radio" : "select" }, options: s };
753
+ }
754
+ case "function":
755
+ case "symbol":
756
+ return null;
757
+ default:
758
+ return { control: { type: i ? "select" : "object" } };
759
+ }
760
+ }
761
+ }, "inferControl"), me = /* @__PURE__ */ n((e) => {
762
+ let {
763
+ argTypes: t,
764
+ parameters: { __isArgsStory: r, controls: { include: o = null, exclude: i = null, matchers: s = {} } = {} }
765
+ } = e;
766
+ if (!r)
767
+ return t;
768
+ let a = ze(t, o, i), p = U(a, (c, l) => c?.type && bo(c, l.toString(), s));
769
+ return D(p, a);
770
+ }, "inferControls");
771
+ me.secondPass = !0;
772
+
773
+ // src/preview-api/modules/store/csf/normalizeProjectAnnotations.ts
774
+ function te({
775
+ argTypes: e,
776
+ globalTypes: t,
777
+ argTypesEnhancers: r,
778
+ decorators: o,
779
+ loaders: i,
780
+ beforeEach: s,
781
+ afterEach: a,
782
+ initialGlobals: p,
783
+ ...c
784
+ }) {
785
+ return {
786
+ ...e && { argTypes: K(e) },
787
+ ...t && { globalTypes: K(t) },
788
+ decorators: b(o),
789
+ loaders: b(i),
790
+ beforeEach: b(s),
791
+ afterEach: b(a),
792
+ argTypesEnhancers: [
793
+ ...r || [],
794
+ Be,
795
+ // There's an architectural decision to be made regarding embedded addons in core:
796
+ //
797
+ // Option 1: Keep embedded addons but ensure consistency by moving addon-specific code
798
+ // (like inferControls) to live alongside the addon code itself. This maintains the
799
+ // concept of core addons while improving code organization.
800
+ //
801
+ // Option 2: Fully integrate these addons into core, potentially moving UI components
802
+ // into the manager and treating them as core features rather than addons. This is a
803
+ // bigger architectural change requiring careful consideration.
804
+ //
805
+ // For now, we're keeping inferControls here as we need time to properly evaluate
806
+ // these options and their implications. Some features (like Angular's cleanArgsDecorator)
807
+ // currently rely on this behavior.
808
+ //
809
+ // TODO: Make an architectural decision on the handling of core addons
810
+ me
811
+ ],
812
+ initialGlobals: p,
813
+ ...c
814
+ };
815
+ }
816
+ n(te, "normalizeProjectAnnotations");
817
+
818
+ // src/preview-api/modules/store/csf/composeConfigs.ts
819
+ import { global as To } from "@storybook/global";
820
+
821
+ // src/preview-api/modules/store/csf/beforeAll.ts
822
+ var Lt = /* @__PURE__ */ n((e) => async () => {
823
+ let t = [];
824
+ for (let r of e) {
825
+ let o = await r();
826
+ o && t.unshift(o);
827
+ }
828
+ return async () => {
829
+ for (let r of t)
830
+ await r();
831
+ };
832
+ }, "composeBeforeAllHooks");
833
+
834
+ // src/preview-api/modules/store/csf/stepRunners.ts
835
+ function Ue(e) {
836
+ return async (t, r, o) => {
837
+ await e.reduceRight(
838
+ (s, a) => async () => a(t, s, o),
839
+ async () => r(o)
840
+ )();
841
+ };
842
+ }
843
+ n(Ue, "composeStepRunners");
844
+
845
+ // src/preview-api/modules/store/csf/composeConfigs.ts
846
+ function oe(e, t) {
847
+ return e.map((r) => r.default?.[t] ?? r[t]).filter(Boolean);
848
+ }
849
+ n(oe, "getField");
850
+ function Y(e, t, r = {}) {
851
+ return oe(e, t).reduce((o, i) => {
852
+ let s = b(i);
853
+ return r.reverseFileOrder ? [...s, ...o] : [...o, ...s];
854
+ }, []);
855
+ }
856
+ n(Y, "getArrayField");
857
+ function ue(e, t) {
858
+ return Object.assign({}, ...oe(e, t));
859
+ }
860
+ n(ue, "getObjectField");
861
+ function re(e, t) {
862
+ return oe(e, t).pop();
863
+ }
864
+ n(re, "getSingletonField");
865
+ function ne(e) {
866
+ let t = Y(e, "argTypesEnhancers"), r = oe(e, "runStep"), o = Y(e, "beforeAll");
867
+ return {
868
+ parameters: D(...oe(e, "parameters")),
869
+ decorators: Y(e, "decorators", {
870
+ reverseFileOrder: !(To.FEATURES?.legacyDecoratorFileOrder ?? !1)
871
+ }),
872
+ args: ue(e, "args"),
873
+ argsEnhancers: Y(e, "argsEnhancers"),
874
+ argTypes: ue(e, "argTypes"),
875
+ argTypesEnhancers: [
876
+ ...t.filter((i) => !i.secondPass),
877
+ ...t.filter((i) => i.secondPass)
878
+ ],
879
+ initialGlobals: ue(e, "initialGlobals"),
880
+ globalTypes: ue(e, "globalTypes"),
881
+ loaders: Y(e, "loaders"),
882
+ beforeAll: Lt(o),
883
+ beforeEach: Y(e, "beforeEach"),
884
+ afterEach: Y(e, "afterEach"),
885
+ render: re(e, "render"),
886
+ renderToCanvas: re(e, "renderToCanvas"),
887
+ applyDecorators: re(e, "applyDecorators"),
888
+ runStep: Ue(r),
889
+ tags: Y(e, "tags"),
890
+ mount: re(e, "mount"),
891
+ testingLibraryRender: re(e, "testingLibraryRender")
892
+ };
893
+ }
894
+ n(ne, "composeConfigs");
895
+
896
+ // src/preview-api/modules/store/csf/portable-stories.ts
897
+ import { isExportStory as Zs } from "storybook/internal/csf";
898
+ import { getCoreAnnotations as Qs } from "storybook/internal/csf";
899
+ import { MountMustBeDestructuredError as Ao } from "storybook/internal/preview-errors";
900
+
901
+ // src/preview-api/modules/preview-web/render/animation-utils.ts
902
+ function Dt() {
903
+ try {
904
+ return (
905
+ // @ts-expect-error this property exists in certain environments
906
+ !!globalThis.__vitest_browser__ || // @ts-expect-error this property exists in certain environments
907
+ !!globalThis.__playwright__binding__
908
+ );
909
+ } catch {
910
+ return !1;
911
+ }
912
+ }
913
+ n(Dt, "isTestEnvironment");
914
+ function _t(e = !0) {
915
+ if (!("document" in globalThis && "createElement" in globalThis.document))
916
+ return () => {
917
+ };
918
+ let t = document.createElement("style");
919
+ t.textContent = `*, *:before, *:after {
920
+ animation: none !important;
921
+ }`, document.head.appendChild(t);
922
+ let r = document.createElement("style");
923
+ return r.textContent = `*, *:before, *:after {
924
+ animation-delay: 0s !important;
925
+ animation-direction: ${e ? "reverse" : "normal"} !important;
926
+ animation-play-state: paused !important;
927
+ transition: none !important;
928
+ }`, document.head.appendChild(r), document.body.clientHeight, document.head.removeChild(t), () => {
929
+ r.parentNode?.removeChild(r);
930
+ };
931
+ }
932
+ n(_t, "pauseAnimations");
933
+ async function Ht(e) {
934
+ if (!("document" in globalThis && "getAnimations" in globalThis.document && "querySelectorAll" in globalThis.document))
935
+ return;
936
+ let t = !1;
937
+ await Promise.race([
938
+ // After 50ms, retrieve any running animations and wait for them to finish
939
+ // If new animations are created while waiting, we'll wait for them too
940
+ new Promise((r) => {
941
+ setTimeout(() => {
942
+ let o = [globalThis.document, ...Nt(globalThis.document)], i = /* @__PURE__ */ n(async () => {
943
+ if (t || e?.aborted)
944
+ return;
945
+ let s = o.flatMap((a) => a?.getAnimations?.() || []).filter((a) => a.playState === "running" && !So(a));
946
+ s.length > 0 && (await Promise.all(s.map((a) => a.finished)), await i());
947
+ }, "checkAnimationsFinished");
948
+ i().then(r);
949
+ }, 100);
950
+ }),
951
+ // If animations don't finish within the timeout, continue without waiting
952
+ new Promise(
953
+ (r) => setTimeout(() => {
954
+ t = !0, r(void 0);
955
+ }, 5e3)
956
+ )
957
+ ]);
958
+ }
959
+ n(Ht, "waitForAnimations");
960
+ function Nt(e) {
961
+ return [e, ...e.querySelectorAll("*")].reduce((t, r) => ("shadowRoot" in r && r.shadowRoot && t.push(r.shadowRoot, ...Nt(r.shadowRoot)), t),
962
+ []);
963
+ }
964
+ n(Nt, "getShadowRoots");
965
+ function So(e) {
966
+ if (e instanceof CSSAnimation && e.effect instanceof KeyframeEffect && e.effect.target) {
967
+ let t = getComputedStyle(e.effect.target, e.effect.pseudoElement), r = t.animationName?.split(", ").indexOf(e.animationName);
968
+ return t.animationIterationCount.split(", ")[r] === "infinite";
969
+ }
970
+ return !1;
971
+ }
972
+ n(So, "isInfiniteAnimation");
973
+
974
+ // src/preview-api/modules/store/reporter-api.ts
975
+ var Ge = class Ge {
976
+ constructor() {
977
+ this.reports = [];
978
+ }
979
+ async addReport(t) {
980
+ this.reports.push(t);
981
+ }
982
+ };
983
+ n(Ge, "ReporterAPI");
984
+ var fe = Ge;
985
+
986
+ // src/preview-api/modules/store/csf/portable-stories.ts
987
+ var Ro = "ComposedStory", wo = "Unnamed Story";
988
+ var V = [];
989
+ function We(e, t, r, o, i) {
990
+ if (e === void 0)
991
+ throw new Error("Expected a story but received undefined.");
992
+ t.title = t.title ?? Ro;
993
+ let s = kt(t), a = i || e.storyName || e.story?.name || e.name || wo, p = _e(
994
+ a,
995
+ e,
996
+ s
997
+ ), c = te(
998
+ ne([
999
+ o ?? globalThis.globalProjectAnnotations ?? {},
1000
+ r ?? {}
1001
+ ])
1002
+ ), l = Ne(
1003
+ p,
1004
+ s,
1005
+ c
1006
+ ), u = {
1007
+ ...vt(c.globalTypes),
1008
+ ...c.initialGlobals,
1009
+ ...l.storyGlobals
1010
+ }, h = new fe(), T = /* @__PURE__ */ n(() => {
1011
+ let A = Ft({
1012
+ hooks: new de(),
1013
+ globals: u,
1014
+ args: { ...l.initialArgs },
1015
+ viewMode: "story",
1016
+ reporting: h,
1017
+ loaded: {},
1018
+ abortSignal: new AbortController().signal,
1019
+ step: /* @__PURE__ */ n((S, v) => l.runStep(S, v, A), "step"),
1020
+ canvasElement: null,
1021
+ canvas: {},
1022
+ userEvent: {},
1023
+ globalTypes: c.globalTypes,
1024
+ ...l,
1025
+ context: null,
1026
+ mount: null
1027
+ });
1028
+ return A.parameters.__isPortableStory = !0, A.context = A, l.renderToCanvas && (A.renderToCanvas = async () => {
1029
+ let S = await l.renderToCanvas?.(
1030
+ {
1031
+ componentId: l.componentId,
1032
+ title: l.title,
1033
+ id: l.id,
1034
+ name: l.name,
1035
+ tags: l.tags,
1036
+ showMain: /* @__PURE__ */ n(() => {
1037
+ }, "showMain"),
1038
+ showError: /* @__PURE__ */ n((v) => {
1039
+ throw new Error(`${v.title}
1040
+ ${v.description}`);
1041
+ }, "showError"),
1042
+ showException: /* @__PURE__ */ n((v) => {
1043
+ throw v;
1044
+ }, "showException"),
1045
+ forceRemount: !0,
1046
+ storyContext: A,
1047
+ storyFn: /* @__PURE__ */ n(() => l.unboundStoryFn(A), "storyFn"),
1048
+ unboundStoryFn: l.unboundStoryFn
1049
+ },
1050
+ A.canvasElement
1051
+ );
1052
+ S && V.push(S);
1053
+ }), A.mount = l.mount(A), A;
1054
+ }, "initializeContext"), R, P = /* @__PURE__ */ n(async (A) => {
1055
+ let S = T();
1056
+ return S.canvasElement ??= globalThis?.document?.body, R && (S.loaded = R.loaded), Object.assign(S, A), l.playFunction(S);
1057
+ }, "play"), L = /* @__PURE__ */ n((A) => {
1058
+ let S = T();
1059
+ return Object.assign(S, A), Eo(l, S);
1060
+ }, "run"), O = l.playFunction ? P : void 0;
1061
+ return Object.assign(
1062
+ /* @__PURE__ */ n(function(S) {
1063
+ let v = T();
1064
+ return R && (v.loaded = R.loaded), v.args = {
1065
+ ...v.initialArgs,
1066
+ ...S
1067
+ }, l.unboundStoryFn(v);
1068
+ }, "storyFn"),
1069
+ {
1070
+ id: l.id,
1071
+ storyName: a,
1072
+ load: /* @__PURE__ */ n(async () => {
1073
+ for (let S of [...V].reverse())
1074
+ await S();
1075
+ V.length = 0;
1076
+ let A = T();
1077
+ A.loaded = await l.applyLoaders(A), V.push(...(await l.applyBeforeEach(A)).filter(Boolean)), R = A;
1078
+ }, "load"),
1079
+ globals: u,
1080
+ args: l.initialArgs,
1081
+ parameters: l.parameters,
1082
+ argTypes: l.argTypes,
1083
+ play: O,
1084
+ run: L,
1085
+ reporting: h,
1086
+ tags: l.tags
1087
+ }
1088
+ );
1089
+ }
1090
+ n(We, "composeStory");
1091
+ async function Eo(e, t) {
1092
+ for (let s of [...V].reverse())
1093
+ await s();
1094
+ if (V.length = 0, !t.canvasElement) {
1095
+ let s = document.createElement("div");
1096
+ globalThis?.document?.body?.appendChild(s), t.canvasElement = s, V.push(() => {
1097
+ globalThis?.document?.body?.contains(s) && globalThis?.document?.body?.removeChild(s);
1098
+ });
1099
+ }
1100
+ if (t.loaded = await e.applyLoaders(t), t.abortSignal.aborted)
1101
+ return;
1102
+ V.push(...(await e.applyBeforeEach(t)).filter(Boolean));
1103
+ let r = e.playFunction, o = e.usesMount;
1104
+ if (o || await t.mount(), t.abortSignal.aborted)
1105
+ return;
1106
+ r && (o || (t.mount = async () => {
1107
+ throw new Ao({ playFunction: r.toString() });
1108
+ }), await r(t));
1109
+ let i;
1110
+ Dt() ? i = _t() : await Ht(t.abortSignal), await e.applyAfterEach(t), await i?.();
1111
+ }
1112
+ n(Eo, "runStory");
1113
+
1114
+ // ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1115
+ var Co = !1, Ye = "Invariant failed";
1116
+ function ye(e, t) {
1117
+ if (!e) {
1118
+ if (Co)
1119
+ throw new Error(Ye);
1120
+ var r = typeof t == "function" ? t() : t, o = r ? "".concat(Ye, ": ").concat(r) : Ye;
1121
+ throw new Error(o);
1122
+ }
1123
+ }
1124
+ n(ye, "invariant");
1125
+
1126
+ // src/actions/preview.ts
1127
+ import { definePreviewAddon as Lo } from "storybook/internal/csf";
1128
+
1129
+ // src/actions/addArgs.ts
1130
+ var Ke = {};
1131
+ xt(Ke, {
1132
+ argsEnhancers: () => Mo
1133
+ });
1134
+
1135
+ // src/actions/runtime/action.ts
1136
+ import { ImplicitActionsDuringRendering as vo } from "storybook/internal/preview-errors";
1137
+ import { global as zt } from "@storybook/global";
1138
+ import { addons as ko } from "storybook/preview-api";
1139
+
1140
+ // src/actions/constants.ts
1141
+ var Ve = "storybook/actions", Ia = `${Ve}/panel`, jt = `${Ve}/action-event`, La = `${Ve}/action-clear`;
1142
+
1143
+ // src/actions/runtime/configureActions.ts
1144
+ var Bt = {
1145
+ depth: 10,
1146
+ clearOnStoryChange: !0,
1147
+ limit: 50
1148
+ };
1149
+
1150
+ // src/actions/runtime/action.ts
1151
+ var Ut = /* @__PURE__ */ n((e, t) => {
1152
+ let r = Object.getPrototypeOf(e);
1153
+ return !r || t(r) ? r : Ut(r, t);
1154
+ }, "findProto"), Po = /* @__PURE__ */ n((e) => !!(typeof e == "object" && e && Ut(e, (t) => /^Synthetic(?:Base)?Event$/.test(t.constructor.name)) &&
1155
+ typeof e.persist == "function"), "isReactSyntheticEvent"), Oo = /* @__PURE__ */ n((e) => {
1156
+ if (Po(e)) {
1157
+ let t = Object.create(
1158
+ e.constructor.prototype,
1159
+ Object.getOwnPropertyDescriptors(e)
1160
+ );
1161
+ t.persist();
1162
+ let r = Object.getOwnPropertyDescriptor(t, "view"), o = r?.value;
1163
+ return typeof o == "object" && o?.constructor.name === "Window" && Object.defineProperty(t, "view", {
1164
+ ...r,
1165
+ value: Object.create(o.constructor.prototype)
1166
+ }), t;
1167
+ }
1168
+ return e;
1169
+ }, "serializeArg");
1170
+ function ie(e, t = {}) {
1171
+ let r = {
1172
+ ...Bt,
1173
+ ...t
1174
+ }, o = /* @__PURE__ */ n(function(...s) {
1175
+ if (t.implicit) {
1176
+ let T = ("__STORYBOOK_PREVIEW__" in zt ? zt.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
1177
+ (R) => R.phase === "playing" || R.phase === "rendering"
1178
+ );
1179
+ if (T) {
1180
+ let R = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, P = new vo({
1181
+ phase: T.phase,
1182
+ name: e,
1183
+ deprecated: R
1184
+ });
1185
+ if (R)
1186
+ console.warn(P);
1187
+ else
1188
+ throw P;
1189
+ }
1190
+ }
1191
+ let a = ko.getChannel(), p = Date.now().toString(36) + Math.random().toString(36).substring(2), c = 5, l = s.map(Oo), y = s.length > 1 ?
1192
+ l : l[0], u = {
1193
+ id: p,
1194
+ count: 0,
1195
+ data: { name: e, args: y },
1196
+ options: {
1197
+ ...r,
1198
+ maxDepth: c + (r.depth || 3)
1199
+ }
1200
+ };
1201
+ a.emit(jt, u);
1202
+ }, "actionHandler");
1203
+ return o.isAction = !0, o.implicit = t.implicit, o;
1204
+ }
1205
+ n(ie, "action");
1206
+
1207
+ // src/actions/addArgsHelpers.ts
1208
+ var Gt = /* @__PURE__ */ n((e, t) => typeof t[e] > "u" && !(e in t), "isInInitialArgs"), Wt = /* @__PURE__ */ n((e) => {
1209
+ let {
1210
+ initialArgs: t,
1211
+ argTypes: r,
1212
+ id: o,
1213
+ parameters: { actions: i }
1214
+ } = e;
1215
+ if (!i || i.disable || !i.argTypesRegex || !r)
1216
+ return {};
1217
+ let s = new RegExp(i.argTypesRegex);
1218
+ return Object.entries(r).filter(
1219
+ ([p]) => !!s.test(p)
1220
+ ).reduce((p, [c, l]) => (Gt(c, t) && (p[c] = ie(c, { implicit: !0, id: o })), p), {});
1221
+ }, "inferActionsFromArgTypesRegex"), Yt = /* @__PURE__ */ n((e) => {
1222
+ let {
1223
+ initialArgs: t,
1224
+ argTypes: r,
1225
+ parameters: { actions: o }
1226
+ } = e;
1227
+ return o?.disable || !r ? {} : Object.entries(r).filter(([s, a]) => !!a.action).reduce((s, [a, p]) => (Gt(a, t) && (s[a] = ie(typeof p.action ==
1228
+ "string" ? p.action : a)), s), {});
1229
+ }, "addActionsFromArgTypes");
1230
+
1231
+ // src/actions/addArgs.ts
1232
+ var Mo = [
1233
+ Yt,
1234
+ Wt
1235
+ ];
1236
+
1237
+ // src/actions/loaders.ts
1238
+ var qe = {};
1239
+ xt(qe, {
1240
+ loaders: () => Io
1241
+ });
1242
+ import { onMockCall as $o } from "storybook/test";
1243
+ var Vt = !1, Fo = /* @__PURE__ */ n((e) => {
1244
+ let { parameters: t } = e;
1245
+ t?.actions?.disable || Vt || ($o((r, o) => {
1246
+ let i = r.getMockName();
1247
+ i !== "spy" && (!/^next\/.*::/.test(i) || [
1248
+ "next/router::useRouter()",
1249
+ "next/navigation::useRouter()",
1250
+ "next/navigation::redirect",
1251
+ "next/cache::",
1252
+ "next/headers::cookies().set",
1253
+ "next/headers::cookies().delete",
1254
+ "next/headers::headers().set",
1255
+ "next/headers::headers().delete"
1256
+ ].some((s) => i.startsWith(s))) && ie(i)(o);
1257
+ }), Vt = !0);
1258
+ }, "logActionsWhenMockCalled"), Io = [Fo];
1259
+
1260
+ // src/actions/preview.ts
1261
+ var Xe = /* @__PURE__ */ n(() => Lo({
1262
+ ...Ke,
1263
+ ...qe
1264
+ }), "default");
1265
+
1266
+ // src/backgrounds/preview.ts
1267
+ import { definePreviewAddon as jo } from "storybook/internal/csf";
1268
+
1269
+ // src/backgrounds/constants.ts
1270
+ var Do = "storybook/background", Z = "backgrounds";
1271
+ var rp = {
1272
+ UPDATE: `${Do}/update`
1273
+ };
1274
+
1275
+ // src/backgrounds/decorator.ts
1276
+ import { useEffect as Jt } from "storybook/preview-api";
1277
+
1278
+ // src/backgrounds/defaults.ts
1279
+ var Kt = {
1280
+ light: { name: "light", value: "#F8F8F8" },
1281
+ dark: { name: "dark", value: "#333" }
1282
+ };
1283
+
1284
+ // src/backgrounds/utils.ts
1285
+ var { document: N } = globalThis, qt = /* @__PURE__ */ n(() => globalThis?.matchMedia ? !!globalThis.matchMedia("(prefers-reduced-motion: re\
1286
+ duce)")?.matches : !1, "isReduceMotionEnabled"), Ze = /* @__PURE__ */ n((e) => {
1287
+ (Array.isArray(e) ? e : [e]).forEach(_o);
1288
+ }, "clearStyles"), _o = /* @__PURE__ */ n((e) => {
1289
+ if (!N)
1290
+ return;
1291
+ let t = N.getElementById(e);
1292
+ t && t.parentElement && t.parentElement.removeChild(t);
1293
+ }, "clearStyle"), Xt = /* @__PURE__ */ n((e, t) => {
1294
+ if (!N)
1295
+ return;
1296
+ let r = N.getElementById(e);
1297
+ if (r)
1298
+ r.innerHTML !== t && (r.innerHTML = t);
1299
+ else {
1300
+ let o = N.createElement("style");
1301
+ o.setAttribute("id", e), o.innerHTML = t, N.head.appendChild(o);
1302
+ }
1303
+ }, "addGridStyle"), Zt = /* @__PURE__ */ n((e, t, r) => {
1304
+ if (!N)
1305
+ return;
1306
+ let o = N.getElementById(e);
1307
+ if (o)
1308
+ o.innerHTML !== t && (o.innerHTML = t);
1309
+ else {
1310
+ let i = N.createElement("style");
1311
+ i.setAttribute("id", e), i.innerHTML = t;
1312
+ let s = `addon-backgrounds-grid${r ? `-docs-${r}` : ""}`, a = N.getElementById(s);
1313
+ a ? a.parentElement?.insertBefore(i, a) : N.head.appendChild(i);
1314
+ }
1315
+ }, "addBackgroundStyle");
1316
+
1317
+ // src/backgrounds/decorator.ts
1318
+ var Ho = {
1319
+ cellSize: 100,
1320
+ cellAmount: 10,
1321
+ opacity: 0.8
1322
+ }, Qt = "addon-backgrounds", er = "addon-backgrounds-grid", No = qt() ? "" : "transition: background-color 0.3s;", tr = /* @__PURE__ */ n((e, t) => {
1323
+ let { globals: r = {}, parameters: o = {}, viewMode: i, id: s } = t, {
1324
+ options: a = Kt,
1325
+ disable: p,
1326
+ grid: c = Ho
1327
+ } = o[Z] || {}, l = r[Z] || {}, y = typeof l == "string" ? l : l?.value, u = y ? a[y] : void 0, h = typeof u == "string" ? u : u?.value ||
1328
+ "transparent", T = typeof l == "string" ? !1 : l.grid || !1, R = !!u && !p, P = i === "docs" ? `#anchor--${s} .docs-story` : ".sb-show-mai\
1329
+ n", L = i === "docs" ? `#anchor--${s} .docs-story` : ".sb-show-main", O = o.layout === void 0 || o.layout === "padded", F = i === "docs" ? 20 :
1330
+ O ? 16 : 0, { cellAmount: A, cellSize: S, opacity: v, offsetX: w = F, offsetY: d = F } = c, m = i === "docs" ? `${Qt}-docs-${s}` : `${Qt}-\
1331
+ color`, f = i === "docs" ? s : null;
1332
+ Jt(() => {
1333
+ let g = `
1334
+ ${P} {
1335
+ background: ${h} !important;
1336
+ ${No}
1337
+ }`;
1338
+ if (!R) {
1339
+ Ze(m);
1340
+ return;
1341
+ }
1342
+ Zt(m, g, f);
1343
+ }, [P, m, f, R, h]);
1344
+ let x = i === "docs" ? `${er}-docs-${s}` : `${er}`;
1345
+ return Jt(() => {
1346
+ if (!T) {
1347
+ Ze(x);
1348
+ return;
1349
+ }
1350
+ let g = [
1351
+ `${S * A}px ${S * A}px`,
1352
+ `${S * A}px ${S * A}px`,
1353
+ `${S}px ${S}px`,
1354
+ `${S}px ${S}px`
1355
+ ].join(", "), E = `
1356
+ ${L} {
1357
+ background-size: ${g} !important;
1358
+ background-position: ${w}px ${d}px, ${w}px ${d}px, ${w}px ${d}px, ${w}px ${d}px !important;
1359
+ background-blend-mode: difference !important;
1360
+ background-image: linear-gradient(rgba(130, 130, 130, ${v}) 1px, transparent 1px),
1361
+ linear-gradient(90deg, rgba(130, 130, 130, ${v}) 1px, transparent 1px),
1362
+ linear-gradient(rgba(130, 130, 130, ${v / 2}) 1px, transparent 1px),
1363
+ linear-gradient(90deg, rgba(130, 130, 130, ${v / 2}) 1px, transparent 1px) !important;
1364
+ }
1365
+ `;
1366
+ Xt(x, E);
1367
+ }, [A, S, L, x, T, w, d, v]), e();
1368
+ }, "withBackgroundAndGrid");
1369
+
1370
+ // src/backgrounds/preview.ts
1371
+ var Bo = globalThis.FEATURES?.backgrounds ? [tr] : [], zo = {
1372
+ [Z]: {
1373
+ grid: {
1374
+ cellSize: 20,
1375
+ opacity: 0.5,
1376
+ cellAmount: 5
1377
+ },
1378
+ disable: !1
1379
+ }
1380
+ }, Uo = {
1381
+ [Z]: { value: void 0, grid: !1 }
1382
+ }, Je = /* @__PURE__ */ n(() => jo({
1383
+ decorators: Bo,
1384
+ parameters: zo,
1385
+ initialGlobals: Uo
1386
+ }), "default");
1387
+
1388
+ // src/component-testing/preview.ts
1389
+ import { definePreviewAddon as Go } from "storybook/internal/csf";
1390
+ import { instrument as Wo } from "storybook/internal/instrumenter";
1391
+ var { step: Yo } = Wo(
1392
+ {
1393
+ // It seems like the label is unused, but the instrumenter has access to it
1394
+ // The context will be bounded later in StoryRender, so that the user can write just:
1395
+ // await step("label", (context) => {
1396
+ // // labeled step
1397
+ // });
1398
+ step: /* @__PURE__ */ n(async (e, t, r) => t(r), "step")
1399
+ },
1400
+ { intercept: !0 }
1401
+ ), Qe = /* @__PURE__ */ n(() => Go({
1402
+ parameters: {
1403
+ throwPlayFunctionExceptions: !1
1404
+ },
1405
+ runStep: Yo
1406
+ }), "default");
1407
+
1408
+ // src/highlight/preview.ts
1409
+ import { definePreviewAddon as Zo } from "storybook/internal/csf";
1410
+ import { addons as ur } from "storybook/preview-api";
1411
+
1412
+ // src/highlight/useHighlights.ts
1413
+ import { STORY_RENDER_PHASE_CHANGED as qo } from "storybook/internal/core-events";
1414
+
1415
+ // src/highlight/constants.ts
1416
+ var ge = "storybook/highlight", rr = `${ge}/add`, or = `${ge}/remove`, nr = `${ge}/reset`, ir = `${ge}/scroll-into-view`, et = 2147483647, B = 28;
1417
+
1418
+ // src/highlight/icons.ts
1419
+ var tt = {
1420
+ chevronLeft: [
1421
+ "M9.10355 10.1464C9.29882 10.3417 9.29882 10.6583 9.10355 10.8536C8.90829 11.0488 8.59171 11.0488 8.39645 10.8536L4.89645 7.35355C4.7011\
1422
+ 8 7.15829 4.70118 6.84171 4.89645 6.64645L8.39645 3.14645C8.59171 2.95118 8.90829 2.95118 9.10355 3.14645C9.29882 3.34171 9.29882 3.65829 9.\
1423
+ 10355 3.85355L5.95711 7L9.10355 10.1464Z"
1424
+ ],
1425
+ chevronRight: [
1426
+ "M4.89645 10.1464C4.70118 10.3417 4.70118 10.6583 4.89645 10.8536C5.09171 11.0488 5.40829 11.0488 5.60355 10.8536L9.10355 7.35355C9.2988\
1427
+ 2 7.15829 9.29882 6.84171 9.10355 6.64645L5.60355 3.14645C5.40829 2.95118 5.09171 2.95118 4.89645 3.14645C4.70118 3.34171 4.70118 3.65829 4.\
1428
+ 89645 3.85355L8.04289 7L4.89645 10.1464Z"
1429
+ ],
1430
+ info: [
1431
+ "M7 5.5a.5.5 0 01.5.5v4a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zM7 4.5A.75.75 0 107 3a.75.75 0 000 1.5z",
1432
+ "M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z"
1433
+ ],
1434
+ shareAlt: [
1435
+ "M2 1.004a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1v-4.5a.5.5 0 00-1 0v4.5H2v-10h4.5a.5.5 0 000-1H2z",
1436
+ "M7.354 7.357L12 2.711v1.793a.5.5 0 001 0v-3a.5.5 0 00-.5-.5h-3a.5.5 0 100 1h1.793L6.646 6.65a.5.5 0 10.708.707z"
1437
+ ]
1438
+ };
1439
+
1440
+ // src/highlight/utils.ts
1441
+ var Vo = "svg,path,rect,circle,line,polyline,polygon,ellipse,text".split(","), M = /* @__PURE__ */ n((e, t = {}, r) => {
1442
+ let o = Vo.includes(e) ? document.createElementNS("http://www.w3.org/2000/svg", e) : document.createElement(e);
1443
+ return Object.entries(t).forEach(([i, s]) => {
1444
+ /[A-Z]/.test(i) ? (i === "onClick" && (o.addEventListener("click", s), o.addEventListener("keydown", (a) => {
1445
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), s());
1446
+ })), i === "onMouseEnter" && o.addEventListener("mouseenter", s), i === "onMouseLeave" && o.addEventListener("mouseleave", s)) : o.setAttribute(
1447
+ i, s);
1448
+ }), r?.forEach((i) => {
1449
+ if (!(i == null || i === !1))
1450
+ try {
1451
+ o.appendChild(i);
1452
+ } catch {
1453
+ o.appendChild(document.createTextNode(String(i)));
1454
+ }
1455
+ }), o;
1456
+ }, "createElement"), ae = /* @__PURE__ */ n((e) => tt[e] && M(
1457
+ "svg",
1458
+ { width: "14", height: "14", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg" },
1459
+ tt[e].map(
1460
+ (t) => M("path", {
1461
+ fill: "currentColor",
1462
+ "fill-rule": "evenodd",
1463
+ "clip-rule": "evenodd",
1464
+ d: t
1465
+ })
1466
+ )
1467
+ ), "createIcon"), sr = /* @__PURE__ */ n((e) => {
1468
+ if ("elements" in e) {
1469
+ let { elements: o, color: i, style: s } = e;
1470
+ return {
1471
+ id: void 0,
1472
+ priority: 0,
1473
+ selectors: o,
1474
+ styles: {
1475
+ outline: `2px ${s} ${i}`,
1476
+ outlineOffset: "2px",
1477
+ boxShadow: "0 0 0 6px rgba(255,255,255,0.6)"
1478
+ },
1479
+ menu: void 0
1480
+ };
1481
+ }
1482
+ let { menu: t, ...r } = e;
1483
+ return {
1484
+ id: void 0,
1485
+ priority: 0,
1486
+ styles: {
1487
+ outline: "2px dashed #029cfd"
1488
+ },
1489
+ ...r,
1490
+ menu: Array.isArray(t) ? t.every(Array.isArray) ? t : [t] : void 0
1491
+ };
1492
+ }, "normalizeOptions"), Ko = /* @__PURE__ */ n((e) => e instanceof Function, "isFunction"), se = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(),
1493
+ he = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ n((e) => {
1494
+ let t = Symbol();
1495
+ return q.set(t, []), se.set(t, e), { get: /* @__PURE__ */ n(() => se.get(t), "get"), set: /* @__PURE__ */ n((a) => {
1496
+ let p = se.get(t), c = Ko(a) ? a(p) : a;
1497
+ c !== p && (se.set(t, c), q.get(t)?.forEach((l) => {
1498
+ he.get(l)?.(), he.set(l, l(c));
1499
+ }));
1500
+ }, "set"), subscribe: /* @__PURE__ */ n((a) => (q.get(t)?.push(a), () => {
1501
+ let p = q.get(t);
1502
+ p && q.set(
1503
+ t,
1504
+ p.filter((c) => c !== a)
1505
+ );
1506
+ }), "subscribe"), teardown: /* @__PURE__ */ n(() => {
1507
+ q.get(t)?.forEach((a) => {
1508
+ he.get(a)?.(), he.delete(a);
1509
+ }), q.delete(t), se.delete(t);
1510
+ }, "teardown") };
1511
+ }, "useStore"), rt = /* @__PURE__ */ n((e) => {
1512
+ let t = document.getElementById("storybook-root"), r = /* @__PURE__ */ new Map();
1513
+ for (let o of e) {
1514
+ let { priority: i = 0 } = o;
1515
+ for (let s of o.selectors) {
1516
+ let a = [
1517
+ ...document.querySelectorAll(
1518
+ // Elements matching the selector, excluding storybook elements and their descendants.
1519
+ // Necessary to find portaled elements (e.g. children of `body`).
1520
+ `:is(${s}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`
1521
+ ),
1522
+ // Elements matching the selector inside the storybook root, as these were excluded above.
1523
+ ...t?.querySelectorAll(s) || []
1524
+ ];
1525
+ for (let p of a) {
1526
+ let c = r.get(p);
1527
+ (!c || c.priority <= i) && r.set(p, {
1528
+ ...o,
1529
+ priority: i,
1530
+ selectors: Array.from(new Set((c?.selectors || []).concat(s)))
1531
+ });
1532
+ }
1533
+ }
1534
+ }
1535
+ return r;
1536
+ }, "mapElements"), ar = /* @__PURE__ */ n((e) => Array.from(e.entries()).map(([t, { selectors: r, styles: o, hoverStyles: i, focusStyles: s,
1537
+ menu: a }]) => {
1538
+ let { top: p, left: c, width: l, height: y } = t.getBoundingClientRect(), { position: u } = getComputedStyle(t);
1539
+ return {
1540
+ element: t,
1541
+ selectors: r,
1542
+ styles: o,
1543
+ hoverStyles: i,
1544
+ focusStyles: s,
1545
+ menu: a,
1546
+ top: u === "fixed" ? p : p + window.scrollY,
1547
+ left: u === "fixed" ? c : c + window.scrollX,
1548
+ width: l,
1549
+ height: y
1550
+ };
1551
+ }).sort((t, r) => r.width * r.height - t.width * t.height), "mapBoxes"), ot = /* @__PURE__ */ n((e, t) => {
1552
+ let r = e.getBoundingClientRect(), { x: o, y: i } = t;
1553
+ return r?.top && r?.left && o >= r.left && o <= r.left + r.width && i >= r.top && i <= r.top + r.height;
1554
+ }, "isOverMenu"), nt = /* @__PURE__ */ n((e, t, r) => {
1555
+ if (!t || !r)
1556
+ return !1;
1557
+ let { left: o, top: i, width: s, height: a } = e;
1558
+ a < B && (i = i - Math.round((B - a) / 2), a = B), s < B && (o = o - Math.round((B - s) / 2), s = B), t.style.position === "fixed" && (o +=
1559
+ window.scrollX, i += window.scrollY);
1560
+ let { x: p, y: c } = r;
1561
+ return p >= o && p <= o + s && c >= i && c <= i + a;
1562
+ }, "isTargeted"), pr = /* @__PURE__ */ n((e, t, r = {}) => {
1563
+ let { x: o, y: i } = t, { margin: s = 5, topOffset: a = 0, centered: p = !1 } = r, { scrollX: c, scrollY: l, innerHeight: y, innerWidth: u } = window,
1564
+ h = Math.min(
1565
+ e.style.position === "fixed" ? i - l : i,
1566
+ y - e.clientHeight - s - a + l
1567
+ ), T = p ? e.clientWidth / 2 : 0, R = e.style.position === "fixed" ? Math.max(Math.min(o - c, u - T - s), T + s) : Math.max(
1568
+ Math.min(o, u - T - s + c),
1569
+ T + s + c
1570
+ );
1571
+ Object.assign(e.style, {
1572
+ ...R !== o && { left: `${R}px` },
1573
+ ...h !== i && { top: `${h}px` }
1574
+ });
1575
+ }, "keepInViewport"), it = /* @__PURE__ */ n((e) => {
1576
+ window.HTMLElement.prototype.hasOwnProperty("showPopover") && e.showPopover();
1577
+ }, "showPopover"), lr = /* @__PURE__ */ n((e) => {
1578
+ window.HTMLElement.prototype.hasOwnProperty("showPopover") && e.hidePopover();
1579
+ }, "hidePopover"), cr = /* @__PURE__ */ n((e) => ({
1580
+ top: e.top,
1581
+ left: e.left,
1582
+ width: e.width,
1583
+ height: e.height,
1584
+ selectors: e.selectors,
1585
+ element: {
1586
+ attributes: Object.fromEntries(
1587
+ Array.from(e.element.attributes).map((t) => [t.name, t.value])
1588
+ ),
1589
+ localName: e.element.localName,
1590
+ tagName: e.element.tagName,
1591
+ outerHTML: e.element.outerHTML
1592
+ }
1593
+ }), "getEventDetails");
1594
+
1595
+ // src/highlight/useHighlights.ts
1596
+ var C = "storybook-highlights-menu", dr = "storybook-highlights-root", Xo = "storybook-root", mr = /* @__PURE__ */ n((e) => {
1597
+ if (globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED)
1598
+ return;
1599
+ globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED = !0;
1600
+ let { document: t } = globalThis, r = z([]), o = z(/* @__PURE__ */ new Map()), i = z([]), s = z(), a = z(), p = z([]), c = z([]), l = z(),
1601
+ y = z(), u = t.getElementById(dr);
1602
+ r.subscribe(() => {
1603
+ u || (u = M("div", { id: dr }), t.body.appendChild(u));
1604
+ }), r.subscribe((d) => {
1605
+ let m = t.getElementById(Xo);
1606
+ if (!m)
1607
+ return;
1608
+ o.set(rt(d));
1609
+ let f = new MutationObserver(() => o.set(rt(d)));
1610
+ return f.observe(m, { subtree: !0, childList: !0 }), () => {
1611
+ f.disconnect();
1612
+ };
1613
+ }), o.subscribe((d) => {
1614
+ let m = /* @__PURE__ */ n(() => requestAnimationFrame(() => i.set(ar(d))), "updateBoxes"), f = new ResizeObserver(m);
1615
+ f.observe(t.body), Array.from(d.keys()).forEach((g) => f.observe(g));
1616
+ let x = Array.from(t.body.querySelectorAll("*")).filter((g) => {
1617
+ let { overflow: E, overflowX: I, overflowY: k } = window.getComputedStyle(g);
1618
+ return ["auto", "scroll"].some((H) => [E, I, k].includes(H));
1619
+ });
1620
+ return x.forEach((g) => g.addEventListener("scroll", m)), () => {
1621
+ f.disconnect(), x.forEach((g) => g.removeEventListener("scroll", m));
1622
+ };
1623
+ }), o.subscribe((d) => {
1624
+ let m = Array.from(d.keys()).filter(({ style: x }) => x.position === "sticky"), f = /* @__PURE__ */ n(() => requestAnimationFrame(() => {
1625
+ i.set(
1626
+ (x) => x.map((g) => {
1627
+ if (m.includes(g.element)) {
1628
+ let { top: E, left: I } = g.element.getBoundingClientRect();
1629
+ return { ...g, top: E + window.scrollY, left: I + window.scrollX };
1630
+ }
1631
+ return g;
1632
+ })
1633
+ );
1634
+ }), "updateBoxes");
1635
+ return t.addEventListener("scroll", f), () => t.removeEventListener("scroll", f);
1636
+ }), o.subscribe((d) => {
1637
+ p.set((m) => m.filter(({ element: f }) => d.has(f)));
1638
+ }), p.subscribe((d) => {
1639
+ d.length ? (y.set((m) => d.some((f) => f.element === m?.element) ? m : void 0), l.set((m) => d.some((f) => f.element === m?.element) ? m :
1640
+ void 0)) : (y.set(void 0), l.set(void 0), s.set(void 0));
1641
+ });
1642
+ let h = new Map(/* @__PURE__ */ new Map());
1643
+ r.subscribe((d) => {
1644
+ d.forEach(({ keyframes: m }) => {
1645
+ if (m) {
1646
+ let f = h.get(m);
1647
+ f || (f = t.createElement("style"), f.setAttribute("data-highlight", "keyframes"), h.set(m, f), t.head.appendChild(f)), f.innerHTML =
1648
+ m;
1649
+ }
1650
+ }), h.forEach((m, f) => {
1651
+ d.some((x) => x.keyframes === f) || (m.remove(), h.delete(f));
1652
+ });
1653
+ });
1654
+ let T = new Map(/* @__PURE__ */ new Map());
1655
+ i.subscribe((d) => {
1656
+ d.forEach((m) => {
1657
+ let f = T.get(m.element);
1658
+ if (u && !f) {
1659
+ let x = {
1660
+ popover: "manual",
1661
+ "data-highlight-dimensions": `w${m.width.toFixed(0)}h${m.height.toFixed(0)}`,
1662
+ "data-highlight-coordinates": `x${m.left.toFixed(0)}y${m.top.toFixed(0)}`
1663
+ };
1664
+ f = u.appendChild(
1665
+ M("div", x, [M("div")])
1666
+ ), T.set(m.element, f);
1667
+ }
1668
+ }), T.forEach((m, f) => {
1669
+ d.some(({ element: x }) => x === f) || (m.remove(), T.delete(f));
1670
+ });
1671
+ }), i.subscribe((d) => {
1672
+ let m = d.filter((x) => x.menu);
1673
+ if (!m.length)
1674
+ return;
1675
+ let f = /* @__PURE__ */ n((x) => {
1676
+ requestAnimationFrame(() => {
1677
+ let g = t.getElementById(C), E = { x: x.pageX, y: x.pageY };
1678
+ if (g && !ot(g, E)) {
1679
+ let I = m.filter((k) => {
1680
+ let H = T.get(k.element);
1681
+ return nt(k, H, E);
1682
+ });
1683
+ s.set(I.length ? E : void 0), p.set(I);
1684
+ }
1685
+ });
1686
+ }, "onClick");
1687
+ return t.addEventListener("click", f), () => t.removeEventListener("click", f);
1688
+ });
1689
+ let R = /* @__PURE__ */ n(() => {
1690
+ let d = t.getElementById(C), m = a.get();
1691
+ !m || d && ot(d, m) || c.set((f) => {
1692
+ let x = i.get().filter((k) => {
1693
+ let H = T.get(k.element);
1694
+ return nt(k, H, m);
1695
+ }), g = f.filter((k) => x.includes(k)), E = x.filter((k) => !f.includes(k)), I = f.length - g.length;
1696
+ return E.length || I ? [...g, ...E] : f;
1697
+ });
1698
+ }, "updateHovered");
1699
+ a.subscribe(R), i.subscribe(R);
1700
+ let P = /* @__PURE__ */ n(() => {
1701
+ let d = y.get(), m = d ? [d] : p.get(), f = m.length === 1 ? m[0] : l.get(), x = s.get() !== void 0;
1702
+ i.get().forEach((g) => {
1703
+ let E = T.get(g.element);
1704
+ if (E) {
1705
+ let I = f === g, k = x ? f ? I : m.includes(g) : c.get()?.includes(g);
1706
+ Object.assign(E.style, {
1707
+ animation: "none",
1708
+ background: "transparent",
1709
+ border: "none",
1710
+ boxSizing: "border-box",
1711
+ outline: "none",
1712
+ outlineOffset: "0px",
1713
+ ...g.styles,
1714
+ ...k ? g.hoverStyles : {},
1715
+ ...I ? g.focusStyles : {},
1716
+ position: getComputedStyle(g.element).position === "fixed" ? "fixed" : "absolute",
1717
+ zIndex: et - 10,
1718
+ top: `${g.top}px`,
1719
+ left: `${g.left}px`,
1720
+ width: `${g.width}px`,
1721
+ height: `${g.height}px`,
1722
+ margin: 0,
1723
+ padding: 0,
1724
+ cursor: g.menu && k ? "pointer" : "default",
1725
+ pointerEvents: g.menu ? "auto" : "none",
1726
+ display: "flex",
1727
+ alignItems: "center",
1728
+ justifyContent: "center",
1729
+ overflow: "visible"
1730
+ }), Object.assign(E.children[0].style, {
1731
+ width: "100%",
1732
+ height: "100%",
1733
+ minHeight: `${B}px`,
1734
+ minWidth: `${B}px`,
1735
+ boxSizing: "content-box",
1736
+ padding: E.style.outlineWidth || "0px"
1737
+ }), it(E);
1738
+ }
1739
+ });
1740
+ }, "updateBoxStyles");
1741
+ i.subscribe(P), p.subscribe(P), c.subscribe(P), l.subscribe(P), y.subscribe(P);
1742
+ let L = /* @__PURE__ */ n(() => {
1743
+ if (!u)
1744
+ return;
1745
+ let d = t.getElementById(C);
1746
+ if (d)
1747
+ d.innerHTML = "";
1748
+ else {
1749
+ let g = { id: C, popover: "manual" };
1750
+ d = u.appendChild(M("div", g)), u.appendChild(
1751
+ M("style", {}, [
1752
+ `
1753
+ #${C} {
1754
+ position: absolute;
1755
+ z-index: ${et};
1756
+ width: 300px;
1757
+ padding: 0px;
1758
+ margin: 15px 0 0 0;
1759
+ transform: translateX(-50%);
1760
+ font-family: "Nunito Sans", -apple-system, ".SFNSText-Regular", "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Ne\
1761
+ ue", Helvetica, Arial, sans-serif;
1762
+ font-size: 12px;
1763
+ background: white;
1764
+ border: none;
1765
+ border-radius: 6px;
1766
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.05), 0 5px 15px 0 rgba(0, 0, 0, 0.1);
1767
+ color: #2E3438;
1768
+ }
1769
+ #${C} ul {
1770
+ list-style: none;
1771
+ margin: 0;
1772
+ padding: 0;
1773
+ }
1774
+ #${C} > ul {
1775
+ max-height: 300px;
1776
+ overflow-y: auto;
1777
+ padding: 4px 0;
1778
+ }
1779
+ #${C} li {
1780
+ padding: 0 4px;
1781
+ margin: 0;
1782
+ }
1783
+ #${C} li > :not(ul) {
1784
+ display: flex;
1785
+ padding: 8px;
1786
+ margin: 0;
1787
+ align-items: center;
1788
+ gap: 8px;
1789
+ border-radius: 4px;
1790
+ }
1791
+ #${C} button {
1792
+ width: 100%;
1793
+ border: 0;
1794
+ background: transparent;
1795
+ color: inherit;
1796
+ text-align: left;
1797
+ font-family: inherit;
1798
+ font-size: inherit;
1799
+ }
1800
+ #${C} button:focus-visible {
1801
+ outline-color: #029CFD;
1802
+ }
1803
+ #${C} button:hover {
1804
+ background: rgba(2, 156, 253, 0.07);
1805
+ color: #029CFD;
1806
+ cursor: pointer;
1807
+ }
1808
+ #${C} li code {
1809
+ white-space: nowrap;
1810
+ overflow: hidden;
1811
+ text-overflow: ellipsis;
1812
+ line-height: 16px;
1813
+ font-size: 11px;
1814
+ }
1815
+ #${C} li svg {
1816
+ flex-shrink: 0;
1817
+ margin: 1px;
1818
+ color: #73828C;
1819
+ }
1820
+ #${C} li > button:hover svg, #${C} li > button:focus-visible svg {
1821
+ color: #029CFD;
1822
+ }
1823
+ #${C} .element-list li svg {
1824
+ display: none;
1825
+ }
1826
+ #${C} li.selectable svg, #${C} li.selected svg {
1827
+ display: block;
1828
+ }
1829
+ #${C} .menu-list {
1830
+ border-top: 1px solid rgba(38, 85, 115, 0.15);
1831
+ }
1832
+ #${C} .menu-list > li:not(:last-child) {
1833
+ padding-bottom: 4px;
1834
+ margin-bottom: 4px;
1835
+ border-bottom: 1px solid rgba(38, 85, 115, 0.15);
1836
+ }
1837
+ #${C} .menu-items, #${C} .menu-items li {
1838
+ padding: 0;
1839
+ }
1840
+ #${C} .menu-item {
1841
+ display: flex;
1842
+ }
1843
+ #${C} .menu-item-content {
1844
+ display: flex;
1845
+ flex-direction: column;
1846
+ flex-grow: 1;
1847
+ }
1848
+ `
1849
+ ])
1850
+ );
1851
+ }
1852
+ let m = y.get(), f = m ? [m] : p.get();
1853
+ if (f.length && (d.style.position = getComputedStyle(f[0].element).position === "fixed" ? "fixed" : "absolute", d.appendChild(
1854
+ M(
1855
+ "ul",
1856
+ { class: "element-list" },
1857
+ f.map((g) => {
1858
+ let E = f.length > 1 && !!g.menu?.some(
1859
+ (H) => H.some(
1860
+ (X) => !X.selectors || X.selectors.some((le) => g.selectors.includes(le))
1861
+ )
1862
+ ), I = E ? {
1863
+ class: "selectable",
1864
+ onClick: /* @__PURE__ */ n(() => y.set(g), "onClick"),
1865
+ onMouseEnter: /* @__PURE__ */ n(() => l.set(g), "onMouseEnter"),
1866
+ onMouseLeave: /* @__PURE__ */ n(() => l.set(void 0), "onMouseLeave")
1867
+ } : m ? { class: "selected", onClick: /* @__PURE__ */ n(() => y.set(void 0), "onClick") } : {}, k = E || m;
1868
+ return M("li", I, [
1869
+ M(k ? "button" : "div", k ? { type: "button" } : {}, [
1870
+ m ? ae("chevronLeft") : null,
1871
+ M("code", {}, [g.element.outerHTML]),
1872
+ E ? ae("chevronRight") : null
1873
+ ])
1874
+ ]);
1875
+ })
1876
+ )
1877
+ )), y.get() || p.get().length === 1) {
1878
+ let g = y.get() || p.get()[0], E = g.menu?.filter(
1879
+ (I) => I.some(
1880
+ (k) => !k.selectors || k.selectors.some((H) => g.selectors.includes(H))
1881
+ )
1882
+ );
1883
+ E?.length && d.appendChild(
1884
+ M(
1885
+ "ul",
1886
+ { class: "menu-list" },
1887
+ E.map(
1888
+ (I) => M("li", {}, [
1889
+ M(
1890
+ "ul",
1891
+ { class: "menu-items" },
1892
+ I.map(
1893
+ ({ id: k, title: H, description: X, iconLeft: le, iconRight: gt, clickEvent: ht }) => {
1894
+ let we = ht && (() => e.emit(ht, k, cr(g)));
1895
+ return M("li", {}, [
1896
+ M(
1897
+ we ? "button" : "div",
1898
+ we ? { class: "menu-item", type: "button", onClick: we } : { class: "menu-item" },
1899
+ [
1900
+ le ? ae(le) : null,
1901
+ M("div", { class: "menu-item-content" }, [
1902
+ M(X ? "strong" : "span", {}, [H]),
1903
+ X && M("span", {}, [X])
1904
+ ]),
1905
+ gt ? ae(gt) : null
1906
+ ]
1907
+ )
1908
+ ]);
1909
+ }
1910
+ )
1911
+ )
1912
+ ])
1913
+ )
1914
+ )
1915
+ );
1916
+ }
1917
+ let x = s.get();
1918
+ x ? (Object.assign(d.style, {
1919
+ display: "block",
1920
+ left: `${d.style.position === "fixed" ? x.x - window.scrollX : x.x}px`,
1921
+ top: `${d.style.position === "fixed" ? x.y - window.scrollY : x.y}px`
1922
+ }), it(d), requestAnimationFrame(() => pr(d, x, { topOffset: 15, centered: !0 }))) : (lr(d), Object.assign(d.style, { display: "none" }));
1923
+ }, "renderMenu");
1924
+ p.subscribe(L), y.subscribe(L);
1925
+ let O = /* @__PURE__ */ n((d) => {
1926
+ let m = sr(d);
1927
+ r.set((f) => {
1928
+ let x = m.id ? f.filter((g) => g.id !== m.id) : f;
1929
+ return m.selectors?.length ? [...x, m] : x;
1930
+ });
1931
+ }, "addHighlight"), F = /* @__PURE__ */ n((d) => {
1932
+ d && r.set((m) => m.filter((f) => f.id !== d));
1933
+ }, "removeHighlight"), A = /* @__PURE__ */ n(() => {
1934
+ r.set([]), o.set(/* @__PURE__ */ new Map()), i.set([]), s.set(void 0), a.set(void 0), p.set([]), c.set([]), l.set(void 0), y.set(void 0);
1935
+ }, "resetState"), S, v = /* @__PURE__ */ n((d, m) => {
1936
+ let f = "scrollIntoView-highlight";
1937
+ clearTimeout(S), F(f);
1938
+ let x = t.querySelector(d);
1939
+ if (!x) {
1940
+ console.warn(`Cannot scroll into view: ${d} not found`);
1941
+ return;
1942
+ }
1943
+ x.scrollIntoView({ behavior: "smooth", block: "center", ...m });
1944
+ let g = `kf-${Math.random().toString(36).substring(2, 15)}`;
1945
+ r.set((E) => [
1946
+ ...E,
1947
+ {
1948
+ id: f,
1949
+ priority: 1e3,
1950
+ selectors: [d],
1951
+ styles: {
1952
+ outline: "2px solid #1EA7FD",
1953
+ outlineOffset: "-1px",
1954
+ animation: `${g} 3s linear forwards`
1955
+ },
1956
+ keyframes: `@keyframes ${g} {
1957
+ 0% { outline: 2px solid #1EA7FD; }
1958
+ 20% { outline: 2px solid #1EA7FD00; }
1959
+ 40% { outline: 2px solid #1EA7FD; }
1960
+ 60% { outline: 2px solid #1EA7FD00; }
1961
+ 80% { outline: 2px solid #1EA7FD; }
1962
+ 100% { outline: 2px solid #1EA7FD00; }
1963
+ }`
1964
+ }
1965
+ ]), S = setTimeout(() => F(f), 3500);
1966
+ }, "scrollIntoView"), w = /* @__PURE__ */ n((d) => {
1967
+ requestAnimationFrame(() => a.set({ x: d.pageX, y: d.pageY }));
1968
+ }, "onMouseMove");
1969
+ t.body.addEventListener("mousemove", w), e.on(rr, O), e.on(or, F), e.on(nr, A), e.on(ir, v), e.on(qo, ({ newPhase: d }) => {
1970
+ d === "loading" && A();
1971
+ });
1972
+ }, "useHighlights");
1973
+
1974
+ // src/highlight/preview.ts
1975
+ globalThis?.FEATURES?.highlight && ur?.ready && ur.ready().then(mr);
1976
+ var st = /* @__PURE__ */ n(() => Zo({}), "default");
1977
+
1978
+ // src/measure/preview.ts
1979
+ import { definePreviewAddon as yn } from "storybook/internal/csf";
1980
+
1981
+ // src/measure/constants.ts
1982
+ var xe = "storybook/measure-addon", Hp = `${xe}/tool`, fr = "measureEnabled", Np = {
1983
+ RESULT: `${xe}/result`,
1984
+ REQUEST: `${xe}/request`,
1985
+ CLEAR: `${xe}/clear`
1986
+ };
1987
+
1988
+ // src/measure/withMeasure.ts
1989
+ import { useEffect as kr } from "storybook/preview-api";
1990
+
1991
+ // src/measure/box-model/canvas.ts
1992
+ import { global as be } from "@storybook/global";
1993
+ function yr() {
1994
+ let e = be.document.documentElement, t = Math.max(e.scrollHeight, e.offsetHeight);
1995
+ return { width: Math.max(e.scrollWidth, e.offsetWidth), height: t };
1996
+ }
1997
+ n(yr, "getDocumentWidthAndHeight");
1998
+ function Jo() {
1999
+ let e = be.document.createElement("canvas");
2000
+ e.id = "storybook-addon-measure";
2001
+ let t = e.getContext("2d");
2002
+ ye(t != null);
2003
+ let { width: r, height: o } = yr();
2004
+ return at(e, t, { width: r, height: o }), e.style.position = "absolute", e.style.left = "0", e.style.top = "0", e.style.zIndex = "21474836\
2005
+ 47", e.style.pointerEvents = "none", be.document.body.appendChild(e), { canvas: e, context: t, width: r, height: o };
2006
+ }
2007
+ n(Jo, "createCanvas");
2008
+ function at(e, t, { width: r, height: o }) {
2009
+ e.style.width = `${r}px`, e.style.height = `${o}px`;
2010
+ let i = be.window.devicePixelRatio;
2011
+ e.width = Math.floor(r * i), e.height = Math.floor(o * i), t.scale(i, i);
2012
+ }
2013
+ n(at, "setCanvasWidthAndHeight");
2014
+ var $ = {};
2015
+ function gr() {
2016
+ $.canvas || ($ = Jo());
2017
+ }
2018
+ n(gr, "init");
2019
+ function hr() {
2020
+ $.context && $.context.clearRect(0, 0, $.width ?? 0, $.height ?? 0);
2021
+ }
2022
+ n(hr, "clear");
2023
+ function xr(e) {
2024
+ hr(), e($.context);
2025
+ }
2026
+ n(xr, "draw");
2027
+ function br() {
2028
+ ye($.canvas, "Canvas should exist in the state."), ye($.context, "Context should exist in the state."), at($.canvas, $.context, { width: 0,
2029
+ height: 0 });
2030
+ let { width: e, height: t } = yr();
2031
+ at($.canvas, $.context, { width: e, height: t }), $.width = e, $.height = t;
2032
+ }
2033
+ n(br, "rescale");
2034
+ function Tr() {
2035
+ $.canvas && (hr(), $.canvas.parentNode?.removeChild($.canvas), $ = {});
2036
+ }
2037
+ n(Tr, "destroy");
2038
+
2039
+ // src/measure/box-model/visualizer.ts
2040
+ import { global as j } from "@storybook/global";
2041
+
2042
+ // src/measure/box-model/labels.ts
2043
+ var J = {
2044
+ margin: "#f6b26b",
2045
+ border: "#ffe599",
2046
+ padding: "#93c47d",
2047
+ content: "#6fa8dc",
2048
+ text: "#232020"
2049
+ }, G = 6;
2050
+ function Sr(e, { x: t, y: r, w: o, h: i, r: s }) {
2051
+ t = t - o / 2, r = r - i / 2, o < 2 * s && (s = o / 2), i < 2 * s && (s = i / 2), e.beginPath(), e.moveTo(t + s, r), e.arcTo(t + o, r, t +
2052
+ o, r + i, s), e.arcTo(t + o, r + i, t, r + i, s), e.arcTo(t, r + i, t, r, s), e.arcTo(t, r, t + o, r, s), e.closePath();
2053
+ }
2054
+ n(Sr, "roundedRect");
2055
+ function Qo(e, { padding: t, border: r, width: o, height: i, top: s, left: a }) {
2056
+ let p = o - r.left - r.right - t.left - t.right, c = i - t.top - t.bottom - r.top - r.bottom, l = a + r.left + t.left, y = s + r.top + t.top;
2057
+ return e === "top" ? l += p / 2 : e === "right" ? (l += p, y += c / 2) : e === "bottom" ? (l += p / 2, y += c) : e === "left" ? y += c / 2 :
2058
+ e === "center" && (l += p / 2, y += c / 2), { x: l, y };
2059
+ }
2060
+ n(Qo, "positionCoordinate");
2061
+ function en(e, t, { margin: r, border: o, padding: i }, s, a) {
2062
+ let p = /* @__PURE__ */ n((h) => 0, "shift"), c = 0, l = 0, y = a ? 1 : 0.5, u = a ? s * 2 : 0;
2063
+ return e === "padding" ? p = /* @__PURE__ */ n((h) => i[h] * y + u, "shift") : e === "border" ? p = /* @__PURE__ */ n((h) => i[h] + o[h] *
2064
+ y + u, "shift") : e === "margin" && (p = /* @__PURE__ */ n((h) => i[h] + o[h] + r[h] * y + u, "shift")), t === "top" ? l = -p("top") : t ===
2065
+ "right" ? c = p("right") : t === "bottom" ? l = p("bottom") : t === "left" && (c = -p("left")), { offsetX: c, offsetY: l };
2066
+ }
2067
+ n(en, "offset");
2068
+ function tn(e, t) {
2069
+ return Math.abs(e.x - t.x) < Math.abs(e.w + t.w) / 2 && Math.abs(e.y - t.y) < Math.abs(e.h + t.h) / 2;
2070
+ }
2071
+ n(tn, "collide");
2072
+ function rn(e, t, r) {
2073
+ return e === "top" ? t.y = r.y - r.h - G : e === "right" ? t.x = r.x + r.w / 2 + G + t.w / 2 : e === "bottom" ? t.y = r.y + r.h + G : e ===
2074
+ "left" && (t.x = r.x - r.w / 2 - G - t.w / 2), { x: t.x, y: t.y };
2075
+ }
2076
+ n(rn, "overlapAdjustment");
2077
+ function Ar(e, t, { x: r, y: o, w: i, h: s }, a) {
2078
+ return Sr(e, { x: r, y: o, w: i, h: s, r: 3 }), e.fillStyle = `${J[t]}dd`, e.fill(), e.strokeStyle = J[t], e.stroke(), e.fillStyle = J.text,
2079
+ e.fillText(a, r, o), Sr(e, { x: r, y: o, w: i, h: s, r: 3 }), e.fillStyle = `${J[t]}dd`, e.fill(), e.strokeStyle = J[t], e.stroke(), e.fillStyle =
2080
+ J.text, e.fillText(a, r, o), { x: r, y: o, w: i, h: s };
2081
+ }
2082
+ n(Ar, "textWithRect");
2083
+ function Rr(e, t) {
2084
+ e.font = "600 12px monospace", e.textBaseline = "middle", e.textAlign = "center";
2085
+ let r = e.measureText(t), o = r.actualBoundingBoxAscent + r.actualBoundingBoxDescent, i = r.width + G * 2, s = o + G * 2;
2086
+ return { w: i, h: s };
2087
+ }
2088
+ n(Rr, "configureText");
2089
+ function on(e, t, { type: r, position: o = "center", text: i }, s, a = !1) {
2090
+ let { x: p, y: c } = Qo(o, t), { offsetX: l, offsetY: y } = en(r, o, t, G + 1, a);
2091
+ p += l, c += y;
2092
+ let { w: u, h } = Rr(e, i);
2093
+ if (s && tn({ x: p, y: c, w: u, h }, s)) {
2094
+ let T = rn(o, { x: p, y: c, w: u, h }, s);
2095
+ p = T.x, c = T.y;
2096
+ }
2097
+ return Ar(e, r, { x: p, y: c, w: u, h }, i);
2098
+ }
2099
+ n(on, "drawLabel");
2100
+ function nn(e, { w: t, h: r }) {
2101
+ let o = t * 0.5 + G, i = r * 0.5 + G;
2102
+ return {
2103
+ offsetX: (e.x === "left" ? -1 : 1) * o,
2104
+ offsetY: (e.y === "top" ? -1 : 1) * i
2105
+ };
2106
+ }
2107
+ n(nn, "floatingOffset");
2108
+ function sn(e, t, { type: r, text: o }) {
2109
+ let { floatingAlignment: i, extremities: s } = t, a = s[i.x], p = s[i.y], { w: c, h: l } = Rr(e, o), { offsetX: y, offsetY: u } = nn(i, {
2110
+ w: c,
2111
+ h: l
2112
+ });
2113
+ return a += y, p += u, Ar(e, r, { x: a, y: p, w: c, h: l }, o);
2114
+ }
2115
+ n(sn, "drawFloatingLabel");
2116
+ function pe(e, t, r, o) {
2117
+ let i = [];
2118
+ r.forEach((s, a) => {
2119
+ let p = o && s.position === "center" ? sn(e, t, s) : on(e, t, s, i[a - 1], o);
2120
+ i[a] = p;
2121
+ });
2122
+ }
2123
+ n(pe, "drawStack");
2124
+ function wr(e, t, r, o) {
2125
+ let i = r.reduce((s, a) => (Object.prototype.hasOwnProperty.call(s, a.position) || (s[a.position] = []), s[a.position]?.push(a), s), {});
2126
+ i.top && pe(e, t, i.top, o), i.right && pe(e, t, i.right, o), i.bottom && pe(e, t, i.bottom, o), i.left && pe(e, t, i.left, o), i.center &&
2127
+ pe(e, t, i.center, o);
2128
+ }
2129
+ n(wr, "labelStacks");
2130
+
2131
+ // src/measure/box-model/visualizer.ts
2132
+ var Te = {
2133
+ margin: "#f6b26ba8",
2134
+ border: "#ffe599a8",
2135
+ padding: "#93c47d8c",
2136
+ content: "#6fa8dca8"
2137
+ }, Er = 30;
2138
+ function _(e) {
2139
+ return parseInt(e.replace("px", ""), 10);
2140
+ }
2141
+ n(_, "pxToNumber");
2142
+ function Q(e) {
2143
+ return Number.isInteger(e) ? e : e.toFixed(2);
2144
+ }
2145
+ n(Q, "round");
2146
+ function pt(e) {
2147
+ return e.filter((t) => t.text !== 0 && t.text !== "0");
2148
+ }
2149
+ n(pt, "filterZeroValues");
2150
+ function an(e) {
2151
+ let t = {
2152
+ top: j.window.scrollY,
2153
+ bottom: j.window.scrollY + j.window.innerHeight,
2154
+ left: j.window.scrollX,
2155
+ right: j.window.scrollX + j.window.innerWidth
2156
+ }, r = {
2157
+ top: Math.abs(t.top - e.top),
2158
+ bottom: Math.abs(t.bottom - e.bottom),
2159
+ left: Math.abs(t.left - e.left),
2160
+ right: Math.abs(t.right - e.right)
2161
+ };
2162
+ return {
2163
+ x: r.left > r.right ? "left" : "right",
2164
+ y: r.top > r.bottom ? "top" : "bottom"
2165
+ };
2166
+ }
2167
+ n(an, "floatingAlignment");
2168
+ function pn(e) {
2169
+ let t = j.getComputedStyle(e), { top: r, left: o, right: i, bottom: s, width: a, height: p } = e.getBoundingClientRect(), {
2170
+ marginTop: c,
2171
+ marginBottom: l,
2172
+ marginLeft: y,
2173
+ marginRight: u,
2174
+ paddingTop: h,
2175
+ paddingBottom: T,
2176
+ paddingLeft: R,
2177
+ paddingRight: P,
2178
+ borderBottomWidth: L,
2179
+ borderTopWidth: O,
2180
+ borderLeftWidth: F,
2181
+ borderRightWidth: A
2182
+ } = t;
2183
+ r = r + j.window.scrollY, o = o + j.window.scrollX, s = s + j.window.scrollY, i = i + j.window.scrollX;
2184
+ let S = {
2185
+ top: _(c),
2186
+ bottom: _(l),
2187
+ left: _(y),
2188
+ right: _(u)
2189
+ }, v = {
2190
+ top: _(h),
2191
+ bottom: _(T),
2192
+ left: _(R),
2193
+ right: _(P)
2194
+ }, w = {
2195
+ top: _(O),
2196
+ bottom: _(L),
2197
+ left: _(F),
2198
+ right: _(A)
2199
+ }, d = {
2200
+ top: r - S.top,
2201
+ bottom: s + S.bottom,
2202
+ left: o - S.left,
2203
+ right: i + S.right
2204
+ };
2205
+ return {
2206
+ margin: S,
2207
+ padding: v,
2208
+ border: w,
2209
+ top: r,
2210
+ left: o,
2211
+ bottom: s,
2212
+ right: i,
2213
+ width: a,
2214
+ height: p,
2215
+ extremities: d,
2216
+ floatingAlignment: an(d)
2217
+ };
2218
+ }
2219
+ n(pn, "measureElement");
2220
+ function ln(e, { margin: t, width: r, height: o, top: i, left: s, bottom: a, right: p }) {
2221
+ let c = o + t.bottom + t.top;
2222
+ e.fillStyle = Te.margin, e.fillRect(s, i - t.top, r, t.top), e.fillRect(p, i - t.top, t.right, c), e.fillRect(s, a, r, t.bottom), e.fillRect(
2223
+ s - t.left, i - t.top, t.left, c);
2224
+ let l = [
2225
+ {
2226
+ type: "margin",
2227
+ text: Q(t.top),
2228
+ position: "top"
2229
+ },
2230
+ {
2231
+ type: "margin",
2232
+ text: Q(t.right),
2233
+ position: "right"
2234
+ },
2235
+ {
2236
+ type: "margin",
2237
+ text: Q(t.bottom),
2238
+ position: "bottom"
2239
+ },
2240
+ {
2241
+ type: "margin",
2242
+ text: Q(t.left),
2243
+ position: "left"
2244
+ }
2245
+ ];
2246
+ return pt(l);
2247
+ }
2248
+ n(ln, "drawMargin");
2249
+ function cn(e, { padding: t, border: r, width: o, height: i, top: s, left: a, bottom: p, right: c }) {
2250
+ let l = o - r.left - r.right, y = i - t.top - t.bottom - r.top - r.bottom;
2251
+ e.fillStyle = Te.padding, e.fillRect(a + r.left, s + r.top, l, t.top), e.fillRect(
2252
+ c - t.right - r.right,
2253
+ s + t.top + r.top,
2254
+ t.right,
2255
+ y
2256
+ ), e.fillRect(
2257
+ a + r.left,
2258
+ p - t.bottom - r.bottom,
2259
+ l,
2260
+ t.bottom
2261
+ ), e.fillRect(a + r.left, s + t.top + r.top, t.left, y);
2262
+ let u = [
2263
+ {
2264
+ type: "padding",
2265
+ text: t.top,
2266
+ position: "top"
2267
+ },
2268
+ {
2269
+ type: "padding",
2270
+ text: t.right,
2271
+ position: "right"
2272
+ },
2273
+ {
2274
+ type: "padding",
2275
+ text: t.bottom,
2276
+ position: "bottom"
2277
+ },
2278
+ {
2279
+ type: "padding",
2280
+ text: t.left,
2281
+ position: "left"
2282
+ }
2283
+ ];
2284
+ return pt(u);
2285
+ }
2286
+ n(cn, "drawPadding");
2287
+ function dn(e, { border: t, width: r, height: o, top: i, left: s, bottom: a, right: p }) {
2288
+ let c = o - t.top - t.bottom;
2289
+ e.fillStyle = Te.border, e.fillRect(s, i, r, t.top), e.fillRect(s, a - t.bottom, r, t.bottom), e.fillRect(s, i + t.top, t.left, c), e.fillRect(
2290
+ p - t.right, i + t.top, t.right, c);
2291
+ let l = [
2292
+ {
2293
+ type: "border",
2294
+ text: t.top,
2295
+ position: "top"
2296
+ },
2297
+ {
2298
+ type: "border",
2299
+ text: t.right,
2300
+ position: "right"
2301
+ },
2302
+ {
2303
+ type: "border",
2304
+ text: t.bottom,
2305
+ position: "bottom"
2306
+ },
2307
+ {
2308
+ type: "border",
2309
+ text: t.left,
2310
+ position: "left"
2311
+ }
2312
+ ];
2313
+ return pt(l);
2314
+ }
2315
+ n(dn, "drawBorder");
2316
+ function mn(e, { padding: t, border: r, width: o, height: i, top: s, left: a }) {
2317
+ let p = o - r.left - r.right - t.left - t.right, c = i - t.top - t.bottom - r.top - r.bottom;
2318
+ return e.fillStyle = Te.content, e.fillRect(
2319
+ a + r.left + t.left,
2320
+ s + r.top + t.top,
2321
+ p,
2322
+ c
2323
+ ), [
2324
+ {
2325
+ type: "content",
2326
+ position: "center",
2327
+ text: `${Q(p)} x ${Q(c)}`
2328
+ }
2329
+ ];
2330
+ }
2331
+ n(mn, "drawContent");
2332
+ function un(e) {
2333
+ return (t) => {
2334
+ if (e && t) {
2335
+ let r = pn(e), o = ln(t, r), i = cn(t, r), s = dn(t, r), a = mn(t, r), p = r.width <= Er * 3 || r.height <= Er;
2336
+ wr(
2337
+ t,
2338
+ r,
2339
+ [...a, ...i, ...s, ...o],
2340
+ p
2341
+ );
2342
+ }
2343
+ };
2344
+ }
2345
+ n(un, "drawBoxModel");
2346
+ function Cr(e) {
2347
+ xr(un(e));
2348
+ }
2349
+ n(Cr, "drawSelectedElement");
2350
+
2351
+ // src/measure/util.ts
2352
+ import { global as fn } from "@storybook/global";
2353
+ var vr = /* @__PURE__ */ n((e, t) => {
2354
+ let r = fn.document.elementFromPoint(e, t), o = /* @__PURE__ */ n((s) => {
2355
+ if (s && s.shadowRoot) {
2356
+ let a = s.shadowRoot.elementFromPoint(e, t);
2357
+ return s.isEqualNode(a) ? s : a.shadowRoot ? o(a) : a;
2358
+ }
2359
+ return s;
2360
+ }, "crawlShadows");
2361
+ return o(r) || r;
2362
+ }, "deepElementFromPoint");
2363
+
2364
+ // src/measure/withMeasure.ts
2365
+ var Pr, Se = { x: 0, y: 0 };
2366
+ function Or(e, t) {
2367
+ Pr = vr(e, t), Cr(Pr);
2368
+ }
2369
+ n(Or, "findAndDrawElement");
2370
+ var Mr = /* @__PURE__ */ n((e, t) => {
2371
+ let { measureEnabled: r } = t.globals || {};
2372
+ return kr(() => {
2373
+ if (typeof globalThis.document > "u")
2374
+ return;
2375
+ let o = /* @__PURE__ */ n((i) => {
2376
+ window.requestAnimationFrame(() => {
2377
+ i.stopPropagation(), Se.x = i.clientX, Se.y = i.clientY;
2378
+ });
2379
+ }, "onPointerMove");
2380
+ return globalThis.document.addEventListener("pointermove", o), () => {
2381
+ globalThis.document.removeEventListener("pointermove", o);
2382
+ };
2383
+ }, []), kr(() => {
2384
+ let o = /* @__PURE__ */ n((s) => {
2385
+ window.requestAnimationFrame(() => {
2386
+ s.stopPropagation(), Or(s.clientX, s.clientY);
2387
+ });
2388
+ }, "onPointerOver"), i = /* @__PURE__ */ n(() => {
2389
+ window.requestAnimationFrame(() => {
2390
+ br();
2391
+ });
2392
+ }, "onResize");
2393
+ return t.viewMode === "story" && r && (globalThis.document.addEventListener("pointerover", o), gr(), globalThis.window.addEventListener(
2394
+ "resize", i), Or(Se.x, Se.y)), () => {
2395
+ globalThis.window.removeEventListener("resize", i), Tr();
2396
+ };
2397
+ }, [r, t.viewMode]), e();
2398
+ }, "withMeasure");
2399
+
2400
+ // src/measure/preview.ts
2401
+ var gn = globalThis.FEATURES?.measure ? [Mr] : [], hn = {
2402
+ [fr]: !1
2403
+ }, lt = /* @__PURE__ */ n(() => yn({
2404
+ decorators: gn,
2405
+ initialGlobals: hn
2406
+ }), "default");
2407
+
2408
+ // src/outline/preview.ts
2409
+ import { definePreviewAddon as Sn } from "storybook/internal/csf";
2410
+
2411
+ // src/outline/constants.ts
2412
+ var Ae = "outline";
2413
+
2414
+ // src/outline/withOutline.ts
2415
+ import { useEffect as bn, useMemo as Tn } from "storybook/preview-api";
2416
+
2417
+ // src/outline/helpers.ts
2418
+ import { global as Re } from "@storybook/global";
2419
+ var ct = /* @__PURE__ */ n((e) => {
2420
+ (Array.isArray(e) ? e : [e]).forEach(xn);
2421
+ }, "clearStyles"), xn = /* @__PURE__ */ n((e) => {
2422
+ let t = typeof e == "string" ? e : e.join(""), r = Re.document.getElementById(t);
2423
+ r && r.parentElement && r.parentElement.removeChild(r);
2424
+ }, "clearStyle"), $r = /* @__PURE__ */ n((e, t) => {
2425
+ let r = Re.document.getElementById(e);
2426
+ if (r)
2427
+ r.innerHTML !== t && (r.innerHTML = t);
2428
+ else {
2429
+ let o = Re.document.createElement("style");
2430
+ o.setAttribute("id", e), o.innerHTML = t, Re.document.head.appendChild(o);
2431
+ }
2432
+ }, "addOutlineStyles");
2433
+
2434
+ // src/outline/outlineCSS.ts
2435
+ function dt(e) {
2436
+ return W`
2437
+ ${e} body {
2438
+ outline: 1px solid #2980b9 !important;
2439
+ }
2440
+
2441
+ ${e} article {
2442
+ outline: 1px solid #3498db !important;
2443
+ }
2444
+
2445
+ ${e} nav {
2446
+ outline: 1px solid #0088c3 !important;
2447
+ }
2448
+
2449
+ ${e} aside {
2450
+ outline: 1px solid #33a0ce !important;
2451
+ }
2452
+
2453
+ ${e} section {
2454
+ outline: 1px solid #66b8da !important;
2455
+ }
2456
+
2457
+ ${e} header {
2458
+ outline: 1px solid #99cfe7 !important;
2459
+ }
2460
+
2461
+ ${e} footer {
2462
+ outline: 1px solid #cce7f3 !important;
2463
+ }
2464
+
2465
+ ${e} h1 {
2466
+ outline: 1px solid #162544 !important;
2467
+ }
2468
+
2469
+ ${e} h2 {
2470
+ outline: 1px solid #314e6e !important;
2471
+ }
2472
+
2473
+ ${e} h3 {
2474
+ outline: 1px solid #3e5e85 !important;
2475
+ }
2476
+
2477
+ ${e} h4 {
2478
+ outline: 1px solid #449baf !important;
2479
+ }
2480
+
2481
+ ${e} h5 {
2482
+ outline: 1px solid #c7d1cb !important;
2483
+ }
2484
+
2485
+ ${e} h6 {
2486
+ outline: 1px solid #4371d0 !important;
2487
+ }
2488
+
2489
+ ${e} main {
2490
+ outline: 1px solid #2f4f90 !important;
2491
+ }
2492
+
2493
+ ${e} address {
2494
+ outline: 1px solid #1a2c51 !important;
2495
+ }
2496
+
2497
+ ${e} div {
2498
+ outline: 1px solid #036cdb !important;
2499
+ }
2500
+
2501
+ ${e} p {
2502
+ outline: 1px solid #ac050b !important;
2503
+ }
2504
+
2505
+ ${e} hr {
2506
+ outline: 1px solid #ff063f !important;
2507
+ }
2508
+
2509
+ ${e} pre {
2510
+ outline: 1px solid #850440 !important;
2511
+ }
2512
+
2513
+ ${e} blockquote {
2514
+ outline: 1px solid #f1b8e7 !important;
2515
+ }
2516
+
2517
+ ${e} ol {
2518
+ outline: 1px solid #ff050c !important;
2519
+ }
2520
+
2521
+ ${e} ul {
2522
+ outline: 1px solid #d90416 !important;
2523
+ }
2524
+
2525
+ ${e} li {
2526
+ outline: 1px solid #d90416 !important;
2527
+ }
2528
+
2529
+ ${e} dl {
2530
+ outline: 1px solid #fd3427 !important;
2531
+ }
2532
+
2533
+ ${e} dt {
2534
+ outline: 1px solid #ff0043 !important;
2535
+ }
2536
+
2537
+ ${e} dd {
2538
+ outline: 1px solid #e80174 !important;
2539
+ }
2540
+
2541
+ ${e} figure {
2542
+ outline: 1px solid #ff00bb !important;
2543
+ }
2544
+
2545
+ ${e} figcaption {
2546
+ outline: 1px solid #bf0032 !important;
2547
+ }
2548
+
2549
+ ${e} table {
2550
+ outline: 1px solid #00cc99 !important;
2551
+ }
2552
+
2553
+ ${e} caption {
2554
+ outline: 1px solid #37ffc4 !important;
2555
+ }
2556
+
2557
+ ${e} thead {
2558
+ outline: 1px solid #98daca !important;
2559
+ }
2560
+
2561
+ ${e} tbody {
2562
+ outline: 1px solid #64a7a0 !important;
2563
+ }
2564
+
2565
+ ${e} tfoot {
2566
+ outline: 1px solid #22746b !important;
2567
+ }
2568
+
2569
+ ${e} tr {
2570
+ outline: 1px solid #86c0b2 !important;
2571
+ }
2572
+
2573
+ ${e} th {
2574
+ outline: 1px solid #a1e7d6 !important;
2575
+ }
2576
+
2577
+ ${e} td {
2578
+ outline: 1px solid #3f5a54 !important;
2579
+ }
2580
+
2581
+ ${e} col {
2582
+ outline: 1px solid #6c9a8f !important;
2583
+ }
2584
+
2585
+ ${e} colgroup {
2586
+ outline: 1px solid #6c9a9d !important;
2587
+ }
2588
+
2589
+ ${e} button {
2590
+ outline: 1px solid #da8301 !important;
2591
+ }
2592
+
2593
+ ${e} datalist {
2594
+ outline: 1px solid #c06000 !important;
2595
+ }
2596
+
2597
+ ${e} fieldset {
2598
+ outline: 1px solid #d95100 !important;
2599
+ }
2600
+
2601
+ ${e} form {
2602
+ outline: 1px solid #d23600 !important;
2603
+ }
2604
+
2605
+ ${e} input {
2606
+ outline: 1px solid #fca600 !important;
2607
+ }
2608
+
2609
+ ${e} keygen {
2610
+ outline: 1px solid #b31e00 !important;
2611
+ }
2612
+
2613
+ ${e} label {
2614
+ outline: 1px solid #ee8900 !important;
2615
+ }
2616
+
2617
+ ${e} legend {
2618
+ outline: 1px solid #de6d00 !important;
2619
+ }
2620
+
2621
+ ${e} meter {
2622
+ outline: 1px solid #e8630c !important;
2623
+ }
2624
+
2625
+ ${e} optgroup {
2626
+ outline: 1px solid #b33600 !important;
2627
+ }
2628
+
2629
+ ${e} option {
2630
+ outline: 1px solid #ff8a00 !important;
2631
+ }
2632
+
2633
+ ${e} output {
2634
+ outline: 1px solid #ff9619 !important;
2635
+ }
2636
+
2637
+ ${e} progress {
2638
+ outline: 1px solid #e57c00 !important;
2639
+ }
2640
+
2641
+ ${e} select {
2642
+ outline: 1px solid #e26e0f !important;
2643
+ }
2644
+
2645
+ ${e} textarea {
2646
+ outline: 1px solid #cc5400 !important;
2647
+ }
2648
+
2649
+ ${e} details {
2650
+ outline: 1px solid #33848f !important;
2651
+ }
2652
+
2653
+ ${e} summary {
2654
+ outline: 1px solid #60a1a6 !important;
2655
+ }
2656
+
2657
+ ${e} command {
2658
+ outline: 1px solid #438da1 !important;
2659
+ }
2660
+
2661
+ ${e} menu {
2662
+ outline: 1px solid #449da6 !important;
2663
+ }
2664
+
2665
+ ${e} del {
2666
+ outline: 1px solid #bf0000 !important;
2667
+ }
2668
+
2669
+ ${e} ins {
2670
+ outline: 1px solid #400000 !important;
2671
+ }
2672
+
2673
+ ${e} img {
2674
+ outline: 1px solid #22746b !important;
2675
+ }
2676
+
2677
+ ${e} iframe {
2678
+ outline: 1px solid #64a7a0 !important;
2679
+ }
2680
+
2681
+ ${e} embed {
2682
+ outline: 1px solid #98daca !important;
2683
+ }
2684
+
2685
+ ${e} object {
2686
+ outline: 1px solid #00cc99 !important;
2687
+ }
2688
+
2689
+ ${e} param {
2690
+ outline: 1px solid #37ffc4 !important;
2691
+ }
2692
+
2693
+ ${e} video {
2694
+ outline: 1px solid #6ee866 !important;
2695
+ }
2696
+
2697
+ ${e} audio {
2698
+ outline: 1px solid #027353 !important;
2699
+ }
2700
+
2701
+ ${e} source {
2702
+ outline: 1px solid #012426 !important;
2703
+ }
2704
+
2705
+ ${e} canvas {
2706
+ outline: 1px solid #a2f570 !important;
2707
+ }
2708
+
2709
+ ${e} track {
2710
+ outline: 1px solid #59a600 !important;
2711
+ }
2712
+
2713
+ ${e} map {
2714
+ outline: 1px solid #7be500 !important;
2715
+ }
2716
+
2717
+ ${e} area {
2718
+ outline: 1px solid #305900 !important;
2719
+ }
2720
+
2721
+ ${e} a {
2722
+ outline: 1px solid #ff62ab !important;
2723
+ }
2724
+
2725
+ ${e} em {
2726
+ outline: 1px solid #800b41 !important;
2727
+ }
2728
+
2729
+ ${e} strong {
2730
+ outline: 1px solid #ff1583 !important;
2731
+ }
2732
+
2733
+ ${e} i {
2734
+ outline: 1px solid #803156 !important;
2735
+ }
2736
+
2737
+ ${e} b {
2738
+ outline: 1px solid #cc1169 !important;
2739
+ }
2740
+
2741
+ ${e} u {
2742
+ outline: 1px solid #ff0430 !important;
2743
+ }
2744
+
2745
+ ${e} s {
2746
+ outline: 1px solid #f805e3 !important;
2747
+ }
2748
+
2749
+ ${e} small {
2750
+ outline: 1px solid #d107b2 !important;
2751
+ }
2752
+
2753
+ ${e} abbr {
2754
+ outline: 1px solid #4a0263 !important;
2755
+ }
2756
+
2757
+ ${e} q {
2758
+ outline: 1px solid #240018 !important;
2759
+ }
2760
+
2761
+ ${e} cite {
2762
+ outline: 1px solid #64003c !important;
2763
+ }
2764
+
2765
+ ${e} dfn {
2766
+ outline: 1px solid #b4005a !important;
2767
+ }
2768
+
2769
+ ${e} sub {
2770
+ outline: 1px solid #dba0c8 !important;
2771
+ }
2772
+
2773
+ ${e} sup {
2774
+ outline: 1px solid #cc0256 !important;
2775
+ }
2776
+
2777
+ ${e} time {
2778
+ outline: 1px solid #d6606d !important;
2779
+ }
2780
+
2781
+ ${e} code {
2782
+ outline: 1px solid #e04251 !important;
2783
+ }
2784
+
2785
+ ${e} kbd {
2786
+ outline: 1px solid #5e001f !important;
2787
+ }
2788
+
2789
+ ${e} samp {
2790
+ outline: 1px solid #9c0033 !important;
2791
+ }
2792
+
2793
+ ${e} var {
2794
+ outline: 1px solid #d90047 !important;
2795
+ }
2796
+
2797
+ ${e} mark {
2798
+ outline: 1px solid #ff0053 !important;
2799
+ }
2800
+
2801
+ ${e} bdi {
2802
+ outline: 1px solid #bf3668 !important;
2803
+ }
2804
+
2805
+ ${e} bdo {
2806
+ outline: 1px solid #6f1400 !important;
2807
+ }
2808
+
2809
+ ${e} ruby {
2810
+ outline: 1px solid #ff7b93 !important;
2811
+ }
2812
+
2813
+ ${e} rt {
2814
+ outline: 1px solid #ff2f54 !important;
2815
+ }
2816
+
2817
+ ${e} rp {
2818
+ outline: 1px solid #803e49 !important;
2819
+ }
2820
+
2821
+ ${e} span {
2822
+ outline: 1px solid #cc2643 !important;
2823
+ }
2824
+
2825
+ ${e} br {
2826
+ outline: 1px solid #db687d !important;
2827
+ }
2828
+
2829
+ ${e} wbr {
2830
+ outline: 1px solid #db175b !important;
2831
+ }`;
2832
+ }
2833
+ n(dt, "outlineCSS");
2834
+
2835
+ // src/outline/withOutline.ts
2836
+ var Fr = /* @__PURE__ */ n((e, t) => {
2837
+ let r = t.globals || {}, o = [!0, "true"].includes(r[Ae]), i = t.viewMode === "docs", s = Tn(() => dt(i ? '[data-story-block="true"]' : ".\
2838
+ sb-show-main"), [t]);
2839
+ return bn(() => {
2840
+ let a = i ? `addon-outline-docs-${t.id}` : "addon-outline";
2841
+ return o ? $r(a, s) : ct(a), () => {
2842
+ ct(a);
2843
+ };
2844
+ }, [o, s, t]), e();
2845
+ }, "withOutline");
2846
+
2847
+ // src/outline/preview.ts
2848
+ var An = globalThis.FEATURES?.outline ? [Fr] : [], Rn = {
2849
+ [Ae]: !1
2850
+ }, mt = /* @__PURE__ */ n(() => Sn({ decorators: An, initialGlobals: Rn }), "default");
2851
+
2852
+ // src/test/preview.ts
2853
+ import { definePreviewAddon as wn } from "storybook/internal/csf";
2854
+ import { instrument as En } from "storybook/internal/instrumenter";
2855
+ import {
2856
+ clearAllMocks as Cn,
2857
+ fn as vn,
2858
+ isMockFunction as kn,
2859
+ resetAllMocks as Pn,
2860
+ restoreAllMocks as On,
2861
+ uninstrumentedUserEvent as Mn,
2862
+ within as $n
2863
+ } from "storybook/test";
2864
+ var Fn = /* @__PURE__ */ n(({ parameters: e }) => {
2865
+ e?.test?.mockReset === !0 ? Pn() : e?.test?.clearMocks === !0 ? Cn() : e?.test?.restoreMocks !== !1 && On();
2866
+ }, "resetAllMocksLoader"), ut = /* @__PURE__ */ n((e, t = 0, r) => {
2867
+ if (t > 5 || e == null)
2868
+ return e;
2869
+ if (kn(e))
2870
+ return r && e.mockName(r), e;
2871
+ if (typeof e == "function" && "isAction" in e && e.isAction && !("implicit" in e && e.implicit)) {
2872
+ let o = vn(e);
2873
+ return r && o.mockName(r), o;
2874
+ }
2875
+ if (Array.isArray(e)) {
2876
+ t++;
2877
+ for (let o = 0; o < e.length; o++)
2878
+ Object.getOwnPropertyDescriptor(e, o)?.writable && (e[o] = ut(e[o], t));
2879
+ return e;
2880
+ }
2881
+ if (typeof e == "object" && e.constructor === Object) {
2882
+ t++;
2883
+ for (let [o, i] of Object.entries(e))
2884
+ Object.getOwnPropertyDescriptor(e, o)?.writable && (e[o] = ut(i, t, o));
2885
+ return e;
2886
+ }
2887
+ return e;
2888
+ }, "traverseArgs"), In = /* @__PURE__ */ n(({ initialArgs: e }) => {
2889
+ ut(e);
2890
+ }, "nameSpiesAndWrapActionsInSpies"), Ir = !1, Ln = /* @__PURE__ */ n(async (e) => {
2891
+ globalThis.HTMLElement && e.canvasElement instanceof globalThis.HTMLElement && (e.canvas = $n(e.canvasElement));
2892
+ let t = globalThis.window?.navigator?.clipboard;
2893
+ if (t) {
2894
+ e.userEvent = En(
2895
+ { userEvent: Mn.setup() },
2896
+ { intercept: !0 }
2897
+ ).userEvent, Object.defineProperty(globalThis.window.navigator, "clipboard", {
2898
+ get: /* @__PURE__ */ n(() => t, "get"),
2899
+ configurable: !0
2900
+ });
2901
+ let r = HTMLElement.prototype.focus;
2902
+ Ir || Object.defineProperties(HTMLElement.prototype, {
2903
+ focus: {
2904
+ configurable: !0,
2905
+ set: /* @__PURE__ */ n((o) => {
2906
+ r = o, Ir = !0;
2907
+ }, "set"),
2908
+ get: /* @__PURE__ */ n(() => r, "get")
2909
+ }
2910
+ });
2911
+ }
2912
+ }, "enhanceContext"), ft = /* @__PURE__ */ n(() => wn({
2913
+ loaders: [Fn, In, Ln]
2914
+ }), "default");
2915
+
2916
+ // src/viewport/preview.ts
2917
+ import { definePreviewAddon as Dn } from "storybook/internal/csf";
2918
+
2919
+ // src/viewport/constants.ts
2920
+ var Lr = "storybook/viewport", Dr = "viewport", Ll = `${Lr}/panel`, Dl = `${Lr}/tool`;
2921
+
2922
+ // src/viewport/preview.ts
2923
+ var _n = {
2924
+ [Dr]: { value: void 0, isRotated: !1 }
2925
+ }, yt = /* @__PURE__ */ n(() => Dn({
2926
+ initialGlobals: _n
2927
+ }), "default");
2928
+
2929
+ // src/csf/core-annotations.ts
2930
+ function _r() {
2931
+ return [
2932
+ // @ts-expect-error CJS fallback
2933
+ (lt.default ?? lt)(),
2934
+ // @ts-expect-error CJS fallback
2935
+ (Je.default ?? Je)(),
2936
+ // @ts-expect-error CJS fallback
2937
+ (st.default ?? st)(),
2938
+ // @ts-expect-error CJS fallback
2939
+ (mt.default ?? mt)(),
2940
+ // @ts-expect-error CJS fallback
2941
+ (yt.default ?? yt)(),
2942
+ // @ts-expect-error CJS fallback
2943
+ (Xe.default ?? Xe)(),
2944
+ // @ts-expect-error CJS fallback
2945
+ (Qe.default ?? Qe)(),
2946
+ // @ts-expect-error CJS fallback
2947
+ (ft.default ?? ft)()
2948
+ ];
2949
+ }
2950
+ n(_r, "getCoreAnnotations");
2951
+
2952
+ // src/csf/csf-factories.ts
2953
+ function tc(e) {
2954
+ let t, r = {
2955
+ _tag: "Preview",
2956
+ input: e,
2957
+ get composed() {
2958
+ if (t)
2959
+ return t;
2960
+ let { addons: o, ...i } = e;
2961
+ return t = te(
2962
+ ne([..._r(), ...o ?? [], i])
2963
+ ), t;
2964
+ },
2965
+ meta(o) {
2966
+ return Nn(o, this);
2967
+ }
2968
+ };
2969
+ return globalThis.globalProjectAnnotations = r.composed, r;
2970
+ }
2971
+ n(tc, "definePreview");
2972
+ function rc(e) {
2973
+ return e;
2974
+ }
2975
+ n(rc, "definePreviewAddon");
2976
+ function oc(e) {
119
2977
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Preview";
120
2978
  }
121
- a(F, "isPreview");
122
- function G(e) {
2979
+ n(oc, "isPreview");
2980
+ function nc(e) {
123
2981
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Meta";
124
2982
  }
125
- a(G, "isMeta");
126
- function J(e) {
2983
+ n(nc, "isMeta");
2984
+ function Nn(e, t) {
2985
+ return {
2986
+ _tag: "Meta",
2987
+ input: e,
2988
+ preview: t,
2989
+ get composed() {
2990
+ throw new Error("Not implemented");
2991
+ },
2992
+ // @ts-expect-error hard
2993
+ story(r = {}) {
2994
+ return Hr(typeof r == "function" ? { render: r } : r, this);
2995
+ }
2996
+ };
2997
+ }
2998
+ n(Nn, "defineMeta");
2999
+ function ic(e) {
127
3000
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Story";
128
3001
  }
129
- a(J, "isStory");
3002
+ n(ic, "isStory");
3003
+ function Hr(e, t) {
3004
+ let r, o = /* @__PURE__ */ n(() => (r || (r = We(
3005
+ e,
3006
+ t.input,
3007
+ void 0,
3008
+ t.preview.composed
3009
+ )), r), "compose");
3010
+ return {
3011
+ _tag: "Story",
3012
+ input: e,
3013
+ meta: t,
3014
+ __compose: o,
3015
+ get composed() {
3016
+ let i = o(), { args: s, argTypes: a, parameters: p, id: c, tags: l, globals: y, storyName: u } = i;
3017
+ return { args: s, argTypes: a, parameters: p, id: c, tags: l, name: u, globals: y };
3018
+ },
3019
+ get play() {
3020
+ return e.play ?? t.input?.play ?? (async () => {
3021
+ });
3022
+ },
3023
+ get run() {
3024
+ return o().run ?? (async () => {
3025
+ });
3026
+ },
3027
+ extend(i) {
3028
+ return Hr(
3029
+ {
3030
+ ...this.input,
3031
+ ...i,
3032
+ args: { ...this.input.args, ...i.args },
3033
+ argTypes: D(this.input.argTypes, i.argTypes),
3034
+ afterEach: [
3035
+ ...b(this.input?.afterEach ?? []),
3036
+ ...b(i.afterEach ?? [])
3037
+ ],
3038
+ beforeEach: [
3039
+ ...b(this.input?.beforeEach ?? []),
3040
+ ...b(i.beforeEach ?? [])
3041
+ ],
3042
+ decorators: [
3043
+ ...b(this.input?.decorators ?? []),
3044
+ ...b(i.decorators ?? [])
3045
+ ],
3046
+ globals: { ...this.input.globals, ...i.globals },
3047
+ loaders: [
3048
+ ...b(this.input?.loaders ?? []),
3049
+ ...b(i.loaders ?? [])
3050
+ ],
3051
+ parameters: D(this.input.parameters, i.parameters),
3052
+ tags: Hn(...this.input.tags ?? [], ...i.tags ?? [])
3053
+ },
3054
+ this.meta
3055
+ );
3056
+ }
3057
+ };
3058
+ }
3059
+ n(Hr, "defineStory");
130
3060
 
131
3061
  // src/csf/index.ts
132
- var I = /* @__PURE__ */ a((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
133
- "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), R = /* @__PURE__ */ a((e, r) => {
134
- let t = I(e);
135
- if (t === "")
136
- throw new Error(`Invalid ${r} '${e}', must include alphanumeric characters`);
137
- return t;
138
- }, "sanitizeSafe"), W = /* @__PURE__ */ a((e, r) => `${R(e, "kind")}${r ? `--${R(r, "name")}` : ""}`, "toId"), H = /* @__PURE__ */ a((e) => x(
3062
+ var jn = /* @__PURE__ */ n((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
3063
+ "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), Nr = /* @__PURE__ */ n((e, t) => {
3064
+ let r = jn(e);
3065
+ if (r === "")
3066
+ throw new Error(`Invalid ${t} '${e}', must include alphanumeric characters`);
3067
+ return r;
3068
+ }, "sanitizeSafe"), lc = /* @__PURE__ */ n((e, t) => `${Nr(e, "kind")}${t ? `--${Nr(t, "name")}` : ""}`, "toId"), cc = /* @__PURE__ */ n((e) => bt(
139
3069
  e), "storyNameFromExport");
140
- function T(e, r) {
141
- return Array.isArray(r) ? r.includes(e) : e.match(r);
3070
+ function jr(e, t) {
3071
+ return Array.isArray(t) ? t.includes(e) : e.match(t);
142
3072
  }
143
- a(T, "matches");
144
- function K(e, { includeStories: r, excludeStories: t }) {
3073
+ n(jr, "matches");
3074
+ function dc(e, { includeStories: t, excludeStories: r }) {
145
3075
  return (
146
3076
  // https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
147
- e !== "__esModule" && (!r || T(e, r)) && (!t || !T(e, t))
3077
+ e !== "__esModule" && (!t || jr(e, t)) && (!r || !jr(e, r))
148
3078
  );
149
3079
  }
150
- a(K, "isExportStory");
151
- var Q = /* @__PURE__ */ a((e, { rootSeparator: r, groupSeparator: t }) => {
152
- let [n, s] = e.split(r, 2), l = (s || e).split(t).filter((o) => !!o);
3080
+ n(dc, "isExportStory");
3081
+ var mc = /* @__PURE__ */ n((e, { rootSeparator: t, groupSeparator: r }) => {
3082
+ let [o, i] = e.split(t, 2), s = (i || e).split(r).filter((a) => !!a);
153
3083
  return {
154
- root: s ? n : null,
155
- groups: l
3084
+ root: i ? o : null,
3085
+ groups: s
156
3086
  };
157
- }, "parseKind"), X = /* @__PURE__ */ a((...e) => {
158
- let r = e.reduce((t, n) => (n.startsWith("!") ? t.delete(n.slice(1)) : t.add(n), t), /* @__PURE__ */ new Set());
159
- return Array.from(r);
3087
+ }, "parseKind"), uc = /* @__PURE__ */ n((...e) => {
3088
+ let t = e.reduce((r, o) => (o.startsWith("!") ? r.delete(o.slice(1)) : r.add(o), r), /* @__PURE__ */ new Set());
3089
+ return Array.from(t);
160
3090
  }, "combineTags");
161
3091
  export {
162
- X as combineTags,
163
- z as includeConditionalArg,
164
- K as isExportStory,
165
- G as isMeta,
166
- F as isPreview,
167
- J as isStory,
168
- Q as parseKind,
169
- I as sanitize,
170
- H as storyNameFromExport,
171
- W as toId
3092
+ uc as combineTags,
3093
+ tc as definePreview,
3094
+ rc as definePreviewAddon,
3095
+ _r as getCoreAnnotations,
3096
+ Xr as includeConditionalArg,
3097
+ dc as isExportStory,
3098
+ nc as isMeta,
3099
+ oc as isPreview,
3100
+ ic as isStory,
3101
+ mc as parseKind,
3102
+ jn as sanitize,
3103
+ cc as storyNameFromExport,
3104
+ lc as toId
172
3105
  };