storybook 9.0.0-alpha.0 → 9.0.0-alpha.2
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.
- package/README.md +31 -29
- package/assets/browser/favicon.svg +1 -0
- package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-bold.woff2 +0 -0
- package/assets/browser/nunito-sans-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-regular.woff2 +0 -0
- package/assets/docs/message-reference.png +0 -0
- package/assets/server/addon.tsconfig.json +6 -0
- package/assets/server/base-preview-body.html +119 -0
- package/assets/server/base-preview-head.html +451 -0
- package/assets/server/template.ejs +87 -0
- package/bin/index.cjs +1 -1
- package/dist/babel/index.cjs +54034 -0
- package/dist/babel/index.d.ts +7488 -0
- package/dist/babel/index.js +54044 -0
- package/dist/bin/index.cjs +124 -0
- package/dist/bin/index.js +118 -0
- package/dist/builder-manager/index.cjs +2167 -0
- package/dist/builder-manager/index.d.ts +19 -0
- package/dist/builder-manager/index.js +2189 -0
- package/dist/channels/index.cjs +1938 -0
- package/dist/channels/index.d.ts +108 -0
- package/dist/channels/index.js +1885 -0
- package/dist/cli/bin/index.cjs +2687 -0
- package/dist/cli/bin/index.d.ts +2 -0
- package/dist/cli/bin/index.js +2707 -0
- package/dist/cli/index.cjs +17327 -0
- package/dist/cli/index.d.ts +209 -0
- package/dist/cli/index.js +17349 -0
- package/dist/client-logger/index.cjs +112 -0
- package/dist/client-logger/index.d.ts +29 -0
- package/dist/client-logger/index.js +70 -0
- package/dist/common/index.cjs +20558 -0
- package/dist/common/index.d.ts +955 -0
- package/dist/common/index.js +20643 -0
- package/dist/components/index.cjs +30056 -0
- package/dist/components/index.d.ts +1423 -0
- package/dist/components/index.js +25416 -0
- package/dist/core-events/index.cjs +167 -0
- package/dist/core-events/index.d.ts +313 -0
- package/dist/core-events/index.js +149 -0
- package/dist/core-server/index.cjs +37872 -0
- package/dist/core-server/index.d.ts +462 -0
- package/dist/core-server/index.js +37966 -0
- package/dist/core-server/presets/common-manager.js +28 -0
- package/dist/core-server/presets/common-override-preset.cjs +4824 -0
- package/dist/core-server/presets/common-override-preset.js +4829 -0
- package/dist/core-server/presets/common-preset.cjs +10228 -0
- package/dist/core-server/presets/common-preset.js +10306 -0
- package/dist/csf/index.cjs +223 -0
- package/dist/csf/index.d.ts +752 -0
- package/dist/csf/index.js +216 -0
- package/dist/csf-tools/index.cjs +1422 -0
- package/dist/csf-tools/index.d.ts +250 -0
- package/dist/csf-tools/index.js +1439 -0
- package/dist/docs-tools/index.cjs +923 -0
- package/dist/docs-tools/index.d.ts +162 -0
- package/dist/docs-tools/index.js +909 -0
- package/dist/index.cjs +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -7
- package/dist/instrumenter/index.cjs +3273 -0
- package/dist/instrumenter/index.d.ts +104 -0
- package/dist/instrumenter/index.js +4800 -0
- package/dist/manager/globals-module-info.cjs +666 -0
- package/dist/manager/globals-module-info.d.ts +36 -0
- package/dist/manager/globals-module-info.js +653 -0
- package/dist/manager/globals-runtime.js +41567 -0
- package/dist/manager/globals.cjs +43 -0
- package/dist/manager/globals.d.ts +21 -0
- package/dist/manager/globals.js +30 -0
- package/dist/manager/runtime.js +12043 -0
- package/dist/manager-api/index.cjs +10772 -0
- package/dist/manager-api/index.d.ts +1211 -0
- package/dist/manager-api/index.js +4547 -0
- package/dist/manager-errors.d.ts +65 -0
- package/dist/manager-errors.js +83 -0
- package/dist/node-logger/index.cjs +1642 -0
- package/dist/node-logger/index.d.ts +117 -0
- package/dist/node-logger/index.js +1652 -0
- package/dist/preview/globals.cjs +34 -0
- package/dist/preview/globals.d.ts +12 -0
- package/dist/preview/globals.js +21 -0
- package/dist/preview/runtime.js +7723 -0
- package/dist/preview-api/index.cjs +5658 -0
- package/dist/preview-api/index.d.ts +1356 -0
- package/dist/preview-api/index.js +5665 -0
- package/dist/preview-errors.cjs +486 -0
- package/dist/preview-errors.d.ts +188 -0
- package/dist/preview-errors.js +433 -0
- package/dist/router/index.cjs +3320 -0
- package/dist/router/index.d.ts +385 -0
- package/dist/router/index.js +1849 -0
- package/dist/server-errors.cjs +710 -0
- package/dist/server-errors.d.ts +272 -0
- package/dist/server-errors.js +711 -0
- package/dist/telemetry/index.cjs +3683 -0
- package/dist/telemetry/index.d.ts +112 -0
- package/dist/telemetry/index.js +3720 -0
- package/dist/theming/create.cjs +2422 -0
- package/dist/theming/create.d.ts +50 -0
- package/dist/theming/create.js +990 -0
- package/dist/theming/index.cjs +4832 -0
- package/dist/theming/index.d.ts +11939 -0
- package/dist/theming/index.js +3253 -0
- package/dist/types/index.cjs +27 -0
- package/dist/types/index.d.ts +2541 -0
- package/dist/types/index.js +7 -0
- package/package.json +308 -212
- package/.eslintrc.cjs +0 -31
- package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
- package/core/babel/index.cjs +0 -1
- package/core/babel/index.d.ts +0 -2
- package/core/babel/index.js +0 -1
- package/core/builder-manager/index.cjs +0 -1
- package/core/builder-manager/index.d.ts +0 -2
- package/core/builder-manager/index.js +0 -1
- package/core/channels/index.cjs +0 -1
- package/core/channels/index.d.ts +0 -2
- package/core/channels/index.js +0 -1
- package/core/cli/bin/index.cjs +0 -1
- package/core/cli/bin/index.d.ts +0 -2
- package/core/cli/bin/index.js +0 -1
- package/core/cli/index.cjs +0 -1
- package/core/cli/index.d.ts +0 -2
- package/core/cli/index.js +0 -1
- package/core/client-logger/index.cjs +0 -1
- package/core/client-logger/index.d.ts +0 -2
- package/core/client-logger/index.js +0 -1
- package/core/common/index.cjs +0 -1
- package/core/common/index.d.ts +0 -2
- package/core/common/index.js +0 -1
- package/core/components/index.cjs +0 -1
- package/core/components/index.d.ts +0 -2
- package/core/components/index.js +0 -1
- package/core/core-events/index.cjs +0 -1
- package/core/core-events/index.d.ts +0 -2
- package/core/core-events/index.js +0 -1
- package/core/core-server/index.cjs +0 -1
- package/core/core-server/index.d.ts +0 -2
- package/core/core-server/index.js +0 -1
- package/core/core-server/presets/common-manager.js +0 -1
- package/core/core-server/presets/common-override-preset.cjs +0 -1
- package/core/core-server/presets/common-override-preset.js +0 -1
- package/core/core-server/presets/common-preset.cjs +0 -1
- package/core/core-server/presets/common-preset.js +0 -1
- package/core/csf/index.cjs +0 -1
- package/core/csf/index.d.ts +0 -2
- package/core/csf/index.js +0 -1
- package/core/csf-tools/index.cjs +0 -1
- package/core/csf-tools/index.d.ts +0 -2
- package/core/csf-tools/index.js +0 -1
- package/core/docs-tools/index.cjs +0 -1
- package/core/docs-tools/index.d.ts +0 -2
- package/core/docs-tools/index.js +0 -1
- package/core/index.cjs +0 -1
- package/core/index.d.ts +0 -2
- package/core/index.js +0 -1
- package/core/manager/globals-module-info.cjs +0 -1
- package/core/manager/globals-module-info.d.ts +0 -2
- package/core/manager/globals-module-info.js +0 -1
- package/core/manager/globals-runtime.js +0 -1
- package/core/manager/globals.cjs +0 -1
- package/core/manager/globals.d.ts +0 -2
- package/core/manager/globals.js +0 -1
- package/core/manager-api/index.cjs +0 -1
- package/core/manager-api/index.d.ts +0 -2
- package/core/manager-api/index.js +0 -1
- package/core/manager-errors.d.ts +0 -2
- package/core/manager-errors.js +0 -1
- package/core/node-logger/index.cjs +0 -1
- package/core/node-logger/index.d.ts +0 -2
- package/core/node-logger/index.js +0 -1
- package/core/preview/globals.cjs +0 -1
- package/core/preview/globals.d.ts +0 -2
- package/core/preview/globals.js +0 -1
- package/core/preview/runtime.js +0 -1
- package/core/preview-api/index.cjs +0 -1
- package/core/preview-api/index.d.ts +0 -2
- package/core/preview-api/index.js +0 -1
- package/core/preview-errors.cjs +0 -1
- package/core/preview-errors.d.ts +0 -2
- package/core/preview-errors.js +0 -1
- package/core/router/index.cjs +0 -1
- package/core/router/index.d.ts +0 -2
- package/core/router/index.js +0 -1
- package/core/server-errors.cjs +0 -1
- package/core/server-errors.d.ts +0 -2
- package/core/server-errors.js +0 -1
- package/core/telemetry/index.cjs +0 -1
- package/core/telemetry/index.d.ts +0 -2
- package/core/telemetry/index.js +0 -1
- package/core/theming/create.cjs +0 -1
- package/core/theming/create.d.ts +0 -2
- package/core/theming/create.js +0 -1
- package/core/theming/index.cjs +0 -1
- package/core/theming/index.d.ts +0 -2
- package/core/theming/index.js +0 -1
- package/core/types/index.cjs +0 -1
- package/core/types/index.d.ts +0 -2
- package/core/types/index.js +0 -1
- package/core.cjs +0 -0
- package/core.d.ts +0 -0
- package/core.js +0 -1
- package/dist/chunk-OWLSIX54.js +0 -8
- package/dist/core-path.cjs +0 -1
- package/dist/core-path.d.ts +0 -3
- package/dist/core-path.js +0 -9
- package/dist/proxy.cjs +0 -1
- package/dist/proxy.d.ts +0 -2
- package/dist/proxy.js +0 -9
|
@@ -0,0 +1,1885 @@
|
|
|
1
|
+
var ae = Object.create;
|
|
2
|
+
var ut = Object.defineProperty;
|
|
3
|
+
var se = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var le = Object.getOwnPropertyNames;
|
|
5
|
+
var ce = Object.getPrototypeOf, pe = Object.prototype.hasOwnProperty;
|
|
6
|
+
var a = (r, t) => ut(r, "name", { value: t, configurable: !0 }), H = /* @__PURE__ */ ((r) => typeof require < "u" ? require : typeof Proxy <
|
|
7
|
+
"u" ? new Proxy(r, {
|
|
8
|
+
get: (t, e) => (typeof require < "u" ? require : t)[e]
|
|
9
|
+
}) : r)(function(r) {
|
|
10
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + r + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var ue = (r, t) => () => (t || r((t = { exports: {} }).exports, t), t.exports);
|
|
14
|
+
var fe = (r, t, e, n) => {
|
|
15
|
+
if (t && typeof t == "object" || typeof t == "function")
|
|
16
|
+
for (let o of le(t))
|
|
17
|
+
!pe.call(r, o) && o !== e && ut(r, o, { get: () => t[o], enumerable: !(n = se(t, o)) || n.enumerable });
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
var he = (r, t, e) => (e = r != null ? ae(ce(r)) : {}, fe(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
t || !r || !r.__esModule ? ut(e, "default", { value: r, enumerable: !0 }) : e,
|
|
26
|
+
r
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
// ../node_modules/memoizerific/memoizerific.js
|
|
30
|
+
var xt = ue((It, yt) => {
|
|
31
|
+
(function(r) {
|
|
32
|
+
if (typeof It == "object" && typeof yt < "u")
|
|
33
|
+
yt.exports = r();
|
|
34
|
+
else if (typeof define == "function" && define.amd)
|
|
35
|
+
define([], r);
|
|
36
|
+
else {
|
|
37
|
+
var t;
|
|
38
|
+
typeof window < "u" ? t = window : typeof global < "u" ? t = global : typeof self < "u" ? t = self : t = this, t.memoizerific = r();
|
|
39
|
+
}
|
|
40
|
+
})(function() {
|
|
41
|
+
var r, t, e;
|
|
42
|
+
return (/* @__PURE__ */ a(function n(o, s, l) {
|
|
43
|
+
function c(p, u) {
|
|
44
|
+
if (!s[p]) {
|
|
45
|
+
if (!o[p]) {
|
|
46
|
+
var y = typeof H == "function" && H;
|
|
47
|
+
if (!u && y) return y(p, !0);
|
|
48
|
+
if (i) return i(p, !0);
|
|
49
|
+
var v = new Error("Cannot find module '" + p + "'");
|
|
50
|
+
throw v.code = "MODULE_NOT_FOUND", v;
|
|
51
|
+
}
|
|
52
|
+
var d = s[p] = { exports: {} };
|
|
53
|
+
o[p][0].call(d.exports, function(m) {
|
|
54
|
+
var E = o[p][1][m];
|
|
55
|
+
return c(E || m);
|
|
56
|
+
}, d, d.exports, n, o, s, l);
|
|
57
|
+
}
|
|
58
|
+
return s[p].exports;
|
|
59
|
+
}
|
|
60
|
+
a(c, "s");
|
|
61
|
+
for (var i = typeof H == "function" && H, g = 0; g < l.length; g++) c(l[g]);
|
|
62
|
+
return c;
|
|
63
|
+
}, "e"))({ 1: [function(n, o, s) {
|
|
64
|
+
o.exports = function(l) {
|
|
65
|
+
if (typeof Map != "function" || l) {
|
|
66
|
+
var c = n("./similar");
|
|
67
|
+
return new c();
|
|
68
|
+
} else
|
|
69
|
+
return /* @__PURE__ */ new Map();
|
|
70
|
+
};
|
|
71
|
+
}, { "./similar": 2 }], 2: [function(n, o, s) {
|
|
72
|
+
function l() {
|
|
73
|
+
return this.list = [], this.lastItem = void 0, this.size = 0, this;
|
|
74
|
+
}
|
|
75
|
+
a(l, "Similar"), l.prototype.get = function(c) {
|
|
76
|
+
var i;
|
|
77
|
+
if (this.lastItem && this.isEqual(this.lastItem.key, c))
|
|
78
|
+
return this.lastItem.val;
|
|
79
|
+
if (i = this.indexOf(c), i >= 0)
|
|
80
|
+
return this.lastItem = this.list[i], this.list[i].val;
|
|
81
|
+
}, l.prototype.set = function(c, i) {
|
|
82
|
+
var g;
|
|
83
|
+
return this.lastItem && this.isEqual(this.lastItem.key, c) ? (this.lastItem.val = i, this) : (g = this.indexOf(c), g >= 0 ? (this.lastItem =
|
|
84
|
+
this.list[g], this.list[g].val = i, this) : (this.lastItem = { key: c, val: i }, this.list.push(this.lastItem), this.size++, this));
|
|
85
|
+
}, l.prototype.delete = function(c) {
|
|
86
|
+
var i;
|
|
87
|
+
if (this.lastItem && this.isEqual(this.lastItem.key, c) && (this.lastItem = void 0), i = this.indexOf(c), i >= 0)
|
|
88
|
+
return this.size--, this.list.splice(i, 1)[0];
|
|
89
|
+
}, l.prototype.has = function(c) {
|
|
90
|
+
var i;
|
|
91
|
+
return this.lastItem && this.isEqual(this.lastItem.key, c) ? !0 : (i = this.indexOf(c), i >= 0 ? (this.lastItem = this.list[i], !0) :
|
|
92
|
+
!1);
|
|
93
|
+
}, l.prototype.forEach = function(c, i) {
|
|
94
|
+
var g;
|
|
95
|
+
for (g = 0; g < this.size; g++)
|
|
96
|
+
c.call(i || this, this.list[g].val, this.list[g].key, this);
|
|
97
|
+
}, l.prototype.indexOf = function(c) {
|
|
98
|
+
var i;
|
|
99
|
+
for (i = 0; i < this.size; i++)
|
|
100
|
+
if (this.isEqual(this.list[i].key, c))
|
|
101
|
+
return i;
|
|
102
|
+
return -1;
|
|
103
|
+
}, l.prototype.isEqual = function(c, i) {
|
|
104
|
+
return c === i || c !== c && i !== i;
|
|
105
|
+
}, o.exports = l;
|
|
106
|
+
}, {}], 3: [function(n, o, s) {
|
|
107
|
+
var l = n("map-or-similar");
|
|
108
|
+
o.exports = function(p) {
|
|
109
|
+
var u = new l(!1), y = [];
|
|
110
|
+
return function(v) {
|
|
111
|
+
var d = /* @__PURE__ */ a(function() {
|
|
112
|
+
var m = u, E, I, T = arguments.length - 1, R = Array(T + 1), C = !0, N;
|
|
113
|
+
if ((d.numArgs || d.numArgs === 0) && d.numArgs !== T + 1)
|
|
114
|
+
throw new Error("Memoizerific functions should always be called with the same number of arguments");
|
|
115
|
+
for (N = 0; N < T; N++) {
|
|
116
|
+
if (R[N] = {
|
|
117
|
+
cacheItem: m,
|
|
118
|
+
arg: arguments[N]
|
|
119
|
+
}, m.has(arguments[N])) {
|
|
120
|
+
m = m.get(arguments[N]);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
C = !1, E = new l(!1), m.set(arguments[N], E), m = E;
|
|
124
|
+
}
|
|
125
|
+
return C && (m.has(arguments[T]) ? I = m.get(arguments[T]) : C = !1), C || (I = v.apply(null, arguments), m.set(arguments[T], I)),
|
|
126
|
+
p > 0 && (R[T] = {
|
|
127
|
+
cacheItem: m,
|
|
128
|
+
arg: arguments[T]
|
|
129
|
+
}, C ? c(y, R) : y.push(R), y.length > p && i(y.shift())), d.wasMemoized = C, d.numArgs = T + 1, I;
|
|
130
|
+
}, "memoizerific");
|
|
131
|
+
return d.limit = p, d.wasMemoized = !1, d.cache = u, d.lru = y, d;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
function c(p, u) {
|
|
135
|
+
var y = p.length, v = u.length, d, m, E;
|
|
136
|
+
for (m = 0; m < y; m++) {
|
|
137
|
+
for (d = !0, E = 0; E < v; E++)
|
|
138
|
+
if (!g(p[m][E].arg, u[E].arg)) {
|
|
139
|
+
d = !1;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
if (d)
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
p.push(p.splice(m, 1)[0]);
|
|
146
|
+
}
|
|
147
|
+
a(c, "moveToMostRecentLru");
|
|
148
|
+
function i(p) {
|
|
149
|
+
var u = p.length, y = p[u - 1], v, d;
|
|
150
|
+
for (y.cacheItem.delete(y.arg), d = u - 2; d >= 0 && (y = p[d], v = y.cacheItem.get(y.arg), !v || !v.size); d--)
|
|
151
|
+
y.cacheItem.delete(y.arg);
|
|
152
|
+
}
|
|
153
|
+
a(i, "removeCachedResult");
|
|
154
|
+
function g(p, u) {
|
|
155
|
+
return p === u || p !== p && u !== u;
|
|
156
|
+
}
|
|
157
|
+
a(g, "isEqual");
|
|
158
|
+
}, { "map-or-similar": 1 }] }, {}, [3])(3);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// ../node_modules/@storybook/global/dist/index.mjs
|
|
163
|
+
var S = (() => {
|
|
164
|
+
let r;
|
|
165
|
+
return typeof window < "u" ? r = window : typeof globalThis < "u" ? r = globalThis : typeof global < "u" ? r = global : typeof self < "u" ?
|
|
166
|
+
r = self : r = {}, r;
|
|
167
|
+
})();
|
|
168
|
+
|
|
169
|
+
// ../node_modules/ts-dedent/esm/index.js
|
|
170
|
+
function F(r) {
|
|
171
|
+
for (var t = [], e = 1; e < arguments.length; e++)
|
|
172
|
+
t[e - 1] = arguments[e];
|
|
173
|
+
var n = Array.from(typeof r == "string" ? [r] : r);
|
|
174
|
+
n[n.length - 1] = n[n.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
175
|
+
var o = n.reduce(function(c, i) {
|
|
176
|
+
var g = i.match(/\n([\t ]+|(?!\s).)/g);
|
|
177
|
+
return g ? c.concat(g.map(function(p) {
|
|
178
|
+
var u, y;
|
|
179
|
+
return (y = (u = p.match(/[\t ]/g)) === null || u === void 0 ? void 0 : u.length) !== null && y !== void 0 ? y : 0;
|
|
180
|
+
})) : c;
|
|
181
|
+
}, []);
|
|
182
|
+
if (o.length) {
|
|
183
|
+
var s = new RegExp(`
|
|
184
|
+
[ ]{` + Math.min.apply(Math, o) + "}", "g");
|
|
185
|
+
n = n.map(function(c) {
|
|
186
|
+
return c.replace(s, `
|
|
187
|
+
`);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
n[0] = n[0].replace(/^\r?\n/, "");
|
|
191
|
+
var l = n[0];
|
|
192
|
+
return t.forEach(function(c, i) {
|
|
193
|
+
var g = l.match(/(?:^|\n)( *)$/), p = g ? g[1] : "", u = c;
|
|
194
|
+
typeof c == "string" && c.includes(`
|
|
195
|
+
`) && (u = String(c).split(`
|
|
196
|
+
`).map(function(y, v) {
|
|
197
|
+
return v === 0 ? y : "" + p + y;
|
|
198
|
+
}).join(`
|
|
199
|
+
`)), l += u + n[i + 1];
|
|
200
|
+
}), l;
|
|
201
|
+
}
|
|
202
|
+
a(F, "dedent");
|
|
203
|
+
|
|
204
|
+
// src/shared/universal-store/instances.ts
|
|
205
|
+
var ft = /* @__PURE__ */ new Map();
|
|
206
|
+
|
|
207
|
+
// src/shared/universal-store/index.ts
|
|
208
|
+
var ye = "UNIVERSAL_STORE:", x = {
|
|
209
|
+
PENDING: "PENDING",
|
|
210
|
+
RESOLVED: "RESOLVED",
|
|
211
|
+
REJECTED: "REJECTED"
|
|
212
|
+
}, h = class h {
|
|
213
|
+
constructor(t, e) {
|
|
214
|
+
/** Enable debug logs for this store */
|
|
215
|
+
this.debugging = !1;
|
|
216
|
+
// TODO: narrow type of listeners based on event type
|
|
217
|
+
this.listeners = /* @__PURE__ */ new Map([["*", /* @__PURE__ */ new Set()]]);
|
|
218
|
+
/** Gets the current state */
|
|
219
|
+
this.getState = /* @__PURE__ */ a(() => (this.debug("getState", { state: this.state }), this.state), "getState");
|
|
220
|
+
/**
|
|
221
|
+
* Subscribes to store events
|
|
222
|
+
*
|
|
223
|
+
* @returns A function to unsubscribe
|
|
224
|
+
*/
|
|
225
|
+
this.subscribe = /* @__PURE__ */ a((t, e) => {
|
|
226
|
+
let n = typeof t == "function", o = n ? "*" : t, s = n ? t : e;
|
|
227
|
+
if (this.debug("subscribe", { eventType: o, listener: s }), !s)
|
|
228
|
+
throw new TypeError(
|
|
229
|
+
`Missing first subscribe argument, or second if first is the event type, when subscribing to a UniversalStore with id '${this.id}'`
|
|
230
|
+
);
|
|
231
|
+
return this.listeners.has(o) || this.listeners.set(o, /* @__PURE__ */ new Set()), this.listeners.get(o).add(s), () => {
|
|
232
|
+
this.debug("unsubscribe", { eventType: o, listener: s }), this.listeners.has(o) && (this.listeners.get(o).delete(s), this.listeners.
|
|
233
|
+
get(o)?.size === 0 && this.listeners.delete(o));
|
|
234
|
+
};
|
|
235
|
+
}, "subscribe");
|
|
236
|
+
/** Sends a custom event to the other stores */
|
|
237
|
+
this.send = /* @__PURE__ */ a((t) => {
|
|
238
|
+
if (this.debug("send", { event: t }), this.status !== h.Status.READY)
|
|
239
|
+
throw new TypeError(
|
|
240
|
+
F`Cannot send event before store is ready. You can get the current status with store.status,
|
|
241
|
+
or await store.readyPromise to wait for the store to be ready before sending events.
|
|
242
|
+
${JSON.stringify(
|
|
243
|
+
{
|
|
244
|
+
event: t,
|
|
245
|
+
id: this.id,
|
|
246
|
+
actor: this.actor,
|
|
247
|
+
environment: this.environment
|
|
248
|
+
},
|
|
249
|
+
null,
|
|
250
|
+
2
|
|
251
|
+
)}`
|
|
252
|
+
);
|
|
253
|
+
this.emitToListeners(t, { actor: this.actor }), this.emitToChannel(t, { actor: this.actor });
|
|
254
|
+
}, "send");
|
|
255
|
+
if (this.debugging = t.debug ?? !1, !h.isInternalConstructing)
|
|
256
|
+
throw new TypeError(
|
|
257
|
+
"UniversalStore is not constructable - use UniversalStore.create() instead"
|
|
258
|
+
);
|
|
259
|
+
if (h.isInternalConstructing = !1, this.id = t.id, this.actorId = globalThis.crypto ? globalThis.crypto.randomUUID() : (
|
|
260
|
+
// TODO: remove this fallback in SB 9.0 when we no longer support Node 18
|
|
261
|
+
Date.now().toString(36) + Math.random().toString(36).substring(2)
|
|
262
|
+
), this.actorType = t.leader ? h.ActorType.LEADER : h.ActorType.FOLLOWER, this.state = t.initialState, this.channelEventName = `${ye}${this.
|
|
263
|
+
id}`, this.debug("constructor", {
|
|
264
|
+
options: t,
|
|
265
|
+
environmentOverrides: e,
|
|
266
|
+
channelEventName: this.channelEventName
|
|
267
|
+
}), this.actor.type === h.ActorType.LEADER)
|
|
268
|
+
this.syncing = {
|
|
269
|
+
state: x.RESOLVED,
|
|
270
|
+
promise: Promise.resolve()
|
|
271
|
+
};
|
|
272
|
+
else {
|
|
273
|
+
let n, o, s = new Promise((l, c) => {
|
|
274
|
+
n = /* @__PURE__ */ a(() => {
|
|
275
|
+
this.syncing.state === x.PENDING && (this.syncing.state = x.RESOLVED, l());
|
|
276
|
+
}, "syncingResolve"), o = /* @__PURE__ */ a((i) => {
|
|
277
|
+
this.syncing.state === x.PENDING && (this.syncing.state = x.REJECTED, c(i));
|
|
278
|
+
}, "syncingReject");
|
|
279
|
+
});
|
|
280
|
+
this.syncing = {
|
|
281
|
+
state: x.PENDING,
|
|
282
|
+
promise: s,
|
|
283
|
+
resolve: n,
|
|
284
|
+
reject: o
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
this.getState = this.getState.bind(this), this.setState = this.setState.bind(this), this.subscribe = this.subscribe.bind(this), this.onStateChange =
|
|
288
|
+
this.onStateChange.bind(this), this.send = this.send.bind(this), this.emitToChannel = this.emitToChannel.bind(this), this.prepareThis = this.
|
|
289
|
+
prepareThis.bind(this), this.emitToListeners = this.emitToListeners.bind(this), this.handleChannelEvents = this.handleChannelEvents.bind(
|
|
290
|
+
this), this.debug = this.debug.bind(this), this.channel = e?.channel ?? h.preparation.channel, this.environment = e?.environment ?? h.preparation.
|
|
291
|
+
environment, this.channel && this.environment ? this.prepareThis({ channel: this.channel, environment: this.environment }) : h.preparation.
|
|
292
|
+
promise.then(this.prepareThis);
|
|
293
|
+
}
|
|
294
|
+
static setupPreparationPromise() {
|
|
295
|
+
let t, e, n = new Promise(
|
|
296
|
+
(o, s) => {
|
|
297
|
+
t = /* @__PURE__ */ a((l) => {
|
|
298
|
+
o(l);
|
|
299
|
+
}, "resolveRef"), e = /* @__PURE__ */ a((...l) => {
|
|
300
|
+
s(l);
|
|
301
|
+
}, "rejectRef");
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
h.preparation = {
|
|
305
|
+
resolve: t,
|
|
306
|
+
reject: e,
|
|
307
|
+
promise: n
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/** The actor object representing the store instance with a unique ID and a type */
|
|
311
|
+
get actor() {
|
|
312
|
+
return Object.freeze({
|
|
313
|
+
id: this.actorId,
|
|
314
|
+
type: this.actorType,
|
|
315
|
+
environment: this.environment ?? h.Environment.UNKNOWN
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The current state of the store, that signals both if the store is prepared by Storybook and
|
|
320
|
+
* also - in the case of a follower - if the state has been synced with the leader's state.
|
|
321
|
+
*/
|
|
322
|
+
get status() {
|
|
323
|
+
if (!this.channel || !this.environment)
|
|
324
|
+
return h.Status.UNPREPARED;
|
|
325
|
+
switch (this.syncing?.state) {
|
|
326
|
+
case x.PENDING:
|
|
327
|
+
case void 0:
|
|
328
|
+
return h.Status.SYNCING;
|
|
329
|
+
case x.REJECTED:
|
|
330
|
+
return h.Status.ERROR;
|
|
331
|
+
case x.RESOLVED:
|
|
332
|
+
default:
|
|
333
|
+
return h.Status.READY;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* A promise that resolves when the store is fully ready. A leader will be ready when the store
|
|
338
|
+
* has been prepared by Storybook, which is almost instantly.
|
|
339
|
+
*
|
|
340
|
+
* A follower will be ready when the state has been synced with the leader's state, within a few
|
|
341
|
+
* hundred milliseconds.
|
|
342
|
+
*/
|
|
343
|
+
untilReady() {
|
|
344
|
+
return Promise.all([h.preparation.promise, this.syncing?.promise]);
|
|
345
|
+
}
|
|
346
|
+
/** Creates a new instance of UniversalStore */
|
|
347
|
+
static create(t) {
|
|
348
|
+
if (!t || typeof t?.id != "string")
|
|
349
|
+
throw new TypeError("id is required and must be a string, when creating a UniversalStore");
|
|
350
|
+
t.debug && console.debug(
|
|
351
|
+
F`[UniversalStore]
|
|
352
|
+
create`,
|
|
353
|
+
{ options: t }
|
|
354
|
+
);
|
|
355
|
+
let e = ft.get(t.id);
|
|
356
|
+
if (e)
|
|
357
|
+
return console.warn(F`UniversalStore with id "${t.id}" already exists in this environment, re-using existing.
|
|
358
|
+
You should reuse the existing instance instead of trying to create a new one.`), e;
|
|
359
|
+
h.isInternalConstructing = !0;
|
|
360
|
+
let n = new h(t);
|
|
361
|
+
return ft.set(t.id, n), n;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Used by Storybook to set the channel for all instances of UniversalStore in the given
|
|
365
|
+
* environment.
|
|
366
|
+
*
|
|
367
|
+
* @internal
|
|
368
|
+
*/
|
|
369
|
+
static __prepare(t, e) {
|
|
370
|
+
h.preparation.channel = t, h.preparation.environment = e, h.preparation.resolve({ channel: t, environment: e });
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Updates the store's state
|
|
374
|
+
*
|
|
375
|
+
* Either a new state or a state updater function can be passed to the method.
|
|
376
|
+
*/
|
|
377
|
+
setState(t) {
|
|
378
|
+
let e = this.state, n = typeof t == "function" ? t(e) : t;
|
|
379
|
+
if (this.debug("setState", { newState: n, previousState: e, updater: t }), this.status !== h.Status.READY)
|
|
380
|
+
throw new TypeError(
|
|
381
|
+
F`Cannot set state before store is ready. You can get the current status with store.status,
|
|
382
|
+
or await store.readyPromise to wait for the store to be ready before sending events.
|
|
383
|
+
${JSON.stringify(
|
|
384
|
+
{
|
|
385
|
+
newState: n,
|
|
386
|
+
id: this.id,
|
|
387
|
+
actor: this.actor,
|
|
388
|
+
environment: this.environment
|
|
389
|
+
},
|
|
390
|
+
null,
|
|
391
|
+
2
|
|
392
|
+
)}`
|
|
393
|
+
);
|
|
394
|
+
this.state = n;
|
|
395
|
+
let o = {
|
|
396
|
+
type: h.InternalEventType.SET_STATE,
|
|
397
|
+
payload: {
|
|
398
|
+
state: n,
|
|
399
|
+
previousState: e
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
this.emitToChannel(o, { actor: this.actor }), this.emitToListeners(o, { actor: this.actor });
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Subscribes to state changes
|
|
406
|
+
*
|
|
407
|
+
* @returns Unsubscribe function
|
|
408
|
+
*/
|
|
409
|
+
onStateChange(t) {
|
|
410
|
+
return this.debug("onStateChange", { listener: t }), this.subscribe(
|
|
411
|
+
h.InternalEventType.SET_STATE,
|
|
412
|
+
({ payload: e }, n) => {
|
|
413
|
+
t(e.state, e.previousState, n);
|
|
414
|
+
}
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
emitToChannel(t, e) {
|
|
418
|
+
this.debug("emitToChannel", { event: t, eventInfo: e, channel: !!this.channel }), this.channel?.emit(this.channelEventName, {
|
|
419
|
+
event: t,
|
|
420
|
+
eventInfo: e
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
prepareThis({
|
|
424
|
+
channel: t,
|
|
425
|
+
environment: e
|
|
426
|
+
}) {
|
|
427
|
+
this.channel = t, this.environment = e, this.debug("prepared", { channel: !!t, environment: e }), this.channel.on(this.channelEventName,
|
|
428
|
+
this.handleChannelEvents), this.actor.type === h.ActorType.LEADER ? this.emitToChannel(
|
|
429
|
+
{ type: h.InternalEventType.LEADER_CREATED },
|
|
430
|
+
{ actor: this.actor }
|
|
431
|
+
) : (this.emitToChannel(
|
|
432
|
+
{ type: h.InternalEventType.FOLLOWER_CREATED },
|
|
433
|
+
{ actor: this.actor }
|
|
434
|
+
), this.emitToChannel(
|
|
435
|
+
{ type: h.InternalEventType.EXISTING_STATE_REQUEST },
|
|
436
|
+
{ actor: this.actor }
|
|
437
|
+
), setTimeout(() => {
|
|
438
|
+
this.syncing.reject(
|
|
439
|
+
new TypeError(
|
|
440
|
+
`No existing state found for follower with id: '${this.id}'. Make sure a leader with the same id exists before creating a follower\
|
|
441
|
+
.`
|
|
442
|
+
)
|
|
443
|
+
);
|
|
444
|
+
}, 1e3));
|
|
445
|
+
}
|
|
446
|
+
emitToListeners(t, e) {
|
|
447
|
+
let n = this.listeners.get(t.type), o = this.listeners.get("*");
|
|
448
|
+
this.debug("emitToListeners", {
|
|
449
|
+
event: t,
|
|
450
|
+
eventInfo: e,
|
|
451
|
+
eventTypeListeners: n,
|
|
452
|
+
everythingListeners: o
|
|
453
|
+
}), [...n ?? [], ...o ?? []].forEach(
|
|
454
|
+
(s) => s(t, e)
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
handleChannelEvents(t) {
|
|
458
|
+
let { event: e, eventInfo: n } = t;
|
|
459
|
+
if ([n.actor.id, n.forwardingActor?.id].includes(this.actor.id)) {
|
|
460
|
+
this.debug("handleChannelEvents: Ignoring event from self", { channelEvent: t });
|
|
461
|
+
return;
|
|
462
|
+
} else if (this.syncing?.state === x.PENDING && e.type !== h.InternalEventType.EXISTING_STATE_RESPONSE) {
|
|
463
|
+
this.debug("handleChannelEvents: Ignoring event while syncing", { channelEvent: t });
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (this.debug("handleChannelEvents", { channelEvent: t }), this.actor.type === h.ActorType.LEADER) {
|
|
467
|
+
let o = !0;
|
|
468
|
+
switch (e.type) {
|
|
469
|
+
case h.InternalEventType.EXISTING_STATE_REQUEST:
|
|
470
|
+
o = !1;
|
|
471
|
+
let s = {
|
|
472
|
+
type: h.InternalEventType.EXISTING_STATE_RESPONSE,
|
|
473
|
+
payload: this.state
|
|
474
|
+
};
|
|
475
|
+
this.debug("handleChannelEvents: responding to existing state request", {
|
|
476
|
+
responseEvent: s
|
|
477
|
+
}), this.emitToChannel(s, { actor: this.actor });
|
|
478
|
+
break;
|
|
479
|
+
case h.InternalEventType.LEADER_CREATED:
|
|
480
|
+
o = !1, this.syncing.state = x.REJECTED, this.debug("handleChannelEvents: erroring due to second leader being created", {
|
|
481
|
+
event: e
|
|
482
|
+
}), console.error(
|
|
483
|
+
F`Detected multiple UniversalStore leaders created with the same id "${this.id}".
|
|
484
|
+
Only one leader can exists at a time, your stores are now in an invalid state.
|
|
485
|
+
Leaders detected:
|
|
486
|
+
this: ${JSON.stringify(this.actor, null, 2)}
|
|
487
|
+
other: ${JSON.stringify(n.actor, null, 2)}`
|
|
488
|
+
);
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
o && (this.debug("handleChannelEvents: forwarding event", { channelEvent: t }), this.emitToChannel(e, { actor: n.actor, forwardingActor: this.
|
|
492
|
+
actor }));
|
|
493
|
+
}
|
|
494
|
+
if (this.actor.type === h.ActorType.FOLLOWER)
|
|
495
|
+
switch (e.type) {
|
|
496
|
+
case h.InternalEventType.EXISTING_STATE_RESPONSE:
|
|
497
|
+
if (this.debug("handleChannelEvents: Setting state from leader's existing state response", {
|
|
498
|
+
event: e
|
|
499
|
+
}), this.syncing?.state !== x.PENDING)
|
|
500
|
+
break;
|
|
501
|
+
this.syncing.resolve?.();
|
|
502
|
+
let o = {
|
|
503
|
+
type: h.InternalEventType.SET_STATE,
|
|
504
|
+
payload: {
|
|
505
|
+
state: e.payload,
|
|
506
|
+
previousState: this.state
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
this.state = e.payload, this.emitToListeners(o, n);
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
switch (e.type) {
|
|
513
|
+
case h.InternalEventType.SET_STATE:
|
|
514
|
+
this.debug("handleChannelEvents: Setting state", { event: e }), this.state = e.payload.state;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
this.emitToListeners(e, { actor: n.actor });
|
|
518
|
+
}
|
|
519
|
+
debug(t, e) {
|
|
520
|
+
this.debugging && console.debug(
|
|
521
|
+
F`[UniversalStore::${this.id}::${this.environment ?? h.Environment.UNKNOWN}]
|
|
522
|
+
${t}`,
|
|
523
|
+
JSON.stringify(
|
|
524
|
+
{
|
|
525
|
+
data: e,
|
|
526
|
+
actor: this.actor,
|
|
527
|
+
state: this.state,
|
|
528
|
+
status: this.status
|
|
529
|
+
},
|
|
530
|
+
null,
|
|
531
|
+
2
|
|
532
|
+
)
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Used to reset the static fields of the UniversalStore class when cleaning up tests
|
|
537
|
+
*
|
|
538
|
+
* @internal
|
|
539
|
+
*/
|
|
540
|
+
static __reset() {
|
|
541
|
+
h.preparation.reject(new Error("reset")), h.setupPreparationPromise(), h.isInternalConstructing = !1;
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
a(h, "UniversalStore"), /**
|
|
545
|
+
* Defines the possible actor types in the store system
|
|
546
|
+
*
|
|
547
|
+
* @readonly
|
|
548
|
+
*/
|
|
549
|
+
h.ActorType = {
|
|
550
|
+
LEADER: "LEADER",
|
|
551
|
+
FOLLOWER: "FOLLOWER"
|
|
552
|
+
}, /**
|
|
553
|
+
* Defines the possible environments the store can run in
|
|
554
|
+
*
|
|
555
|
+
* @readonly
|
|
556
|
+
*/
|
|
557
|
+
h.Environment = {
|
|
558
|
+
SERVER: "SERVER",
|
|
559
|
+
MANAGER: "MANAGER",
|
|
560
|
+
PREVIEW: "PREVIEW",
|
|
561
|
+
UNKNOWN: "UNKNOWN",
|
|
562
|
+
MOCK: "MOCK"
|
|
563
|
+
}, /**
|
|
564
|
+
* Internal event types used for store synchronization
|
|
565
|
+
*
|
|
566
|
+
* @readonly
|
|
567
|
+
*/
|
|
568
|
+
h.InternalEventType = {
|
|
569
|
+
EXISTING_STATE_REQUEST: "__EXISTING_STATE_REQUEST",
|
|
570
|
+
EXISTING_STATE_RESPONSE: "__EXISTING_STATE_RESPONSE",
|
|
571
|
+
SET_STATE: "__SET_STATE",
|
|
572
|
+
LEADER_CREATED: "__LEADER_CREATED",
|
|
573
|
+
FOLLOWER_CREATED: "__FOLLOWER_CREATED"
|
|
574
|
+
}, h.Status = {
|
|
575
|
+
UNPREPARED: "UNPREPARED",
|
|
576
|
+
SYNCING: "SYNCING",
|
|
577
|
+
READY: "READY",
|
|
578
|
+
ERROR: "ERROR"
|
|
579
|
+
}, // This is used to check if constructor was called from the static factory create()
|
|
580
|
+
h.isInternalConstructing = !1, h.setupPreparationPromise();
|
|
581
|
+
var $ = h;
|
|
582
|
+
|
|
583
|
+
// src/channels/main.ts
|
|
584
|
+
var de = /* @__PURE__ */ a((r) => r.transports !== void 0, "isMulti"), ge = /* @__PURE__ */ a(() => Math.random().toString(16).slice(2), "ge\
|
|
585
|
+
nerateRandomId"), ht = class ht {
|
|
586
|
+
constructor(t = {}) {
|
|
587
|
+
this.sender = ge();
|
|
588
|
+
this.events = {};
|
|
589
|
+
this.data = {};
|
|
590
|
+
this.transports = [];
|
|
591
|
+
this.isAsync = t.async || !1, de(t) ? (this.transports = t.transports || [], this.transports.forEach((e) => {
|
|
592
|
+
e.setHandler((n) => this.handleEvent(n));
|
|
593
|
+
})) : this.transports = t.transport ? [t.transport] : [], this.transports.forEach((e) => {
|
|
594
|
+
e.setHandler((n) => this.handleEvent(n));
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
get hasTransport() {
|
|
598
|
+
return this.transports.length > 0;
|
|
599
|
+
}
|
|
600
|
+
addListener(t, e) {
|
|
601
|
+
this.events[t] = this.events[t] || [], this.events[t].push(e);
|
|
602
|
+
}
|
|
603
|
+
emit(t, ...e) {
|
|
604
|
+
let n = { type: t, args: e, from: this.sender }, o = {};
|
|
605
|
+
e.length >= 1 && e[0] && e[0].options && (o = e[0].options);
|
|
606
|
+
let s = /* @__PURE__ */ a(() => {
|
|
607
|
+
this.transports.forEach((l) => {
|
|
608
|
+
l.send(n, o);
|
|
609
|
+
}), this.handleEvent(n);
|
|
610
|
+
}, "handler");
|
|
611
|
+
this.isAsync ? setImmediate(s) : s();
|
|
612
|
+
}
|
|
613
|
+
last(t) {
|
|
614
|
+
return this.data[t];
|
|
615
|
+
}
|
|
616
|
+
eventNames() {
|
|
617
|
+
return Object.keys(this.events);
|
|
618
|
+
}
|
|
619
|
+
listenerCount(t) {
|
|
620
|
+
let e = this.listeners(t);
|
|
621
|
+
return e ? e.length : 0;
|
|
622
|
+
}
|
|
623
|
+
listeners(t) {
|
|
624
|
+
return this.events[t] || void 0;
|
|
625
|
+
}
|
|
626
|
+
once(t, e) {
|
|
627
|
+
let n = this.onceListener(t, e);
|
|
628
|
+
this.addListener(t, n);
|
|
629
|
+
}
|
|
630
|
+
removeAllListeners(t) {
|
|
631
|
+
t ? this.events[t] && delete this.events[t] : this.events = {};
|
|
632
|
+
}
|
|
633
|
+
removeListener(t, e) {
|
|
634
|
+
let n = this.listeners(t);
|
|
635
|
+
n && (this.events[t] = n.filter((o) => o !== e));
|
|
636
|
+
}
|
|
637
|
+
on(t, e) {
|
|
638
|
+
this.addListener(t, e);
|
|
639
|
+
}
|
|
640
|
+
off(t, e) {
|
|
641
|
+
this.removeListener(t, e);
|
|
642
|
+
}
|
|
643
|
+
handleEvent(t) {
|
|
644
|
+
let e = this.listeners(t.type);
|
|
645
|
+
e && e.length && e.forEach((n) => {
|
|
646
|
+
n.apply(t, t.args);
|
|
647
|
+
}), this.data[t.type] = t.args;
|
|
648
|
+
}
|
|
649
|
+
onceListener(t, e) {
|
|
650
|
+
let n = /* @__PURE__ */ a((...o) => (this.removeListener(t, n), e(...o)), "onceListener");
|
|
651
|
+
return n;
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
a(ht, "Channel");
|
|
655
|
+
var B = ht;
|
|
656
|
+
|
|
657
|
+
// src/channels/postmessage/index.ts
|
|
658
|
+
import { logger as Kt, pretty as Yt } from "storybook/internal/client-logger";
|
|
659
|
+
import * as so from "storybook/internal/core-events";
|
|
660
|
+
|
|
661
|
+
// ../node_modules/telejson/dist/chunk-465TF3XA.mjs
|
|
662
|
+
var ve = Object.create, Ot = Object.defineProperty, me = Object.getOwnPropertyDescriptor, Ct = Object.getOwnPropertyNames, Ee = Object.getPrototypeOf,
|
|
663
|
+
be = Object.prototype.hasOwnProperty, P = /* @__PURE__ */ a((r, t) => /* @__PURE__ */ a(function() {
|
|
664
|
+
return t || (0, r[Ct(r)[0]])((t = { exports: {} }).exports, t), t.exports;
|
|
665
|
+
}, "__require"), "__commonJS"), Se = /* @__PURE__ */ a((r, t, e, n) => {
|
|
666
|
+
if (t && typeof t == "object" || typeof t == "function")
|
|
667
|
+
for (let o of Ct(t))
|
|
668
|
+
!be.call(r, o) && o !== e && Ot(r, o, { get: /* @__PURE__ */ a(() => t[o], "get"), enumerable: !(n = me(t, o)) || n.enumerable });
|
|
669
|
+
return r;
|
|
670
|
+
}, "__copyProps"), ot = /* @__PURE__ */ a((r, t, e) => (e = r != null ? ve(Ee(r)) : {}, Se(
|
|
671
|
+
t || !r || !r.__esModule ? Ot(e, "default", { value: r, enumerable: !0 }) : e,
|
|
672
|
+
r
|
|
673
|
+
)), "__toESM"), _e = [
|
|
674
|
+
"bubbles",
|
|
675
|
+
"cancelBubble",
|
|
676
|
+
"cancelable",
|
|
677
|
+
"composed",
|
|
678
|
+
"currentTarget",
|
|
679
|
+
"defaultPrevented",
|
|
680
|
+
"eventPhase",
|
|
681
|
+
"isTrusted",
|
|
682
|
+
"returnValue",
|
|
683
|
+
"srcElement",
|
|
684
|
+
"target",
|
|
685
|
+
"timeStamp",
|
|
686
|
+
"type"
|
|
687
|
+
], Te = ["detail"];
|
|
688
|
+
function Pt(r) {
|
|
689
|
+
let t = _e.filter((e) => r[e] !== void 0).reduce((e, n) => ({ ...e, [n]: r[n] }), {});
|
|
690
|
+
return r instanceof CustomEvent && Te.filter((e) => r[e] !== void 0).forEach((e) => {
|
|
691
|
+
t[e] = r[e];
|
|
692
|
+
}), t;
|
|
693
|
+
}
|
|
694
|
+
a(Pt, "extractEventHiddenProperties");
|
|
695
|
+
|
|
696
|
+
// ../node_modules/telejson/dist/index.mjs
|
|
697
|
+
var Bt = he(xt(), 1);
|
|
698
|
+
var Ft = P({
|
|
699
|
+
"node_modules/has-symbols/shams.js"(r, t) {
|
|
700
|
+
"use strict";
|
|
701
|
+
t.exports = /* @__PURE__ */ a(function() {
|
|
702
|
+
if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
|
|
703
|
+
return !1;
|
|
704
|
+
if (typeof Symbol.iterator == "symbol")
|
|
705
|
+
return !0;
|
|
706
|
+
var n = {}, o = Symbol("test"), s = Object(o);
|
|
707
|
+
if (typeof o == "string" || Object.prototype.toString.call(o) !== "[object Symbol]" || Object.prototype.toString.call(s) !== "[object \
|
|
708
|
+
Symbol]")
|
|
709
|
+
return !1;
|
|
710
|
+
var l = 42;
|
|
711
|
+
n[o] = l;
|
|
712
|
+
for (o in n)
|
|
713
|
+
return !1;
|
|
714
|
+
if (typeof Object.keys == "function" && Object.keys(n).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(
|
|
715
|
+
n).length !== 0)
|
|
716
|
+
return !1;
|
|
717
|
+
var c = Object.getOwnPropertySymbols(n);
|
|
718
|
+
if (c.length !== 1 || c[0] !== o || !Object.prototype.propertyIsEnumerable.call(n, o))
|
|
719
|
+
return !1;
|
|
720
|
+
if (typeof Object.getOwnPropertyDescriptor == "function") {
|
|
721
|
+
var i = Object.getOwnPropertyDescriptor(n, o);
|
|
722
|
+
if (i.value !== l || i.enumerable !== !0)
|
|
723
|
+
return !1;
|
|
724
|
+
}
|
|
725
|
+
return !0;
|
|
726
|
+
}, "hasSymbols");
|
|
727
|
+
}
|
|
728
|
+
}), Mt = P({
|
|
729
|
+
"node_modules/has-symbols/index.js"(r, t) {
|
|
730
|
+
"use strict";
|
|
731
|
+
var e = typeof Symbol < "u" && Symbol, n = Ft();
|
|
732
|
+
t.exports = /* @__PURE__ */ a(function() {
|
|
733
|
+
return typeof e != "function" || typeof Symbol != "function" || typeof e("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 :
|
|
734
|
+
n();
|
|
735
|
+
}, "hasNativeSymbols");
|
|
736
|
+
}
|
|
737
|
+
}), Ae = P({
|
|
738
|
+
"node_modules/function-bind/implementation.js"(r, t) {
|
|
739
|
+
"use strict";
|
|
740
|
+
var e = "Function.prototype.bind called on incompatible ", n = Array.prototype.slice, o = Object.prototype.toString, s = "[object Functi\
|
|
741
|
+
on]";
|
|
742
|
+
t.exports = /* @__PURE__ */ a(function(c) {
|
|
743
|
+
var i = this;
|
|
744
|
+
if (typeof i != "function" || o.call(i) !== s)
|
|
745
|
+
throw new TypeError(e + i);
|
|
746
|
+
for (var g = n.call(arguments, 1), p, u = /* @__PURE__ */ a(function() {
|
|
747
|
+
if (this instanceof p) {
|
|
748
|
+
var E = i.apply(
|
|
749
|
+
this,
|
|
750
|
+
g.concat(n.call(arguments))
|
|
751
|
+
);
|
|
752
|
+
return Object(E) === E ? E : this;
|
|
753
|
+
} else
|
|
754
|
+
return i.apply(
|
|
755
|
+
c,
|
|
756
|
+
g.concat(n.call(arguments))
|
|
757
|
+
);
|
|
758
|
+
}, "binder"), y = Math.max(0, i.length - g.length), v = [], d = 0; d < y; d++)
|
|
759
|
+
v.push("$" + d);
|
|
760
|
+
if (p = Function("binder", "return function (" + v.join(",") + "){ return binder.apply(this,arguments); }")(u), i.prototype) {
|
|
761
|
+
var m = /* @__PURE__ */ a(function() {
|
|
762
|
+
}, "Empty2");
|
|
763
|
+
m.prototype = i.prototype, p.prototype = new m(), m.prototype = null;
|
|
764
|
+
}
|
|
765
|
+
return p;
|
|
766
|
+
}, "bind");
|
|
767
|
+
}
|
|
768
|
+
}), gt = P({
|
|
769
|
+
"node_modules/function-bind/index.js"(r, t) {
|
|
770
|
+
"use strict";
|
|
771
|
+
var e = Ae();
|
|
772
|
+
t.exports = Function.prototype.bind || e;
|
|
773
|
+
}
|
|
774
|
+
}), we = P({
|
|
775
|
+
"node_modules/has/src/index.js"(r, t) {
|
|
776
|
+
"use strict";
|
|
777
|
+
var e = gt();
|
|
778
|
+
t.exports = e.call(Function.call, Object.prototype.hasOwnProperty);
|
|
779
|
+
}
|
|
780
|
+
}), $t = P({
|
|
781
|
+
"node_modules/get-intrinsic/index.js"(r, t) {
|
|
782
|
+
"use strict";
|
|
783
|
+
var e, n = SyntaxError, o = Function, s = TypeError, l = /* @__PURE__ */ a(function(j) {
|
|
784
|
+
try {
|
|
785
|
+
return o('"use strict"; return (' + j + ").constructor;")();
|
|
786
|
+
} catch {
|
|
787
|
+
}
|
|
788
|
+
}, "getEvalledConstructor"), c = Object.getOwnPropertyDescriptor;
|
|
789
|
+
if (c)
|
|
790
|
+
try {
|
|
791
|
+
c({}, "");
|
|
792
|
+
} catch {
|
|
793
|
+
c = null;
|
|
794
|
+
}
|
|
795
|
+
var i = /* @__PURE__ */ a(function() {
|
|
796
|
+
throw new s();
|
|
797
|
+
}, "throwTypeError"), g = c ? function() {
|
|
798
|
+
try {
|
|
799
|
+
return arguments.callee, i;
|
|
800
|
+
} catch {
|
|
801
|
+
try {
|
|
802
|
+
return c(arguments, "callee").get;
|
|
803
|
+
} catch {
|
|
804
|
+
return i;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}() : i, p = Mt()(), u = Object.getPrototypeOf || function(j) {
|
|
808
|
+
return j.__proto__;
|
|
809
|
+
}, y = {}, v = typeof Uint8Array > "u" ? e : u(Uint8Array), d = {
|
|
810
|
+
"%AggregateError%": typeof AggregateError > "u" ? e : AggregateError,
|
|
811
|
+
"%Array%": Array,
|
|
812
|
+
"%ArrayBuffer%": typeof ArrayBuffer > "u" ? e : ArrayBuffer,
|
|
813
|
+
"%ArrayIteratorPrototype%": p ? u([][Symbol.iterator]()) : e,
|
|
814
|
+
"%AsyncFromSyncIteratorPrototype%": e,
|
|
815
|
+
"%AsyncFunction%": y,
|
|
816
|
+
"%AsyncGenerator%": y,
|
|
817
|
+
"%AsyncGeneratorFunction%": y,
|
|
818
|
+
"%AsyncIteratorPrototype%": y,
|
|
819
|
+
"%Atomics%": typeof Atomics > "u" ? e : Atomics,
|
|
820
|
+
"%BigInt%": typeof BigInt > "u" ? e : BigInt,
|
|
821
|
+
"%Boolean%": Boolean,
|
|
822
|
+
"%DataView%": typeof DataView > "u" ? e : DataView,
|
|
823
|
+
"%Date%": Date,
|
|
824
|
+
"%decodeURI%": decodeURI,
|
|
825
|
+
"%decodeURIComponent%": decodeURIComponent,
|
|
826
|
+
"%encodeURI%": encodeURI,
|
|
827
|
+
"%encodeURIComponent%": encodeURIComponent,
|
|
828
|
+
"%Error%": Error,
|
|
829
|
+
"%eval%": eval,
|
|
830
|
+
"%EvalError%": EvalError,
|
|
831
|
+
"%Float32Array%": typeof Float32Array > "u" ? e : Float32Array,
|
|
832
|
+
"%Float64Array%": typeof Float64Array > "u" ? e : Float64Array,
|
|
833
|
+
"%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? e : FinalizationRegistry,
|
|
834
|
+
"%Function%": o,
|
|
835
|
+
"%GeneratorFunction%": y,
|
|
836
|
+
"%Int8Array%": typeof Int8Array > "u" ? e : Int8Array,
|
|
837
|
+
"%Int16Array%": typeof Int16Array > "u" ? e : Int16Array,
|
|
838
|
+
"%Int32Array%": typeof Int32Array > "u" ? e : Int32Array,
|
|
839
|
+
"%isFinite%": isFinite,
|
|
840
|
+
"%isNaN%": isNaN,
|
|
841
|
+
"%IteratorPrototype%": p ? u(u([][Symbol.iterator]())) : e,
|
|
842
|
+
"%JSON%": typeof JSON == "object" ? JSON : e,
|
|
843
|
+
"%Map%": typeof Map > "u" ? e : Map,
|
|
844
|
+
"%MapIteratorPrototype%": typeof Map > "u" || !p ? e : u((/* @__PURE__ */ new Map())[Symbol.iterator]()),
|
|
845
|
+
"%Math%": Math,
|
|
846
|
+
"%Number%": Number,
|
|
847
|
+
"%Object%": Object,
|
|
848
|
+
"%parseFloat%": parseFloat,
|
|
849
|
+
"%parseInt%": parseInt,
|
|
850
|
+
"%Promise%": typeof Promise > "u" ? e : Promise,
|
|
851
|
+
"%Proxy%": typeof Proxy > "u" ? e : Proxy,
|
|
852
|
+
"%RangeError%": RangeError,
|
|
853
|
+
"%ReferenceError%": ReferenceError,
|
|
854
|
+
"%Reflect%": typeof Reflect > "u" ? e : Reflect,
|
|
855
|
+
"%RegExp%": RegExp,
|
|
856
|
+
"%Set%": typeof Set > "u" ? e : Set,
|
|
857
|
+
"%SetIteratorPrototype%": typeof Set > "u" || !p ? e : u((/* @__PURE__ */ new Set())[Symbol.iterator]()),
|
|
858
|
+
"%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? e : SharedArrayBuffer,
|
|
859
|
+
"%String%": String,
|
|
860
|
+
"%StringIteratorPrototype%": p ? u(""[Symbol.iterator]()) : e,
|
|
861
|
+
"%Symbol%": p ? Symbol : e,
|
|
862
|
+
"%SyntaxError%": n,
|
|
863
|
+
"%ThrowTypeError%": g,
|
|
864
|
+
"%TypedArray%": v,
|
|
865
|
+
"%TypeError%": s,
|
|
866
|
+
"%Uint8Array%": typeof Uint8Array > "u" ? e : Uint8Array,
|
|
867
|
+
"%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? e : Uint8ClampedArray,
|
|
868
|
+
"%Uint16Array%": typeof Uint16Array > "u" ? e : Uint16Array,
|
|
869
|
+
"%Uint32Array%": typeof Uint32Array > "u" ? e : Uint32Array,
|
|
870
|
+
"%URIError%": URIError,
|
|
871
|
+
"%WeakMap%": typeof WeakMap > "u" ? e : WeakMap,
|
|
872
|
+
"%WeakRef%": typeof WeakRef > "u" ? e : WeakRef,
|
|
873
|
+
"%WeakSet%": typeof WeakSet > "u" ? e : WeakSet
|
|
874
|
+
}, m = /* @__PURE__ */ a(function j(b) {
|
|
875
|
+
var A;
|
|
876
|
+
if (b === "%AsyncFunction%")
|
|
877
|
+
A = l("async function () {}");
|
|
878
|
+
else if (b === "%GeneratorFunction%")
|
|
879
|
+
A = l("function* () {}");
|
|
880
|
+
else if (b === "%AsyncGeneratorFunction%")
|
|
881
|
+
A = l("async function* () {}");
|
|
882
|
+
else if (b === "%AsyncGenerator%") {
|
|
883
|
+
var _ = j("%AsyncGeneratorFunction%");
|
|
884
|
+
_ && (A = _.prototype);
|
|
885
|
+
} else if (b === "%AsyncIteratorPrototype%") {
|
|
886
|
+
var w = j("%AsyncGenerator%");
|
|
887
|
+
w && (A = u(w.prototype));
|
|
888
|
+
}
|
|
889
|
+
return d[b] = A, A;
|
|
890
|
+
}, "doEval2"), E = {
|
|
891
|
+
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
|
|
892
|
+
"%ArrayPrototype%": ["Array", "prototype"],
|
|
893
|
+
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
|
|
894
|
+
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
|
|
895
|
+
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
|
|
896
|
+
"%ArrayProto_values%": ["Array", "prototype", "values"],
|
|
897
|
+
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
|
|
898
|
+
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
|
|
899
|
+
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
|
|
900
|
+
"%BooleanPrototype%": ["Boolean", "prototype"],
|
|
901
|
+
"%DataViewPrototype%": ["DataView", "prototype"],
|
|
902
|
+
"%DatePrototype%": ["Date", "prototype"],
|
|
903
|
+
"%ErrorPrototype%": ["Error", "prototype"],
|
|
904
|
+
"%EvalErrorPrototype%": ["EvalError", "prototype"],
|
|
905
|
+
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
|
|
906
|
+
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
|
|
907
|
+
"%FunctionPrototype%": ["Function", "prototype"],
|
|
908
|
+
"%Generator%": ["GeneratorFunction", "prototype"],
|
|
909
|
+
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
|
|
910
|
+
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
|
|
911
|
+
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
|
|
912
|
+
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
|
|
913
|
+
"%JSONParse%": ["JSON", "parse"],
|
|
914
|
+
"%JSONStringify%": ["JSON", "stringify"],
|
|
915
|
+
"%MapPrototype%": ["Map", "prototype"],
|
|
916
|
+
"%NumberPrototype%": ["Number", "prototype"],
|
|
917
|
+
"%ObjectPrototype%": ["Object", "prototype"],
|
|
918
|
+
"%ObjProto_toString%": ["Object", "prototype", "toString"],
|
|
919
|
+
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
|
|
920
|
+
"%PromisePrototype%": ["Promise", "prototype"],
|
|
921
|
+
"%PromiseProto_then%": ["Promise", "prototype", "then"],
|
|
922
|
+
"%Promise_all%": ["Promise", "all"],
|
|
923
|
+
"%Promise_reject%": ["Promise", "reject"],
|
|
924
|
+
"%Promise_resolve%": ["Promise", "resolve"],
|
|
925
|
+
"%RangeErrorPrototype%": ["RangeError", "prototype"],
|
|
926
|
+
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
|
|
927
|
+
"%RegExpPrototype%": ["RegExp", "prototype"],
|
|
928
|
+
"%SetPrototype%": ["Set", "prototype"],
|
|
929
|
+
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
|
|
930
|
+
"%StringPrototype%": ["String", "prototype"],
|
|
931
|
+
"%SymbolPrototype%": ["Symbol", "prototype"],
|
|
932
|
+
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
|
|
933
|
+
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
|
|
934
|
+
"%TypeErrorPrototype%": ["TypeError", "prototype"],
|
|
935
|
+
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
|
|
936
|
+
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
|
|
937
|
+
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
|
|
938
|
+
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
|
|
939
|
+
"%URIErrorPrototype%": ["URIError", "prototype"],
|
|
940
|
+
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
941
|
+
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
942
|
+
}, I = gt(), T = we(), R = I.call(Function.call, Array.prototype.concat), C = I.call(Function.apply, Array.prototype.splice), N = I.call(
|
|
943
|
+
Function.call, String.prototype.replace), Q = I.call(Function.call, String.prototype.slice), ee = I.call(Function.call, RegExp.prototype.
|
|
944
|
+
exec), re = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, ne = /\\(\\)?/g, oe = /* @__PURE__ */ a(
|
|
945
|
+
function(b) {
|
|
946
|
+
var A = Q(b, 0, 1), _ = Q(b, -1);
|
|
947
|
+
if (A === "%" && _ !== "%")
|
|
948
|
+
throw new n("invalid intrinsic syntax, expected closing `%`");
|
|
949
|
+
if (_ === "%" && A !== "%")
|
|
950
|
+
throw new n("invalid intrinsic syntax, expected opening `%`");
|
|
951
|
+
var w = [];
|
|
952
|
+
return N(b, re, function(L, M, O, Z) {
|
|
953
|
+
w[w.length] = O ? N(Z, ne, "$1") : M || L;
|
|
954
|
+
}), w;
|
|
955
|
+
}, "stringToPath3"), ie = /* @__PURE__ */ a(function(b, A) {
|
|
956
|
+
var _ = b, w;
|
|
957
|
+
if (T(E, _) && (w = E[_], _ = "%" + w[0] + "%"), T(d, _)) {
|
|
958
|
+
var L = d[_];
|
|
959
|
+
if (L === y && (L = m(_)), typeof L > "u" && !A)
|
|
960
|
+
throw new s("intrinsic " + b + " exists, but is not available. Please file an issue!");
|
|
961
|
+
return {
|
|
962
|
+
alias: w,
|
|
963
|
+
name: _,
|
|
964
|
+
value: L
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
throw new n("intrinsic " + b + " does not exist!");
|
|
968
|
+
}, "getBaseIntrinsic2");
|
|
969
|
+
t.exports = /* @__PURE__ */ a(function(b, A) {
|
|
970
|
+
if (typeof b != "string" || b.length === 0)
|
|
971
|
+
throw new s("intrinsic name must be a non-empty string");
|
|
972
|
+
if (arguments.length > 1 && typeof A != "boolean")
|
|
973
|
+
throw new s('"allowMissing" argument must be a boolean');
|
|
974
|
+
if (ee(/^%?[^%]*%?$/, b) === null)
|
|
975
|
+
throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
|
|
976
|
+
var _ = oe(b), w = _.length > 0 ? _[0] : "", L = ie("%" + w + "%", A), M = L.name, O = L.value, Z = !1, pt = L.alias;
|
|
977
|
+
pt && (w = pt[0], C(_, R([0, 1], pt)));
|
|
978
|
+
for (var tt = 1, z = !0; tt < _.length; tt += 1) {
|
|
979
|
+
var D = _[tt], et = Q(D, 0, 1), rt = Q(D, -1);
|
|
980
|
+
if ((et === '"' || et === "'" || et === "`" || rt === '"' || rt === "'" || rt === "`") && et !== rt)
|
|
981
|
+
throw new n("property names with quotes must have matching quotes");
|
|
982
|
+
if ((D === "constructor" || !z) && (Z = !0), w += "." + D, M = "%" + w + "%", T(d, M))
|
|
983
|
+
O = d[M];
|
|
984
|
+
else if (O != null) {
|
|
985
|
+
if (!(D in O)) {
|
|
986
|
+
if (!A)
|
|
987
|
+
throw new s("base intrinsic for " + b + " exists, but the property is not available.");
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
if (c && tt + 1 >= _.length) {
|
|
991
|
+
var nt = c(O, D);
|
|
992
|
+
z = !!nt, z && "get" in nt && !("originalValue" in nt.get) ? O = nt.get : O = O[D];
|
|
993
|
+
} else
|
|
994
|
+
z = T(O, D), O = O[D];
|
|
995
|
+
z && !Z && (d[M] = O);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return O;
|
|
999
|
+
}, "GetIntrinsic");
|
|
1000
|
+
}
|
|
1001
|
+
}), Oe = P({
|
|
1002
|
+
"node_modules/call-bind/index.js"(r, t) {
|
|
1003
|
+
"use strict";
|
|
1004
|
+
var e = gt(), n = $t(), o = n("%Function.prototype.apply%"), s = n("%Function.prototype.call%"), l = n("%Reflect.apply%", !0) || e.call(
|
|
1005
|
+
s, o), c = n("%Object.getOwnPropertyDescriptor%", !0), i = n("%Object.defineProperty%", !0), g = n("%Math.max%");
|
|
1006
|
+
if (i)
|
|
1007
|
+
try {
|
|
1008
|
+
i({}, "a", { value: 1 });
|
|
1009
|
+
} catch {
|
|
1010
|
+
i = null;
|
|
1011
|
+
}
|
|
1012
|
+
t.exports = /* @__PURE__ */ a(function(y) {
|
|
1013
|
+
var v = l(e, s, arguments);
|
|
1014
|
+
if (c && i) {
|
|
1015
|
+
var d = c(v, "length");
|
|
1016
|
+
d.configurable && i(
|
|
1017
|
+
v,
|
|
1018
|
+
"length",
|
|
1019
|
+
{ value: 1 + g(0, y.length - (arguments.length - 1)) }
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
return v;
|
|
1023
|
+
}, "callBind");
|
|
1024
|
+
var p = /* @__PURE__ */ a(function() {
|
|
1025
|
+
return l(e, o, arguments);
|
|
1026
|
+
}, "applyBind2");
|
|
1027
|
+
i ? i(t.exports, "apply", { value: p }) : t.exports.apply = p;
|
|
1028
|
+
}
|
|
1029
|
+
}), Ce = P({
|
|
1030
|
+
"node_modules/call-bind/callBound.js"(r, t) {
|
|
1031
|
+
"use strict";
|
|
1032
|
+
var e = $t(), n = Oe(), o = n(e("String.prototype.indexOf"));
|
|
1033
|
+
t.exports = /* @__PURE__ */ a(function(l, c) {
|
|
1034
|
+
var i = e(l, !!c);
|
|
1035
|
+
return typeof i == "function" && o(l, ".prototype.") > -1 ? n(i) : i;
|
|
1036
|
+
}, "callBoundIntrinsic");
|
|
1037
|
+
}
|
|
1038
|
+
}), Pe = P({
|
|
1039
|
+
"node_modules/has-tostringtag/shams.js"(r, t) {
|
|
1040
|
+
"use strict";
|
|
1041
|
+
var e = Ft();
|
|
1042
|
+
t.exports = /* @__PURE__ */ a(function() {
|
|
1043
|
+
return e() && !!Symbol.toStringTag;
|
|
1044
|
+
}, "hasToStringTagShams");
|
|
1045
|
+
}
|
|
1046
|
+
}), Ie = P({
|
|
1047
|
+
"node_modules/is-regex/index.js"(r, t) {
|
|
1048
|
+
"use strict";
|
|
1049
|
+
var e = Ce(), n = Pe()(), o, s, l, c;
|
|
1050
|
+
n && (o = e("Object.prototype.hasOwnProperty"), s = e("RegExp.prototype.exec"), l = {}, i = /* @__PURE__ */ a(function() {
|
|
1051
|
+
throw l;
|
|
1052
|
+
}, "throwRegexMarker"), c = {
|
|
1053
|
+
toString: i,
|
|
1054
|
+
valueOf: i
|
|
1055
|
+
}, typeof Symbol.toPrimitive == "symbol" && (c[Symbol.toPrimitive] = i));
|
|
1056
|
+
var i, g = e("Object.prototype.toString"), p = Object.getOwnPropertyDescriptor, u = "[object RegExp]";
|
|
1057
|
+
t.exports = /* @__PURE__ */ a(n ? function(v) {
|
|
1058
|
+
if (!v || typeof v != "object")
|
|
1059
|
+
return !1;
|
|
1060
|
+
var d = p(v, "lastIndex"), m = d && o(d, "value");
|
|
1061
|
+
if (!m)
|
|
1062
|
+
return !1;
|
|
1063
|
+
try {
|
|
1064
|
+
s(v, c);
|
|
1065
|
+
} catch (E) {
|
|
1066
|
+
return E === l;
|
|
1067
|
+
}
|
|
1068
|
+
} : function(v) {
|
|
1069
|
+
return !v || typeof v != "object" && typeof v != "function" ? !1 : g(v) === u;
|
|
1070
|
+
}, "isRegex");
|
|
1071
|
+
}
|
|
1072
|
+
}), xe = P({
|
|
1073
|
+
"node_modules/is-function/index.js"(r, t) {
|
|
1074
|
+
t.exports = n;
|
|
1075
|
+
var e = Object.prototype.toString;
|
|
1076
|
+
function n(o) {
|
|
1077
|
+
if (!o)
|
|
1078
|
+
return !1;
|
|
1079
|
+
var s = e.call(o);
|
|
1080
|
+
return s === "[object Function]" || typeof o == "function" && s !== "[object RegExp]" || typeof window < "u" && (o === window.setTimeout ||
|
|
1081
|
+
o === window.alert || o === window.confirm || o === window.prompt);
|
|
1082
|
+
}
|
|
1083
|
+
a(n, "isFunction3");
|
|
1084
|
+
}
|
|
1085
|
+
}), Re = P({
|
|
1086
|
+
"node_modules/is-symbol/index.js"(r, t) {
|
|
1087
|
+
"use strict";
|
|
1088
|
+
var e = Object.prototype.toString, n = Mt()();
|
|
1089
|
+
n ? (o = Symbol.prototype.toString, s = /^Symbol\(.*\)$/, l = /* @__PURE__ */ a(function(i) {
|
|
1090
|
+
return typeof i.valueOf() != "symbol" ? !1 : s.test(o.call(i));
|
|
1091
|
+
}, "isRealSymbolObject"), t.exports = /* @__PURE__ */ a(function(i) {
|
|
1092
|
+
if (typeof i == "symbol")
|
|
1093
|
+
return !0;
|
|
1094
|
+
if (e.call(i) !== "[object Symbol]")
|
|
1095
|
+
return !1;
|
|
1096
|
+
try {
|
|
1097
|
+
return l(i);
|
|
1098
|
+
} catch {
|
|
1099
|
+
return !1;
|
|
1100
|
+
}
|
|
1101
|
+
}, "isSymbol3")) : t.exports = /* @__PURE__ */ a(function(i) {
|
|
1102
|
+
return !1;
|
|
1103
|
+
}, "isSymbol3");
|
|
1104
|
+
var o, s, l;
|
|
1105
|
+
}
|
|
1106
|
+
}), Ne = ot(Ie()), je = ot(xe()), Le = ot(Re());
|
|
1107
|
+
function De(r) {
|
|
1108
|
+
return r != null && typeof r == "object" && Array.isArray(r) === !1;
|
|
1109
|
+
}
|
|
1110
|
+
a(De, "isObject");
|
|
1111
|
+
var Fe = typeof global == "object" && global && global.Object === Object && global, Me = Fe, $e = typeof self == "object" && self && self.Object ===
|
|
1112
|
+
Object && self, Ue = Me || $e || Function("return this")(), vt = Ue, ke = vt.Symbol, U = ke, Ut = Object.prototype, Ge = Ut.hasOwnProperty, We = Ut.
|
|
1113
|
+
toString, q = U ? U.toStringTag : void 0;
|
|
1114
|
+
function ze(r) {
|
|
1115
|
+
var t = Ge.call(r, q), e = r[q];
|
|
1116
|
+
try {
|
|
1117
|
+
r[q] = void 0;
|
|
1118
|
+
var n = !0;
|
|
1119
|
+
} catch {
|
|
1120
|
+
}
|
|
1121
|
+
var o = We.call(r);
|
|
1122
|
+
return n && (t ? r[q] = e : delete r[q]), o;
|
|
1123
|
+
}
|
|
1124
|
+
a(ze, "getRawTag");
|
|
1125
|
+
var He = ze, Be = Object.prototype, qe = Be.toString;
|
|
1126
|
+
function Ve(r) {
|
|
1127
|
+
return qe.call(r);
|
|
1128
|
+
}
|
|
1129
|
+
a(Ve, "objectToString");
|
|
1130
|
+
var Je = Ve, Ke = "[object Null]", Ye = "[object Undefined]", Rt = U ? U.toStringTag : void 0;
|
|
1131
|
+
function Xe(r) {
|
|
1132
|
+
return r == null ? r === void 0 ? Ye : Ke : Rt && Rt in Object(r) ? He(r) : Je(r);
|
|
1133
|
+
}
|
|
1134
|
+
a(Xe, "baseGetTag");
|
|
1135
|
+
var kt = Xe;
|
|
1136
|
+
function Qe(r) {
|
|
1137
|
+
return r != null && typeof r == "object";
|
|
1138
|
+
}
|
|
1139
|
+
a(Qe, "isObjectLike");
|
|
1140
|
+
var Ze = Qe, tr = "[object Symbol]";
|
|
1141
|
+
function er(r) {
|
|
1142
|
+
return typeof r == "symbol" || Ze(r) && kt(r) == tr;
|
|
1143
|
+
}
|
|
1144
|
+
a(er, "isSymbol");
|
|
1145
|
+
var mt = er;
|
|
1146
|
+
function rr(r, t) {
|
|
1147
|
+
for (var e = -1, n = r == null ? 0 : r.length, o = Array(n); ++e < n; )
|
|
1148
|
+
o[e] = t(r[e], e, r);
|
|
1149
|
+
return o;
|
|
1150
|
+
}
|
|
1151
|
+
a(rr, "arrayMap");
|
|
1152
|
+
var nr = rr, or = Array.isArray, Et = or, ir = 1 / 0, Nt = U ? U.prototype : void 0, jt = Nt ? Nt.toString : void 0;
|
|
1153
|
+
function Gt(r) {
|
|
1154
|
+
if (typeof r == "string")
|
|
1155
|
+
return r;
|
|
1156
|
+
if (Et(r))
|
|
1157
|
+
return nr(r, Gt) + "";
|
|
1158
|
+
if (mt(r))
|
|
1159
|
+
return jt ? jt.call(r) : "";
|
|
1160
|
+
var t = r + "";
|
|
1161
|
+
return t == "0" && 1 / r == -ir ? "-0" : t;
|
|
1162
|
+
}
|
|
1163
|
+
a(Gt, "baseToString");
|
|
1164
|
+
var ar = Gt;
|
|
1165
|
+
function sr(r) {
|
|
1166
|
+
var t = typeof r;
|
|
1167
|
+
return r != null && (t == "object" || t == "function");
|
|
1168
|
+
}
|
|
1169
|
+
a(sr, "isObject2");
|
|
1170
|
+
var Wt = sr, lr = "[object AsyncFunction]", cr = "[object Function]", pr = "[object GeneratorFunction]", ur = "[object Proxy]";
|
|
1171
|
+
function fr(r) {
|
|
1172
|
+
if (!Wt(r))
|
|
1173
|
+
return !1;
|
|
1174
|
+
var t = kt(r);
|
|
1175
|
+
return t == cr || t == pr || t == lr || t == ur;
|
|
1176
|
+
}
|
|
1177
|
+
a(fr, "isFunction");
|
|
1178
|
+
var hr = fr, yr = vt["__core-js_shared__"], dt = yr, Lt = function() {
|
|
1179
|
+
var r = /[^.]+$/.exec(dt && dt.keys && dt.keys.IE_PROTO || "");
|
|
1180
|
+
return r ? "Symbol(src)_1." + r : "";
|
|
1181
|
+
}();
|
|
1182
|
+
function dr(r) {
|
|
1183
|
+
return !!Lt && Lt in r;
|
|
1184
|
+
}
|
|
1185
|
+
a(dr, "isMasked");
|
|
1186
|
+
var gr = dr, vr = Function.prototype, mr = vr.toString;
|
|
1187
|
+
function Er(r) {
|
|
1188
|
+
if (r != null) {
|
|
1189
|
+
try {
|
|
1190
|
+
return mr.call(r);
|
|
1191
|
+
} catch {
|
|
1192
|
+
}
|
|
1193
|
+
try {
|
|
1194
|
+
return r + "";
|
|
1195
|
+
} catch {
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
return "";
|
|
1199
|
+
}
|
|
1200
|
+
a(Er, "toSource");
|
|
1201
|
+
var br = Er, Sr = /[\\^$.*+?()[\]{}|]/g, _r = /^\[object .+?Constructor\]$/, Tr = Function.prototype, Ar = Object.prototype, wr = Tr.toString,
|
|
1202
|
+
Or = Ar.hasOwnProperty, Cr = RegExp(
|
|
1203
|
+
"^" + wr.call(Or).replace(Sr, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1204
|
+
);
|
|
1205
|
+
function Pr(r) {
|
|
1206
|
+
if (!Wt(r) || gr(r))
|
|
1207
|
+
return !1;
|
|
1208
|
+
var t = hr(r) ? Cr : _r;
|
|
1209
|
+
return t.test(br(r));
|
|
1210
|
+
}
|
|
1211
|
+
a(Pr, "baseIsNative");
|
|
1212
|
+
var Ir = Pr;
|
|
1213
|
+
function xr(r, t) {
|
|
1214
|
+
return r?.[t];
|
|
1215
|
+
}
|
|
1216
|
+
a(xr, "getValue");
|
|
1217
|
+
var Rr = xr;
|
|
1218
|
+
function Nr(r, t) {
|
|
1219
|
+
var e = Rr(r, t);
|
|
1220
|
+
return Ir(e) ? e : void 0;
|
|
1221
|
+
}
|
|
1222
|
+
a(Nr, "getNative");
|
|
1223
|
+
var zt = Nr;
|
|
1224
|
+
function jr(r, t) {
|
|
1225
|
+
return r === t || r !== r && t !== t;
|
|
1226
|
+
}
|
|
1227
|
+
a(jr, "eq");
|
|
1228
|
+
var Lr = jr, Dr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Fr = /^\w*$/;
|
|
1229
|
+
function Mr(r, t) {
|
|
1230
|
+
if (Et(r))
|
|
1231
|
+
return !1;
|
|
1232
|
+
var e = typeof r;
|
|
1233
|
+
return e == "number" || e == "symbol" || e == "boolean" || r == null || mt(r) ? !0 : Fr.test(r) || !Dr.test(r) || t != null && r in Object(
|
|
1234
|
+
t);
|
|
1235
|
+
}
|
|
1236
|
+
a(Mr, "isKey");
|
|
1237
|
+
var $r = Mr, Ur = zt(Object, "create"), V = Ur;
|
|
1238
|
+
function kr() {
|
|
1239
|
+
this.__data__ = V ? V(null) : {}, this.size = 0;
|
|
1240
|
+
}
|
|
1241
|
+
a(kr, "hashClear");
|
|
1242
|
+
var Gr = kr;
|
|
1243
|
+
function Wr(r) {
|
|
1244
|
+
var t = this.has(r) && delete this.__data__[r];
|
|
1245
|
+
return this.size -= t ? 1 : 0, t;
|
|
1246
|
+
}
|
|
1247
|
+
a(Wr, "hashDelete");
|
|
1248
|
+
var zr = Wr, Hr = "__lodash_hash_undefined__", Br = Object.prototype, qr = Br.hasOwnProperty;
|
|
1249
|
+
function Vr(r) {
|
|
1250
|
+
var t = this.__data__;
|
|
1251
|
+
if (V) {
|
|
1252
|
+
var e = t[r];
|
|
1253
|
+
return e === Hr ? void 0 : e;
|
|
1254
|
+
}
|
|
1255
|
+
return qr.call(t, r) ? t[r] : void 0;
|
|
1256
|
+
}
|
|
1257
|
+
a(Vr, "hashGet");
|
|
1258
|
+
var Jr = Vr, Kr = Object.prototype, Yr = Kr.hasOwnProperty;
|
|
1259
|
+
function Xr(r) {
|
|
1260
|
+
var t = this.__data__;
|
|
1261
|
+
return V ? t[r] !== void 0 : Yr.call(t, r);
|
|
1262
|
+
}
|
|
1263
|
+
a(Xr, "hashHas");
|
|
1264
|
+
var Qr = Xr, Zr = "__lodash_hash_undefined__";
|
|
1265
|
+
function tn(r, t) {
|
|
1266
|
+
var e = this.__data__;
|
|
1267
|
+
return this.size += this.has(r) ? 0 : 1, e[r] = V && t === void 0 ? Zr : t, this;
|
|
1268
|
+
}
|
|
1269
|
+
a(tn, "hashSet");
|
|
1270
|
+
var en = tn;
|
|
1271
|
+
function k(r) {
|
|
1272
|
+
var t = -1, e = r == null ? 0 : r.length;
|
|
1273
|
+
for (this.clear(); ++t < e; ) {
|
|
1274
|
+
var n = r[t];
|
|
1275
|
+
this.set(n[0], n[1]);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
a(k, "Hash");
|
|
1279
|
+
k.prototype.clear = Gr;
|
|
1280
|
+
k.prototype.delete = zr;
|
|
1281
|
+
k.prototype.get = Jr;
|
|
1282
|
+
k.prototype.has = Qr;
|
|
1283
|
+
k.prototype.set = en;
|
|
1284
|
+
var Dt = k;
|
|
1285
|
+
function rn() {
|
|
1286
|
+
this.__data__ = [], this.size = 0;
|
|
1287
|
+
}
|
|
1288
|
+
a(rn, "listCacheClear");
|
|
1289
|
+
var nn = rn;
|
|
1290
|
+
function on(r, t) {
|
|
1291
|
+
for (var e = r.length; e--; )
|
|
1292
|
+
if (Lr(r[e][0], t))
|
|
1293
|
+
return e;
|
|
1294
|
+
return -1;
|
|
1295
|
+
}
|
|
1296
|
+
a(on, "assocIndexOf");
|
|
1297
|
+
var at = on, an = Array.prototype, sn = an.splice;
|
|
1298
|
+
function ln(r) {
|
|
1299
|
+
var t = this.__data__, e = at(t, r);
|
|
1300
|
+
if (e < 0)
|
|
1301
|
+
return !1;
|
|
1302
|
+
var n = t.length - 1;
|
|
1303
|
+
return e == n ? t.pop() : sn.call(t, e, 1), --this.size, !0;
|
|
1304
|
+
}
|
|
1305
|
+
a(ln, "listCacheDelete");
|
|
1306
|
+
var cn = ln;
|
|
1307
|
+
function pn(r) {
|
|
1308
|
+
var t = this.__data__, e = at(t, r);
|
|
1309
|
+
return e < 0 ? void 0 : t[e][1];
|
|
1310
|
+
}
|
|
1311
|
+
a(pn, "listCacheGet");
|
|
1312
|
+
var un = pn;
|
|
1313
|
+
function fn(r) {
|
|
1314
|
+
return at(this.__data__, r) > -1;
|
|
1315
|
+
}
|
|
1316
|
+
a(fn, "listCacheHas");
|
|
1317
|
+
var hn = fn;
|
|
1318
|
+
function yn(r, t) {
|
|
1319
|
+
var e = this.__data__, n = at(e, r);
|
|
1320
|
+
return n < 0 ? (++this.size, e.push([r, t])) : e[n][1] = t, this;
|
|
1321
|
+
}
|
|
1322
|
+
a(yn, "listCacheSet");
|
|
1323
|
+
var dn = yn;
|
|
1324
|
+
function G(r) {
|
|
1325
|
+
var t = -1, e = r == null ? 0 : r.length;
|
|
1326
|
+
for (this.clear(); ++t < e; ) {
|
|
1327
|
+
var n = r[t];
|
|
1328
|
+
this.set(n[0], n[1]);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
a(G, "ListCache");
|
|
1332
|
+
G.prototype.clear = nn;
|
|
1333
|
+
G.prototype.delete = cn;
|
|
1334
|
+
G.prototype.get = un;
|
|
1335
|
+
G.prototype.has = hn;
|
|
1336
|
+
G.prototype.set = dn;
|
|
1337
|
+
var gn = G, vn = zt(vt, "Map"), mn = vn;
|
|
1338
|
+
function En() {
|
|
1339
|
+
this.size = 0, this.__data__ = {
|
|
1340
|
+
hash: new Dt(),
|
|
1341
|
+
map: new (mn || gn)(),
|
|
1342
|
+
string: new Dt()
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
a(En, "mapCacheClear");
|
|
1346
|
+
var bn = En;
|
|
1347
|
+
function Sn(r) {
|
|
1348
|
+
var t = typeof r;
|
|
1349
|
+
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? r !== "__proto__" : r === null;
|
|
1350
|
+
}
|
|
1351
|
+
a(Sn, "isKeyable");
|
|
1352
|
+
var _n = Sn;
|
|
1353
|
+
function Tn(r, t) {
|
|
1354
|
+
var e = r.__data__;
|
|
1355
|
+
return _n(t) ? e[typeof t == "string" ? "string" : "hash"] : e.map;
|
|
1356
|
+
}
|
|
1357
|
+
a(Tn, "getMapData");
|
|
1358
|
+
var st = Tn;
|
|
1359
|
+
function An(r) {
|
|
1360
|
+
var t = st(this, r).delete(r);
|
|
1361
|
+
return this.size -= t ? 1 : 0, t;
|
|
1362
|
+
}
|
|
1363
|
+
a(An, "mapCacheDelete");
|
|
1364
|
+
var wn = An;
|
|
1365
|
+
function On(r) {
|
|
1366
|
+
return st(this, r).get(r);
|
|
1367
|
+
}
|
|
1368
|
+
a(On, "mapCacheGet");
|
|
1369
|
+
var Cn = On;
|
|
1370
|
+
function Pn(r) {
|
|
1371
|
+
return st(this, r).has(r);
|
|
1372
|
+
}
|
|
1373
|
+
a(Pn, "mapCacheHas");
|
|
1374
|
+
var In = Pn;
|
|
1375
|
+
function xn(r, t) {
|
|
1376
|
+
var e = st(this, r), n = e.size;
|
|
1377
|
+
return e.set(r, t), this.size += e.size == n ? 0 : 1, this;
|
|
1378
|
+
}
|
|
1379
|
+
a(xn, "mapCacheSet");
|
|
1380
|
+
var Rn = xn;
|
|
1381
|
+
function W(r) {
|
|
1382
|
+
var t = -1, e = r == null ? 0 : r.length;
|
|
1383
|
+
for (this.clear(); ++t < e; ) {
|
|
1384
|
+
var n = r[t];
|
|
1385
|
+
this.set(n[0], n[1]);
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
a(W, "MapCache");
|
|
1389
|
+
W.prototype.clear = bn;
|
|
1390
|
+
W.prototype.delete = wn;
|
|
1391
|
+
W.prototype.get = Cn;
|
|
1392
|
+
W.prototype.has = In;
|
|
1393
|
+
W.prototype.set = Rn;
|
|
1394
|
+
var Ht = W, Nn = "Expected a function";
|
|
1395
|
+
function bt(r, t) {
|
|
1396
|
+
if (typeof r != "function" || t != null && typeof t != "function")
|
|
1397
|
+
throw new TypeError(Nn);
|
|
1398
|
+
var e = /* @__PURE__ */ a(function() {
|
|
1399
|
+
var n = arguments, o = t ? t.apply(this, n) : n[0], s = e.cache;
|
|
1400
|
+
if (s.has(o))
|
|
1401
|
+
return s.get(o);
|
|
1402
|
+
var l = r.apply(this, n);
|
|
1403
|
+
return e.cache = s.set(o, l) || s, l;
|
|
1404
|
+
}, "memoized");
|
|
1405
|
+
return e.cache = new (bt.Cache || Ht)(), e;
|
|
1406
|
+
}
|
|
1407
|
+
a(bt, "memoize");
|
|
1408
|
+
bt.Cache = Ht;
|
|
1409
|
+
var jn = bt, Ln = 500;
|
|
1410
|
+
function Dn(r) {
|
|
1411
|
+
var t = jn(r, function(n) {
|
|
1412
|
+
return e.size === Ln && e.clear(), n;
|
|
1413
|
+
}), e = t.cache;
|
|
1414
|
+
return t;
|
|
1415
|
+
}
|
|
1416
|
+
a(Dn, "memoizeCapped");
|
|
1417
|
+
var Fn = Dn, Mn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, $n = /\\(\\)?/g, Un = Fn(
|
|
1418
|
+
function(r) {
|
|
1419
|
+
var t = [];
|
|
1420
|
+
return r.charCodeAt(0) === 46 && t.push(""), r.replace(Mn, function(e, n, o, s) {
|
|
1421
|
+
t.push(o ? s.replace($n, "$1") : n || e);
|
|
1422
|
+
}), t;
|
|
1423
|
+
}), kn = Un;
|
|
1424
|
+
function Gn(r) {
|
|
1425
|
+
return r == null ? "" : ar(r);
|
|
1426
|
+
}
|
|
1427
|
+
a(Gn, "toString");
|
|
1428
|
+
var Wn = Gn;
|
|
1429
|
+
function zn(r, t) {
|
|
1430
|
+
return Et(r) ? r : $r(r, t) ? [r] : kn(Wn(r));
|
|
1431
|
+
}
|
|
1432
|
+
a(zn, "castPath");
|
|
1433
|
+
var Hn = zn, Bn = 1 / 0;
|
|
1434
|
+
function qn(r) {
|
|
1435
|
+
if (typeof r == "string" || mt(r))
|
|
1436
|
+
return r;
|
|
1437
|
+
var t = r + "";
|
|
1438
|
+
return t == "0" && 1 / r == -Bn ? "-0" : t;
|
|
1439
|
+
}
|
|
1440
|
+
a(qn, "toKey");
|
|
1441
|
+
var Vn = qn;
|
|
1442
|
+
function Jn(r, t) {
|
|
1443
|
+
t = Hn(t, r);
|
|
1444
|
+
for (var e = 0, n = t.length; r != null && e < n; )
|
|
1445
|
+
r = r[Vn(t[e++])];
|
|
1446
|
+
return e && e == n ? r : void 0;
|
|
1447
|
+
}
|
|
1448
|
+
a(Jn, "baseGet");
|
|
1449
|
+
var Kn = Jn;
|
|
1450
|
+
function Yn(r, t, e) {
|
|
1451
|
+
var n = r == null ? void 0 : Kn(r, t);
|
|
1452
|
+
return n === void 0 ? e : n;
|
|
1453
|
+
}
|
|
1454
|
+
a(Yn, "get");
|
|
1455
|
+
var Xn = Yn, it = De, Qn = /* @__PURE__ */ a((r) => {
|
|
1456
|
+
let t = null, e = !1, n = !1, o = !1, s = "";
|
|
1457
|
+
if (r.indexOf("//") >= 0 || r.indexOf("/*") >= 0)
|
|
1458
|
+
for (let l = 0; l < r.length; l += 1)
|
|
1459
|
+
!t && !e && !n && !o ? r[l] === '"' || r[l] === "'" || r[l] === "`" ? t = r[l] : r[l] === "/" && r[l + 1] === "*" ? e = !0 : r[l] === "\
|
|
1460
|
+
/" && r[l + 1] === "/" ? n = !0 : r[l] === "/" && r[l + 1] !== "/" && (o = !0) : (t && (r[l] === t && r[l - 1] !== "\\" || r[l] === `
|
|
1461
|
+
` && t !== "`") && (t = null), o && (r[l] === "/" && r[l - 1] !== "\\" || r[l] === `
|
|
1462
|
+
`) && (o = !1), e && r[l - 1] === "/" && r[l - 2] === "*" && (e = !1), n && r[l] === `
|
|
1463
|
+
` && (n = !1)), !e && !n && (s += r[l]);
|
|
1464
|
+
else
|
|
1465
|
+
s = r;
|
|
1466
|
+
return s;
|
|
1467
|
+
}, "removeCodeComments"), Zn = (0, Bt.default)(1e4)(
|
|
1468
|
+
(r) => Qn(r).replace(/\n\s*/g, "").trim()
|
|
1469
|
+
), to = /* @__PURE__ */ a(function(t, e) {
|
|
1470
|
+
let n = e.slice(0, e.indexOf("{")), o = e.slice(e.indexOf("{"));
|
|
1471
|
+
if (n.includes("=>") || n.includes("function"))
|
|
1472
|
+
return e;
|
|
1473
|
+
let s = n;
|
|
1474
|
+
return s = s.replace(t, "function"), s + o;
|
|
1475
|
+
}, "convertShorthandMethods2"), eo = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/, J = /* @__PURE__ */ a((r) => r.match(/^[\[\{\"\}].*[\]\}\"]$/),
|
|
1476
|
+
"isJSON");
|
|
1477
|
+
function qt(r) {
|
|
1478
|
+
if (!it(r))
|
|
1479
|
+
return r;
|
|
1480
|
+
let t = r, e = !1;
|
|
1481
|
+
return typeof Event < "u" && r instanceof Event && (t = Pt(t), e = !0), t = Object.keys(t).reduce((n, o) => {
|
|
1482
|
+
try {
|
|
1483
|
+
t[o] && t[o].toJSON, n[o] = t[o];
|
|
1484
|
+
} catch {
|
|
1485
|
+
e = !0;
|
|
1486
|
+
}
|
|
1487
|
+
return n;
|
|
1488
|
+
}, {}), e ? t : r;
|
|
1489
|
+
}
|
|
1490
|
+
a(qt, "convertUnconventionalData");
|
|
1491
|
+
var ro = /* @__PURE__ */ a(function(t) {
|
|
1492
|
+
let e, n, o, s;
|
|
1493
|
+
return /* @__PURE__ */ a(function(c, i) {
|
|
1494
|
+
try {
|
|
1495
|
+
if (c === "")
|
|
1496
|
+
return s = [], e = /* @__PURE__ */ new Map([[i, "[]"]]), n = /* @__PURE__ */ new Map(), o = [], i;
|
|
1497
|
+
let g = n.get(this) || this;
|
|
1498
|
+
for (; o.length && g !== o[0]; )
|
|
1499
|
+
o.shift(), s.pop();
|
|
1500
|
+
if (typeof i == "boolean")
|
|
1501
|
+
return i;
|
|
1502
|
+
if (i === void 0)
|
|
1503
|
+
return t.allowUndefined ? "_undefined_" : void 0;
|
|
1504
|
+
if (i === null)
|
|
1505
|
+
return null;
|
|
1506
|
+
if (typeof i == "number")
|
|
1507
|
+
return i === -1 / 0 ? "_-Infinity_" : i === 1 / 0 ? "_Infinity_" : Number.isNaN(i) ? "_NaN_" : i;
|
|
1508
|
+
if (typeof i == "bigint")
|
|
1509
|
+
return `_bigint_${i.toString()}`;
|
|
1510
|
+
if (typeof i == "string")
|
|
1511
|
+
return eo.test(i) ? t.allowDate ? `_date_${i}` : void 0 : i;
|
|
1512
|
+
if ((0, Ne.default)(i))
|
|
1513
|
+
return t.allowRegExp ? `_regexp_${i.flags}|${i.source}` : void 0;
|
|
1514
|
+
if ((0, je.default)(i)) {
|
|
1515
|
+
if (!t.allowFunction)
|
|
1516
|
+
return;
|
|
1517
|
+
let { name: u } = i, y = i.toString();
|
|
1518
|
+
return y.match(
|
|
1519
|
+
/(\[native code\]|WEBPACK_IMPORTED_MODULE|__webpack_exports__|__webpack_require__)/
|
|
1520
|
+
) ? `_function_${u}|${(() => {
|
|
1521
|
+
}).toString()}` : `_function_${u}|${Zn(to(c, y))}`;
|
|
1522
|
+
}
|
|
1523
|
+
if ((0, Le.default)(i)) {
|
|
1524
|
+
if (!t.allowSymbol)
|
|
1525
|
+
return;
|
|
1526
|
+
let u = Symbol.keyFor(i);
|
|
1527
|
+
return u !== void 0 ? `_gsymbol_${u}` : `_symbol_${i.toString().slice(7, -1)}`;
|
|
1528
|
+
}
|
|
1529
|
+
if (o.length >= t.maxDepth)
|
|
1530
|
+
return Array.isArray(i) ? `[Array(${i.length})]` : "[Object]";
|
|
1531
|
+
if (i === this)
|
|
1532
|
+
return `_duplicate_${JSON.stringify(s)}`;
|
|
1533
|
+
if (i instanceof Error && t.allowError)
|
|
1534
|
+
return {
|
|
1535
|
+
__isConvertedError__: !0,
|
|
1536
|
+
errorProperties: {
|
|
1537
|
+
...i.cause ? { cause: i.cause } : {},
|
|
1538
|
+
...i,
|
|
1539
|
+
name: i.name,
|
|
1540
|
+
message: i.message,
|
|
1541
|
+
stack: i.stack,
|
|
1542
|
+
"_constructor-name_": i.constructor.name
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
if (i.constructor && i.constructor.name && i.constructor.name !== "Object" && !Array.isArray(i) && !t.allowClass)
|
|
1546
|
+
return;
|
|
1547
|
+
let p = e.get(i);
|
|
1548
|
+
if (!p) {
|
|
1549
|
+
let u = Array.isArray(i) ? i : qt(i);
|
|
1550
|
+
if (i.constructor && i.constructor.name && i.constructor.name !== "Object" && !Array.isArray(i) && t.allowClass)
|
|
1551
|
+
try {
|
|
1552
|
+
Object.assign(u, { "_constructor-name_": i.constructor.name });
|
|
1553
|
+
} catch {
|
|
1554
|
+
}
|
|
1555
|
+
return s.push(c), o.unshift(u), e.set(i, JSON.stringify(s)), i !== u && n.set(i, u), u;
|
|
1556
|
+
}
|
|
1557
|
+
return `_duplicate_${p}`;
|
|
1558
|
+
} catch {
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1561
|
+
}, "replace");
|
|
1562
|
+
}, "replacer2"), no = /* @__PURE__ */ a(function reviver(options) {
|
|
1563
|
+
let refs = [], root;
|
|
1564
|
+
return /* @__PURE__ */ a(function revive(key, value) {
|
|
1565
|
+
if (key === "" && (root = value, refs.forEach(({ target: r, container: t, replacement: e }) => {
|
|
1566
|
+
let n = J(e) ? JSON.parse(e) : e.split(".");
|
|
1567
|
+
n.length === 0 ? t[r] = root : t[r] = Xn(root, n);
|
|
1568
|
+
})), key === "_constructor-name_")
|
|
1569
|
+
return value;
|
|
1570
|
+
if (it(value) && value.__isConvertedError__) {
|
|
1571
|
+
let { message: r, ...t } = value.errorProperties, e = new Error(r);
|
|
1572
|
+
return Object.assign(e, t), e;
|
|
1573
|
+
}
|
|
1574
|
+
if (it(value) && value["_constructor-name_"] && options.allowFunction) {
|
|
1575
|
+
let r = value["_constructor-name_"];
|
|
1576
|
+
if (r !== "Object") {
|
|
1577
|
+
let t = new Function(`return function ${r.replace(/[^a-zA-Z0-9$_]+/g, "")}(){}`)();
|
|
1578
|
+
Object.setPrototypeOf(value, new t());
|
|
1579
|
+
}
|
|
1580
|
+
return delete value["_constructor-name_"], value;
|
|
1581
|
+
}
|
|
1582
|
+
if (typeof value == "string" && value.startsWith("_function_") && options.allowFunction) {
|
|
1583
|
+
let [, name, source] = value.match(/_function_([^|]*)\|(.*)/) || [], sourceSanitized = source.replace(/[(\(\))|\\| |\]|`]*$/, "");
|
|
1584
|
+
if (!options.lazyEval)
|
|
1585
|
+
return eval(`(${sourceSanitized})`);
|
|
1586
|
+
let result = /* @__PURE__ */ a((...args) => {
|
|
1587
|
+
let f = eval(`(${sourceSanitized})`);
|
|
1588
|
+
return f(...args);
|
|
1589
|
+
}, "result");
|
|
1590
|
+
return Object.defineProperty(result, "toString", {
|
|
1591
|
+
value: /* @__PURE__ */ a(() => sourceSanitized, "value")
|
|
1592
|
+
}), Object.defineProperty(result, "name", {
|
|
1593
|
+
value: name
|
|
1594
|
+
}), result;
|
|
1595
|
+
}
|
|
1596
|
+
if (typeof value == "string" && value.startsWith("_regexp_") && options.allowRegExp) {
|
|
1597
|
+
let [, r, t] = value.match(/_regexp_([^|]*)\|(.*)/) || [];
|
|
1598
|
+
return new RegExp(t, r);
|
|
1599
|
+
}
|
|
1600
|
+
return typeof value == "string" && value.startsWith("_date_") && options.allowDate ? new Date(value.replace("_date_", "")) : typeof value ==
|
|
1601
|
+
"string" && value.startsWith("_duplicate_") ? (refs.push({ target: key, container: this, replacement: value.replace(/^_duplicate_/, "") }),
|
|
1602
|
+
null) : typeof value == "string" && value.startsWith("_symbol_") && options.allowSymbol ? Symbol(value.replace("_symbol_", "")) : typeof value ==
|
|
1603
|
+
"string" && value.startsWith("_gsymbol_") && options.allowSymbol ? Symbol.for(value.replace("_gsymbol_", "")) : typeof value == "string" &&
|
|
1604
|
+
value === "_-Infinity_" ? -1 / 0 : typeof value == "string" && value === "_Infinity_" ? 1 / 0 : typeof value == "string" && value === "_\
|
|
1605
|
+
NaN_" ? NaN : typeof value == "string" && value.startsWith("_bigint_") && typeof BigInt == "function" ? BigInt(value.replace("_bigint_", "")) :
|
|
1606
|
+
value;
|
|
1607
|
+
}, "revive");
|
|
1608
|
+
}, "reviver"), Vt = {
|
|
1609
|
+
maxDepth: 10,
|
|
1610
|
+
space: void 0,
|
|
1611
|
+
allowFunction: !0,
|
|
1612
|
+
allowRegExp: !0,
|
|
1613
|
+
allowDate: !0,
|
|
1614
|
+
allowClass: !0,
|
|
1615
|
+
allowError: !0,
|
|
1616
|
+
allowUndefined: !0,
|
|
1617
|
+
allowSymbol: !0,
|
|
1618
|
+
lazyEval: !0
|
|
1619
|
+
}, lt = /* @__PURE__ */ a((r, t = {}) => {
|
|
1620
|
+
let e = { ...Vt, ...t };
|
|
1621
|
+
return JSON.stringify(qt(r), ro(e), t.space);
|
|
1622
|
+
}, "stringify"), oo = /* @__PURE__ */ a(() => {
|
|
1623
|
+
let r = /* @__PURE__ */ new Map();
|
|
1624
|
+
return /* @__PURE__ */ a(function t(e) {
|
|
1625
|
+
it(e) && Object.entries(e).forEach(([n, o]) => {
|
|
1626
|
+
o === "_undefined_" ? e[n] = void 0 : r.get(o) || (r.set(o, !0), t(o));
|
|
1627
|
+
}), Array.isArray(e) && e.forEach((n, o) => {
|
|
1628
|
+
n === "_undefined_" ? (r.set(n, !0), e[o] = void 0) : r.get(n) || (r.set(n, !0), t(n));
|
|
1629
|
+
});
|
|
1630
|
+
}, "mutateUndefined");
|
|
1631
|
+
}, "mutator"), ct = /* @__PURE__ */ a((r, t = {}) => {
|
|
1632
|
+
let e = { ...Vt, ...t }, n = JSON.parse(r, no(e));
|
|
1633
|
+
return oo()(n), n;
|
|
1634
|
+
}, "parse");
|
|
1635
|
+
|
|
1636
|
+
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
1637
|
+
var io = !1, St = "Invariant failed";
|
|
1638
|
+
function K(r, t) {
|
|
1639
|
+
if (!r) {
|
|
1640
|
+
if (io)
|
|
1641
|
+
throw new Error(St);
|
|
1642
|
+
var e = typeof t == "function" ? t() : t, n = e ? "".concat(St, ": ").concat(e) : St;
|
|
1643
|
+
throw new Error(n);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
a(K, "invariant");
|
|
1647
|
+
|
|
1648
|
+
// src/channels/postmessage/getEventSourceUrl.ts
|
|
1649
|
+
import { logger as ao } from "storybook/internal/client-logger";
|
|
1650
|
+
var Jt = /* @__PURE__ */ a((r) => {
|
|
1651
|
+
let t = Array.from(
|
|
1652
|
+
document.querySelectorAll("iframe[data-is-storybook]")
|
|
1653
|
+
), [e, ...n] = t.filter((s) => {
|
|
1654
|
+
try {
|
|
1655
|
+
return s.contentWindow?.location.origin === r.source.location.origin && s.contentWindow?.location.pathname === r.source.location.pathname;
|
|
1656
|
+
} catch {
|
|
1657
|
+
}
|
|
1658
|
+
try {
|
|
1659
|
+
return s.contentWindow === r.source;
|
|
1660
|
+
} catch {
|
|
1661
|
+
}
|
|
1662
|
+
let l = s.getAttribute("src"), c;
|
|
1663
|
+
try {
|
|
1664
|
+
if (!l)
|
|
1665
|
+
return !1;
|
|
1666
|
+
({ origin: c } = new URL(l, document.location.toString()));
|
|
1667
|
+
} catch {
|
|
1668
|
+
return !1;
|
|
1669
|
+
}
|
|
1670
|
+
return c === r.origin;
|
|
1671
|
+
}), o = e?.getAttribute("src");
|
|
1672
|
+
if (o && n.length === 0) {
|
|
1673
|
+
let { protocol: s, host: l, pathname: c } = new URL(o, document.location.toString());
|
|
1674
|
+
return `${s}//${l}${c}`;
|
|
1675
|
+
}
|
|
1676
|
+
return n.length > 0 && ao.error("found multiple candidates for event source"), null;
|
|
1677
|
+
}, "getEventSourceUrl");
|
|
1678
|
+
|
|
1679
|
+
// src/channels/postmessage/index.ts
|
|
1680
|
+
var { document: _t, location: Tt } = S, Xt = "storybook-channel", lo = { allowFunction: !1, maxDepth: 25 }, At = class At {
|
|
1681
|
+
constructor(t) {
|
|
1682
|
+
this.config = t;
|
|
1683
|
+
this.connected = !1;
|
|
1684
|
+
if (this.buffer = [], typeof S?.addEventListener == "function" && S.addEventListener("message", this.handleEvent.bind(this), !1), t.page !==
|
|
1685
|
+
"manager" && t.page !== "preview")
|
|
1686
|
+
throw new Error(`postmsg-channel: "config.page" cannot be "${t.page}"`);
|
|
1687
|
+
}
|
|
1688
|
+
setHandler(t) {
|
|
1689
|
+
this.handler = (...e) => {
|
|
1690
|
+
t.apply(this, e), !this.connected && this.getLocalFrame().length && (this.flush(), this.connected = !0);
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* Sends `event` to the associated window. If the window does not yet exist the event will be
|
|
1695
|
+
* stored in a buffer and sent when the window exists.
|
|
1696
|
+
*
|
|
1697
|
+
* @param event
|
|
1698
|
+
*/
|
|
1699
|
+
send(t, e) {
|
|
1700
|
+
let {
|
|
1701
|
+
target: n,
|
|
1702
|
+
// telejson options
|
|
1703
|
+
allowRegExp: o,
|
|
1704
|
+
allowFunction: s,
|
|
1705
|
+
allowSymbol: l,
|
|
1706
|
+
allowDate: c,
|
|
1707
|
+
allowError: i,
|
|
1708
|
+
allowUndefined: g,
|
|
1709
|
+
allowClass: p,
|
|
1710
|
+
maxDepth: u,
|
|
1711
|
+
space: y,
|
|
1712
|
+
lazyEval: v
|
|
1713
|
+
} = e || {}, d = Object.fromEntries(
|
|
1714
|
+
Object.entries({
|
|
1715
|
+
allowRegExp: o,
|
|
1716
|
+
allowFunction: s,
|
|
1717
|
+
allowSymbol: l,
|
|
1718
|
+
allowDate: c,
|
|
1719
|
+
allowError: i,
|
|
1720
|
+
allowUndefined: g,
|
|
1721
|
+
allowClass: p,
|
|
1722
|
+
maxDepth: u,
|
|
1723
|
+
space: y,
|
|
1724
|
+
lazyEval: v
|
|
1725
|
+
}).filter(([R, C]) => typeof C < "u")
|
|
1726
|
+
), m = {
|
|
1727
|
+
...lo,
|
|
1728
|
+
...S.CHANNEL_OPTIONS || {},
|
|
1729
|
+
...d
|
|
1730
|
+
}, E = this.getFrames(n), I = new URLSearchParams(Tt?.search || ""), T = lt(
|
|
1731
|
+
{
|
|
1732
|
+
key: Xt,
|
|
1733
|
+
event: t,
|
|
1734
|
+
refId: I.get("refId")
|
|
1735
|
+
},
|
|
1736
|
+
m
|
|
1737
|
+
);
|
|
1738
|
+
return E.length ? (this.buffer.length && this.flush(), E.forEach((R) => {
|
|
1739
|
+
try {
|
|
1740
|
+
R.postMessage(T, "*");
|
|
1741
|
+
} catch {
|
|
1742
|
+
Kt.error("sending over postmessage fail");
|
|
1743
|
+
}
|
|
1744
|
+
}), Promise.resolve(null)) : new Promise((R, C) => {
|
|
1745
|
+
this.buffer.push({ event: t, resolve: R, reject: C });
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
flush() {
|
|
1749
|
+
let { buffer: t } = this;
|
|
1750
|
+
this.buffer = [], t.forEach((e) => {
|
|
1751
|
+
this.send(e.event).then(e.resolve).catch(e.reject);
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
getFrames(t) {
|
|
1755
|
+
if (this.config.page === "manager") {
|
|
1756
|
+
let n = Array.from(
|
|
1757
|
+
_t.querySelectorAll("iframe[data-is-storybook][data-is-loaded]")
|
|
1758
|
+
).flatMap((o) => {
|
|
1759
|
+
try {
|
|
1760
|
+
return o.contentWindow && o.dataset.isStorybook !== void 0 && o.id === t ? [o.contentWindow] : [];
|
|
1761
|
+
} catch {
|
|
1762
|
+
return [];
|
|
1763
|
+
}
|
|
1764
|
+
});
|
|
1765
|
+
return n?.length ? n : this.getCurrentFrames();
|
|
1766
|
+
}
|
|
1767
|
+
return S && S.parent && S.parent !== S.self ? [S.parent] : [];
|
|
1768
|
+
}
|
|
1769
|
+
getCurrentFrames() {
|
|
1770
|
+
return this.config.page === "manager" ? Array.from(
|
|
1771
|
+
_t.querySelectorAll('[data-is-storybook="true"]')
|
|
1772
|
+
).flatMap((e) => e.contentWindow ? [e.contentWindow] : []) : S && S.parent ? [S.parent] : [];
|
|
1773
|
+
}
|
|
1774
|
+
getLocalFrame() {
|
|
1775
|
+
return this.config.page === "manager" ? Array.from(
|
|
1776
|
+
_t.querySelectorAll("#storybook-preview-iframe")
|
|
1777
|
+
).flatMap((e) => e.contentWindow ? [e.contentWindow] : []) : S && S.parent ? [S.parent] : [];
|
|
1778
|
+
}
|
|
1779
|
+
handleEvent(t) {
|
|
1780
|
+
try {
|
|
1781
|
+
let { data: e } = t, { key: n, event: o, refId: s } = typeof e == "string" && J(e) ? ct(e, S.CHANNEL_OPTIONS || {}) : e;
|
|
1782
|
+
if (n === Xt) {
|
|
1783
|
+
let l = this.config.page === "manager" ? '<span style="color: #37D5D3; background: black"> manager </span>' : '<span style="color: #\
|
|
1784
|
+
1EA7FD; background: black"> preview </span>', c = Object.values(so).includes(o.type) ? `<span style="color: #FF4785">${o.type}</span>` : `<s\
|
|
1785
|
+
pan style="color: #FFAE00">${o.type}</span>`;
|
|
1786
|
+
if (s && (o.refId = s), o.source = this.config.page === "preview" ? t.origin : Jt(t), !o.source) {
|
|
1787
|
+
Yt.error(
|
|
1788
|
+
`${l} received ${c} but was unable to determine the source of the event`
|
|
1789
|
+
);
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
let i = `${l} received ${c} (${e.length})`;
|
|
1793
|
+
Yt.debug(
|
|
1794
|
+
Tt.origin !== o.source ? i : `${i} <span style="color: gray">(on ${Tt.origin} from ${o.source})</span>`,
|
|
1795
|
+
...o.args
|
|
1796
|
+
), K(this.handler, "ChannelHandler should be set"), this.handler(o);
|
|
1797
|
+
}
|
|
1798
|
+
} catch (e) {
|
|
1799
|
+
Kt.error(e);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
a(At, "PostMessageTransport");
|
|
1804
|
+
var Y = At;
|
|
1805
|
+
|
|
1806
|
+
// src/channels/websocket/index.ts
|
|
1807
|
+
import * as Qt from "storybook/internal/core-events";
|
|
1808
|
+
var { WebSocket: co } = S, Zt = 15e3, te = 5e3, wt = class wt {
|
|
1809
|
+
constructor({ url: t, onError: e, page: n }) {
|
|
1810
|
+
this.buffer = [];
|
|
1811
|
+
this.isReady = !1;
|
|
1812
|
+
this.isClosed = !1;
|
|
1813
|
+
this.pingTimeout = 0;
|
|
1814
|
+
this.socket = new co(t), this.socket.onopen = () => {
|
|
1815
|
+
this.isReady = !0, this.heartbeat(), this.flush();
|
|
1816
|
+
}, this.socket.onmessage = ({ data: o }) => {
|
|
1817
|
+
let s = typeof o == "string" && J(o) ? ct(o) : o;
|
|
1818
|
+
K(this.handler, "WebsocketTransport handler should be set"), this.handler(s), s.type === "ping" && (this.heartbeat(), this.send({ type: "\
|
|
1819
|
+
pong" }));
|
|
1820
|
+
}, this.socket.onerror = (o) => {
|
|
1821
|
+
e && e(o);
|
|
1822
|
+
}, this.socket.onclose = (o) => {
|
|
1823
|
+
K(this.handler, "WebsocketTransport handler should be set"), this.handler({
|
|
1824
|
+
type: Qt.CHANNEL_WS_DISCONNECT,
|
|
1825
|
+
args: [{ reason: o.reason, code: o.code }],
|
|
1826
|
+
from: n || "preview"
|
|
1827
|
+
}), this.isClosed = !0, clearTimeout(this.pingTimeout);
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
heartbeat() {
|
|
1831
|
+
clearTimeout(this.pingTimeout), this.pingTimeout = setTimeout(() => {
|
|
1832
|
+
this.socket.close(3008, "timeout");
|
|
1833
|
+
}, Zt + te);
|
|
1834
|
+
}
|
|
1835
|
+
setHandler(t) {
|
|
1836
|
+
this.handler = t;
|
|
1837
|
+
}
|
|
1838
|
+
send(t) {
|
|
1839
|
+
this.isClosed || (this.isReady ? this.sendNow(t) : this.sendLater(t));
|
|
1840
|
+
}
|
|
1841
|
+
sendLater(t) {
|
|
1842
|
+
this.buffer.push(t);
|
|
1843
|
+
}
|
|
1844
|
+
sendNow(t) {
|
|
1845
|
+
let e = lt(t, {
|
|
1846
|
+
maxDepth: 15,
|
|
1847
|
+
allowFunction: !1,
|
|
1848
|
+
...S.CHANNEL_OPTIONS
|
|
1849
|
+
});
|
|
1850
|
+
this.socket.send(e);
|
|
1851
|
+
}
|
|
1852
|
+
flush() {
|
|
1853
|
+
let { buffer: t } = this;
|
|
1854
|
+
this.buffer = [], t.forEach((e) => this.send(e));
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
a(wt, "WebsocketTransport");
|
|
1858
|
+
var X = wt;
|
|
1859
|
+
|
|
1860
|
+
// src/channels/index.ts
|
|
1861
|
+
var { CONFIG_TYPE: po } = S, Xo = B;
|
|
1862
|
+
function Qo({ page: r, extraTransports: t = [] }) {
|
|
1863
|
+
let e = [new Y({ page: r }), ...t];
|
|
1864
|
+
if (po === "DEVELOPMENT") {
|
|
1865
|
+
let o = window.location.protocol === "http:" ? "ws" : "wss", { hostname: s, port: l } = window.location, c = `${o}://${s}:${l}/storybook\
|
|
1866
|
+
-server-channel`;
|
|
1867
|
+
e.push(new X({ url: c, onError: /* @__PURE__ */ a(() => {
|
|
1868
|
+
}, "onError"), page: r }));
|
|
1869
|
+
}
|
|
1870
|
+
let n = new B({ transports: e });
|
|
1871
|
+
return $.__prepare(
|
|
1872
|
+
n,
|
|
1873
|
+
r === "manager" ? $.Environment.MANAGER : $.Environment.PREVIEW
|
|
1874
|
+
), n;
|
|
1875
|
+
}
|
|
1876
|
+
a(Qo, "createBrowserChannel");
|
|
1877
|
+
export {
|
|
1878
|
+
B as Channel,
|
|
1879
|
+
Zt as HEARTBEAT_INTERVAL,
|
|
1880
|
+
te as HEARTBEAT_MAX_LATENCY,
|
|
1881
|
+
Y as PostMessageTransport,
|
|
1882
|
+
X as WebsocketTransport,
|
|
1883
|
+
Qo as createBrowserChannel,
|
|
1884
|
+
Xo as default
|
|
1885
|
+
};
|