@sheetxl/scripting 0.1.96

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.
@@ -0,0 +1,826 @@
1
+ /**
2
+ * @license @sheetxl/scripting - SheetXL scripting utilities including TypeScript compilation. - v0.0.0
3
+ *
4
+ * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ /**
8
+ * @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.1.93
9
+ *
10
+ * (C) 2025-present SheetXL Inc. & Michael T. Ford
11
+ * License: The license can be found at https://www.sheetxl.com/license.
12
+ */
13
+ const h = "text/html", b = "text/plain", L = "image/png", Tt = Object.freeze({ left: 0, top: 0 }), Ct = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Mt = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
14
+ Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Mt, EmptyRect: Ct, EmptyTopLeft: Tt }, Symbol.toStringTag, { value: "Module" }));
15
+ const m = "column", j = "row", Rt = Object.freeze({ colIndex: 0, rowIndex: 0 }), At = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), yt = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, gt = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, Ft = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, Lt = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, J = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, H = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, bt = (e = j, t = !1) => t ? e !== m ? Ft : Lt : e !== m ? gt : yt, Y = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, D = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, $ = (e, t) => !(!e || !t || e.colStart > t.colEnd || t.colStart > e.colEnd || e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), K = (e, t) => {
16
+ if (e === t) return !0;
17
+ if (!e || !t || e.length !== t.length) return !1;
18
+ for (let r = 0; r < e.length; r++) if (!D(e[r], t[r])) return !1;
19
+ return !0;
20
+ }, U = (e, t, r) => {
21
+ if (!e && !t) return null;
22
+ if (!e) return r ? t : { ...t };
23
+ if (!t) return r ? e : { ...e };
24
+ const n = Math.min(e.colStart, t.colStart), o = Math.min(e.rowStart, t.rowStart), a = Math.max(e.colEnd, t.colEnd), i = Math.max(e.rowEnd, t.rowEnd);
25
+ let l = r;
26
+ return l ? (l.colStart = n, l.rowStart = o, l.colEnd = a, l.rowEnd = i) : l = { colStart: n, rowStart: o, colEnd: a, rowEnd: i }, l;
27
+ }, Z = (e, t) => {
28
+ if (!t || t.length === 0) return e;
29
+ const r = { ...e };
30
+ for (let n = 0; n < t.length; n++) {
31
+ const o = t[n];
32
+ $(r, o) && (r.rowStart = Math.min(r.rowStart, o.rowStart), r.colStart = Math.min(r.colStart, o.colStart), r.rowEnd = Math.max(r.rowEnd, o.rowEnd), r.colEnd = Math.max(r.colEnd, o.colEnd));
33
+ }
34
+ return r;
35
+ }, Ut = [null, null], Pt = (e, t, r) => {
36
+ if (e[0].value === e[1].value) return t;
37
+ };
38
+ function X(e, t = 2, r, n = j, o) {
39
+ let a = [...e];
40
+ if (t <= 0 || e.length <= 1) return a;
41
+ let i = n === m, l = 0, s = !1;
42
+ do {
43
+ const c = a.sort(bt(i ? j : m));
44
+ a = [], a.push(c[0]);
45
+ const d = c.length;
46
+ let w = 0, u = c[0], f = u.colStart, p = u.rowStart, x = u.colEnd, O = u.rowEnd;
47
+ for (let A = 1; A < d; A++) {
48
+ const g = c[A];
49
+ let G = !1;
50
+ if (G = i ? u && p === g.rowStart && O === g.rowEnd && x + 1 === g.colStart : u && f === g.colStart && x === g.colEnd && O + 1 === g.rowStart, G) {
51
+ let S = { colStart: f, rowStart: p, colEnd: i ? g.colEnd : x, rowEnd: i ? O : g.rowEnd };
52
+ if (u.value !== void 0 && (S.value = u.value), r) {
53
+ const F = o ?? [null, null];
54
+ F[0] = u, F[1] = g, S = r(F, S, n);
55
+ }
56
+ if (S) {
57
+ a[w] = S, s = !0, u = S, f = u.colStart, p = u.rowStart, x = u.colEnd, O = u.rowEnd;
58
+ continue;
59
+ }
60
+ }
61
+ a[++w] = g, u = g, f = u.colStart, p = u.rowStart, x = u.colEnd, O = u.rowEnd;
62
+ }
63
+ l++, i = !i, l === 1 && (s = !0);
64
+ } while (l < t && s && a.length > 1);
65
+ return a;
66
+ }
67
+ Object.freeze(Object.defineProperty({ __proto__: null, EmptyCell: Rt, EmptyRange: At, cellToRange: (e, t) => {
68
+ if (!e) return null;
69
+ let r = t;
70
+ return r || (r = { ...e }, delete r.colIndex, delete r.rowIndex), r.colStart = e.colIndex ?? 0, r.rowStart = e.rowIndex ?? 0, r.colEnd = e.colIndex ?? 0, r.rowEnd = e.rowIndex ?? 0, r;
71
+ }, columnFirstCellComparator: J, columnFirstRangeComparator: yt, createCellComparator: (e = j, t = !1) => t ? e !== m ? (r, n) => r.rowIndex === n.rowIndex ? n.colIndex - r.colIndex : n.rowIndex - r.rowIndex : (r, n) => r.colIndex === n.colIndex ? n.rowIndex - r.rowIndex : n.colIndex - r.colIndex : e !== m ? H : J, createConflatingRanges: (e, t = !1) => {
72
+ const r = [];
73
+ let n, o, a = Number.MIN_SAFE_INTEGER, i = Number.MIN_SAFE_INTEGER;
74
+ return { append: (l, s, c) => {
75
+ let d = !0;
76
+ const w = c !== void 0;
77
+ if (w) {
78
+ const p = e ? e(o, c, t) : o === c ? c : void 0;
79
+ p === void 0 ? d = !1 : c = p;
80
+ }
81
+ if (d && s === i + 1 && l === a) return t ? n.rowEnd = s : n.colEnd = s, i = s, void (o = c);
82
+ n && r.push(n);
83
+ const u = t ? l : s, f = t ? s : l;
84
+ n = { colStart: u, rowStart: f, colEnd: u, rowEnd: f }, w && (n.value = c), a = l, i = s, o = c;
85
+ }, done: (l) => (n && (r.push(n), n = null), l ? X(r, 3, l === !0 ? Pt : l, t ? m : j, Ut) : r) };
86
+ }, createRangeComparator: bt, defaultRange: (e, t, r) => e ? r ? (r.colStart = e.colStart ?? t.colStart, r.rowStart = e.rowStart ?? t.rowStart, r.colEnd = e.colEnd ?? t.colEnd, r.rowEnd = e.rowEnd ?? t.rowEnd, r) : { colStart: e.colStart ?? t.colStart, rowStart: e.rowStart ?? t.rowStart, colEnd: e.colEnd ?? t.colEnd, rowEnd: e.rowEnd ?? t.rowEnd } : t, extendRangeToIntersectingRanges: Z, extendRangeToUnionRanges: (e, t) => {
87
+ if (!t || t.length === 0) return e;
88
+ let r = e, n = null;
89
+ for (; !D(r, n); ) n = r, r = Z(n, t);
90
+ return r;
91
+ }, indexOfCoords: (e, t) => {
92
+ const r = { colStart: e.colIndex, rowStart: e.rowIndex, colEnd: e.colIndex, rowEnd: e.rowIndex };
93
+ for (let n = t.length - 1; n >= 0; n--) if ($(r, t[n])) return n;
94
+ return -1;
95
+ }, intersectRanges: (e, t, r) => {
96
+ if (!e) return r ? t : { ...t };
97
+ if (!t) return r ? e : { ...e };
98
+ if (!e && !t || e.rowStart > t.rowEnd || e.rowEnd < t.rowStart || e.colStart > t.colEnd || e.colEnd < t.colStart) return null;
99
+ const n = Math.max(e.colStart, t.colStart), o = Math.max(e.rowStart, t.rowStart), a = Math.min(e.colEnd, t.colEnd), i = Math.min(e.rowEnd, t.rowEnd);
100
+ let l = r;
101
+ return l ? (l.colStart = n, l.rowStart = o, l.colEnd = a, l.rowEnd = i) : l = { colStart: n, rowStart: o, colEnd: a, rowEnd: i }, l;
102
+ }, isCellWithinRange: (e, t) => !(!e || !t || e.rowIndex < t.rowStart || e.rowIndex > t.rowEnd || e.colIndex < t.colStart || e.colIndex > t.colEnd), isEqualCells: Y, isEqualRanges: D, isEqualRangesArrays: K, isEqualSelectionCoords: (e, t) => e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!Y(e.cell, t.cell) && K(e.ranges, t.ranges), isRangeWithinRange: (e, t) => !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd || e.colStart < t.colStart || e.colEnd > t.colEnd), isRangesIntersect: $, isSingleCell: (e) => !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd, isValidRange: (e) => !(!e || typeof e.colStart != "number" || e.colStart < 0 || typeof e.colEnd != "number" || e.colEnd < e.colStart || typeof e.rowStart != "number" || e.rowStart < 0 || typeof e.rowEnd != "number" || e.rowEnd < e.rowStart), mergeRangedValues: X, rowFirstCellComparator: H, rowFirstRangeComparator: gt, sanitizeRange: (e) => e ? { colStart: e.colIndex ?? e.colStart ?? 0, rowStart: e.rowIndex ?? e.rowStart ?? 0, colEnd: e.colIndex ?? e.colEnd ?? 0, rowEnd: e.rowIndex ?? e.rowEnd ?? 0 } : null, translateRange: (e, t = -e.rowStart, r = -e.colStart, n) => n ? (n.colStart = e.colStart + r, n.rowStart = e.rowStart + t, n.colEnd = e.colEnd + r, n.rowEnd = e.rowEnd + t, n) : { colStart: e.colStart + r, rowStart: e.rowStart + t, colEnd: e.colEnd + r, rowEnd: e.rowEnd + t }, unionRanges: U, unionRangesArrays: (e, t, r) => {
103
+ if (!e || e.length === 0) return null;
104
+ if (e.length === 1 && !t) return e[0];
105
+ let n = e[0];
106
+ for (let o = 1; o < e.length; o++) n = U(n, e[o], r);
107
+ return t && (n = U(n, t, r)), n;
108
+ } }, Symbol.toStringTag, { value: "Module" }));
109
+ const kt = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
110
+ function Nt(e) {
111
+ return /* @__PURE__ */ function(t) {
112
+ return !!t && typeof t == "object";
113
+ }(e) && !function(t) {
114
+ const r = Object.prototype.toString.call(t);
115
+ return r === "[object RegExp]" || r === "[object Date]" || t.$$typeof === kt;
116
+ }(e);
117
+ }
118
+ function I(e, t) {
119
+ return t.clone !== !1 && t.isMergeableObject(e) ? E((r = e, Array.isArray(r) ? [] : {}), e, t) : e;
120
+ var r;
121
+ }
122
+ function Bt(e, t, r) {
123
+ return e.concat(t).map(function(n) {
124
+ return I(n, r);
125
+ });
126
+ }
127
+ function Q(e) {
128
+ return Object.keys(e).concat((t = e, Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(r) {
129
+ return Object.propertyIsEnumerable.call(t, r);
130
+ }) : []));
131
+ var t;
132
+ }
133
+ function tt(e, t) {
134
+ try {
135
+ return t in e;
136
+ } catch {
137
+ return !1;
138
+ }
139
+ }
140
+ function E(e, t, r) {
141
+ (r = r || {}).arrayMerge = r.arrayMerge || Bt, r.isMergeableObject = r.isMergeableObject || Nt, r.cloneUnlessOtherwiseSpecified = I;
142
+ const n = Array.isArray(t);
143
+ return n === Array.isArray(e) ? n ? r.arrayMerge(e, t, r) : function(o, a, i) {
144
+ const l = {};
145
+ return i.isMergeableObject(o) && Q(o).forEach(function(s) {
146
+ l[s] = I(o[s], i);
147
+ }), Q(a).forEach(function(s) {
148
+ var c, d;
149
+ tt(c = o, d = s) && (!Object.hasOwnProperty.call(c, d) || !Object.propertyIsEnumerable.call(c, d)) || (tt(o, s) && i.isMergeableObject(a[s]) ? l[s] = function(w, u) {
150
+ if (!u.customMerge) return E;
151
+ const f = u.customMerge(w);
152
+ return typeof f == "function" ? f : E;
153
+ }(s, i)(o[s], a[s], i) : l[s] = I(a[s], i));
154
+ }), l;
155
+ }(e, t, r) : I(t, r);
156
+ }
157
+ E.all = function(e, t) {
158
+ if (!Array.isArray(e)) throw new Error("first argument should be an array");
159
+ return e.reduce(function(r, n) {
160
+ return E(r, n, t);
161
+ }, {});
162
+ };
163
+ const zt = Object.freeze([]), qt = Object.freeze({}), et = (e) => e, R = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
164
+ let t = 16 * Math.random() | 0;
165
+ return (e === "x" ? t : 3 & t | 8).toString(16);
166
+ }), mt = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((r, n) => r === t[n]), _ = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, Et = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
167
+ e[t] && typeof e[t] == "object" ? Et(e[t]) : e[t] !== null && e[t] !== void 0 || delete e[t], typeof e[t] == "object" && Object.keys(e[t]).length === 0 && delete e[t];
168
+ }), Object.keys(e).length === 0 ? null : e), Dt = (e, t) => !(e !== t && !mt(e, t) && !e.isEqual?.(t)), St = (e, t, r = Dt) => {
169
+ if (e == null || e === t) return null;
170
+ if (!e || typeof e != "object" || Array.isArray(e) || e.isImmutable?.()) return r(e, t) ? null : e;
171
+ const n = Object.keys(e);
172
+ if (n.length === 0) return null;
173
+ let o = !1;
174
+ for (let a = 0; a < n.length; a++) {
175
+ const i = n[a];
176
+ St(e[i], t?.[i], r) === null && (o = !0, delete e[i]);
177
+ }
178
+ return o && Object.keys(e).length === 0 ? null : void 0;
179
+ }, rt = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), nt = (e) => e == null, ot = (e, t) => !(t.left > e.right || t.right < e.left || t.top > e.bottom || t.bottom < e.top), at = !(typeof window > "u" || !window.document || !window.document.createElement), y = { Windows: "windows", MacOS: "macos", IOS: "ios", Linux: "linux", Android: "android", Safari: "safari", Firefox: "firefox", Node: "node", Unknown: "unknown" }, T = () => {
180
+ if (vt()) return y.Node;
181
+ const e = globalThis.navigator !== void 0 && globalThis.navigator.userAgent ? globalThis.navigator.userAgent.toLowerCase() : "";
182
+ return e ? /(win32|win64|windows|wince)/i.test(e) ? y.Windows : /(macintosh|macintel|macppc|mac68k|macos)/i.test(e) ? y.MacOS : /(iphone|ipad|ipod)/i.test(e) ? y.IOS : /android/.test(e) ? y.Android : /linux/.test(e) ? y.Linux : /^((?!chrome|android|).)*safari/i.test(e) ? y.Safari : /^((?!chrome|android|Seamonkey).)*firefox/i.test(e) ? y.Firefox : y.Unknown : y.Unknown;
183
+ };
184
+ function vt() {
185
+ return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
186
+ }
187
+ const it = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), $t = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: zt, EmptyObject: qt, OSType: y, arrayMove: function(e, t, r) {
188
+ const n = e.slice();
189
+ return n.splice(r < 0 ? n.length + r : r, 0, n.splice(t, 1)[0]), n;
190
+ }, asNumber: (e) => {
191
+ const t = ((r) => 1 * r)(e);
192
+ return Number.isFinite(t) ? t : 0;
193
+ }, camelToPrettyCase: (e) => e.length === 1 ? e.toUpperCase() : e.replace(/([A-Z])/g, " $1").replace(/^./, function(t) {
194
+ return t.toUpperCase();
195
+ }).trim(), canUseDOM: at, cancelTimeout: (e) => {
196
+ cancelAnimationFrame(e.id);
197
+ }, castToString: (e) => e == null || e === void 0 ? "" : typeof e != "string" ? "" + e : e, cloneObject: (e) => nt(e) ? e : JSON.parse(JSON.stringify(e)), consoleWithNoSource: (...e) => new Promise((t) => {
198
+ setTimeout(() => {
199
+ Function("console.log.apply(console, arguments)").apply(null, e), t();
200
+ });
201
+ }), debounce: function(e, t = 300, r = !1) {
202
+ let n, o, a, i, l = 0;
203
+ function s() {
204
+ let d = Date.now() - l;
205
+ d < t && d >= 0 ? n = setTimeout(s, t - d) : (n = null, r || (i = e.apply(a, o), a = o = null));
206
+ }
207
+ t == null && (t = 100);
208
+ const c = function() {
209
+ a = globalThis, o = arguments, l = Date.now();
210
+ var d = r && !n;
211
+ return n || (n = setTimeout(s, t)), d && (i = e.apply(a, o), a = o = null), i;
212
+ };
213
+ return c.clear = function() {
214
+ n && (clearTimeout(n), n = null);
215
+ }, c.flush = function() {
216
+ n && (i = e.apply(a, o), a = o = null, clearTimeout(n), n = null);
217
+ }, c;
218
+ }, deepEqual: function e(t, r) {
219
+ if (t === r) return !0;
220
+ if (t && r && typeof t == "object" && typeof r == "object") {
221
+ if (t.constructor !== r.constructor) return !1;
222
+ let n, o, a;
223
+ if (Array.isArray(t)) {
224
+ if (n = t.length, n != r.length) return !1;
225
+ for (o = n; o-- !== 0; ) if (!e(t[o], r[o])) return !1;
226
+ return !0;
227
+ }
228
+ if (t instanceof Map && r instanceof Map) {
229
+ if (t.size !== r.size) return !1;
230
+ for (o of t.entries()) if (!r.has(o[0])) return !1;
231
+ for (o of t.entries()) if (!e(o[1], r.get(o[0]))) return !1;
232
+ return !0;
233
+ }
234
+ if (t instanceof Set && r instanceof Set) {
235
+ if (t.size !== r.size) return !1;
236
+ for (o of t.entries()) if (!r.has(o[0])) return !1;
237
+ return !0;
238
+ }
239
+ if (ArrayBuffer.isView(t) && ArrayBuffer.isView(r)) {
240
+ if (n = t.length, n != r.length) return !1;
241
+ for (o = n; o-- !== 0; ) if (t[o] !== r[o]) return !1;
242
+ return !0;
243
+ }
244
+ if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
245
+ if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
246
+ if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
247
+ if (a = Object.keys(t), n = a.length, n !== Object.keys(r).length) return !1;
248
+ for (o = n; o-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(r, a[o])) return !1;
249
+ for (o = n; o-- !== 0; ) {
250
+ let i = a[o];
251
+ if (!(i === "_owner" && t.$$typeof || e(t[i], r[i]))) return !1;
252
+ }
253
+ return !0;
254
+ }
255
+ return t != t && r != r;
256
+ }, deepFreeze: function e(t) {
257
+ return Object.freeze(t), Object.keys(t).forEach((r) => {
258
+ typeof t[r] != "object" || t[r] === null || Object.isFrozen(t[r]) || e(t[r]);
259
+ }), t;
260
+ }, deepMerge: E, diffValues: (e, t) => {
261
+ const r = {}, n = Object.keys(t), o = n.length;
262
+ for (let a = 0; a < o; a++) {
263
+ const i = n[a];
264
+ e[i] !== t[i] && (e[i] === void 0 ? r[i] = t[i] : r[i] = e[i]);
265
+ }
266
+ return Object.keys(r).length === 0 ? null : r;
267
+ }, findEqualOrGreater: function(e, t, r = et) {
268
+ let n = 0, o = e.length - 1;
269
+ for (; n <= o; ) {
270
+ let a = Math.floor((n + o) / 2), i = r(e[a]);
271
+ if (i === t) return a;
272
+ i < t ? n = a + 1 : o = a - 1;
273
+ }
274
+ return n;
275
+ }, findEqualOrLesser: function(e, t, r = et) {
276
+ let n = e.length - 1, o = 0;
277
+ for (; n >= o; ) {
278
+ let a = Math.floor((n + o) / 2), i = r(e[a]);
279
+ if (i === t) return a;
280
+ i > t ? n = a - 1 : o = a + 1;
281
+ }
282
+ return n;
283
+ }, findNextStep: (e, t = !0, r = 15, n = 10, o = 400) => {
284
+ const a = Math.max(e - n, 0) + (t ? 1 : -1);
285
+ return Math.min(o, Math[t ? "ceil" : "floor"](a / r) * r + n);
286
+ }, getBuildEnv: () => "browser2-build", getDPI: () => {
287
+ let e = 1;
288
+ return typeof window == "object" && (e = window.devicePixelRatio || 1), e;
289
+ }, getFromPath: (e, t) => {
290
+ const r = t.split(".");
291
+ let n = e;
292
+ for (let o = 0; o < r.length; o++) {
293
+ const a = r[o];
294
+ if (!n) return null;
295
+ let i = n[a];
296
+ if (typeof i == "function" && (i = i.bind(n)()), !i || !_(i)) return i;
297
+ n = i;
298
+ }
299
+ return n ?? null;
300
+ }, getOS: T, hasFocus: it, isDefined: (e) => e != null, isEmpty: (e) => e == null || e === "", isEqualArrays: mt, isEqualBounds: (e, t) => e === t || !(e && !t || t && !e) && e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height, isEqualObjectKeys: (e, t) => {
301
+ if (e === t) return !0;
302
+ if (e && !t || t && !e) return !1;
303
+ const r = Object.keys(e);
304
+ if (r.length !== Object.keys(t).length) return !1;
305
+ for (let n = 0; n < r.length; n++) if (e[r[n]] !== t[r[n]]) return !1;
306
+ return !0;
307
+ }, isNode: vt, isNullOrUndefined: nt, isNumeric: (e) => {
308
+ const t = 1 * e;
309
+ return Number.isFinite(t) && typeof t == "number";
310
+ }, isObject: _, isPromiseLike: (e) => !!e && typeof e.then == "function", isRectInsideRect: (e, t) => e.top >= t.top && e.bottom <= t.bottom && e.left >= t.left && e.right <= t.right, isRectIntersect: ot, mergeContentful: (...e) => {
311
+ const t = e.length;
312
+ if (t > 0 && e[t - 1] !== void 0 && !_(e[t - 1])) return e[t - 1];
313
+ let r = e[0] || {};
314
+ for (let n = 1; n < t; n++) r = E(r, e[n] || {}, { arrayMerge: (o, a) => [...a] });
315
+ return r;
316
+ }, nextTick: (e) => {
317
+ typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(() => {
318
+ e();
319
+ }) : (typeof setImmediate == "function" ? setImmediate : setTimeout)(() => {
320
+ e();
321
+ });
322
+ }, openFileDialog: (e = "*.*") => new Promise((t, r) => {
323
+ if (!at) return void r("Unable to open dialog with no dom.");
324
+ const n = document.createElement("input");
325
+ n.type = "file", n.accept = e;
326
+ let o = null, a = !1;
327
+ globalThis.addEventListener?.("focus", () => {
328
+ setTimeout(() => {
329
+ o || a || (a = !0, t(null));
330
+ }, 1e3);
331
+ }, { once: !0, passive: !0 }), n.onchange = () => {
332
+ if (o = n.files[0], o) {
333
+ if (a) return void console.warn("File open detected after faux cancel.", o);
334
+ t(o);
335
+ }
336
+ }, n.autofocus = !0, n.click();
337
+ }), rafThrottle: (e) => {
338
+ let t, r = !1, n = function() {
339
+ r = !1, e(t);
340
+ };
341
+ return function(o) {
342
+ t = o, t && t.persist && t.persist(), r || (r = !0, requestAnimationFrame(n));
343
+ };
344
+ }, removeEmptyProperties: Et, removeEqualValues: St, removeListenerAll: (e) => {
345
+ if (!e) return [];
346
+ for (let t = 0; t < e.length; t++) e[t] && e[t]();
347
+ return [];
348
+ }, requestTimeout: (e, t) => {
349
+ const r = rt(), n = { id: requestAnimationFrame(function o() {
350
+ rt() - r >= t ? e.call(null) : n.id = requestAnimationFrame(o);
351
+ }) };
352
+ return n;
353
+ }, roundAccurately: (e, t = 0) => {
354
+ if (e == null || !isFinite(e)) return null;
355
+ const r = 10 ** t;
356
+ return Number(Math.round(e * r) / r);
357
+ }, setToPath: (e, t, r) => {
358
+ const n = t.split(".");
359
+ let o = e;
360
+ if (!o) throw new Error("Can not set path to a null path.");
361
+ for (let a = 0; o && a < n.length - 1; a++) {
362
+ const i = n[a];
363
+ let l = o[i];
364
+ if (l == null && (l = {}, o[i] = l), !_(l)) throw new Error("Can not set path to a non object path.");
365
+ o = l;
366
+ }
367
+ if (typeof r != "number" && typeof r != "boolean" && typeof r != "string" && !_(r)) throw new Error(`Can not set path to ${r} that is not a a supported primitive.`);
368
+ return o[n[n.length - 1]] = r, e;
369
+ }, splitNumber: (e) => {
370
+ let t = Math.abs(e);
371
+ if (isNaN(t) || !isFinite(e)) return null;
372
+ let r = 0 | t, n = t - r, o = 0, a = 0, i = 1;
373
+ if (n > 5e-8) for (; a < 8 && Math.abs(o / i - n) > 5e-8; ) a++, i *= 10, o = Math.round(n * i);
374
+ return { ip: Math.trunc(e), fp: o, ipLength: Math.ceil(Math.log10(r + 1)), fpLength: a };
375
+ }, subtractRect: (e, t, r = !1) => {
376
+ if (!t) return [e];
377
+ if (!ot(e, t)) return [];
378
+ const n = [];
379
+ let o = e;
380
+ const a = () => {
381
+ t.top > o.top && t.top < o.bottom && (n.push({ ...o, bottom: t.top }), o = { ...o, top: t.top });
382
+ }, i = () => {
383
+ t.bottom > o.top && t.bottom < o.bottom && (n.push({ ...o, top: t.bottom }), o = { ...o, bottom: t.bottom });
384
+ }, l = () => {
385
+ t.right > o.left && t.right < o.right && (n.push({ ...o, left: t.right }), o = { ...o, right: t.right });
386
+ }, s = () => {
387
+ t.left > o.left && t.left < o.right && (n.push({ ...o, right: t.left }), o = { ...o, left: t.left });
388
+ };
389
+ return r ? (s(), l(), a(), i()) : (a(), i(), l(), s()), n;
390
+ }, textToKey: (e) => e.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(), throttle: function(e, t) {
391
+ let r = null;
392
+ return (...n) => {
393
+ const o = Date.now();
394
+ (!r || o - r >= t) && (r = o, e(...n));
395
+ };
396
+ }, toSafeJSON: function e(t) {
397
+ if (t === null || typeof t != "object") return t;
398
+ if (typeof t.toJSON == "function") return t.toJSON();
399
+ if (Array.isArray(t)) return t.map((n) => e(n));
400
+ if (typeof t.toString == "function" && t.toString !== Object.prototype.toString) return t.toString();
401
+ const r = {};
402
+ for (const n in t) t.hasOwnProperty(n) && (r[n] = e(t[n]));
403
+ return r;
404
+ }, transpose: (e) => {
405
+ if (!e) return e;
406
+ const t = e.length, r = e[0].length, n = [];
407
+ for (let o = 0; o < r; o++) n[o] = Array(t);
408
+ for (let o = 0; o < t; o++) for (let a = 0; a < r; a++) n[a][o] = e[o][a];
409
+ return n;
410
+ }, uuidV4: R, validEnumValue: (e, t) => {
411
+ if (!Object.values(e).includes(t)) throw new Error(`Invalid type: ${t ?? "null"}. Must be one of: ${Object.values(t).join(", ")}.`);
412
+ }, whenFocus: async (e, t = !1) => new Promise((r) => {
413
+ it(e, t) ? r(!0) : e.addEventListener("focusin", () => {
414
+ r(!0);
415
+ }, { once: !0 }), e.focus();
416
+ }) }, Symbol.toStringTag, { value: "Module" }));
417
+ Object.freeze(Object.defineProperty({ __proto__: null, MESSAGE_ERROR_INVALID_ARG: (e) => `Invalid argument: '${e}'.` }, Symbol.toStringTag, { value: "Module" }));
418
+ const xt = (e) => {
419
+ const t = new Uint8Array(e), r = t.byteLength;
420
+ let n = "";
421
+ for (let o = 0; o < r; o++) n += String.fromCharCode(t[o]);
422
+ if (typeof window < "u" && typeof globalThis.btoa == "function") return globalThis.btoa(n);
423
+ if (typeof Buffer < "u") return Buffer.from(n, "binary").toString("base64");
424
+ throw new Error("Unsupported environment");
425
+ }, W = (e) => new Promise((t, r) => {
426
+ if (e) if (typeof FileReader < "u") {
427
+ const n = new FileReader();
428
+ n.onload = () => {
429
+ t(n.result);
430
+ }, n.onerror = () => {
431
+ r(n.error);
432
+ }, n.readAsText(e);
433
+ } else if (typeof Buffer < "u") {
434
+ const n = (o) => Buffer.from(o).toString("utf-8");
435
+ e.arrayBuffer().then((o) => {
436
+ t(n(o));
437
+ }).catch((o) => {
438
+ r(o);
439
+ });
440
+ } else r(new Error("Unsupported environment"));
441
+ else t("");
442
+ });
443
+ Object.freeze(Object.defineProperty({ __proto__: null, DEFAULT_MIME_TYPE: "*/*", arrayBufferToBase64: xt, base64ToArrayBuffer: (e) => {
444
+ const t = typeof window < "u" && typeof globalThis.atob == "function" ? globalThis.atob(e) : Buffer.from(e, "base64").toString("binary"), r = t.length, n = new Uint8Array(r);
445
+ for (let o = 0; o < r; o++) n[o] = t.charCodeAt(o);
446
+ return n.buffer;
447
+ }, blobToString: W }, Symbol.toStringTag, { value: "Module" }));
448
+ const Ot = "data:image/png;base64,", _t = "Unable to resolve image.", lt = (e) => new Promise(async (t, r) => {
449
+ let n = null;
450
+ try {
451
+ n = new Image(), n.src = e, n.addEventListener("load", function() {
452
+ t({ width: n.naturalWidth, height: n.naturalHeight });
453
+ }, { once: !0 }), n.addEventListener("error", function() {
454
+ URL.revokeObjectURL(e), r("Invalid Image");
455
+ }, { once: !0 }), await n.decode("sync");
456
+ } catch {
457
+ n?.src && URL.revokeObjectURL(n.src);
458
+ }
459
+ n || r(_t);
460
+ }), P = "image/svg+xml";
461
+ var st, ct;
462
+ Object.freeze(Object.defineProperty({ __proto__: null, DATA_URL_PNG_PREFIX: Ot, getImageDataUrl: (e, t = 1) => new Promise(async (r, n) => {
463
+ let o = null;
464
+ try {
465
+ o = new Image(), o.src = e, o.addEventListener("load", function() {
466
+ try {
467
+ const a = document.createElement("canvas");
468
+ a.width = o.naturalWidth, a.height = o.naturalHeight, a.getContext("2d").drawImage(o, 0, 0);
469
+ const i = a.toDataURL("image/png", t);
470
+ r({ elemImg: o, dataUrl: i });
471
+ } catch (a) {
472
+ URL.revokeObjectURL(e), n(a);
473
+ }
474
+ }, { once: !0 }), o.addEventListener("error", function() {
475
+ URL.revokeObjectURL(e), n("Invalid Image");
476
+ }, { once: !0 }), await o.decode("sync");
477
+ } catch {
478
+ o?.src && URL.revokeObjectURL(o.src);
479
+ }
480
+ o || n(_t);
481
+ }), loadImageDetails: async (e, t = null) => {
482
+ let r = null;
483
+ const n = async () => {
484
+ try {
485
+ const a = t ?? "image/*", i = URL.createObjectURL(new Blob([e], { type: a })), l = await lt(i);
486
+ r = { mimeType: a, naturalDimensions: l, asUrl: i };
487
+ } catch {
488
+ }
489
+ }, o = async () => {
490
+ try {
491
+ const a = new TextDecoder().decode(e), i = URL.createObjectURL(new Blob([a], { type: P })), l = await lt(i);
492
+ r = { mimeType: t ?? P, naturalDimensions: l, asUrl: i, asSVGText: a };
493
+ } catch {
494
+ }
495
+ };
496
+ if (t === P ? await o() : t.startsWith("image/") ? await n() : (await n(), r || await o()), !r) throw new Error("Failed to load image");
497
+ return r;
498
+ } }, Symbol.toStringTag, { value: "Module" })), (ct = st || (st = {})).resolveTypedUpdates = (e, t, r, n) => {
499
+ if (e === null) return e;
500
+ if (e === void 0) return n;
501
+ let o = e;
502
+ if (t?.shorthand) {
503
+ const s = t?.shorthand(e, r);
504
+ s !== void 0 && (o = s);
505
+ }
506
+ if (o !== null && t?.getSubType) {
507
+ const s = t.getSubType(o);
508
+ s && (t = s);
509
+ }
510
+ const a = t?.properties, i = t?.arrayType ?? !1;
511
+ let l = o;
512
+ if (t && t.merge && l && n) l = t.merge(l, n, r);
513
+ else if (!i && a) {
514
+ const s = Object.keys({ ...o, ...n });
515
+ l = null;
516
+ for (let c = 0; c < s.length; c++) {
517
+ const d = s[c];
518
+ let w, u = o[d];
519
+ if (u !== void 0) {
520
+ const f = a[d];
521
+ w = f ? (0, ct.resolveTypedUpdates)(u, f, r, n?.[d]) : u;
522
+ } else w = n?.[d];
523
+ w != null && (l = l ?? {}, l[d] = w);
524
+ }
525
+ }
526
+ return l;
527
+ };
528
+ const ut = `The Safari browser does not support advanced copy and paste.
529
+ Copy and paste will be limited to within the browser tab.
530
+
531
+ Please use Chrome or Edge if external copy and paste is required.`, k = `You do not have permissions to access the clipboard.
532
+ All copy and paste operations will be limited to the browser tab.`, It = { Safari: `The Safari browser does not support advanced copy and paste.
533
+ Copy and paste will be limited to within the browser tab.
534
+
535
+ Please use Chrome or Edge if external copy and paste is required.`, Perms: k, PermsWrite: T() === y.Safari ? ut : k, PermsRead: T() === y.Safari ? ut : k }, N = async () => new Promise((e) => {
536
+ document.hasFocus() ? e() : globalThis.addEventListener?.("focus", () => {
537
+ e();
538
+ }, { once: !0 }), document.activeElement.focus?.();
539
+ }), B = async (e, t, r) => {
540
+ if (T() === y.Safari) return await r(new Error(It.Safari));
541
+ try {
542
+ const n = async (i) => {
543
+ try {
544
+ return await i();
545
+ } catch (l) {
546
+ if (l.message?.includes("Document is not focused")) return !1;
547
+ throw l;
548
+ }
549
+ }, o = await globalThis?.navigator?.permissions?.query({ name: e, allowWithoutGesture: !0, allowWithoutSanitization: !0 });
550
+ let a = !1;
551
+ if (o.state === "prompt" && (a = await n(t)), a || o.state !== "granted" || (a = await t()), !a) return await r(new Error(o.state));
552
+ } catch (n) {
553
+ return n.message === "No valid data on clipboard" || n.name === "DataError" ? void 0 : await r(n);
554
+ }
555
+ }, jt = async (e) => {
556
+ try {
557
+ return await e.read({ unsanitized: [h] });
558
+ } catch {
559
+ }
560
+ return await e.read();
561
+ };
562
+ if (!globalThis.ClipboardItem) {
563
+ const e = (r, n) => new Blob([n], { type: r });
564
+ class t {
565
+ constructor(n, o) {
566
+ this._items = {}, this._types = Object.keys(n);
567
+ const a = {}, i = Object.keys(n);
568
+ for (let l = 0; l < i.length; l++) {
569
+ const s = i[l];
570
+ let c = n[s];
571
+ a[s] = typeof c == "string" ? e(s, c) : c;
572
+ }
573
+ this._items = a, this._presentationStyle = o?.presentationStyle ?? "unspecified";
574
+ }
575
+ get types() {
576
+ return this._types;
577
+ }
578
+ getType(n) {
579
+ return Promise.resolve(this._items[n]);
580
+ }
581
+ supports(n) {
582
+ return !0;
583
+ }
584
+ }
585
+ globalThis.ClipboardItem = t;
586
+ }
587
+ const V = async (e, t = h) => new Promise(async (r, n) => {
588
+ try {
589
+ const o = await (async (a, i) => {
590
+ if (!a) return null;
591
+ const l = await jt(a);
592
+ let s = !1;
593
+ for (let c = 0; !s && l && c < l.length; c++) if (s = l[c].types.includes(i), s) return await l[c].getType(i);
594
+ return s ? void 0 : null;
595
+ })(e, t);
596
+ if (o) {
597
+ const a = new FileReader();
598
+ a.onload = () => {
599
+ r(a.result);
600
+ }, a.onerror = () => {
601
+ r("");
602
+ }, a.readAsText(o);
603
+ } else r("");
604
+ } catch (o) {
605
+ n(o);
606
+ }
607
+ }), dt = async (e, t = h) => {
608
+ const r = await V(e, t);
609
+ if (!r) return null;
610
+ let n = null;
611
+ try {
612
+ n = new DOMParser().parseFromString(r, h);
613
+ } catch {
614
+ console.warn("Can't parse html from clipboard.");
615
+ }
616
+ return n;
617
+ }, C = "clipboard-uuid", v = "web text/uuid", ft = (e) => `<div style="display:none" ${C}="${e}"/>`, Wt = (e, t) => {
618
+ let r = null;
619
+ try {
620
+ const n = new DOMParser().parseFromString(t, h);
621
+ n.body.firstElementChild.setAttribute(C, e), r = n.getElementsByTagName("body")[0].innerHTML;
622
+ } catch (n) {
623
+ console.warn("Can't embed uuid.", n);
624
+ }
625
+ return r;
626
+ }, pt = (e, t) => {
627
+ if (!t || !e) return !1;
628
+ try {
629
+ const r = t.querySelectorAll(`[${C}="${e}"]`);
630
+ if (r && r.length === 1) return !0;
631
+ if (t.querySelector("parsererror")) throw new Error("We are unable to parse node");
632
+ return !1;
633
+ } catch {
634
+ return !1;
635
+ }
636
+ };
637
+ class wt {
638
+ constructor(t) {
639
+ if (t?.nativeClipboard === void 0 || t?.nativeClipboard === !0) try {
640
+ this._nativeClipboard = globalThis?.navigator.clipboard;
641
+ } catch {
642
+ t?.nativeClipboard === !0 && console.warn("NativeClipboard option set to true but no native clipboard available.");
643
+ }
644
+ else this._nativeClipboard = t?.nativeClipboard === !1 ? null : t?.nativeClipboard;
645
+ this._disableCheckOnFocus = t?.disableCheckOnFocus ?? !1, this._init();
646
+ }
647
+ async _checkForChanges() {
648
+ this._nativeClipboard && this._state && !this._disableCheckOnFocus && await B("clipboard-read", async () => {
649
+ await N();
650
+ const t = await V(this._nativeClipboard, v);
651
+ if (!this._state || t && t === this._state.uuid) return !0;
652
+ const r = await dt(this._nativeClipboard, h);
653
+ return !this._state || (pt(this._state.uuid, r) || this.clear(), !0);
654
+ }, async (t) => {
655
+ t?.message === "denied" || t.message?.includes("Document is not focused") || T() === y.Safari || console.warn("Unable to detect clipboard changes: ", t);
656
+ });
657
+ }
658
+ _init() {
659
+ const t = this;
660
+ this._listeners = /* @__PURE__ */ new Map(), this._listenersCapture = /* @__PURE__ */ new Map(), this._state = null, this._nativeClipboard && (this._onFocus = () => {
661
+ t._checkForChanges();
662
+ }, this._onBlur = () => {
663
+ globalThis.addEventListener?.("focus", t._onFocus, { once: !0 });
664
+ }, globalThis.addEventListener?.("blur", this._onBlur), this._nativeClipboard.addEventListener("clipboardchange", (r) => {
665
+ t._checkForChanges();
666
+ }));
667
+ }
668
+ async read() {
669
+ if (!this._nativeClipboard) return this._state?.items ?? null;
670
+ const t = this;
671
+ return await B("clipboard-read", async () => {
672
+ if (await N(), this._state?.uuid) {
673
+ const r = await V(this._nativeClipboard, v);
674
+ if (r && r === t._state.uuid) return !0;
675
+ const n = await dt(this._nativeClipboard, h);
676
+ if (pt(t._state?.uuid, n)) return !0;
677
+ }
678
+ return t._state = { items: await jt(this._nativeClipboard), uuid: null, ref: null }, this.dispatchEvent(new Event("clipboardread")), !0;
679
+ }, async (r) => {
680
+ this.dispatchEvent(new Event("clipboarderrorread"));
681
+ }), this._state?.items ?? [];
682
+ }
683
+ async write(t) {
684
+ return this._write({ uuid: R(), items: t, ref: null });
685
+ }
686
+ async _write(t) {
687
+ if (!this._nativeClipboard) return this._state = t, this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")), null;
688
+ const r = this, n = [], o = t.uuid;
689
+ let a = t.items ?? [];
690
+ const i = () => {
691
+ r._state = { uuid: o, ref: t.ref, items: n }, r.dispatchEvent(new Event("clipboardwrite")), r.dispatchEvent(new Event("clipboardchange"));
692
+ };
693
+ await B("clipboard-write", async () => {
694
+ await N(), o && a.length === 0 && (a.push(new ClipboardItem({ [v]: new Blob([o], { type: v }) })), a.push(new ClipboardItem({ [h]: new Blob([ft(o)], { type: h }) })));
695
+ for (let l = 0; l < Math.min(1, a.length); l++) {
696
+ const s = a[l];
697
+ let c = s.types.indexOf(h), d = null;
698
+ if (c !== -1) {
699
+ const f = await s.getType(h);
700
+ d = await W(f), d && (d = Wt(o, d));
701
+ }
702
+ if (!d && s.types.includes(b)) {
703
+ const f = await s.getType(b);
704
+ if (f) {
705
+ let p = null;
706
+ typeof f == "string" ? (console.warn("text as string", f), p = f) : p = await W(f), p && (d = `<div ${C}="${o}">${p}</div>`);
707
+ }
708
+ }
709
+ if (!d && s.types.includes(L)) {
710
+ const f = await s.getType(L), p = xt(await f.arrayBuffer());
711
+ d = `<div ${C}="${o}"><img src="${Ot + p}"/></div>`;
712
+ }
713
+ !d && o && (d = ft(o));
714
+ const w = new Blob([d ?? ""], { type: h }), u = {};
715
+ for (let f = 0; f < s.types.length; f++) {
716
+ const p = s.types[f];
717
+ u[p] = f === c ? w : s.getType(p);
718
+ }
719
+ d && c === -1 && (u[h] = w), o && (u[v] = new Blob([o], { type: v })), n.push(new ClipboardItem(u));
720
+ }
721
+ try {
722
+ n && n.length !== 0 ? await this._nativeClipboard.write(n) : await (async (l) => {
723
+ l && await l.writeText("");
724
+ })(this._nativeClipboard);
725
+ } catch (l) {
726
+ l.message?.includes("Document is not focused") || console.warn("Unable to write to native clipboard: ", l);
727
+ }
728
+ return i(), !0;
729
+ }, async (l) => {
730
+ this.dispatchEvent(new Event("clipboarderrorwrite")), i();
731
+ });
732
+ }
733
+ async writeReference(t) {
734
+ if (!t) return void this.clear();
735
+ let r = null;
736
+ const n = {};
737
+ try {
738
+ const a = await t.toText?.() ?? null;
739
+ a && (n[b] = new Blob([a ?? ""], { type: b }));
740
+ } catch (a) {
741
+ r = a;
742
+ }
743
+ try {
744
+ const a = await t.toHtml?.() ?? null;
745
+ a && (n[h] = new Blob([a], { type: h }));
746
+ } catch (a) {
747
+ r = a, console.warn("export to html", a);
748
+ }
749
+ try {
750
+ const a = await t.toImage?.() ?? null;
751
+ a && (n[L] = a);
752
+ } catch (a) {
753
+ r = a, console.warn("export to png", a);
754
+ }
755
+ const o = this._write({ uuid: R(), ref: t, items: Object.keys(n).length > 0 ? [new ClipboardItem(n)] : null });
756
+ if (r) throw r;
757
+ return o;
758
+ }
759
+ clear(t = !1) {
760
+ this._state && (this._state = null, t && this._write({ uuid: null, ref: null, items: null }), this.dispatchEvent(new Event("clipboardwrite")), this.dispatchEvent(new Event("clipboardchange")));
761
+ }
762
+ async readReference() {
763
+ return await this.read(), this._state?.ref ?? null;
764
+ }
765
+ readText() {
766
+ return new Promise(async (t, r) => {
767
+ const n = await this.read();
768
+ let o = null;
769
+ for (let i = 0; !o && n && i < n.length; i++) n[i].types.includes(b) && (o = await n[i].getType(b));
770
+ if (!o) return void t("");
771
+ const a = new FileReader();
772
+ a.onload = () => {
773
+ t(a.result);
774
+ }, a.readAsText(o), a.onerror = (i) => {
775
+ r(i);
776
+ };
777
+ });
778
+ }
779
+ async writeText(t) {
780
+ const r = [new ClipboardItem({ [b]: new Blob([t], { type: b }) })];
781
+ return this._write({ uuid: R(), items: r, ref: null });
782
+ }
783
+ addEventListener(t, r, n = {}) {
784
+ const o = n?.capture ? this._listenersCapture : this._listeners;
785
+ let a = o.get(t);
786
+ a || (a = /* @__PURE__ */ new Map(), o.set(t, a)), a.set(r, typeof n == "boolean" ? {} : n);
787
+ }
788
+ dispatchEvent(t) {
789
+ if (!t) return;
790
+ const r = (n) => {
791
+ const o = n.get(t.type);
792
+ o && o.forEach((a, i) => {
793
+ try {
794
+ typeof i == "function" ? i(t) : i.handleEvent && i.handleEvent(t), a.once && o.delete(i);
795
+ } catch (l) {
796
+ console.warn(l);
797
+ }
798
+ });
799
+ };
800
+ return r(this._listenersCapture), r(this._listeners), !0;
801
+ }
802
+ removeEventListener(t, r, n) {
803
+ const o = n?.capture ? this._listenersCapture : this._listeners, a = o.get(t);
804
+ a && (a.delete(r), a.size === 0 && o.delete(t));
805
+ }
806
+ close() {
807
+ globalThis.removeEventListener?.("focus", this._onFocus), globalThis.removeEventListener?.("blur", this._onBlur);
808
+ }
809
+ }
810
+ var z;
811
+ (z = wt || (wt = {})).ErrorMessages = It, z.Global = new z();
812
+ let ht = null, q = null, M = null;
813
+ const Vt = Object.freeze({ compileTypescript: async function(e) {
814
+ if (!(e?.source ?? null)) return null;
815
+ if (q && $t.deepEqual(q, e)) return ht;
816
+ const t = await async function() {
817
+ if (M) return M;
818
+ const { TypeScriptCompiler: n } = await import("./DlXQZVTPv3b6cUPg.mjs");
819
+ return M = new n(), M;
820
+ }(), r = await t.compileModule(e);
821
+ return ht = r, q = e, r;
822
+ } });
823
+ export {
824
+ Vt as S,
825
+ $t as Y
826
+ };